/**
  * Explicitly initializes all necessary FLOW3 objects by invoking the various initialize* methods.
  *
  * Usually this method is only called from unit tests or other applications which need a more fine grained control over
  * the initialization and request handling process. Most other applications just call the run() method.
  *
  * @return void
  * @author Robert Lemke <*****@*****.**>
  * @see run()
  * @throws \F3\FLOW3\Exception if the framework has already been initialized.
  * @api
  */
 public function initialize()
 {
     $this->initializeClassLoader();
     $this->initializeConfiguration();
     $this->initializeErrorHandling();
     $this->initializeObjectManager();
     $this->initializeSystemLogger();
     #		$this->initializeLockManager();
     if ($this->siteLocked === TRUE) {
         return;
     }
     $this->initializePackages();
     if ($this->packageManager->isPackageActive('FirePHP')) {
         $this->objectManager->registerObject('F3\\FirePHP\\Core');
         $this->objectManager->getObject('F3\\FirePHP\\Core');
     }
     $this->initializeSignalsSlots();
     $this->initializeCache();
     $this->initializeFileMonitor();
     $this->initializeReflection();
     $this->initializeObjects();
     $this->initializeAOP();
     $this->initializePersistence();
     $this->initializeSession();
     $this->initializeResources();
     $this->initializeLocale();
 }
 /**
  * Finds and instanciates a controller that matches the current request.
  * If no controller can be found, an instance of NotFoundControllerInterface is returned.
  *
  * @param \F3\FLOW3\MVC\RequestInterface $request The request to dispatch
  * @return \F3\FLOW3\MVC\Controller\ControllerInterface
  * @author Bastian Waidelich <*****@*****.**>
  */
 protected function resolveController(\F3\FLOW3\MVC\RequestInterface $request)
 {
     $exception = NULL;
     $packageKey = $request->getControllerPackageKey();
     if (!$this->packageManager->isPackageAvailable($packageKey)) {
         $exception = new \F3\FLOW3\MVC\Controller\Exception\InvalidPackageException($request, 'package "' . $packageKey . '" does not exist');
     } elseif (!$this->packageManager->isPackageActive($packageKey)) {
         $exception = new \F3\FLOW3\MVC\Controller\Exception\InactivePackageException($request, 'package "' . $packageKey . '" is not active');
     } else {
         $controllerObjectName = $request->getControllerObjectName();
         if ($controllerObjectName === '') {
             $exception = new \F3\FLOW3\MVC\Controller\Exception\InvalidControllerException($request, 'no controller could be resolved which would match your request');
         }
     }
     if ($exception !== NULL) {
         $controller = $this->objectManager->getObject($this->settings['mvc']['notFoundController']);
         if (!$controller instanceof \F3\FLOW3\MVC\Controller\NotFoundControllerInterface) {
             throw new \F3\FLOW3\MVC\Exception\InvalidControllerException('The NotFoundController must implement "\\F3\\FLOW3\\MVC\\Controller\\NotFoundControllerInterface", ' . (is_object($controller) ? get_class($controller) : gettype($controller)) . ' given.', 1246714416);
         }
         $controller->setException($exception);
     } else {
         $controller = $this->objectManager->getObject($controllerObjectName);
         if (!$controller instanceof \F3\FLOW3\MVC\Controller\ControllerInterface) {
             throw new \F3\FLOW3\MVC\Exception\InvalidControllerException('Invalid controller "' . $request->getControllerObjectName() . '". The controller must be a valid request handling controller, ' . (is_object($controller) ? get_class($controller) : gettype($controller)) . ' given.', 1202921619);
         }
     }
     return $controller;
 }