From df5b9f549c59c6772d77d68f01c72bbc90c422f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 24 Mar 2009 10:26:08 +0000 Subject: [PATCH] Double-quotes rewritten to single-quotes --- .gitattributes | 4 ++ application/hub/class_ApplicationHelper.php | 7 ++- application/hub/config.php | 8 +-- application/hub/data.php | 2 +- application/hub/interfaces/nodes/.htaccess | 1 + .../hub/interfaces/nodes/class_NodeHelper.php | 37 +++++++++++ application/hub/main/nodes/class_ | 50 +++++++++++++++ .../nodes/regular/class_HubRegularNode.php | 62 +++++++++++++++++++ application/hub/starter.php | 6 +- 9 files changed, 170 insertions(+), 7 deletions(-) create mode 100644 application/hub/interfaces/nodes/.htaccess create mode 100644 application/hub/interfaces/nodes/class_NodeHelper.php create mode 100644 application/hub/main/nodes/class_ create mode 100644 application/hub/main/nodes/regular/class_HubRegularNode.php diff --git a/.gitattributes b/.gitattributes index 022116b7f..70fd9a236 100644 --- a/.gitattributes +++ b/.gitattributes @@ -10,14 +10,18 @@ application/hub/exceptions.php -text application/hub/exceptions/.htaccess -text application/hub/init.php -text application/hub/interfaces/.htaccess -text +application/hub/interfaces/nodes/.htaccess -text +application/hub/interfaces/nodes/class_NodeHelper.php -text application/hub/loader.php -text application/hub/main/.htaccess -text application/hub/main/nodes/.htaccess -text application/hub/main/nodes/boot/.htaccess -text +application/hub/main/nodes/class_ -text application/hub/main/nodes/class_BaseHubNode.php -text application/hub/main/nodes/list/.htaccess -text application/hub/main/nodes/master/.htaccess -text application/hub/main/nodes/regular/.htaccess -text +application/hub/main/nodes/regular/class_HubRegularNode.php -text application/hub/starter.php -text /clear-cache.sh -text db/.htaccess -text diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index eb29ff7b1..6f29c8d92 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -153,7 +153,8 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica * @return void */ public final function entryPoint () { - // The default node mode is from config. This mode is being "transfered" into a class name + // --------------------- Init phase --------------------- + // The default node-mode is from our configuration $nodeMode = $this->getConfigInstance()->readConfig('node_mode'); // Prepare a ConsoleRequest class to catch all parameters @@ -170,6 +171,10 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica // And try to instance it $nodeInstance = ObjectFactory::createObjectByName($className); + + // --------------------- Bootstrapping phase --------------------- + // Try to bootstrap the node and pass the request instance to it + $nodeInstance->doBootstrapping($requestInstance); } /** diff --git a/application/hub/config.php b/application/hub/config.php index dfa719473..490f38f28 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -36,11 +36,11 @@ $cfg->setConfigEntry('node_mode', "regular"); // CFG: TEMPLATE-ENGINE $cfg->setConfigEntry('tpl_engine', "ConsoleOutput"); -// CFG: WEB-ENGINE -$cfg->setConfigEntry('web_engine', "DebugConsoleOutput"); +// CFG: OUTPUT-CLASS +$cfg->setConfigEntry('output_class', "DebugConsoleOutput"); -// CFG: DEBUG-ENGINE -$cfg->setConfigEntry('debug_engine', "DebugErrorLogOutput"); +// CFG: DEBUG-CLASS +$cfg->setConfigEntry('debug_class', "DebugErrorLogOutput"); // CFG: WEB-CONTENT-TYPE $cfg->setConfigEntry('web_content_type', ""); diff --git a/application/hub/data.php b/application/hub/data.php index 932d45356..fba94cf90 100644 --- a/application/hub/data.php +++ b/application/hub/data.php @@ -38,7 +38,7 @@ $cfg = FrameworkConfiguration::getInstance(); // Get an instance of the helper $app = call_user_func_array( - array($cfg->readConfig('app_helper_class'), "getInstance"), + array($cfg->readConfig('app_helper_class'), 'getInstance'), array() ); diff --git a/application/hub/interfaces/nodes/.htaccess b/application/hub/interfaces/nodes/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/nodes/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/nodes/class_NodeHelper.php b/application/hub/interfaces/nodes/class_NodeHelper.php new file mode 100644 index 000000000..75b45ee90 --- /dev/null +++ b/application/hub/interfaces/nodes/class_NodeHelper.php @@ -0,0 +1,37 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.org + * @todo We need to find a better name for this interface + * + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface NodeHelper extends FrameworkInterface { + /** + * Method to "bootstrap" the node. This step does also apply provided + * command-line arguments stored in the request instance + * + * @param $requestInstance An instance of a Requestable class + * @return void + */ + function doBootstrapping (Requestable $requestInstance); +} + +// +?> diff --git a/application/hub/main/nodes/class_ b/application/hub/main/nodes/class_ new file mode 100644 index 000000000..0951d0188 --- /dev/null +++ b/application/hub/main/nodes/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class Hub???Node extends BaseHubNode implements NodeHelper { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this hub-node class + * + * @return $nodeInstance An instance of this hub-node class + */ + public final static function createHub???Node () { + // Get a new instance + $nodeInstance = new Hub???Node(); + + // Return the instance + return $nodeInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/nodes/regular/class_HubRegularNode.php b/application/hub/main/nodes/regular/class_HubRegularNode.php new file mode 100644 index 000000000..39903a5a5 --- /dev/null +++ b/application/hub/main/nodes/regular/class_HubRegularNode.php @@ -0,0 +1,62 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.ship-simu.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 + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +class HubRegularNode extends BaseHubNode implements NodeHelper { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this hub-node class + * + * @return $nodeInstance An instance of this hub-node class + */ + public final static function createHubRegularNode () { + // Get a new instance + $nodeInstance = new HubRegularNode(); + + // Return the instance + return $nodeInstance; + } + + /** + * Method to "bootstrap" the node. This step does also apply provided + * command-line arguments stored in the request instance. The regular node + * should communicate with the bootstrap-nodes at this point. + * + * @param $requestInstance An instance of a Requestable class + * @return void + */ + public function doBootstrapping (Requestable $requestInstance) { + $this->partialStub(); + } +} + +// [EOF] +?> diff --git a/application/hub/starter.php b/application/hub/starter.php index 3a3038b7e..4e4a2f770 100644 --- a/application/hub/starter.php +++ b/application/hub/starter.php @@ -24,7 +24,11 @@ // Is there an application helper instance? We need the method main() for // maining the application -$app = call_user_func_array(array(FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), "getInstance"), array()); +$app = call_user_func_array( + array( + FrameworkConfiguration::getInstance()->readConfig('app_helper_class'), 'getInstance' + ), array() +); // Some sanity checks if ((empty($app)) || (is_null($app))) { -- 2.39.5