Changeset 2633
- Timestamp:
- 07/31/08 15:17:02 (5 months ago)
- Location:
- branches/david-xml_only_config_system
- Files:
-
- 1 removed
- 4 modified
-
samples/app/config/autoload.xml (modified) (1 diff)
-
samples/app/config/config_handlers.xml (modified) (1 diff)
-
src/config/AgaviFactoryConfigHandler.class.php (modified) (3 diffs)
-
src/config/AgaviXmlFactoryConfigHandler.class.php (deleted)
-
src/config/defaults/config_handlers.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/david-xml_only_config_system/samples/app/config/autoload.xml
r2474 r2633 10 10 11 11 <autoload name="AgaviSampleAppUser">%core.lib_dir%/user/AgaviSampleAppUser.class.php</autoload> 12 13 <autoload name="AgaviXmlFactoryConfigHandler">%core.agavi_dir%/config/AgaviXmlFactoryConfigHandler.class.php</autoload>14 12 </autoloads> 15 13 </configuration> -
branches/david-xml_only_config_system/samples/app/config/config_handlers.xml
r2632 r2633 1 1 <?xml version="1.0" encoding="UTF-8"?> 2 2 <configurations xmlns="http://agavi.org/agavi/1.0/config" parent="%core.system_config_dir%/config_handlers.xml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanceZOMGNO" xsi:schemaLocation="http://agavi.org/agavi/1.0/config http://localhost/~dzuelke/Code/oss/agavi/branches/david-xml_only_config_system/src/config/xsd/autoload.xsd"> 3 4 <configuration>5 6 <handler pattern="%core.config_dir%/factories.xml" class="AgaviXmlFactoryConfigHandler">7 <validation>%core.agavi_dir%/config/rng/factories.rng</validation>8 <!-- <validation>%core.agavi_dir%/config/sch/config_handlers.sch</validation> -->9 <transformation>%core.agavi_dir%/config/xsl/factories.xsl</transformation>10 </handler>11 12 </configuration>13 14 3 </configurations> -
branches/david-xml_only_config_system/src/config/AgaviFactoryConfigHandler.class.php
r2259 r2633 23 23 * @author David Zülke <dz@bitxtender.com> 24 24 * @author Dominik del Bondio <ddb@bitxtender.com> 25 * @author Noah Fontes <noah.fontes@bitextender.com> 25 26 * @copyright Authors 26 27 * @copyright The Agavi Project … … 30 31 * @version $Id$ 31 32 */ 32 class AgaviFactoryConfigHandler extends Agavi ConfigHandler33 class AgaviFactoryConfigHandler extends AgaviXmlConfigHandler 33 34 { 35 const NAMESPACE = 'http://agavi.org/agavi/config/factories/1.0'; 36 34 37 /** 35 38 * Execute this configuration handler. 36 39 * 37 * @param string An absolute filesystem path to a configuration file. 38 * @param string An optional context in which we are currently running. 40 * @param DOMDocument The document to parse. 39 41 * 40 42 * @return string Data to be written to a cache file. 41 43 * 42 * @throws <b>AgaviUnreadableException</b> If a requested configuration43 * file does not exist or is not44 * readable.45 44 * @throws <b>AgaviParseException</b> If a requested configuration file is 46 45 * improperly formatted. 47 46 * 48 47 * @author David Zülke <dz@bitxtender.com> 49 * @author Dominik del Bondio <ddb@bitxtender.com>50 * @since 0. 9.048 * @author Noah Fontes <noah.fontes@bitextender.com> 49 * @since 0.11.0 51 50 */ 52 public function execute( $config, $context = null)51 public function execute(DOMDocument $doc) 53 52 { 54 if($context == null) { 55 $context = ''; 56 } 57 58 // parse the config file 59 $configurations = $this->orderConfigurations(AgaviConfigCache::parseConfig($config, true, $this->getValidationFile(), $this->parser)->configurations, AgaviConfig::get('core.environment'), $context); 60 53 // set up our default namespace 54 $doc->setDefaultNamespace(self::NAMESPACE, 'factories'); 55 56 $config = $doc->documentURI; 61 57 $data = array(); 62 58 … … 196 192 ); 197 193 198 foreach($ configurations as $cfg) {194 foreach($doc->getConfigurationElements() as $configuration) { 199 195 foreach($factories as $factory => $info) { 200 if($info['required'] && isset($cfg->$factory)) { 196 if(is_array($info) && $info['required'] && $configuration->hasChild($factory)) { 197 $element = $configuration->getChild($factory); 198 201 199 $data[$factory] = isset($data[$factory]) ? $data[$factory] : array('class' => null, 'params' => array()); 202 $data[$factory]['class'] = $ cfg->$factory->getAttribute('class', $data[$factory]['class']);203 $data[$factory]['params'] = $ this->getItemParameters($cfg->$factory,$data[$factory]['params']);200 $data[$factory]['class'] = $element->getAttribute('class', $data[$factory]['class']); 201 $data[$factory]['params'] = $element->getAgaviParameters($data[$factory]['params']); 204 202 } 205 203 } -
branches/david-xml_only_config_system/src/config/defaults/config_handlers.xml
r2482 r2633 20 20 <handler pattern="%core.config_dir%/settings.xml" validate="%core.agavi_dir%/config/xsd/settings.xsd" class="AgaviSettingConfigHandler" /> 21 21 22 <handler pattern="%core.config_dir%/factories.xml" validate="%core.agavi_dir%/config/xsd/factories.xsd" class="AgaviFactoryConfigHandler" /> 22 <handler pattern="%core.config_dir%/factories.xml" class="AgaviFactoryConfigHandler"> 23 <validation>%core.agavi_dir%/config/rng/factories.rng</validation> 24 <transformation>%core.agavi_dir%/config/xsl/factories.xsl</transformation> 25 </handler> 23 26 24 27 <handler pattern="%core.config_dir%/databases.xml" validate="%core.agavi_dir%/config/xsd/databases.xsd" class="AgaviDatabaseConfigHandler" />

