Changeset 344
- Timestamp:
- 03/07/07 14:23:47 (1 year ago)
- Files:
-
- trunk/src/main/php/net/stubbles/ioc/injection/stubInjectionProvider.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/ipo/session/stubSession.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/websites/stubFrontController.php (modified) (8 diffs)
- trunk/src/test/php/net/stubbles/websites/TeststubFrontController.php (added)
- trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php (modified) (1 diff)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerInjectionMapTestCase.php (added)
- trunk/src/test/php/net/stubbles/websites/stubFrontControllerProcessTestCase.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/net/stubbles/ioc/injection/stubInjectionProvider.php
r313 r344 13 13 * @subpackage ioc_injection 14 14 */ 15 interface stubInjectionProvider 15 interface stubInjectionProvider extends stubObject 16 16 { 17 17 /** trunk/src/main/php/net/stubbles/ipo/request/stubRequest.php
r318 r344 22 22 * @see http://stubbles.net/wiki/Docs/Validators 23 23 */ 24 interface stubRequest 24 interface stubRequest extends stubObject 25 25 { 26 26 /** trunk/src/main/php/net/stubbles/ipo/response/stubResponse.php
r179 r344 17 17 * @subpackage ipo_response 18 18 */ 19 interface stubResponse 19 interface stubResponse extends stubObject 20 20 { 21 21 /** trunk/src/main/php/net/stubbles/ipo/session/stubSession.php
r153 r344 14 14 * @subpackage ipo_session 15 15 */ 16 interface stubSession 16 interface stubSession extends stubObject 17 17 { 18 18 /** trunk/src/main/php/net/stubbles/websites/stubFrontController.php
r335 r344 9 9 stubClassLoader::load('net.stubbles.stubFactory', 10 10 'net.stubbles.ioc.injection.injection', 11 'net.stubbles.ipo.interceptors.stubPostInterceptor', 12 'net.stubbles.ipo.interceptors.stubPreInterceptor', 11 13 'net.stubbles.ipo.request.stubWebRequest', 12 14 'net.stubbles.ipo.session.stubPHPSession', 13 15 'net.stubbles.ipo.response.stubBaseResponse', 16 'net.stubbles.websites.processors.stubProcessorResolver', 14 17 'net.stubbles.util.stubRegistry', 15 18 'net.stubbles.util.xjconf.xjconf' … … 28 31 * @var array<stubPreInterceptor> 29 32 */ 30 protected $preInterceptors ;33 protected $preInterceptors = array(); 31 34 /** 32 35 * list of interceptors to call at teardown … … 34 37 * @var array<stubPostInterceptor> 35 38 */ 36 protected $postInterceptors ;39 protected $postInterceptors = array(); 37 40 /** 38 41 * the resolver to use for getting the correct processor 39 42 * 40 * @var stubProcess Resolver43 * @var stubProcessorResolver 41 44 */ 42 45 protected $resolver; … … 73 76 public function __construct() 74 77 { 75 $xjconf = new stubXJConfFacade(array('http://stubbles.net/ipo/interceptors' => stubXJConfLoader::getInstance(), 76 'http://stubbles.net/websites' => stubXJConfLoader::getInstance() 77 ) 78 ); 78 $xjconf = $this->createXJConfFacade(); 79 79 $xjconf->setDefinitionFile(stubFactory::getResourceURI('xjconf/interceptors.xml')); 80 80 $xjconf->parse(stubConfig::getConfigPath() . '/xml/interceptors.xml'); … … 86 86 $this->resolver = $xjconf->getConfigValue('resolver'); 87 87 88 $this->createInjectionMap(); 89 } 90 91 /** 92 * creates the injection map 93 */ 94 protected function createInjectionMap() 95 { 88 96 $this->injectionMap = new stubInjectionMap(); 89 97 if (stubRegistry::hasConfig('net.stubbles.ipo.request.class') == true) { 90 98 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.request.class'); 91 stubClassLoader::load($fqClassName); 92 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 99 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 100 if (class_exists($className, false) == false) { 101 stubClassLoader::load($fqClassName); 102 } 103 93 104 $this->request = new $className(); 94 105 if (($this->request instanceof stubRequest) == false) { … … 103 114 $sessionName = stubRegistry::getConfig('net.stubbles.ipo.session.name'); 104 115 } else { 105 $sessionName = ' stubSID';116 $sessionName = 'SID'; 106 117 } 107 118 if (stubRegistry::hasConfig('net.stubbles.ipo.session.class') == true) { 108 119 $fqClassName = stubRegistry::getConfig('net.stubbles.ipo.session.class'); 109 stubClassLoader::load($fqClassName); 110 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 111 $this->session = new $className($sessionName); 120 $className = stubClassLoader::getNonQualifiedClassName($fqClassName); 121 if (class_exists($className, false) == false) { 122 stubClassLoader::load($fqClassName); 123 } 124 125 $this->session = new $className($sessionName); 112 126 if (($this->session instanceof stubSession) == false) { 113 127 throw new stubException('Configured session class is not an instance of stubSession.'); … … 139 153 $this->injectionMap->addInjection('stubResponse', $this->response); 140 154 141 foreach ($this->postInterceptors as $postInterceptor) { 142 stubInjectAnnotation::factory($this->injectionMap, $postInterceptor); 143 $postInterceptor->postProcess(); 144 if ($this->request->isCancelled() == true) { 145 break; 155 if ($this->request->isCancelled() == false) { 156 foreach ($this->postInterceptors as $postInterceptor) { 157 stubInjectAnnotation::factory($this->injectionMap, $postInterceptor); 158 $postInterceptor->postProcess(); 159 if ($this->request->isCancelled() == true) { 160 break; 161 } 146 162 } 147 163 } … … 149 165 $this->response->send(); 150 166 } 167 168 /** 169 * creates the stubXJConfFacade 170 * 171 * @return stubXJConfFacade 172 */ 173 protected function createXJConfFacade() 174 { 175 $xjconf = new stubXJConfFacade(array('http://stubbles.net/ipo/interceptors' => stubXJConfLoader::getInstance(), 176 'http://stubbles.net/websites' => stubXJConfLoader::getInstance() 177 ) 178 ); 179 180 return $xjconf; 181 } 151 182 } 152 183 ?> trunk/src/test/php/net/stubbles/websites/WebsitesTestSuite.php
r343 r344 22 22 $dir = dirname(__FILE__); 23 23 $this->TestSuite('All websites classes tests'); 24 $this->addTestFile($dir . '/stubFrontControllerInjectionMapTestCase.php'); 25 $this->addTestFile($dir . '/stubFrontControllerProcessTestCase.php'); 24 26 $this->addTestFile($dir . '/stubPageTestCase.php'); 25 27
