Example #1
0
 /**
  * Initializes the the extension manager which in turn scans
  * for components, modules, plugins and wrapper and registers them.
  *
  * @since 0.9.5
  */
 public function _initExtensionManager()
 {
     // require Front controller
     $this->bootstrap('frontController');
     $frontController = $this->getResource('frontController');
     // require Config
     $this->bootstrap('Config');
     $config = $this->getResource('Config');
     //NOTICE: i swtiched loading of erfurt and session
     //because serialized erfurt objects in the session need constants defined in erfurt
     //is this ok?
     Erfurt_Wrapper_Registry::reset();
     // require Erfurt
     $this->bootstrap('Erfurt');
     // apply session configuration settings
     if (isset($config->session)) {
         $this->applySessionConfig($config->session);
     }
     // require Session
     $this->bootstrap('Session');
     // require Dispatcher
     $this->bootstrap('Dispatcher');
     $dispatcher = $this->getResource('Dispatcher');
     // require OntoWiki
     $this->bootstrap('OntoWiki');
     $ontoWiki = $this->getResource('OntoWiki');
     // require Translate
     $this->bootstrap('Translate');
     $translate = $this->getResource('Translate');
     // require View
     $this->bootstrap('View');
     $view = $this->getResource('View');
     // make sure router is bootstrapped
     $this->bootstrap('Router');
     // set view
     $ontoWiki->view = $view;
     $extensionPath = ONTOWIKI_ROOT . $config->extensions->base;
     $extensionPathBase = $config->staticUrlBase . $config->extensions->base;
     $extensionManager = new OntoWiki_Extension_Manager($extensionPath);
     $extensionManager->setTranslate($translate)->setComponentUrlBase($extensionPathBase);
     // register component controller directories
     foreach ($extensionManager->getComponents() as $extensionName => $extensionConfig) {
         $frontController->addControllerDirectory($extensionConfig->path, '_component_' . $extensionName);
     }
     // make extension manager available to dispatcher
     $dispatcher = $frontController->getDispatcher();
     $dispatcher->setExtensionManager($extensionManager);
     // keep extension manager in OntoWiki
     $ontoWiki->extensionManager = $extensionManager;
     // actionhelper
     Zend_Controller_Action_HelperBroker::addPrefix('OntoWiki_Controller_ActionHelper_');
     Zend_Controller_Action_HelperBroker::addHelper(new OntoWiki_Controller_ActionHelper_List());
     return $extensionManager;
 }
Example #2
0
 protected function tearDown()
 {
     Erfurt_Wrapper_Registry::reset();
 }
Example #3
0
 /**
  * Constructor
  */
 public function __construct($extensionPath)
 {
     if (!(substr($extensionPath, -1) == DIRECTORY_SEPARATOR)) {
         $extensionPath .= DIRECTORY_SEPARATOR;
     }
     $this->_extensionPath = $extensionPath;
     OntoWiki_Module_Registry::reset();
     //OntoWiki_Module_Registry::getInstance()->resetInstance();
     $this->_moduleRegistry = OntoWiki_Module_Registry::getInstance();
     $this->_moduleRegistry->setExtensionPath($extensionPath);
     //TODO nessesary?
     Erfurt_Wrapper_Registry::reset();
     $this->_eventDispatcher = Erfurt_Event_Dispatcher::getInstance();
     // scan for extensions
     $this->_scanExtensionPath();
     // scan for translations
     $this->_scanTranslations();
     // register for event
     $dispatcher = Erfurt_Event_Dispatcher::getInstance();
     $dispatcher->register('onRouteShutdown', $this);
 }
 public function init()
 {
     parent::init();
     $this->_syncModelUri = $this->_privateConfig->syncModelUri;
     $this->_syncModelHelperBase = $this->_privateConfig->syncModelHelperBase;
     //$this->_properties = $this->_privateConfig->properties->toArray();
     // For testability we reset the wrapper registry first, since
     // multiple calls of this method would fail otherwise.
     Erfurt_Wrapper_Registry::reset();
     $this->_wrapperRegisty = Erfurt_Wrapper_Registry::getInstance();
     $owApp = OntoWiki::getInstance();
     if (null !== $owApp->selectedModel) {
         $this->_graphUri = $owApp->selectedModel->getModelIri();
     } else {
         if (isset($this->_request->m)) {
             $this->_graphUri = $this->_request->m;
         }
     }
 }
Example #5
0
 private function _getWrapper($wrapperName)
 {
     if ($this->_wrapperRegistry === null) {
         Erfurt_Wrapper_Registry::reset();
         $this->_wrapperRegistry = Erfurt_Wrapper_Registry::getInstance();
     }
     $wrapper = $this->_wrapperRegistry->getWrapperInstance($wrapperName);
     if ($this->_httpAdapter !== null) {
         $wrapper->setHttpAdapter($this->_httpAdapter);
     }
     return $wrapper;
 }