]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/filter/node/class_NodeInitializationFilter.php
Introduced NodeObjectFactory to encapsulate (and ease) a lot calls.
[hub.git] / application / hub / main / filter / node / class_NodeInitializationFilter.php
index 6eaec8309b5cb0b333478599c004922135318113..3070e8547946e74abe5303f034eb8df9d5a170f3 100644 (file)
@@ -2,11 +2,11 @@
 /**
  * A Initialization filter for nodes
  *
- * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @author             Roland Haeder <webmaster@shipsimu.org>
  * @version            0.0.0
  * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
- * @link               http://www.ship-simu.org
+ * @link               http://www.shipsimu.org
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class NodeInitializationFilter extends BaseFilter implements Filterable {
+class NodeInitializationFilter extends BaseNodeFilter implements Filterable {
        /**
         * Protected constructor
         *
@@ -55,7 +55,7 @@ class NodeInitializationFilter extends BaseFilter implements Filterable {
        public function execute (Requestable $requestInstance, Responseable $responseInstance) {
                // The default node-mode is from our configuration
                $nodeMode = $this->getConfigInstance()->getConfigEntry('node_default_mode');
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[INIT:] Got default node mode ' . $nodeMode . ' from configuration.');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Got default node mode ' . $nodeMode . ' from configuration.');
 
                // Is the node 'mode' parameter set?
                if ($requestInstance->isRequestElementSet('mode')) {
@@ -72,16 +72,7 @@ class NodeInitializationFilter extends BaseFilter implements Filterable {
                // And try to instance it
                try {
                        // Get an instance
-                       $nodeInstance = ObjectFactory::createObjectByName($className, array($requestInstance));
-
-                       // Get a registry
-                       $applicationInstance = Registry::getRegistry()->getInstance('app');
-
-                       // Set the app instance
-                       $nodeInstance->setApplicationInstance($applicationInstance);
-
-                       // Add node-specific filters
-                       $nodeInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance);
+                       $nodeInstance = NodeObjectFactory::createNodeInstance($requestInstance, $responseInstance);
                } catch (ClassNotFoundException $e) {
                        // This exception means, the node mode is invalid.
                        // @TODO Can we rewrite this to app_exit() ?
@@ -90,7 +81,7 @@ class NodeInitializationFilter extends BaseFilter implements Filterable {
 
                // Set the node instance in registry
                Registry::getRegistry()->addInstance('node', $nodeInstance);
-               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('[INIT:] Node ' . $nodeMode . ' has been added to registry.');
+               //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Node ' . $nodeMode . ' has been added to registry.');
        }
 }