/**
  * Rahmen zum Ausführen einer Funktion. Konkrete Ausführeung wird
  * von abstrakter Methode executeAction ausgeführt
  * @param $request
  * @return Response
  * @throws Exception
  */
 public function execute($request)
 {
     // Der Response wird direkt am Anfang erzeugt und auch in der Application-Klasse
     // hinterlegt. Das muss aus Gründen der Abwärtskompatibilität sein. In den Controller
     // Methiden wird oft auf Application::currentResponse zurückgegriffen. Das muss an
     // dieser Stelle also gefüllt sein.
     Logging::info("Ausführen von [{$this->request->module}:{$this->request->action}]");
     Profiler::startSection($this->request->module . '.' . $this->request->action);
     $this->request = $request;
     $this->response = new Response();
     Application::getInstance()->setResponse($this->response);
     $this->currentAction = $this->module->getAction($this->request->action);
     // Abbrechen, wenn Aktion nicht gefunden werden konnte
     if ($this->currentAction === null) {
         throw new \DomainException("Aktion '{$this->request->action}' in Modul '{$this->request->module}' nicht gefunden");
     } else {
         // Verhindern, dass von einem Angreifer eine beliebige Seite aufgerufen werden
         // kann
         $this->request->view = null;
         // Response mit den Standard-Daten füllen
         $this->response->setContent($this->currentAction->getDefaultNext($this));
         $result = $this->innerExecute();
         if ($result !== null) {
             $this->response = $result;
         }
         // Jetzt kann sich unter Umständen der View geändert haben
         if ($this->request->view !== null) {
             Logging::warning('anderen View laden');
             $this->response->setContent($this->module->loadView($this->request->view, $this));
         }
         // Überschreiben der eigentlichen Aktion durch eine, die bei der Ausführung der Funktion
         // gesetzt wurde
         if ($this->request->action !== $this->currentAction->name) {
             Logging::warning('Andere Action ausführen');
             $this->response->setContent($this->module->getAction($this->request->action));
         }
         Profiler::endSection($this->request->module . '.' . $this->request->action);
         return $this->response;
     }
 }
 /**
  * Diese Methode erzeugt aus einem XML-Element die Modulobjekte
  *
  * @param SimpleXMLElement $xml XML-Definition
  * @return Module Das erzeugte Modul
  *
  */
 public function createByXml(SimpleXMLElement $xml, $directory)
 {
     $module = new Module();
     $module->name = (string) $xml['name'];
     $module->version = (string) $xml->version;
     $module->description = (string) $xml->description;
     $module->author = (string) $xml->author;
     $module->image = (string) $xml->image;
     $module->namespace = (string) $xml->namespace;
     $module->path = $directory;
     $module->qualifiedName = (string) $xml->qualifiedName;
     if ($module->qualifiedName === '') {
         $module->qualifiedName = $module->name;
     }
     // Model
     $module->model = Model::createByXml($module, $xml->model);
     // Aktionen
     foreach ($xml->actions->action as $action) {
         $module->actions[(string) $action['name']] = Action::createByXml($action, $module);
     }
     $module->init();
     return $module;
 }