From 503c1abcc5b2a56a197187b0e390cbc2ae23cd69 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sat, 1 Aug 2009 21:34:57 +0000 Subject: [PATCH] Extra bootstrapping steps added --- .gitattributes | 1 + application/hub/config.php | 3 + .../console/class_HubConsoleMainCommand.php | 1 + ...s_HubBootstrapExtraBootstrappingFilter.php | 72 +++++++++++++++++++ 4 files changed, 77 insertions(+) create mode 100644 application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php diff --git a/.gitattributes b/.gitattributes index 358421f21..5c741ad66 100644 --- a/.gitattributes +++ b/.gitattributes @@ -61,6 +61,7 @@ application/hub/main/filter/.htaccess -text application/hub/main/filter/bootstrap/.htaccess -text application/hub/main/filter/bootstrap/class_ -text application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php -text +application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php -text application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php -text application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php -text application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php -text diff --git a/application/hub/config.php b/application/hub/config.php index 46f2acf83..db9722b83 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -114,6 +114,9 @@ $cfg->setConfigEntry('hub_bootstrap_restore_nodelist_filter', 'HubBootstrapResto // CFG: HUB-BOOTSTRAP-INIT-QUEUES-FILTER $cfg->setConfigEntry('hub_bootstrap_init_queues_filter', 'HubBootstrapInitQueuesFilter'); +// CFG: HUB-BOOTSTRAP-EXTRA-BOOTSTRAP-FILTER +$cfg->setConfigEntry('hub_bootstrap_extra_bootstrap_filter', 'HubBootstrapExtraBootstrappingFilter'); + // CFG: NEWS-READER-CLASS $cfg->setConfigEntry('news_reader_class', 'ConsoleNewsReader'); diff --git a/application/hub/main/commands/console/class_HubConsoleMainCommand.php b/application/hub/main/commands/console/class_HubConsoleMainCommand.php index cf8a9a78b..20b23e4c8 100644 --- a/application/hub/main/commands/console/class_HubConsoleMainCommand.php +++ b/application/hub/main/commands/console/class_HubConsoleMainCommand.php @@ -119,6 +119,7 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_gen_sessionid_filter')); $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_restore_nodelist_filter')); $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_init_queues_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_extra_bootstrap_filter')); } } diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php new file mode 100644 index 000000000..9c77572a1 --- /dev/null +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php @@ -0,0 +1,72 @@ + + * @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 HubBootstrapExtraBootstrappingFilter extends BaseFilter implements Filterable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this filter class + * + * @return $filterInstance An instance of this filter class + */ + public final static function createHubBootstrapExtraBootstrappingFilter () { + // Get a new instance + $filterInstance = new HubBootstrapExtraBootstrappingFilter(); + + // Return the instance + return $filterInstance; + } + + /** + * Executes the filter with given request and response objects + * + * @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) { + // Get node instance + $nodeInstance = Registry::getRegistry()->getInstance('node'); + + // Sanity-check on it + if (is_null($nodeInstance)) { + // Throws a FilterChainException to stop further processing + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); + } // END - if + + // Do some extra bootstrapping steps + $nodeInstance->doBootstrapping(); + } +} + +// [EOF] +?> -- 2.39.5