From a0a0a197ca9f858041e636e47e3cc46d3d628d6c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 26 May 2011 04:14:04 +0000 Subject: [PATCH] Basic (non-functional) classes added for a chat console (ever want to 'chat' or 'talk' with your node?) Please don't put this to high, at the moment it is only planed to give the node commands, no more --- .gitattributes | 22 +++ application/hub/config.php | 35 ++++- application/hub/interfaces/chat/.htaccess | 1 + .../hub/interfaces/chat/class_Chatter.php | 28 ++++ application/hub/main/chat/.htaccess | 1 + application/hub/main/chat/class_ | 50 +++++++ .../hub/main/chat/class_BaseNodeChat.php | 38 +++++ application/hub/main/chat/console/.htaccess | 1 + .../chat/console/class_NodeConsoleChat.php | 50 +++++++ .../console/class_HubConsoleChatCommand.php | 131 ++++++++++++++++++ .../class_HubConsoleCruncherCommand.php | 2 +- .../class_HubConsoleChatController.php | 131 ++++++++++++++++++ .../hub/main/filter/bootstrap/chat/.htaccess | 1 + .../filter/bootstrap/chat/class_ChatBootstrap | 66 +++++++++ ..._ChatBootstrapExtraBootstrappingFilter.php | 66 +++++++++ ...s_ChatBootstrapGenericActivationFilter.php | 69 +++++++++ .../cruncher/class_CruncherBootstrap | 4 +- application/hub/main/filter/chat/.htaccess | 1 + .../chat/class_ChatInitializationFilter.php | 75 ++++++++++ .../chat/class_ChatPhpRequirementsFilter.php | 78 +++++++++++ .../chat/class_ChatWelcomeTeaserFilter.php | 67 +++++++++ .../class_CruncherWelcomeTeaserFilter.php | 4 +- .../hub/main/filter/shutdown/chat/.htaccess | 1 + .../chat/class_ChatShutdownFilter.php | 68 +++++++++ .../class_CruncherShutdownCruncherFilter.php | 67 +-------- .../cruncher/class_CruncherShutdownFilter.php | 68 +++++++++ .../hub/main/filter/task/chat/.htaccess | 1 + ...class_ChatTaskHandlerInitializerFilter.php | 76 ++++++++++ 28 files changed, 1129 insertions(+), 73 deletions(-) create mode 100644 application/hub/interfaces/chat/.htaccess create mode 100644 application/hub/interfaces/chat/class_Chatter.php create mode 100644 application/hub/main/chat/.htaccess create mode 100644 application/hub/main/chat/class_ create mode 100644 application/hub/main/chat/class_BaseNodeChat.php create mode 100644 application/hub/main/chat/console/.htaccess create mode 100644 application/hub/main/chat/console/class_NodeConsoleChat.php create mode 100644 application/hub/main/commands/console/class_HubConsoleChatCommand.php create mode 100644 application/hub/main/controller/console/class_HubConsoleChatController.php create mode 100644 application/hub/main/filter/bootstrap/chat/.htaccess create mode 100644 application/hub/main/filter/bootstrap/chat/class_ChatBootstrap create mode 100644 application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php create mode 100644 application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php create mode 100644 application/hub/main/filter/chat/.htaccess create mode 100644 application/hub/main/filter/chat/class_ChatInitializationFilter.php create mode 100644 application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php create mode 100644 application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php create mode 100644 application/hub/main/filter/shutdown/chat/.htaccess create mode 100644 application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php create mode 100644 application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php create mode 100644 application/hub/main/filter/task/chat/.htaccess create mode 100644 application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php diff --git a/.gitattributes b/.gitattributes index 1178a29f4..dc18b2b64 100644 --- a/.gitattributes +++ b/.gitattributes @@ -28,6 +28,8 @@ application/hub/exceptions/tasks/.htaccess -text svneol=unset#text/plain application/hub/exceptions/tasks/class_InvalidTaskException.php svneol=native#text/plain application/hub/init.php svneol=native#text/plain application/hub/interfaces/.htaccess -text svneol=unset#text/plain +application/hub/interfaces/chat/.htaccess svneol=native#text/plain +application/hub/interfaces/chat/class_Chatter.php svneol=native#text/plain application/hub/interfaces/connectors/.htaccess -text svneol=unset#text/plain application/hub/interfaces/connectors/class_Connectable.php svneol=native#text/plain application/hub/interfaces/consumer/.htaccess svneol=native#text/plain @@ -125,10 +127,16 @@ application/hub/interfaces/work_units/.htaccess svneol=native#text/plain application/hub/interfaces/work_units/class_UnitHelper.php svneol=native#text/plain application/hub/loader.php svneol=native#text/plain application/hub/main/.htaccess -text svneol=unset#text/plain +application/hub/main/chat/.htaccess svneol=native#text/plain +application/hub/main/chat/class_ -text +application/hub/main/chat/class_BaseNodeChat.php svneol=native#text/plain +application/hub/main/chat/console/.htaccess svneol=native#text/plain +application/hub/main/chat/console/class_NodeConsoleChat.php svneol=native#text/plain application/hub/main/class_ svneol=native#text/plain application/hub/main/class_BaseHubSystem.php svneol=native#text/plain application/hub/main/commands/.htaccess -text svneol=unset#text/plain application/hub/main/commands/console/.htaccess -text svneol=unset#text/plain +application/hub/main/commands/console/class_HubConsoleChatCommand.php svneol=native#text/plain application/hub/main/commands/console/class_HubConsoleCruncherCommand.php svneol=native#text/plain application/hub/main/commands/console/class_HubConsoleMainCommand.php svneol=native#text/plain application/hub/main/compressor/.htaccess -text svneol=unset#text/plain @@ -148,6 +156,7 @@ application/hub/main/connectors/queues/local/.htaccess -text svneol=unset#text/p application/hub/main/connectors/queues/local/class_LocalQueueConnector.php svneol=native#text/plain application/hub/main/controller/.htaccess -text svneol=unset#text/plain application/hub/main/controller/console/.htaccess -text svneol=unset#text/plain +application/hub/main/controller/console/class_HubConsoleChatController.php svneol=native#text/plain application/hub/main/controller/console/class_HubConsoleCruncherController.php svneol=native#text/plain application/hub/main/controller/console/class_HubConsoleDefaultNewsController.php svneol=native#text/plain application/hub/main/cruncher/.htaccess svneol=native#text/plain @@ -205,6 +214,10 @@ application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter application/hub/main/filter/activation/node/.htaccess svneol=native#text/plain application/hub/main/filter/activation/node/class_NodeActivationSelfAnnouncementFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/.htaccess -text svneol=unset#text/plain +application/hub/main/filter/bootstrap/chat/.htaccess svneol=native#text/plain +application/hub/main/filter/bootstrap/chat/class_ChatBootstrap -text +application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php svneol=native#text/plain +application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php svneol=native#text/plain @@ -224,6 +237,10 @@ application/hub/main/filter/bootstrap/node/class_NodeBootstrapGenerateSessionIdF application/hub/main/filter/bootstrap/node/class_NodeBootstrapInitQueuesFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/node/class_NodeBootstrapListenerPoolFilter.php svneol=native#text/plain application/hub/main/filter/bootstrap/node/class_NodeBootstrapRestoreNodeListFilter.php svneol=native#text/plain +application/hub/main/filter/chat/.htaccess svneol=native#text/plain +application/hub/main/filter/chat/class_ChatInitializationFilter.php svneol=native#text/plain +application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php svneol=native#text/plain +application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php svneol=native#text/plain application/hub/main/filter/class_ svneol=native#text/plain application/hub/main/filter/console/.htaccess -text svneol=unset#text/plain application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php svneol=native#text/plain @@ -236,6 +253,8 @@ application/hub/main/filter/node/class_NodeInitializationFilter.php svneol=nativ application/hub/main/filter/node/class_NodePhpRequirementsFilter.php svneol=native#text/plain application/hub/main/filter/node/class_NodeWelcomeTeaserFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/.htaccess -text svneol=unset#text/plain +application/hub/main/filter/shutdown/chat/.htaccess svneol=native#text/plain +application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/class_HubShutdownCruncherFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php svneol=native#text/plain @@ -244,12 +263,15 @@ application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php svneol=nati application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/cruncher/.htaccess svneol=native#text/plain application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownCruncherFilter.php svneol=native#text/plain +application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/node/.htaccess svneol=native#text/plain application/hub/main/filter/shutdown/node/class_NodeShutdownDeinitQueuesFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/node/class_NodeShutdownFlushNodeListFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/node/class_NodeShutdownNodeFilter.php svneol=native#text/plain application/hub/main/filter/shutdown/node/class_NodeShutdownTaskHandlerFilter.php svneol=native#text/plain application/hub/main/filter/task/.htaccess -text svneol=unset#text/plain +application/hub/main/filter/task/chat/.htaccess svneol=native#text/plain +application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php svneol=native#text/plain application/hub/main/filter/task/class_CruncherTaskHandlerInitializerFilter.php svneol=native#text/plain application/hub/main/filter/task/class_HubTaskHandlerInitializerFilter.php svneol=native#text/plain application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php svneol=native#text/plain diff --git a/application/hub/config.php b/application/hub/config.php index 08db0c4df..1a32e2c97 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -559,8 +559,8 @@ $cfg->setConfigEntry('cruncher_bootstrap_generic_activation_filter', 'CruncherBo // CFG: CRUNCHER-WELCOME-TEASER-FILTER $cfg->setConfigEntry('cruncher_welcome_teaser_filter', 'CruncherWelcomeTeaserFilter'); -// CFG: CRUNCHER-SHUTDOWN-CRUNCHER-FILTER -$cfg->setConfigEntry('cruncher_shutdown_cruncher_filter', 'CruncherShutdownCruncherFilter'); +// CFG: CRUNCHER-SHUTDOWN-FILTER +$cfg->setConfigEntry('cruncher_shutdown_filter', 'CruncherShutdownFilter'); // CFG: CRUNCHER-WORK-UNIT-FETCHER-TASK-CLASS $cfg->setConfigEntry('cruncher_work_unit_fetcher_task_class', 'CruncherWorkUnitFetcherTask'); @@ -658,5 +658,36 @@ $cfg->setConfigEntry('cruncher_virgin_state_class', 'CruncherVirginState'); // CFG: CRUNCHER-PER-UNIT-KEY-LIMIT $cfg->setConfigEntry('cruncher_per_unit_key_limit', 10000); +/////////////////////////////////////////////////////////////////////////////// +// Chat Configuration +/////////////////////////////////////////////////////////////////////////////// + +// CFG: HUBCONSOLE-CMD-CHAT-RESOLVER-CLASS +$cfg->setConfigEntry('hubconsole_cmd_chat_resolver_class', 'HubConsoleCommandResolver'); + +// CFG: CHAT-PHP-REQUIREMENTS-FILTER +$cfg->setConfigEntry('chat_php_requirements_filter', 'ChatPhpRequirementsFilter'); + +// CFG: CHAT-INITIALIZER-FILTER +$cfg->setConfigEntry('chat_initializer_filter', 'ChatInitializationFilter'); + +// CFG: NODE-CONSOLE-CHAT +$cfg->setConfigEntry('node_console_chat_class', 'NodeConsoleChat'); + +// CFG: CHAT-WELCOME-TEASER-FILTER +$cfg->setConfigEntry('chat_welcome_teaser_filter', 'ChatWelcomeTeaserFilter'); + +// CFG: CHAT-BOOTSTRAP-TASK-HANDLER-INITIALIZER-FILTER +$cfg->setConfigEntry('chat_bootstrap_task_handler_initializer_filter', 'ChatTaskHandlerInitializerFilter'); + +// CFG: CHAT-BOOTSTRAP-EXTRA-BOOTSTRAPPING-FILTER +$cfg->setConfigEntry('chat_bootstrap_extra_bootstrapping_filter', 'ChatBootstrapExtraBootstrappingFilter'); + +// CFG: CHAT-BOOTSTRAP-GENERIC-ACTIVATION-FILTER +$cfg->setConfigEntry('chat_bootstrap_generic_activation_filter', 'ChatBootstrapGenericActivationFilter'); + +// CFG: CHAT-SHUTDOWN-FILTER +$cfg->setConfigEntry('chat_shutdown_filter', 'ChatShutdownFilter'); + // [EOF] ?> diff --git a/application/hub/interfaces/chat/.htaccess b/application/hub/interfaces/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/chat/class_Chatter.php b/application/hub/interfaces/chat/class_Chatter.php new file mode 100644 index 000000000..f92865e77 --- /dev/null +++ b/application/hub/interfaces/chat/class_Chatter.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 . + */ +interface Chatter extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/application/hub/main/chat/.htaccess b/application/hub/main/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/chat/class_ b/application/hub/main/chat/class_ new file mode 100644 index 000000000..7d7325b7d --- /dev/null +++ b/application/hub/main/chat/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 Node???Chat extends BaseNodeChat implements Chatter { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $chatInstance An instance of a Chatter class + */ + public final static function createNode???Chat () { + // Get new instance + $chatInstance = new Node???Chat(); + + // Return the prepared instance + return $chatInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/chat/class_BaseNodeChat.php b/application/hub/main/chat/class_BaseNodeChat.php new file mode 100644 index 000000000..3620b2b3a --- /dev/null +++ b/application/hub/main/chat/class_BaseNodeChat.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 BaseNodeChat extends BaseHubSystem { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/hub/main/chat/console/.htaccess b/application/hub/main/chat/console/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/chat/console/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/chat/console/class_NodeConsoleChat.php b/application/hub/main/chat/console/class_NodeConsoleChat.php new file mode 100644 index 000000000..c0bf80a4e --- /dev/null +++ b/application/hub/main/chat/console/class_NodeConsoleChat.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 NodeConsoleChat extends BaseNodeChat implements Chatter, Registerable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $chatInstance An instance of a Chatter class + */ + public final static function createNodeConsoleChat () { + // Get new instance + $chatInstance = new NodeConsoleChat(); + + // Return the prepared instance + return $chatInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/commands/console/class_HubConsoleChatCommand.php b/application/hub/main/commands/console/class_HubConsoleChatCommand.php new file mode 100644 index 000000000..8b2852861 --- /dev/null +++ b/application/hub/main/commands/console/class_HubConsoleChatCommand.php @@ -0,0 +1,131 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 HubConsoleChatCommand extends BaseCommand implements Commandable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $commandInstance An instance a prepared command class + */ + public static final function createHubConsoleChatCommand (CommandResolver $resolverInstance) { + // Get new instance + $commandInstance = new HubConsoleChatCommand(); + + // Set the application instance + $commandInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $commandInstance; + } + + /** + * Executes the given command 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 Try to create a ChatActivationTask or so + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get a registry and the application instance from it + $applicationInstance = Registry::getRegistry()->getInstance('app'); + + /* + * ----------------------- Bootstrapping phase ------------------------ + * Try to bootstrap the node and pass the request instance to it for + * extra arguments which mostly override config entries or enable special + * features within the hub (none is ready at this development stage) + */ + $this->debugOutput('BOOTSTRAP: Beginning with bootstrap...'); + $applicationInstance->getControllerInstance()->executeBootstrapFilters($requestInstance, $responseInstance); + $this->debugOutput('BOOTSTRAP: Bootstrap finished.'); + + // Get chat instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Add some chat-specific filters + $chatInstance->addExtraChatFilters(); + + // Get task handler instance + $handlerInstance = Registry::getRegistry()->getInstance('task'); + + // Debug message + $this->debugOutput('MAIN: --- Entering main loop. ---'); + + /* + * ----------------------------- Main loop ---------------------------- + * This is the main loop. Queried calls should come back here very fast + * so the whole application runs on nice speed. This while-loop goes + * until the chat is no longer active or all tasks are killed. + */ + while (($chatInstance->isActive()) && ($handlerInstance->hasTasksLeft())) { + // Handle all tasks here + $handlerInstance->handleTasks(); + } // END - while + + // Debug message + $this->debugOutput('MAIN: --- Leaving main loop. ---'); + } + + /** + * Adds extra filters to the given controller instance + * + * @param $controllerInstance A controller instance + * @param $requestInstance An instance of a class with an Requestable interface + * @return void + * @todo Should we add some more filters? + */ + public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) { + // Add pre filters + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('chat_php_requirements_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('chat_initializer_filter')); + $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('chat_welcome_teaser_filter')); + + // Add bootstrap filters + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('chat_bootstrap_task_handler_initializer_filter')); + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('chat_bootstrap_extra_bootstrapping_filter')); + + // This is the last generic boostrap filter + $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('chat_bootstrap_generic_activation_filter')); + + // Add shutdown filters + //$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('chat_shutdown_task_handler_filter')); + + // This is the last generic shutdown filter + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('chat_shutdown_filter')); + } +} + +// [EOF] +?> diff --git a/application/hub/main/commands/console/class_HubConsoleCruncherCommand.php b/application/hub/main/commands/console/class_HubConsoleCruncherCommand.php index 4885b8993..8cdd1ed8a 100644 --- a/application/hub/main/commands/console/class_HubConsoleCruncherCommand.php +++ b/application/hub/main/commands/console/class_HubConsoleCruncherCommand.php @@ -124,7 +124,7 @@ class HubConsoleCruncherCommand extends BaseCommand implements Commandable { //$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_task_handler_filter')); // This is the last generic shutdown filter - $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_cruncher_filter')); + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_filter')); } } diff --git a/application/hub/main/controller/console/class_HubConsoleChatController.php b/application/hub/main/controller/console/class_HubConsoleChatController.php new file mode 100644 index 000000000..db337fff0 --- /dev/null +++ b/application/hub/main/controller/console/class_HubConsoleChatController.php @@ -0,0 +1,131 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 HubConsoleChatController extends BaseController implements Controller { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Init additional filter chains + foreach (array('bootstrap','shutdown') as $filterChain) { + $this->initFilterChain($filterChain); + } // END - foreach + } + + /** + * Creates an instance of this class + * + * @param $resolverInstance An instance of a command resolver class + * @return $controllerInstance A prepared instance of this class + */ + public static final function createHubConsoleChatController (CommandResolver $resolverInstance) { + // Create the instance + $controllerInstance = new HubConsoleChatController(); + + // Set the command resolver + $controllerInstance->setResolverInstance($resolverInstance); + + // Return the prepared instance + return $controllerInstance; + } + + /** + * Handles the given request and response + * + * @param $requestInstance An instance of a request class + * @param $responseInstance An instance of a response class + * @return void + */ + public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) { + // Get the command instance from the resolver by sending a request instance to the resolver + $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance); + + // Add more filters by the command + $commandInstance->addExtraFilters($this, $requestInstance); + + // Run the pre filters + $this->executePreFilters($requestInstance, $responseInstance); + + // This request was valid! :-D + $requestInstance->requestIsValid(); + + // Execute the command + $commandInstance->execute($requestInstance, $responseInstance); + + // Run the pre filters + $this->executePostFilters($requestInstance, $responseInstance); + + // Flush the response out + $responseInstance->flushBuffer(); + } + + /** + * Add a bootstrap filter + * + * @param $filterInstance A Filterable class + * @return void + */ + public function addBootstrapFilter (Filterable $filterInstance) { + $this->addFilter('bootstrap', $filterInstance); + } + + /** + * Executes all bootstrap filters + * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class + * @return void + */ + public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) { + $this->executeFilters('bootstrap', $requestInstance, $responseInstance); + } + + /** + * Add a shutdown filter + * + * @param $filterInstance A Filterable class + * @return void + */ + public function addShutdownFilter (Filterable $filterInstance) { + $this->addFilter('shutdown', $filterInstance); + } + + /** + * Executes all shutdown filters + * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class + * @return void + */ + public function executeShutdownFilters (Requestable $requestInstance, Responseable $responseInstance) { + $this->executeFilters('shutdown', $requestInstance, $responseInstance); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/bootstrap/chat/.htaccess b/application/hub/main/filter/bootstrap/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/bootstrap/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/bootstrap/chat/class_ChatBootstrap b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrap new file mode 100644 index 000000000..494e98226 --- /dev/null +++ b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrap @@ -0,0 +1,66 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Chat 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 ChatBootstrap???Filter 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 createChatBootstrap???Filter () { + // Get a new instance + $filterInstance = new ChatBootstrap???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) { + // Get chat instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Now do something + $this->partialStub('Please implement this step.'); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php new file mode 100644 index 000000000..be9bf50bc --- /dev/null +++ b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapExtraBootstrappingFilter.php @@ -0,0 +1,66 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Chat 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 ChatBootstrapExtraBootstrappingFilter 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 static final function createChatBootstrapExtraBootstrappingFilter () { + // Get a new instance + $filterInstance = new ChatBootstrapExtraBootstrappingFilter(); + + // 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 $chatInstance is null (no NullPointerException here) + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get chat instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Do some extra bootstrapping steps + $chatInstance->doBootstrapping(); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php new file mode 100644 index 000000000..a2f03d8e5 --- /dev/null +++ b/application/hub/main/filter/bootstrap/chat/class_ChatBootstrapGenericActivationFilter.php @@ -0,0 +1,69 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ChatBootstrapGenericActivationFilter 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 createChatBootstrapGenericActivationFilter () { + // Get a new instance + $filterInstance = new ChatBootstrapGenericActivationFilter(); + + // 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 Maybe we want to do somthing more here? + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get a chat instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Set the flag + $chatInstance->enableIsActive(); + + // Debug message + $this->debugOutput('BOOTSTRAP: The chat console has been activated.'); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrap b/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrap index 8f77e8ab7..e3ef66e84 100644 --- a/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrap +++ b/application/hub/main/filter/bootstrap/cruncher/class_CruncherBootstrap @@ -54,8 +54,8 @@ class CruncherBootstrap???Filter extends BaseFilter implements Filterable { * @todo 0% done */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); + // Get cruncher instance + $cruncherInstance = Registry::getRegistry()->getInstance('cruncher'); // Now do something $this->partialStub('Please implement this step.'); diff --git a/application/hub/main/filter/chat/.htaccess b/application/hub/main/filter/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/chat/class_ChatInitializationFilter.php b/application/hub/main/filter/chat/class_ChatInitializationFilter.php new file mode 100644 index 000000000..df3ef5bf0 --- /dev/null +++ b/application/hub/main/filter/chat/class_ChatInitializationFilter.php @@ -0,0 +1,75 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ChatInitializationFilter 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 static final function createChatInitializationFilter () { + // Get a new instance + $filterInstance = new ChatInitializationFilter(); + + // 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 an instance + $chatInstance = ObjectFactory::createObjectByConfiguredName('node_console_chat_class'); + + // Get a registry + $applicationInstance = Registry::getRegistry()->getInstance('app'); + + // Set the app instance + $chatInstance->setApplicationInstance($applicationInstance); + + // Add chat-specific filters + $chatInstance->addExtraFilters($applicationInstance->getControllerInstance(), $responseInstance); + + // Set the chat instance in registry + Registry::getRegistry()->addInstance('chat', $chatInstance); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php b/application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php new file mode 100644 index 000000000..ccd3bdbba --- /dev/null +++ b/application/hub/main/filter/chat/class_ChatPhpRequirementsFilter.php @@ -0,0 +1,78 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ChatPhpRequirementsFilter 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 static final function createChatPhpRequirementsFilter () { + // Get a new instance + $filterInstance = new ChatPhpRequirementsFilter(); + + // 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; + + // Socket support is essential... + if (!function_exists('socket_create')) { + // Test failed + $checkPassed = false; + $checksFailed++; + } // END -if + + // Are all tests passed? + if ($checkPassed === false) { + // Throw an exception + throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED); + } // END - if + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php b/application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php new file mode 100644 index 000000000..65dcd5038 --- /dev/null +++ b/application/hub/main/filter/chat/class_ChatWelcomeTeaserFilter.php @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ChatWelcomeTeaserFilter 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 static final function createChatWelcomeTeaserFilter () { + // Get a new instance + $filterInstance = new ChatWelcomeTeaserFilter(); + + // 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 $nodeInstance is null (no NullPointerException here) + * @todo Handle over the $responseInstance to outputConsoleTeaser() + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get node instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Now output the teaser + $chatInstance->outputConsoleTeaser(); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/cruncher/class_CruncherWelcomeTeaserFilter.php b/application/hub/main/filter/cruncher/class_CruncherWelcomeTeaserFilter.php index 77b7bb054..52b2a3537 100644 --- a/application/hub/main/filter/cruncher/class_CruncherWelcomeTeaserFilter.php +++ b/application/hub/main/filter/cruncher/class_CruncherWelcomeTeaserFilter.php @@ -1,6 +1,6 @@ * @version 0.0.0 @@ -52,7 +52,7 @@ class CruncherWelcomeTeaserFilter extends BaseFilter implements Filterable { * @param $responseInstance An instance of a class with an Responseable interface * @return void * @throws FilterChainException If $nodeInstance is null (no NullPointerException here) - * @todo Handle over the $responseInstance to outputCruncherTeaser() + * @todo Handle over the $responseInstance to outputConsoleTeaser() */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get node instance diff --git a/application/hub/main/filter/shutdown/chat/.htaccess b/application/hub/main/filter/shutdown/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/shutdown/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php b/application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php new file mode 100644 index 000000000..6d90d4902 --- /dev/null +++ b/application/hub/main/filter/shutdown/chat/class_ChatShutdownFilter.php @@ -0,0 +1,68 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ChatShutdownFilter 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 static final function createChatShutdownFilter () { + // Get a new instance + $filterInstance = new ChatShutdownFilter(); + + // 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 $nodeInstance is null (no NullPointerException please) + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get node instance + $chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Shutdown the chat. This should be the last line + $chatInstance->doShutdown(); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownCruncherFilter.php b/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownCruncherFilter.php index 14022f818..f551ef47b 100644 --- a/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownCruncherFilter.php +++ b/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownCruncherFilter.php @@ -1,68 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 CruncherShutdownCruncherFilter 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 static final function createCruncherShutdownCruncherFilter () { - // Get a new instance - $filterInstance = new CruncherShutdownCruncherFilter(); - - // 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 $nodeInstance is null (no NullPointerException please) - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get node instance - $cruncherInstance = Registry::getRegistry()->getInstance('cruncher'); - - // Shutdown the cruncher. This should be the last line - $cruncherInstance->doShutdown(); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php b/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php new file mode 100644 index 000000000..e92c30d42 --- /dev/null +++ b/application/hub/main/filter/shutdown/cruncher/class_CruncherShutdownFilter.php @@ -0,0 +1,68 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 CruncherShutdownFilter 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 static final function createCruncherShutdownFilter () { + // Get a new instance + $filterInstance = new CruncherShutdownFilter(); + + // 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 $nodeInstance is null (no NullPointerException please) + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get node instance + $cruncherInstance = Registry::getRegistry()->getInstance('cruncher'); + + // Shutdown the cruncher. This should be the last line + $cruncherInstance->doShutdown(); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/task/chat/.htaccess b/application/hub/main/filter/task/chat/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/filter/task/chat/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php b/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php new file mode 100644 index 000000000..5d984d75c --- /dev/null +++ b/application/hub/main/filter/task/chat/class_ChatTaskHandlerInitializerFilter.php @@ -0,0 +1,76 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 chat 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 ChatTaskHandlerInitializerFilter 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 static final function createChatTaskHandlerInitializerFilter () { + // Get a new instance + $filterInstance = new ChatTaskHandlerInitializerFilter(); + + // 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 we need to interrupt the filter chain + * @todo 5% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get chat instance + //$chatInstance = Registry::getRegistry()->getInstance('chat'); + + // Get a new task handler instance + $handlerInstance = ObjectFactory::createObjectByConfiguredName('task_handler_class'); + + // Register all tasks: + // + // 1) A task for fetching WUs (work units) or test units + //$taskInstance = ObjectFactory::createObjectByConfiguredName('chat_work_unit_fetcher_task_class'); + //$handlerInstance->registerTask('chat_work_unit_fetcher', $taskInstance); + + // Put the task handler in registry + Registry::getRegistry()->addInstance('task', $handlerInstance); + } +} + +// [EOF] +?> -- 2.39.5