/**
* 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 - 2011 Hub Developer Team
+ * @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
* 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
*
* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
- * @todo 0% done
*/
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('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Got default node mode ' . $nodeMode . ' from configuration.');
// Is the node 'mode' parameter set?
if ($requestInstance->isRequestElementSet('mode')) {
// 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_die() ?
- $this->debugBackTrace(__METHOD__ . ': node mode ' . $nodeMode . ' is invalid.');
+ // @TODO Can we rewrite this to app_exit() ?
+ $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: node mode ' . $nodeMode . ' is invalid.');
}
// Set the node instance in registry
Registry::getRegistry()->addInstance('node', $nodeInstance);
+ //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: Node ' . $nodeMode . ' has been added to registry.');
}
}