From: Roland Haeder Date: Wed, 10 Jun 2015 18:22:55 +0000 (+0200) Subject: Renamed many classes as they are only for the daemon + added a task which will X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4ac69171150e7668053ca2a528dfbfa4f594a11f;p=city.git Renamed many classes as they are only for the daemon + added a task which will expand the map. Signed-off-by: Roland Haeder --- diff --git a/application/city/config.php b/application/city/config.php index 6487ec0..527502c 100644 --- a/application/city/config.php +++ b/application/city/config.php @@ -483,7 +483,7 @@ $cfg->setConfigEntry('region_manager_class', 'RegionManager'); $cfg->setConfigEntry('region_map_manager_class', 'RegionMapManager'); /****************************************************************************** - * Console client * + * Daemon * ******************************************************************************/ // CFG: DEFAULT-CONSOLE-COMMAND @@ -498,23 +498,23 @@ $cfg->setConfigEntry('default_city_console_controller', 'daemon'); // CFG: CITY-CONSOLE-CMD-DAEMON-RESOLVER-CLASS $cfg->setConfigEntry('city_console_cmd_daemon_resolver_class', 'CityConsoleCommandResolver'); -// CFG: CITY-PHP-REQUIREMENTS-FILTER -$cfg->setConfigEntry('city_php_requirements_filter', 'CityPhpRequirementsFilter'); +// CFG: CITY-DAEMON-PHP-REQUIREMENTS-FILTER +$cfg->setConfigEntry('city_daemon_php_requirements_filter', 'CityDaemonPhpRequirementsFilter'); -// CFG: CITY-INITIALIZER-FILTER -$cfg->setConfigEntry('city_initializer_filter', 'CityInitializationFilter'); +// CFG: CITY-DAEMON-INITIALIZER-FILTER +$cfg->setConfigEntry('city_daemon_initializer_filter', 'CityDaemonInitializationFilter'); -// CFG: CITY-ACTIVATION-TASK-HANDLER-INITIALIZER-FILTER -$cfg->setConfigEntry('city_activation_task_handler_initializer_filter', 'CityTaskHandlerInitializerFilter'); +// CFG: CITY-DAEMON-ACTIVATION-TASK-HANDLER-INITIALIZER-FILTER +$cfg->setConfigEntry('city_daemon_activation_task_handler_initializer_filter', 'CityDaemonTaskHandlerInitializerFilter'); -// CFG: CITY-WELCOME-TEASER-FILTER -$cfg->setConfigEntry('city_welcome_teaser_filter', 'CityWelcomeTeaserFilter'); +// CFG: CITY-DAEMON-WELCOME-TEASER-FILTER +$cfg->setConfigEntry('city_daemon_welcome_teaser_filter', 'CityDaemonWelcomeTeaserFilter'); -// CFG: CITY-SHUTDOWN-TASK-HANDLER-FILTER -$cfg->setConfigEntry('city_shutdown_task_handler_filter', 'CityShutdownTaskHandlerFilter'); +// CFG: CITY-DAEMON-SHUTDOWN-TASK-HANDLER-FILTER +$cfg->setConfigEntry('city_daemon_shutdown_task_handler_filter', 'CityDaemonShutdownTaskHandlerFilter'); -// CFG: CITY-SHUTDOWN-CITY-FILTER -$cfg->setConfigEntry('city_shutdown_city_filter', 'CityShutdownCityFilter'); +// CFG: CITY-DAEMON-SHUTDOWN-CITY-FILTER +$cfg->setConfigEntry('city_daemon_shutdown_city_filter', 'CityDaemonShutdownCityFilter'); // CFG: NEWS-READER-DAEMON-CLASS $cfg->setConfigEntry('news_reader_daemon_class', 'ConsoleNewsReader'); @@ -522,5 +522,17 @@ $cfg->setConfigEntry('news_reader_daemon_class', 'ConsoleNewsReader'); // CFG: NEWS-DAEMON-LIMIT $cfg->setConfigEntry('news_daemon_limit', 5); +// CFG: CITY-DAEMON-MAP-EXPANDER-TASK-CLASS +$cfg->setConfigEntry('city_daemon_map_expander_task_class', 'CityDaemonMapExpanderTask'); + +// CFG: TASK-MAP-EXPANDER-STARTUP-DELAY +$cfg->setConfigEntry('task_map_expander_startup_delay', 500); + +// CFG: TASK-MAP-EXPANDER-INTERVAL-DELAY +$cfg->setConfigEntry('task_map_expander_interval_delay', 100); + +// CFG: TASK-MAP-EXPANDER-MAX-RUNS +$cfg->setConfigEntry('task_map_expander_max_runs', 0); + // [EOF] ?> diff --git a/application/city/main/commands/console/class_CityConsoleDaemonCommand.php b/application/city/main/commands/console/class_CityConsoleDaemonCommand.php index 53b0ea2..4dfed6b 100644 --- a/application/city/main/commands/console/class_CityConsoleDaemonCommand.php +++ b/application/city/main/commands/console/class_CityConsoleDaemonCommand.php @@ -115,21 +115,21 @@ class CityConsoleDaemonCommand extends BaseCommand implements Commandable { */ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { // Add pre filters - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_php_requirements_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_initializer_filter')); - $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_welcome_teaser_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_php_requirements_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_initializer_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_welcome_teaser_filter')); // Add bootstrap filters - //$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_bootstrap_generate_cityid_filter')); + //$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_bootstrap_generate_cityid_filter')); // Add city activation filters - $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_activation_task_handler_initializer_filter')); + $controllerInstance->addActivationFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_activation_task_handler_initializer_filter')); // Add shutdown filters - $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_shutdown_task_handler_filter')); + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_task_handler_filter')); // This is the last generic shutdown filter - $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_shutdown_city_filter')); + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('city_daemon_shutdown_city_filter')); } } diff --git a/application/city/main/filter/city/.htaccess b/application/city/main/filter/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/main/filter/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/main/filter/city/class_City b/application/city/main/filter/city/class_City deleted file mode 100644 index 75aa344..0000000 --- a/application/city/main/filter/city/class_City +++ /dev/null @@ -1,63 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City 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 City???Filter extends BaseCityFilter 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 createCity???Filter () { - // Get a new instance - $filterInstance = new City???Filter(); - - // 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) { - // Implement this! - $this->partialStub('Please implement this method.'); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/city/class_CityInitializationFilter.php b/application/city/main/filter/city/class_CityInitializationFilter.php deleted file mode 100644 index 9175586..0000000 --- a/application/city/main/filter/city/class_CityInitializationFilter.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityInitializationFilter extends BaseCityFilter 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 static final function createCityInitializationFilter () { - // Get a new instance - $filterInstance = new CityInitializationFilter(); - - // 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 - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Try to instance it by using a factory - try { - // Get an instance - $cityInstance = CityObjectFactory::createCityInstance($requestInstance, $responseInstance); - } catch (ClassNotFoundException $e) { - // This exception means, the city mode is invalid. - // @TODO Can we rewrite this to app_exit() ? - $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: city mode ' . $cityMode . ' is invalid.'); - } - - // Set the city instance in registry - Registry::getRegistry()->addInstance('city', $cityInstance); - //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: City ' . $cityMode . ' has been added to registry.'); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/city/class_CityPhpRequirementsFilter.php b/application/city/main/filter/city/class_CityPhpRequirementsFilter.php deleted file mode 100644 index 307de6f..0000000 --- a/application/city/main/filter/city/class_CityPhpRequirementsFilter.php +++ /dev/null @@ -1,71 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityPhpRequirementsFilter extends BaseCityFilter 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 static final function createCityPhpRequirementsFilter () { - // Get a new instance - $filterInstance = new CityPhpRequirementsFilter(); - - // 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 - * @throws FilterChainException If a required PHP function is not available - * @todo Add more test and try to add an extra message to the thrown exception - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // By default, the requirement check is passed and zero checks are failed - $checkPassed = TRUE; - $checksFailed = 0; - - // Are all tests passed? - if ($checkPassed === FALSE) { - // Throw an exception - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/city/class_CityWelcomeTeaserFilter.php b/application/city/main/filter/city/class_CityWelcomeTeaserFilter.php deleted file mode 100644 index 8fc2917..0000000 --- a/application/city/main/filter/city/class_CityWelcomeTeaserFilter.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityWelcomeTeaserFilter extends BaseCityFilter 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 static final function createCityWelcomeTeaserFilter () { - // Get a new instance - $filterInstance = new CityWelcomeTeaserFilter(); - - // 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 - * @throws FilterChainException If $cityInstance is null (no NullPointerException here) - * @todo Handle over the $responseInstance to outputConsoleTeaser() - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get city instance - $cityInstance = CityObjectFactory::createCityInstance(); - - // Now output the teaser - $cityInstance->outputConsoleTeaser(); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/city_daemon/.htaccess b/application/city/main/filter/city_daemon/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/filter/city_daemon/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/filter/city_daemon/class_CityDaemon b/application/city/main/filter/city_daemon/class_CityDaemon new file mode 100644 index 0000000..e5e2f4d --- /dev/null +++ b/application/city/main/filter/city_daemon/class_CityDaemon @@ -0,0 +1,63 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City 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 CityDaemon???Filter extends BaseCityFilter 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 createCityDaemon???Filter () { + // Get a new instance + $filterInstance = new CityDaemon???Filter(); + + // 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) { + // Implement this! + $this->partialStub('Please implement this method.'); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/city_daemon/class_CityDaemonInitializationFilter.php b/application/city/main/filter/city_daemon/class_CityDaemonInitializationFilter.php new file mode 100644 index 0000000..73a78a0 --- /dev/null +++ b/application/city/main/filter/city_daemon/class_CityDaemonInitializationFilter.php @@ -0,0 +1,73 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonInitializationFilter extends BaseCityFilter 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 static final function createCityDaemonInitializationFilter () { + // Get a new instance + $filterInstance = new CityDaemonInitializationFilter(); + + // 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 + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Try to instance it by using a factory + try { + // Get an instance + $cityInstance = CityObjectFactory::createCityInstance($requestInstance, $responseInstance); + } catch (ClassNotFoundException $e) { + // This exception means, the city mode is invalid. + // @TODO Can we rewrite this to app_exit() ? + $this->debugBackTrace('[' . __METHOD__ . ':' . __LINE__ . ']: city mode ' . $cityMode . ' is invalid.'); + } + + // Set the city instance in registry + Registry::getRegistry()->addInstance('city', $cityInstance); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('NODE-INIT-FILTER[' . __METHOD__ . ':' . __LINE__ . ']: City ' . $cityMode . ' has been added to registry.'); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/city_daemon/class_CityDaemonPhpRequirementsFilter.php b/application/city/main/filter/city_daemon/class_CityDaemonPhpRequirementsFilter.php new file mode 100644 index 0000000..8ee57a4 --- /dev/null +++ b/application/city/main/filter/city_daemon/class_CityDaemonPhpRequirementsFilter.php @@ -0,0 +1,71 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonPhpRequirementsFilter extends BaseCityFilter 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 static final function createCityDaemonPhpRequirementsFilter () { + // Get a new instance + $filterInstance = new CityDaemonPhpRequirementsFilter(); + + // 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 + * @throws FilterChainException If a required PHP function is not available + * @todo Add more test and try to add an extra message to the thrown exception + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // By default, the requirement check is passed and zero checks are failed + $checkPassed = TRUE; + $checksFailed = 0; + + // Are all tests passed? + if ($checkPassed === FALSE) { + // Throw an exception + throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/city_daemon/class_CityDaemonWelcomeTeaserFilter.php b/application/city/main/filter/city_daemon/class_CityDaemonWelcomeTeaserFilter.php new file mode 100644 index 0000000..936980c --- /dev/null +++ b/application/city/main/filter/city_daemon/class_CityDaemonWelcomeTeaserFilter.php @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonWelcomeTeaserFilter extends BaseCityFilter 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 static final function createCityDaemonWelcomeTeaserFilter () { + // Get a new instance + $filterInstance = new CityDaemonWelcomeTeaserFilter(); + + // 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 + * @throws FilterChainException If $cityInstance is null (no NullPointerException here) + * @todo Handle over the $responseInstance to outputConsoleTeaser() + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get city instance + $cityInstance = CityObjectFactory::createCityInstance(); + + // Now output the teaser + $cityInstance->outputConsoleTeaser(); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/shutdown/city/class_CityDaemonShutdown b/application/city/main/filter/shutdown/city/class_CityDaemonShutdown new file mode 100644 index 0000000..9ad60d4 --- /dev/null +++ b/application/city/main/filter/shutdown/city/class_CityDaemonShutdown @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City 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 CityDaemonShutdown???Filter extends BaseCityFilter 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 createCityDaemonShutdown???Filter () { + // Get a new instance + $filterInstance = new CityDaemonShutdown???Filter(); + + // 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 + * @throws FilterChainException If $cityInstance is null (no NullPointerException here) + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get city instance + $cityInstance = Registry::getRegistry()->getInstance('city'); + + // Now do something + $this->partialStub('Please implement this step.'); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/shutdown/city/class_CityDaemonShutdownCityFilter.php b/application/city/main/filter/shutdown/city/class_CityDaemonShutdownCityFilter.php new file mode 100644 index 0000000..624d2f2 --- /dev/null +++ b/application/city/main/filter/shutdown/city/class_CityDaemonShutdownCityFilter.php @@ -0,0 +1,68 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonShutdownCityFilter extends BaseCityFilter 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 static final function createCityDaemonShutdownCityFilter () { + // Get a new instance + $filterInstance = new CityDaemonShutdownCityFilter(); + + // 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 + * @throws FilterChainException If $cityInstance is null (no NullPointerException please) + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get city instance + $cityInstance = CityObjectFactory::createCityInstance(); + + // Shutdown the city. This should be the last line + $cityInstance->doShutdown(); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/shutdown/city/class_CityDaemonShutdownTaskHandlerFilter.php b/application/city/main/filter/shutdown/city/class_CityDaemonShutdownTaskHandlerFilter.php new file mode 100644 index 0000000..a80fdae --- /dev/null +++ b/application/city/main/filter/shutdown/city/class_CityDaemonShutdownTaskHandlerFilter.php @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonShutdownTaskHandlerFilter extends BaseCityFilter 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 static final function createCityDaemonShutdownTaskHandlerFilter () { + // Get a new instance + $filterInstance = new CityDaemonShutdownTaskHandlerFilter(); + + // 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 + * @throws FilterChainException If $cityInstance is null (no NullPointerException here) + * @todo 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get task handler instance + $handlerInstance = Registry::getRegistry()->getInstance('task_handler'); + + // Shutdown the task manager and all its registered tasks + $handlerInstance->doShutdown(); + } +} + +// [EOF] +?> diff --git a/application/city/main/filter/shutdown/city/class_CityShutdown b/application/city/main/filter/shutdown/city/class_CityShutdown deleted file mode 100644 index 60201db..0000000 --- a/application/city/main/filter/shutdown/city/class_CityShutdown +++ /dev/null @@ -1,67 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City 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 CityShutdown???Filter extends BaseCityFilter 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 createCityShutdown???Filter () { - // Get a new instance - $filterInstance = new CityShutdown???Filter(); - - // 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 - * @throws FilterChainException If $cityInstance is null (no NullPointerException here) - * @todo 0% done - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get city instance - $cityInstance = Registry::getRegistry()->getInstance('city'); - - // Now do something - $this->partialStub('Please implement this step.'); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/shutdown/city/class_CityShutdownCityFilter.php b/application/city/main/filter/shutdown/city/class_CityShutdownCityFilter.php deleted file mode 100644 index 0b48c5a..0000000 --- a/application/city/main/filter/shutdown/city/class_CityShutdownCityFilter.php +++ /dev/null @@ -1,68 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityShutdownCityFilter extends BaseCityFilter 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 static final function createCityShutdownCityFilter () { - // Get a new instance - $filterInstance = new CityShutdownCityFilter(); - - // 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 - * @throws FilterChainException If $cityInstance is null (no NullPointerException please) - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get city instance - $cityInstance = CityObjectFactory::createCityInstance(); - - // Shutdown the city. This should be the last line - $cityInstance->doShutdown(); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/shutdown/city/class_CityShutdownTaskHandlerFilter.php b/application/city/main/filter/shutdown/city/class_CityShutdownTaskHandlerFilter.php deleted file mode 100644 index 18dfe61..0000000 --- a/application/city/main/filter/shutdown/city/class_CityShutdownTaskHandlerFilter.php +++ /dev/null @@ -1,67 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityShutdownTaskHandlerFilter extends BaseCityFilter 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 static final function createCityShutdownTaskHandlerFilter () { - // Get a new instance - $filterInstance = new CityShutdownTaskHandlerFilter(); - - // 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 - * @throws FilterChainException If $cityInstance is null (no NullPointerException here) - * @todo 0% done - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get task handler instance - $handlerInstance = Registry::getRegistry()->getInstance('task_handler'); - - // Shutdown the task manager and all its registered tasks - $handlerInstance->doShutdown(); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/task/city/.htaccess b/application/city/main/filter/task/city/.htaccess deleted file mode 100644 index 3a42882..0000000 --- a/application/city/main/filter/task/city/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/city/main/filter/task/city/class_CityTaskHandlerInitializerFilter.php b/application/city/main/filter/task/city/class_CityTaskHandlerInitializerFilter.php deleted file mode 100644 index 384421a..0000000 --- a/application/city/main/filter/task/city/class_CityTaskHandlerInitializerFilter.php +++ /dev/null @@ -1,83 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2015 City Developer Team - * @license GNU GPL 3.0 or any newer version - * @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 - * 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 CityTaskHandlerInitializerFilter extends BaseCityFilter 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 static final function createCityTaskHandlerInitializerFilter () { - // Get a new instance - $filterInstance = new CityTaskHandlerInitializerFilter(); - - // 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 - * @throws FilterChainException If the filter chain needs to be interrupted - * @todo Add more tasks - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get city instance - $cityInstance = CityObjectFactory::createCityInstance(); - - // Get a new task handler instance - $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); - - // Put the task handler in registry - Registry::getRegistry()->addInstance('task_handler', $handlerInstance); - - // Prepare a package-tags initialization task for the listeners - //$taskInstance = ObjectFactory::createObjectByConfiguredName('city_package_tags_init_task_class'); - - // Register it - //$handlerInstance->registerTask('package_tags_init', $taskInstance); - - /* - * Allow extra city-depending tasks, e.g. the bootstrapper city needs - * booting its DHT. DHTs are decentralized and are working on - * peer-to-peer basis. - */ - $cityInstance->addExtraTasks($handlerInstance); - } -} - -// [EOF] -?> diff --git a/application/city/main/filter/task/city_daemon/.htaccess b/application/city/main/filter/task/city_daemon/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/filter/task/city_daemon/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/filter/task/city_daemon/class_CityDaemonTaskHandlerInitializerFilter.php b/application/city/main/filter/task/city_daemon/class_CityDaemonTaskHandlerInitializerFilter.php new file mode 100644 index 0000000..542aa27 --- /dev/null +++ b/application/city/main/filter/task/city_daemon/class_CityDaemonTaskHandlerInitializerFilter.php @@ -0,0 +1,83 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2015 City Developer Team + * @license GNU GPL 3.0 or any newer version + * @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 + * 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 CityDaemonTaskHandlerInitializerFilter extends BaseCityFilter 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 static final function createCityDaemonTaskHandlerInitializerFilter () { + // Get a new instance + $filterInstance = new CityDaemonTaskHandlerInitializerFilter(); + + // 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 + * @throws FilterChainException If the filter chain needs to be interrupted + * @todo Add more tasks + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get city instance + $cityInstance = CityObjectFactory::createCityInstance(); + + // Get a new task handler instance + $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + + // Put the task handler in registry + Registry::getRegistry()->addInstance('task_handler', $handlerInstance); + + // Prepare a map-expanding task + $taskInstance = ObjectFactory::createObjectByConfiguredName('city_daemon_map_expander_task_class'); + + // Register it + $handlerInstance->registerTask('map_expander', $taskInstance); + + /* + * Allow extra city-depending tasks, e.g. the bootstrapper city needs + * booting its DHT. DHTs are decentralized and are working on + * peer-to-peer basis. + */ + $cityInstance->addExtraTasks($handlerInstance); + } +} + +// [EOF] +?> diff --git a/application/city/main/tasks/.htaccess b/application/city/main/tasks/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/tasks/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/tasks/daemon/.htaccess b/application/city/main/tasks/daemon/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/tasks/daemon/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/tasks/daemon/city_map/.htaccess b/application/city/main/tasks/daemon/city_map/.htaccess new file mode 100644 index 0000000..3a42882 --- /dev/null +++ b/application/city/main/tasks/daemon/city_map/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/city/main/tasks/daemon/city_map/class_CityDaemonMapExpanderTask.php b/application/city/main/tasks/daemon/city_map/class_CityDaemonMapExpanderTask.php new file mode 100644 index 0000000..6c0dad5 --- /dev/null +++ b/application/city/main/tasks/daemon/city_map/class_CityDaemonMapExpanderTask.php @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub 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 CityDaemonMapExpanderTask extends BaseTask implements Taskable, Visitable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $taskInstance An instance of a Visitable class + */ + public final static function createCityDaemonMapExpanderTask () { + // Get new instance + $taskInstance = new CityDaemonMapExpanderTask(); + + // Return the prepared instance + return $taskInstance; + } + + /** + * Accepts the visitor to process the visitor + * + * @param $visitorInstance An instance of a Visitor class + * @return void + * @todo Maybe visit some sub-objects + */ + public function accept (Visitor $visitorInstance) { + // Visit this task + $visitorInstance->visitTask($this); + } + + /** + * Executes the task + * + * @return void + * @todo 0% done + */ + public function executeTask () { + $this->partialStub('Unimplemented task.'); + } + + /** + * Shuts down the task + * + * @return void + * @todo 0% done + */ + public function doShutdown () { + self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + } +} + +// [EOF] +?> diff --git a/application/city/main/tasks/daemon/class_CityDaemon b/application/city/main/tasks/daemon/class_CityDaemon new file mode 100644 index 0000000..48e0724 --- /dev/null +++ b/application/city/main/tasks/daemon/class_CityDaemon @@ -0,0 +1,82 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub 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 CityDaemon???Task extends BaseTask implements Taskable, Visitable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $taskInstance An instance of a Visitable class + */ + public final static function createCityDaemon???Task () { + // Get new instance + $taskInstance = new CityDaemon???Task(); + + // Return the prepared instance + return $taskInstance; + } + + /** + * Accepts the visitor to process the visitor + * + * @param $visitorInstance An instance of a Visitor class + * @return void + * @todo Maybe visit some sub-objects + */ + public function accept (Visitor $visitorInstance) { + // Visit this task + $visitorInstance->visitTask($this); + } + + /** + * Executes the task + * + * @return void + * @todo 0% done + */ + public function executeTask () { + $this->partialStub('Unimplemented task.'); + } + + /** + * Shuts down the task + * + * @return void + * @todo 0% done + */ + public function doShutdown () { + self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...'); + } +} + +// [EOF] +?> diff --git a/core b/core index b2caf38..cc0e0b4 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit b2caf380b85fbe804d7464ecc1bfe60aafcbc7d9 +Subproject commit cc0e0b439900fd1ffb882f9150f37dd3eb8d301d