From 623221e8b97d0bb7a044265ce7418d0fe7894712 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 27 Jan 2010 01:47:08 +0000 Subject: [PATCH] State pattern classes for node states added, factory added, copyright updated --- .gitattributes | 15 + application/hub/class_ApplicationHelper.php | 2 +- application/hub/config.php | 21 +- application/hub/data.php | 2 +- application/hub/debug.php | 2 +- application/hub/exceptions.php | 2 +- .../class_HubAlreadyAnnouncedException.php | 2 +- .../lists/class_InvalidListHashException.php | 2 +- .../class_ListGroupAlreadyAddedException.php | 2 +- .../lists/class_NoListGroupException.php | 2 +- .../tasks/class_InvalidTaskException.php | 2 +- application/hub/init.php | 2 +- .../connectors/class_Connectable.php | 2 +- .../interfaces/handler/class_Handleable.php | 2 +- .../handler/network/class_Networkable.php | 2 +- .../handler/task/class_HandleableTask.php | 2 +- .../interfaces/listener/class_Listenable.php | 2 +- .../hub/interfaces/lists/class_Listable.php | 2 +- .../hub/interfaces/nodes/class_NodeHelper.php | 7 +- .../hub/interfaces/pool/class_Poolable.php | 2 +- .../pool/client/class_PoolableClient.php | 2 +- .../pool/listener/class_PoolableListener.php | 2 +- .../hub/interfaces/query/class_Queryable.php | 2 +- .../hub/interfaces/queues/class_Queueable.php | 2 +- application/hub/interfaces/states/class_ | 2 +- .../hub/interfaces/states/class_Stateable.php | 2 +- .../states/client/class_ClientStateable.php | 2 +- .../states/hub/class_HubStateable.php | 2 +- .../hub/interfaces/states/node/.htaccess | 1 + .../states/node/class_NodeStateable.php | 28 ++ .../hub/interfaces/tasks/class_Taskable.php | 2 +- .../interfaces/visitor/class_Visitable.php | 4 +- .../hub/interfaces/visitor/class_Visitor.php | 2 +- .../connector/class_QueryConnectorVisitor.php | 2 +- .../decorator/class_DecoratorVisitor.php | 2 +- .../listener/class_ListenerVisitor.php | 2 +- .../visitor/pool/class_PoolVisitor.php | 2 +- .../listener/class_ListenerPoolVisitor.php | 2 +- .../visitor/query/class_QueryVisitor.php | 2 +- .../visitor/tasks/class_TaskVisitor.php | 2 +- application/hub/loader.php | 2 +- application/hub/main/class_ | 2 +- application/hub/main/class_Base | 2 +- application/hub/main/class_BaseHubSystem.php | 2 +- .../console/class_HubConsoleMainCommand.php | 9 +- .../main/connectors/class_BaseConnector.php | 2 +- application/hub/main/connectors/query/class_ | 4 +- .../query/class_BaseQueryConnector.php | 2 +- .../query/local/class_LocalQueryConnector.php | 4 +- application/hub/main/connectors/queues/class_ | 2 +- .../queues/class_BaseQueueConnector.php | 2 +- .../local/class_LocalQueueConnector.php | 2 +- .../class_HubConsoleDefaultNewsController.php | 4 +- .../class_NodeInformationDatabaseWrapper.php | 2 +- .../wrapper/class_NodeListDatabaseWrapper.php | 2 +- .../main/decorators/class_BaseDecorator.php | 2 +- application/hub/main/factories/.htaccess | 1 + .../hub/main/factories/states/.htaccess | 1 + .../states/class_NodeStateFactory.php | 57 ++++ .../filter/activation/class_HubActivation | 2 +- ...ss_HubActivationSelfAnnouncementFilter.php | 2 +- .../main/filter/bootstrap/class_HubBootstrap | 2 +- .../class_HubBootstrapAquireHubIdFilter.php | 75 +---- ...s_HubBootstrapExtraBootstrappingFilter.php | 2 +- .../class_HubBootstrapGenSessionIdFilter.php | 73 +---- .../class_HubBootstrapGenerateHubIdFilter.php | 4 +- ...ss_HubBootstrapGenerateSessionIdFilter.php | 2 +- .../class_HubBootstrapInitQueuesFilter.php | 2 +- .../class_HubBootstrapListenerPoolFilter.php | 2 +- ...lass_HubBootstrapRestoreNodeListFilter.php | 2 +- application/hub/main/filter/class_ | 2 +- .../hub/main/filter/console/class_Console | 2 +- .../class_ConsoleWelcomeTeaserFilter.php | 2 +- application/hub/main/filter/node/class_Node | 2 +- .../node/class_NodeInitializationFilter.php | 2 +- .../node/class_NodePhpRequirementsFilter.php | 23 +- .../main/filter/shutdown/class_HubShutdown | 2 +- .../class_HubShutdownDeinitQueuesFilter.php | 2 +- .../class_HubShutdownFlushNodeListFilter.php | 2 +- .../class_HubShutdownListenerPoolFilter.php | 75 +---- .../shutdown/class_HubShutdownNodeFilter.php | 2 +- .../class_HubShutdownTaskHandlerFilter.php | 67 +++++ .../class_TaskHandlerInitializerFilter.php | 2 +- application/hub/main/handler/class_ | 2 +- .../hub/main/handler/class_BaseHandler.php | 2 +- application/hub/main/handler/network/class_ | 2 +- .../class_BaseNetworkPackageHandler.php | 2 +- .../hub/main/handler/network/tcp/class_ | 2 +- .../tcp/class_TcpNetworkPackageHandler.php | 2 +- .../udp/class_UdpNetworkPackageHandler.php | 2 +- .../main/handler/tasks/class_TaskHandler.php | 60 +++- .../class_HubDescriptorHelper.php | 8 +- application/hub/main/helper/hub/class_ | 1 + .../main/helper/hub/class_BaseHubHelper.php | 2 +- application/hub/main/iterator/class_ | 2 +- .../hub/main/iterator/class_BaseIterator.php | 2 +- .../iterator/hub/class_HubPingIterator.php | 2 +- .../network/class_NetworkListenIterator.php | 2 +- .../iterator/pool/class_DefaultIterator.php | 2 +- .../main/iterator/pool/handler/class_Handler | 2 +- .../handler/class_HandlerPoolIterator.php | 2 +- .../iterator/pool/shutdown/class_Shutdown | 2 +- .../shutdown/class_ShutdownPoolIterator.php | 2 +- .../pool/tasks/class_TaskPoolIterator.php | 2 +- application/hub/main/listener/class_ | 2 +- .../hub/main/listener/class_BaseListener.php | 4 +- .../listener/class_BaseListenerDecorator.php | 6 +- application/hub/main/listener/tcp/class_ | 2 +- .../main/listener/tcp/class_TcpListener.php | 2 +- .../class_ClientTcpListenerDecorator.php | 2 +- .../class_HubTcpListenerDecorator.php | 2 +- application/hub/main/listener/udp/class_ | 2 +- .../main/listener/udp/class_UdpListener.php | 2 +- .../class_ClientUdpListenerDecorator.php | 2 +- .../class_HubUdpListenerDecorator.php | 2 +- application/hub/main/lists/class_ | 2 +- application/hub/main/lists/class_BaseList.php | 32 ++- .../main/lists/groups/class_ListGroupList.php | 2 +- .../main/lists/pool/class_PoolEntriesList.php | 2 +- .../query/local/class_LocalQueryList.php | 2 +- .../hub/main/lists/tasks/class_TaskList.php | 2 +- .../hub/main/nodes/boot/class_HubBootNode.php | 2 +- application/hub/main/nodes/class_ | 2 +- .../hub/main/nodes/class_BaseHubNode.php | 156 ++++++++--- .../hub/main/nodes/list/class_HubListNode.php | 2 +- .../main/nodes/master/class_HubMasterNode.php | 2 +- .../nodes/regular/class_HubRegularNode.php | 2 +- application/hub/main/pools/class_ | 2 +- application/hub/main/pools/class_BasePool.php | 4 +- .../pools/client/class_DefaultClientPool.php | 2 +- .../listener/class_DefaultListenerPool.php | 2 +- application/hub/main/queries/class_ | 2 +- .../hub/main/queries/class_BaseQuery.php | 2 +- .../main/queries/local/class_LocalQuery.php | 4 +- application/hub/main/queues/class_ | 2 +- .../hub/main/queues/class_BaseQueue.php | 2 +- .../queues/client/class_LocalClientQueue.php | 2 +- .../class_HubConsoleCommandResolver.php | 2 +- .../class_HubConsoleControllerResolver.php | 2 +- .../state/class_BaseStateResolver.php | 2 +- .../network/class_NetworkStateResolver.php | 2 +- application/hub/main/states/class_ | 5 +- .../hub/main/states/class_BaseState.php | 27 +- .../states/client/class_BaseClientState.php | 2 +- .../main/states/hub/class_BaseHubState.php | 2 +- application/hub/main/states/node/.htaccess | 1 + .../hub/main/states/node/active/.htaccess | 1 + .../node/active/class_NodeActiveState.php | 60 ++++ application/hub/main/states/node/class_ | 60 ++++ .../main/states/node/class_BaseNodeState.php | 38 +++ .../hub/main/states/node/init/.htaccess | 1 + .../states/node/init/class_NodeInitState.php | 70 +++++ .../hub/main/states/node/virgin/.htaccess | 1 + .../node/virgin/class_NodeVirginState.php | 74 +++++ application/hub/main/tasks/class_ | 4 +- application/hub/main/tasks/class_BaseTask.php | 2 +- .../class_HubSelfAnnouncementTask.php | 4 +- .../tasks/hub/class_HubSelfConnectTask.php | 4 +- .../main/tasks/hub/ping/class_HubPingTask.php | 4 +- .../hub/update/class_HubUpdateCheckTask.php | 4 +- .../main/tasks/idle/class_IdleLoopTask.php | 14 +- .../class_AnnouncementTemplateEngine.php | 258 +++++++++++++++++- application/hub/main/visitor/class_ | 2 +- .../hub/main/visitor/class_BaseVisitor.php | 2 +- application/hub/main/visitor/pool/class_ | 2 +- .../main/visitor/pool/handler/class_Handler | 2 +- .../main/visitor/pool/shutdown/class_Shutdown | 2 +- .../class_ShutdownListenerPoolVisitor.php | 36 ++- .../visitor/tasks/class_ActiveTaskVisitor.php | 4 +- application/hub/starter.php | 2 +- .../xml/announcement/self_announcement.xml | 14 +- 171 files changed, 1223 insertions(+), 453 deletions(-) create mode 100644 application/hub/interfaces/states/node/.htaccess create mode 100644 application/hub/interfaces/states/node/class_NodeStateable.php create mode 100644 application/hub/main/factories/.htaccess create mode 100644 application/hub/main/factories/states/.htaccess create mode 100644 application/hub/main/factories/states/class_NodeStateFactory.php create mode 100644 application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php create mode 100644 application/hub/main/states/node/.htaccess create mode 100644 application/hub/main/states/node/active/.htaccess create mode 100644 application/hub/main/states/node/active/class_NodeActiveState.php create mode 100644 application/hub/main/states/node/class_ create mode 100644 application/hub/main/states/node/class_BaseNodeState.php create mode 100644 application/hub/main/states/node/init/.htaccess create mode 100644 application/hub/main/states/node/init/class_NodeInitState.php create mode 100644 application/hub/main/states/node/virgin/.htaccess create mode 100644 application/hub/main/states/node/virgin/class_NodeVirginState.php diff --git a/.gitattributes b/.gitattributes index 840120e22..9682bd401 100644 --- a/.gitattributes +++ b/.gitattributes @@ -49,6 +49,8 @@ application/hub/interfaces/states/client/.htaccess -text application/hub/interfaces/states/client/class_ClientStateable.php -text application/hub/interfaces/states/hub/.htaccess -text application/hub/interfaces/states/hub/class_HubStateable.php -text +application/hub/interfaces/states/node/.htaccess -text +application/hub/interfaces/states/node/class_NodeStateable.php -text application/hub/interfaces/tasks/.htaccess -text application/hub/interfaces/tasks/class_Taskable.php -text application/hub/interfaces/visitor/.htaccess -text @@ -97,6 +99,9 @@ application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php - application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php -text application/hub/main/decorators/.htaccess -text application/hub/main/decorators/class_BaseDecorator.php -text +application/hub/main/factories/.htaccess -text +application/hub/main/factories/states/.htaccess -text +application/hub/main/factories/states/class_NodeStateFactory.php -text application/hub/main/filter/.htaccess -text application/hub/main/filter/activation/.htaccess -text application/hub/main/filter/activation/class_HubActivation -text @@ -125,6 +130,7 @@ application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php -te application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php -text application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php -text application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php -text +application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php -text application/hub/main/filter/task/.htaccess -text application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php -text application/hub/main/handler/.htaccess -text @@ -239,6 +245,15 @@ application/hub/main/states/client/class_BaseClientState.php -text application/hub/main/states/generic/.htaccess -text application/hub/main/states/hub/.htaccess -text application/hub/main/states/hub/class_BaseHubState.php -text +application/hub/main/states/node/.htaccess -text +application/hub/main/states/node/active/.htaccess -text +application/hub/main/states/node/active/class_NodeActiveState.php -text +application/hub/main/states/node/class_ -text +application/hub/main/states/node/class_BaseNodeState.php -text +application/hub/main/states/node/init/.htaccess -text +application/hub/main/states/node/init/class_NodeInitState.php -text +application/hub/main/states/node/virgin/.htaccess -text +application/hub/main/states/node/virgin/class_NodeVirginState.php -text application/hub/main/tasks/.htaccess -text application/hub/main/tasks/class_ -text application/hub/main/tasks/class_BaseTask.php -text diff --git a/application/hub/class_ApplicationHelper.php b/application/hub/class_ApplicationHelper.php index 3e62874fd..053a4b111 100644 --- a/application/hub/class_ApplicationHelper.php +++ b/application/hub/class_ApplicationHelper.php @@ -22,7 +22,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify diff --git a/application/hub/config.php b/application/hub/config.php index 9da6c2bfd..623c27776 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify @@ -168,8 +168,8 @@ $cfg->setConfigEntry('hub_shutdown_flush_node_list_filter', 'HubShutdownFlushNod // CFG: HUB-SHUTDOWN-DEINIT-QUEUES-FILTER $cfg->setConfigEntry('hub_shutdown_deinit_queues_filter', 'HubShutdownDeinitQueuesFilter'); -// CFG: HUB-SHUTDOWN-LISTENER-POOL-FILTER -$cfg->setConfigEntry('hub_shutdown_listener_pool_filter', 'HubShutdownListenerPoolFilter'); +// CFG: HUB-SHUTDOWN-TASK-HANDLER-FILTER +$cfg->setConfigEntry('hub_shutdown_task_handler_filter', 'HubShutdownTaskHandlerFilter'); // CFG: HUB-SHUTDOWN-NODE-FILTER $cfg->setConfigEntry('hub_shutdown_node_filter', 'HubShutdownNodeFilter'); @@ -189,6 +189,9 @@ $cfg->setConfigEntry('announcement_template_type', 'xml/announcement'); // CFG: ANNOUNCEMENT-STACKER-CLASS $cfg->setConfigEntry('announcement_stacker_class', 'FiLoStacker'); +// CFG: STACKER-ANNOUNCEMENT-MAX-SIZE +$cfg->setConfigEntry('stacker_announcement_max_size', 20); + // CFG: NEWS-MAIN-LIMIT $cfg->setConfigEntry('news_main_limit', 5); @@ -294,5 +297,17 @@ $cfg->setConfigEntry('local_query_list_class', 'LocalQueryList'); // CFG: LOCAL-QUERY-CLASS $cfg->setConfigEntry('local_query_class', 'LocalQuery'); +// CFG: WEB-TEMPLATE-CLASS @OVERRIDE +$cfg->setConfigEntry('web_template_class', 'ConsoleTemplateEngine'); + +// CFG: NODE-INIT-STATE-CLASS +$cfg->setConfigEntry('node_init_state_class', 'NodeInitState'); + +// CFG: NODE-VIRGIN-STATE-CLASS +$cfg->setConfigEntry('node_virgin_state_class', 'NodeVirginState'); + +// CFG: NODE-ACTIVE-STATE-CLASS +$cfg->setConfigEntry('node_active_state_class', 'NodeActiveState'); + // [EOF] ?> diff --git a/application/hub/data.php b/application/hub/data.php index d68aca482..e469cca62 100644 --- a/application/hub/data.php +++ b/application/hub/data.php @@ -15,7 +15,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/debug.php b/application/hub/debug.php index 5f222924a..06b28e27e 100644 --- a/application/hub/debug.php +++ b/application/hub/debug.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify diff --git a/application/hub/exceptions.php b/application/hub/exceptions.php index 11116ed31..b9daf47d1 100644 --- a/application/hub/exceptions.php +++ b/application/hub/exceptions.php @@ -5,7 +5,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify diff --git a/application/hub/exceptions/hub/class_HubAlreadyAnnouncedException.php b/application/hub/exceptions/hub/class_HubAlreadyAnnouncedException.php index 34b5a2142..532419296 100644 --- a/application/hub/exceptions/hub/class_HubAlreadyAnnouncedException.php +++ b/application/hub/exceptions/hub/class_HubAlreadyAnnouncedException.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/exceptions/lists/class_InvalidListHashException.php b/application/hub/exceptions/lists/class_InvalidListHashException.php index 19f1b60f0..4affa7dcd 100644 --- a/application/hub/exceptions/lists/class_InvalidListHashException.php +++ b/application/hub/exceptions/lists/class_InvalidListHashException.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php index fc7098ed7..1bbc2c178 100644 --- a/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php +++ b/application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/exceptions/lists/class_NoListGroupException.php b/application/hub/exceptions/lists/class_NoListGroupException.php index 6348edf2b..00da4d9bd 100644 --- a/application/hub/exceptions/lists/class_NoListGroupException.php +++ b/application/hub/exceptions/lists/class_NoListGroupException.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/exceptions/tasks/class_InvalidTaskException.php b/application/hub/exceptions/tasks/class_InvalidTaskException.php index e1b1c3e57..0879bf76c 100644 --- a/application/hub/exceptions/tasks/class_InvalidTaskException.php +++ b/application/hub/exceptions/tasks/class_InvalidTaskException.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/init.php b/application/hub/init.php index 32d4ab3bc..96eecc494 100644 --- a/application/hub/init.php +++ b/application/hub/init.php @@ -15,7 +15,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify diff --git a/application/hub/interfaces/connectors/class_Connectable.php b/application/hub/interfaces/connectors/class_Connectable.php index 6299ff0c8..e4270e036 100644 --- a/application/hub/interfaces/connectors/class_Connectable.php +++ b/application/hub/interfaces/connectors/class_Connectable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/handler/class_Handleable.php b/application/hub/interfaces/handler/class_Handleable.php index e7775272a..2c95227dc 100644 --- a/application/hub/interfaces/handler/class_Handleable.php +++ b/application/hub/interfaces/handler/class_Handleable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/handler/network/class_Networkable.php b/application/hub/interfaces/handler/network/class_Networkable.php index fb4302141..6598e8743 100644 --- a/application/hub/interfaces/handler/network/class_Networkable.php +++ b/application/hub/interfaces/handler/network/class_Networkable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/handler/task/class_HandleableTask.php b/application/hub/interfaces/handler/task/class_HandleableTask.php index 45781cc44..ba2d58e46 100644 --- a/application/hub/interfaces/handler/task/class_HandleableTask.php +++ b/application/hub/interfaces/handler/task/class_HandleableTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/listener/class_Listenable.php b/application/hub/interfaces/listener/class_Listenable.php index 2f7bfe858..9b6e4e5e3 100644 --- a/application/hub/interfaces/listener/class_Listenable.php +++ b/application/hub/interfaces/listener/class_Listenable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/lists/class_Listable.php b/application/hub/interfaces/lists/class_Listable.php index 60712ed18..25d2bf3d7 100644 --- a/application/hub/interfaces/lists/class_Listable.php +++ b/application/hub/interfaces/lists/class_Listable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/nodes/class_NodeHelper.php b/application/hub/interfaces/nodes/class_NodeHelper.php index 0d712d9c7..b76bb29b8 100644 --- a/application/hub/interfaces/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/nodes/class_NodeHelper.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo We need to find a better name for this interface @@ -52,9 +52,11 @@ interface NodeHelper extends FrameworkInterface { * based on many pseudo-random data. On any later run, unless the id * got not removed from database, it will be restored from the database. * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class * @return void */ - function bootstrapAcquireHubId (); + function bootstrapAcquireHubId (Requestable $requestInstance, Responseable $responseInstance); /** * Activates the hub by doing some final preparation and setting @@ -107,3 +109,4 @@ interface NodeHelper extends FrameworkInterface { // ?> + diff --git a/application/hub/interfaces/pool/class_Poolable.php b/application/hub/interfaces/pool/class_Poolable.php index 8a9511748..a63b2a4d8 100644 --- a/application/hub/interfaces/pool/class_Poolable.php +++ b/application/hub/interfaces/pool/class_Poolable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/pool/client/class_PoolableClient.php b/application/hub/interfaces/pool/client/class_PoolableClient.php index 73a97e409..1bb948572 100644 --- a/application/hub/interfaces/pool/client/class_PoolableClient.php +++ b/application/hub/interfaces/pool/client/class_PoolableClient.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/pool/listener/class_PoolableListener.php b/application/hub/interfaces/pool/listener/class_PoolableListener.php index 162d8a6c7..597dc2ba5 100644 --- a/application/hub/interfaces/pool/listener/class_PoolableListener.php +++ b/application/hub/interfaces/pool/listener/class_PoolableListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/query/class_Queryable.php b/application/hub/interfaces/query/class_Queryable.php index 0d40f0573..1cb1eff61 100644 --- a/application/hub/interfaces/query/class_Queryable.php +++ b/application/hub/interfaces/query/class_Queryable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/queues/class_Queueable.php b/application/hub/interfaces/queues/class_Queueable.php index 5bb2b9668..9e3fe30a9 100644 --- a/application/hub/interfaces/queues/class_Queueable.php +++ b/application/hub/interfaces/queues/class_Queueable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/states/class_ b/application/hub/interfaces/states/class_ index 8d73e2b8c..b9f6e5be9 100644 --- a/application/hub/interfaces/states/class_ +++ b/application/hub/interfaces/states/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/states/class_Stateable.php b/application/hub/interfaces/states/class_Stateable.php index 3c205ba2c..9b0755c95 100644 --- a/application/hub/interfaces/states/class_Stateable.php +++ b/application/hub/interfaces/states/class_Stateable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/states/client/class_ClientStateable.php b/application/hub/interfaces/states/client/class_ClientStateable.php index de9967875..9ec1c39b7 100644 --- a/application/hub/interfaces/states/client/class_ClientStateable.php +++ b/application/hub/interfaces/states/client/class_ClientStateable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/states/hub/class_HubStateable.php b/application/hub/interfaces/states/hub/class_HubStateable.php index 47d9a785c..d1ff9feec 100644 --- a/application/hub/interfaces/states/hub/class_HubStateable.php +++ b/application/hub/interfaces/states/hub/class_HubStateable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/states/node/.htaccess b/application/hub/interfaces/states/node/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/states/node/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/states/node/class_NodeStateable.php b/application/hub/interfaces/states/node/class_NodeStateable.php new file mode 100644 index 000000000..96039babd --- /dev/null +++ b/application/hub/interfaces/states/node/class_NodeStateable.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NodeStateable extends Stateable { +} + +// +?> diff --git a/application/hub/interfaces/tasks/class_Taskable.php b/application/hub/interfaces/tasks/class_Taskable.php index a32e0af5e..abd12cd7c 100644 --- a/application/hub/interfaces/tasks/class_Taskable.php +++ b/application/hub/interfaces/tasks/class_Taskable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/class_Visitable.php b/application/hub/interfaces/visitor/class_Visitable.php index 6211f0548..159bcc517 100644 --- a/application/hub/interfaces/visitor/class_Visitable.php +++ b/application/hub/interfaces/visitor/class_Visitable.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -23,7 +23,7 @@ */ interface Visitable extends FrameworkInterface { /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/interfaces/visitor/class_Visitor.php b/application/hub/interfaces/visitor/class_Visitor.php index b098a70e6..328babd94 100644 --- a/application/hub/interfaces/visitor/class_Visitor.php +++ b/application/hub/interfaces/visitor/class_Visitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php b/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php index baf86edcc..78fcc2ef9 100644 --- a/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php +++ b/application/hub/interfaces/visitor/connector/class_QueryConnectorVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php b/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php index ef962715c..69041868e 100644 --- a/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php +++ b/application/hub/interfaces/visitor/decorator/class_DecoratorVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php b/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php index fa2da2c53..fdd27bb94 100644 --- a/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php +++ b/application/hub/interfaces/visitor/listener/class_ListenerVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/pool/class_PoolVisitor.php b/application/hub/interfaces/visitor/pool/class_PoolVisitor.php index 6a9b6c8e0..970d3fd75 100644 --- a/application/hub/interfaces/visitor/pool/class_PoolVisitor.php +++ b/application/hub/interfaces/visitor/pool/class_PoolVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php b/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php index 109b75d3a..5f17c97b8 100644 --- a/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php +++ b/application/hub/interfaces/visitor/pool/listener/class_ListenerPoolVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/query/class_QueryVisitor.php b/application/hub/interfaces/visitor/query/class_QueryVisitor.php index 4e59d8fe7..d88106b0b 100644 --- a/application/hub/interfaces/visitor/query/class_QueryVisitor.php +++ b/application/hub/interfaces/visitor/query/class_QueryVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/interfaces/visitor/tasks/class_TaskVisitor.php b/application/hub/interfaces/visitor/tasks/class_TaskVisitor.php index 40093324e..cb3523c72 100644 --- a/application/hub/interfaces/visitor/tasks/class_TaskVisitor.php +++ b/application/hub/interfaces/visitor/tasks/class_TaskVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/loader.php b/application/hub/loader.php index 5b1f37c69..3fa42e466 100644 --- a/application/hub/loader.php +++ b/application/hub/loader.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0 - * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * * This program is free software: you can redistribute it and/or modify diff --git a/application/hub/main/class_ b/application/hub/main/class_ index ea4538679..698f097af 100644 --- a/application/hub/main/class_ +++ b/application/hub/main/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/class_Base b/application/hub/main/class_Base index d0122d615..5e48c51be 100644 --- a/application/hub/main/class_Base +++ b/application/hub/main/class_Base @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php index c741aad56..6a4608d53 100644 --- a/application/hub/main/class_BaseHubSystem.php +++ b/application/hub/main/class_BaseHubSystem.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/commands/console/class_HubConsoleMainCommand.php b/application/hub/main/commands/console/class_HubConsoleMainCommand.php index 424717577..c2c4a65a7 100644 --- a/application/hub/main/commands/console/class_HubConsoleMainCommand.php +++ b/application/hub/main/commands/console/class_HubConsoleMainCommand.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -55,6 +55,7 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { * @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 HubActivationTask or so */ public function execute (Requestable $requestInstance, Responseable $responseInstance) { // Get a registry and the application instance from it @@ -88,8 +89,8 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { // ----------------------------- 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 hub is no longer active. - while (($nodeInstance->isHubActive()) && ($handlerInstance->hasTasksLeft())) { + // until the hub is no longer active or all tasks are killed. + while (($nodeInstance->determineIfHubIsActive()) && ($handlerInstance->hasTasksLeft())) { // Handle all tasks here $handlerInstance->handleTasks(); } // END - while @@ -126,7 +127,7 @@ class HubConsoleMainCommand extends BaseCommand implements Commandable { // Add shutdown filters $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_flush_node_list_filter')); $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_deinit_queues_filter')); - $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_listener_pool_filter')); + $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_task_handler_filter')); // This is the last generic filter $controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('hub_shutdown_node_filter')); diff --git a/application/hub/main/connectors/class_BaseConnector.php b/application/hub/main/connectors/class_BaseConnector.php index edcda15ea..304a1e37f 100644 --- a/application/hub/main/connectors/class_BaseConnector.php +++ b/application/hub/main/connectors/class_BaseConnector.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/connectors/query/class_ b/application/hub/main/connectors/query/class_ index 363fcc1d9..c0bb530eb 100644 --- a/application/hub/main/connectors/query/class_ +++ b/application/hub/main/connectors/query/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo Find an interface for: handleAllQueries() @@ -57,7 +57,7 @@ class ???QueryConnector extends BaseQueryConnector implements Connectable, Visit } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/connectors/query/class_BaseQueryConnector.php b/application/hub/main/connectors/query/class_BaseQueryConnector.php index f84666857..e7ff1cac3 100644 --- a/application/hub/main/connectors/query/class_BaseQueryConnector.php +++ b/application/hub/main/connectors/query/class_BaseQueryConnector.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/connectors/query/local/class_LocalQueryConnector.php b/application/hub/main/connectors/query/local/class_LocalQueryConnector.php index d818abaf4..2d35cae8a 100644 --- a/application/hub/main/connectors/query/local/class_LocalQueryConnector.php +++ b/application/hub/main/connectors/query/local/class_LocalQueryConnector.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo Find an interface for: handleAllQueries() @@ -71,7 +71,7 @@ class LocalQueryConnector extends BaseQueryConnector implements Connectable, Vis } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/connectors/queues/class_ b/application/hub/main/connectors/queues/class_ index 066db0bda..216eaa695 100644 --- a/application/hub/main/connectors/queues/class_ +++ b/application/hub/main/connectors/queues/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/connectors/queues/class_BaseQueueConnector.php b/application/hub/main/connectors/queues/class_BaseQueueConnector.php index 6ea83de0c..bb1177c46 100644 --- a/application/hub/main/connectors/queues/class_BaseQueueConnector.php +++ b/application/hub/main/connectors/queues/class_BaseQueueConnector.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php b/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php index 95abad132..30f4f91e9 100644 --- a/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php +++ b/application/hub/main/connectors/queues/local/class_LocalQueueConnector.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/controller/console/class_HubConsoleDefaultNewsController.php b/application/hub/main/controller/console/class_HubConsoleDefaultNewsController.php index 842bd2606..55bb98d56 100644 --- a/application/hub/main/controller/console/class_HubConsoleDefaultNewsController.php +++ b/application/hub/main/controller/console/class_HubConsoleDefaultNewsController.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -32,7 +32,7 @@ class HubConsoleDefaultNewsController extends BaseController implements Controll parent::__construct(__CLASS__); // Init additional filter chains - foreach (array('bootstrap', 'activation', 'shutdown') as $filterChain) { + foreach (array('bootstrap', 'activation','shutdown') as $filterChain) { $this->initFilterChain($filterChain); } // END - foreach } diff --git a/application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php b/application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php index e8550f281..6a736d040 100644 --- a/application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php b/application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php index 7d4acea49..676ad0a5b 100644 --- a/application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php +++ b/application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/decorators/class_BaseDecorator.php b/application/hub/main/decorators/class_BaseDecorator.php index 43b6e5d05..c83722916 100644 --- a/application/hub/main/decorators/class_BaseDecorator.php +++ b/application/hub/main/decorators/class_BaseDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/factories/.htaccess b/application/hub/main/factories/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/factories/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/factories/states/.htaccess b/application/hub/main/factories/states/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/factories/states/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/factories/states/class_NodeStateFactory.php b/application/hub/main/factories/states/class_NodeStateFactory.php new file mode 100644 index 000000000..1cb5c967b --- /dev/null +++ b/application/hub/main/factories/states/class_NodeStateFactory.php @@ -0,0 +1,57 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NodeStateFactory extends ObjectFactory { + /** + * Creates an instance of a configurable node state and sets it in the + * given node instance. + * + * @param $stateName Name of the node state + * @param $nodeInstance A NodeHelper class instance + * @return $stateInstance A Stateable class instance + */ + public static final function createNodeStateInstanceByName($stateName, NodeHelper $nodeInstance) { + // Then construct the class' configuraton entry + $className = 'node_' . $stateName . '_state_class'; + + // Get a class from that configuration entry + $stateInstance = self::createObjectByConfiguredName($className, array($nodeInstance)); + + // Once we have that state, set it in the node instance + $nodeInstance->setNodeStateInstance($stateInstance); + + // For any purposes, return the state instance + return $stateInstance; + } + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } +} +?> diff --git a/application/hub/main/filter/activation/class_HubActivation b/application/hub/main/filter/activation/class_HubActivation index babe06470..67db3954c 100644 --- a/application/hub/main/filter/activation/class_HubActivation +++ b/application/hub/main/filter/activation/class_HubActivation @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php b/application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php index 8fbcced23..47509105e 100644 --- a/application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php +++ b/application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrap b/application/hub/main/filter/bootstrap/class_HubBootstrap index 37520419c..5290fe48e 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrap +++ b/application/hub/main/filter/bootstrap/class_HubBootstrap @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php index 0836c04b4..f551ef47b 100755 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php @@ -1,76 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubBootstrapAquireHubIdFilter 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 createHubBootstrapAquireHubIdFilter () { - // Get a new instance - $filterInstance = new HubBootstrapAquireHubIdFilter(); - - // 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) - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); - - // Sanity-check on it - if (is_null($nodeInstance)) { - // Throws a FilterChainException to stop further processing - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - - // --------------------- Hub-id acquirement phase --------------------- - // Acquire a hub-id. This step generates on first launch a new one and - // on any later launches it will restore the hub-id from the database. - // A passed 'nickname=xxx' argument will be used to add some - // 'personality' to the hub. - $nodeInstance->bootstrapAcquireHubId(); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php index cb7474687..d4a4d4eea 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php index 70fddac66..f551ef47b 100755 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php @@ -1,74 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubBootstrapGenSessionIdFilter 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 createHubBootstrapGenSessionIdFilter () { - // Get a new instance - $filterInstance = new HubBootstrapGenSessionIdFilter(); - - // 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) - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); - - // Sanity-check on it - if (is_null($nodeInstance)) { - // Throws a FilterChainException to stop further processing - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - - // ------------------- More generic bootstrap steps ------------------- - // Generate the session id which will only be stored in RAM and kept for - // the whole "session". - $nodeInstance->bootstrapGenerateSessionId(); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateHubIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateHubIdFilter.php index e922b5798..82a828c1a 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateHubIdFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateHubIdFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -62,7 +62,7 @@ class HubBootstrapGenerateHubIdFilter extends BaseFilter implements Filterable { // on any later launches it will restore the hub-id from the database. // A passed 'nickname=xxx' argument will be used to add some // 'personality' to the hub. - $nodeInstance->bootstrapAcquireHubId(); + $nodeInstance->bootstrapAcquireHubId($requestInstance, $responseInstance); } } diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateSessionIdFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateSessionIdFilter.php index e8ae454ae..a37020d90 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateSessionIdFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapGenerateSessionIdFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php index 5bb4f1572..702b18f5f 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapListenerPoolFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapListenerPoolFilter.php index 7fdcd3ada..91b268762 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapListenerPoolFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapListenerPoolFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php b/application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php index 6def96e30..023238892 100644 --- a/application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php +++ b/application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/class_ b/application/hub/main/filter/class_ index f432f1079..1c71f95b4 100644 --- a/application/hub/main/filter/class_ +++ b/application/hub/main/filter/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/console/class_Console b/application/hub/main/filter/console/class_Console index 52f584f36..632d3280a 100644 --- a/application/hub/main/filter/console/class_Console +++ b/application/hub/main/filter/console/class_Console @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php b/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php index 29e7282c4..d348d4b7c 100644 --- a/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php +++ b/application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/node/class_Node b/application/hub/main/filter/node/class_Node index 969e7cad9..32521e456 100644 --- a/application/hub/main/filter/node/class_Node +++ b/application/hub/main/filter/node/class_Node @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/node/class_NodeInitializationFilter.php b/application/hub/main/filter/node/class_NodeInitializationFilter.php index 55471b161..097e693c7 100644 --- a/application/hub/main/filter/node/class_NodeInitializationFilter.php +++ b/application/hub/main/filter/node/class_NodeInitializationFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/node/class_NodePhpRequirementsFilter.php b/application/hub/main/filter/node/class_NodePhpRequirementsFilter.php index 2012ca5d4..e88e5e377 100644 --- a/application/hub/main/filter/node/class_NodePhpRequirementsFilter.php +++ b/application/hub/main/filter/node/class_NodePhpRequirementsFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -51,11 +51,26 @@ class NodePhpRequirementsFilter extends BaseFilter implements Filterable { * @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 + * @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) { - // Implement this! - $this->partialStub('Please implement this method.'); + // 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 } } diff --git a/application/hub/main/filter/shutdown/class_HubShutdown b/application/hub/main/filter/shutdown/class_HubShutdown index aeefaf44f..caf1a8e65 100644 --- a/application/hub/main/filter/shutdown/class_HubShutdown +++ b/application/hub/main/filter/shutdown/class_HubShutdown @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php index dea5619e3..35129feaa 100644 --- a/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php +++ b/application/hub/main/filter/shutdown/class_HubShutdownDeinitQueuesFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php index 28c169e77..22b0d2f99 100644 --- a/application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php +++ b/application/hub/main/filter/shutdown/class_HubShutdownFlushNodeListFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php index f9e725df5..f551ef47b 100644 --- a/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php +++ b/application/hub/main/filter/shutdown/class_HubShutdownListenerPoolFilter.php @@ -1,76 +1,3 @@ - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 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 HubShutdownListenerPoolFilter 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 createHubShutdownListenerPoolFilter () { - // Get a new instance - $filterInstance = new HubShutdownListenerPoolFilter(); - - // 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 0% done - */ - public function execute (Requestable $requestInstance, Responseable $responseInstance) { - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); - - // Get listener pool instance - $listenerPoolInstance = $nodeInstance->getListenerPoolInstance(); - - // Sanity-check on it - if (is_null($listenerPoolInstance)) { - // Throws a FilterChainException to stop further processing - throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED); - } // END - if - - // Now shutdown this one done - $listenerPoolInstance->doShutdown(); - } -} - -// [EOF] +// @DEPRECATED ?> diff --git a/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php index 56919564e..8d3807f32 100644 --- a/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php +++ b/application/hub/main/filter/shutdown/class_HubShutdownNodeFilter.php @@ -6,7 +6,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php b/application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php new file mode 100644 index 000000000..dd99c7bb1 --- /dev/null +++ b/application/hub/main/filter/shutdown/class_HubShutdownTaskHandlerFilter.php @@ -0,0 +1,67 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 HubShutdownTaskHandlerFilter 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 createHubShutdownTaskHandlerFilter () { + // Get a new instance + $filterInstance = new HubShutdownTaskHandlerFilter(); + + // 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 0% done + */ + public function execute (Requestable $requestInstance, Responseable $responseInstance) { + // Get task handler instance + $handlerInstance = Registry::getRegistry()->getInstance('task'); + + // Shutdown the task manager and all its registered tasks + $handlerInstance->doShutdown(); + } +} + +// [EOF] +?> diff --git a/application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php b/application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php index b3fb45146..dae02e044 100644 --- a/application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php +++ b/application/hub/main/filter/task/class_TaskHandlerInitializerFilter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/class_ b/application/hub/main/handler/class_ index e8c9d36d5..bb33e383a 100644 --- a/application/hub/main/handler/class_ +++ b/application/hub/main/handler/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/class_BaseHandler.php b/application/hub/main/handler/class_BaseHandler.php index ca4023419..7c02b75e5 100644 --- a/application/hub/main/handler/class_BaseHandler.php +++ b/application/hub/main/handler/class_BaseHandler.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/network/class_ b/application/hub/main/handler/network/class_ index b130b4662..4f7c32141 100644 --- a/application/hub/main/handler/network/class_ +++ b/application/hub/main/handler/network/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php b/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php index 816b83639..8b3e847dd 100644 --- a/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php +++ b/application/hub/main/handler/network/class_BaseNetworkPackageHandler.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/network/tcp/class_ b/application/hub/main/handler/network/tcp/class_ index 968182332..2f6eab468 100644 --- a/application/hub/main/handler/network/tcp/class_ +++ b/application/hub/main/handler/network/tcp/class_ @@ -138,7 +138,7 @@ socket_close($mainSocket); * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php b/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php index c42684b1f..d2622d477 100644 --- a/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php +++ b/application/hub/main/handler/network/tcp/class_TcpNetworkPackageHandler.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php b/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php index c62e7fca8..edf93218d 100644 --- a/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php +++ b/application/hub/main/handler/network/udp/class_UdpNetworkPackageHandler.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/handler/tasks/class_TaskHandler.php b/application/hub/main/handler/tasks/class_TaskHandler.php index a53edd931..9799fb06d 100644 --- a/application/hub/main/handler/tasks/class_TaskHandler.php +++ b/application/hub/main/handler/tasks/class_TaskHandler.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -161,6 +161,17 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { $this->listInstance->updateCurrentEntryByHash($hash, $taskEntry); } + /** + * Unregisters the given task + * + * @param $taskName Name of the task + * @return void + */ + private function unregisterTask ($taskName) { + // Remove the entry + $this->listInstance->removeEntry('tasks', $taskName); + } + /** * Registers a task with a task handler. * @@ -241,6 +252,53 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Go to next entry $this->iteratorInstance->next(); } + + /** + * Shuts down all tasks and the task handler itself. This method should be + * called from a corresponding filter class. + * + * @return void + */ + public function doShutdown () { + // Should we rewind? + if (!$this->iteratorInstance->valid()) { + // Rewind to the beginning for next loop + $this->iteratorInstance->rewind(); + } // END - if + + // Debug message + $this->debugOutput('TASK-HANDLER: Shutting down all ' . $this->listInstance->count() . ' tasks...'); + + // Remember all tasks that has been shutdown for removal + $tasks = array(); + + // Shutdown all tasks in once go + while ($this->iteratorInstance->valid()) { + // Get current entry + $current = $this->iteratorInstance->current(); + + // Output debug message + $this->debugOutput('TASK-HANDLER: Shutting down task ' . $current['id'] . ' (taskInstance=' . $current['task_instance']->__toString() . ') ...'); + + // Shutdown the task + $current['task_instance']->doShutdown(); + + // Remember this task + $tasks[] = $current; + + // Advance to next one + $this->iteratorInstance->next(); + } // END - while + + + // Debug message + $this->debugOutput('TASK-HANDLER: Shutdown of all tasks completed.'); + + // Remove all tasks + foreach ($tasks as $entry) { + $this->unregisterTask($entry); + } // END - foreach + } } // [EOF] diff --git a/application/hub/main/helper/hub/announcement/class_HubDescriptorHelper.php b/application/hub/main/helper/hub/announcement/class_HubDescriptorHelper.php index da244d405..3ff692aa3 100644 --- a/application/hub/main/helper/hub/announcement/class_HubDescriptorHelper.php +++ b/application/hub/main/helper/hub/announcement/class_HubDescriptorHelper.php @@ -4,9 +4,10 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @todo Find an interface for hub helper * * 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 @@ -53,8 +54,12 @@ class HubDescriptorHelper extends BaseHubHelper { * Loads the announcement descriptor for parsing * * @return void + * @todo Rewrite the ->renderXmlContent() call to no arguments */ public function loadAnnouncementDescriptor () { + // Debug message + $this->debugOutput('HELPER: Starting with announcement to upper hubs...'); + // Get the application instance $appInstance = Registry::getRegistry()->getInstance('app'); @@ -78,7 +83,6 @@ class HubDescriptorHelper extends BaseHubHelper { // Render it here $this->getTemplateInstance()->renderXmlContent($announcementContent); - die(__METHOD__."\n"); } } diff --git a/application/hub/main/helper/hub/class_ b/application/hub/main/helper/hub/class_ index 46a974e53..b47de1f53 100644 --- a/application/hub/main/helper/hub/class_ +++ b/application/hub/main/helper/hub/class_ @@ -7,6 +7,7 @@ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @todo Find an interface for hub helper * * 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 diff --git a/application/hub/main/helper/hub/class_BaseHubHelper.php b/application/hub/main/helper/hub/class_BaseHubHelper.php index ffec8f3b6..54f8157a9 100644 --- a/application/hub/main/helper/hub/class_BaseHubHelper.php +++ b/application/hub/main/helper/hub/class_BaseHubHelper.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/class_ b/application/hub/main/iterator/class_ index 0a44b5d6e..0c43c5ded 100644 --- a/application/hub/main/iterator/class_ +++ b/application/hub/main/iterator/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/class_BaseIterator.php b/application/hub/main/iterator/class_BaseIterator.php index 82745decc..ed842d1f9 100644 --- a/application/hub/main/iterator/class_BaseIterator.php +++ b/application/hub/main/iterator/class_BaseIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/hub/class_HubPingIterator.php b/application/hub/main/iterator/hub/class_HubPingIterator.php index 4c21ee7cc..700375797 100644 --- a/application/hub/main/iterator/hub/class_HubPingIterator.php +++ b/application/hub/main/iterator/hub/class_HubPingIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/network/class_NetworkListenIterator.php b/application/hub/main/iterator/network/class_NetworkListenIterator.php index e08bf9751..82aae6723 100644 --- a/application/hub/main/iterator/network/class_NetworkListenIterator.php +++ b/application/hub/main/iterator/network/class_NetworkListenIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo This current implementation is not recommended, use a diff --git a/application/hub/main/iterator/pool/class_DefaultIterator.php b/application/hub/main/iterator/pool/class_DefaultIterator.php index 230d0568e..949c6c188 100755 --- a/application/hub/main/iterator/pool/class_DefaultIterator.php +++ b/application/hub/main/iterator/pool/class_DefaultIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/pool/handler/class_Handler b/application/hub/main/iterator/pool/handler/class_Handler index febcac445..a356fc0ac 100644 --- a/application/hub/main/iterator/pool/handler/class_Handler +++ b/application/hub/main/iterator/pool/handler/class_Handler @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php b/application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php index 46ae93006..2a7b124b5 100644 --- a/application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php +++ b/application/hub/main/iterator/pool/handler/class_HandlerPoolIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo This current implementation is not recommended, use a diff --git a/application/hub/main/iterator/pool/shutdown/class_Shutdown b/application/hub/main/iterator/pool/shutdown/class_Shutdown index 758ab9b9b..5aad3b526 100644 --- a/application/hub/main/iterator/pool/shutdown/class_Shutdown +++ b/application/hub/main/iterator/pool/shutdown/class_Shutdown @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/pool/shutdown/class_ShutdownPoolIterator.php b/application/hub/main/iterator/pool/shutdown/class_ShutdownPoolIterator.php index b307ce46b..39d4041ea 100644 --- a/application/hub/main/iterator/pool/shutdown/class_ShutdownPoolIterator.php +++ b/application/hub/main/iterator/pool/shutdown/class_ShutdownPoolIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php b/application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php index 25c79b69a..f037f26ea 100644 --- a/application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php +++ b/application/hub/main/iterator/pool/tasks/class_TaskPoolIterator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @todo This current implementation is not recommended, use a diff --git a/application/hub/main/listener/class_ b/application/hub/main/listener/class_ index 199e8c7fc..546266a21 100644 --- a/application/hub/main/listener/class_ +++ b/application/hub/main/listener/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/class_BaseListener.php b/application/hub/main/listener/class_BaseListener.php index 8b28acd0c..6c921f5bb 100644 --- a/application/hub/main/listener/class_BaseListener.php +++ b/application/hub/main/listener/class_BaseListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -225,7 +225,7 @@ class BaseListener extends BaseHubSystem implements Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/listener/class_BaseListenerDecorator.php b/application/hub/main/listener/class_BaseListenerDecorator.php index dcf284649..5b9889e20 100644 --- a/application/hub/main/listener/class_BaseListenerDecorator.php +++ b/application/hub/main/listener/class_BaseListenerDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -61,7 +61,7 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void @@ -71,7 +71,7 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable { $visitorInstance->visitDecorator($this); // Visit the covered class - $visitorInstance->visitListener($this); + $visitorInstance->visitListener($this->getListenerInstance()); } } diff --git a/application/hub/main/listener/tcp/class_ b/application/hub/main/listener/tcp/class_ index 968182332..2f6eab468 100644 --- a/application/hub/main/listener/tcp/class_ +++ b/application/hub/main/listener/tcp/class_ @@ -138,7 +138,7 @@ socket_close($mainSocket); * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/tcp/class_TcpListener.php b/application/hub/main/listener/tcp/class_TcpListener.php index 4881e4f2f..2bfc9ce93 100644 --- a/application/hub/main/listener/tcp/class_TcpListener.php +++ b/application/hub/main/listener/tcp/class_TcpListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/tcp/decorators/class_ClientTcpListenerDecorator.php b/application/hub/main/listener/tcp/decorators/class_ClientTcpListenerDecorator.php index 7dfb77868..a55e2d413 100644 --- a/application/hub/main/listener/tcp/decorators/class_ClientTcpListenerDecorator.php +++ b/application/hub/main/listener/tcp/decorators/class_ClientTcpListenerDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Client Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/tcp/decorators/class_HubTcpListenerDecorator.php b/application/hub/main/listener/tcp/decorators/class_HubTcpListenerDecorator.php index 0335e98ce..b3a6013c7 100644 --- a/application/hub/main/listener/tcp/decorators/class_HubTcpListenerDecorator.php +++ b/application/hub/main/listener/tcp/decorators/class_HubTcpListenerDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/udp/class_ b/application/hub/main/listener/udp/class_ index c066c086e..4dda18d8c 100644 --- a/application/hub/main/listener/udp/class_ +++ b/application/hub/main/listener/udp/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/udp/class_UdpListener.php b/application/hub/main/listener/udp/class_UdpListener.php index 1c770c63f..764b6bac2 100644 --- a/application/hub/main/listener/udp/class_UdpListener.php +++ b/application/hub/main/listener/udp/class_UdpListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/udp/decorators/class_ClientUdpListenerDecorator.php b/application/hub/main/listener/udp/decorators/class_ClientUdpListenerDecorator.php index fc9c40cb2..b6d2fdaf1 100644 --- a/application/hub/main/listener/udp/decorators/class_ClientUdpListenerDecorator.php +++ b/application/hub/main/listener/udp/decorators/class_ClientUdpListenerDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Client Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/listener/udp/decorators/class_HubUdpListenerDecorator.php b/application/hub/main/listener/udp/decorators/class_HubUdpListenerDecorator.php index 09a6c4462..4595ab6b3 100644 --- a/application/hub/main/listener/udp/decorators/class_HubUdpListenerDecorator.php +++ b/application/hub/main/listener/udp/decorators/class_HubUdpListenerDecorator.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/lists/class_ b/application/hub/main/lists/class_ index fa8573787..453cb0df0 100644 --- a/application/hub/main/lists/class_ +++ b/application/hub/main/lists/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/lists/class_BaseList.php b/application/hub/main/lists/class_BaseList.php index fe416e104..3755b2605 100644 --- a/application/hub/main/lists/class_BaseList.php +++ b/application/hub/main/lists/class_BaseList.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -190,7 +190,7 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable { // Generate hash $hash = $this->generateHash($groupName, $groupName, $entry); - //* DEBUG: */ $this->debugOutput(__METHOD__.'('.$this->__toString().'): hash='.$hash.''); + //* DEBUG: */ $this->debugOutput(__METHOD__ . ': groupName=' . $groupName . ', entry=' . $entry . ', hash=' . $hash); // Add the hash to the index $this->listIndex[] = $hash; @@ -202,6 +202,34 @@ class BaseList extends BaseHubSystem implements IteratorAggregate, Countable { //* DEBUG: */ $this->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - FINISHED'); } + /** + * Removes given entry from the list group + * + * @param $groupName Group where we should remove the entry from + * @param $entry The entry we should remove + * @return void + * @throws NoListGroupException If the given group is not found + */ + public function removeEntry ($groupName, $entry) { + //* DEBUG: */ $this->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - START'); + // Is the group already added? + if (!$this->isGroupSet($groupName)) { + // Throw the exception here + throw new NoListGroupException(array($this, $groupName), self::EXCEPTION_GROUP_NOT_FOUND); + } // END - if + + // Generate hash + $hash = $this->generateHash($groupName, $groupName, $entry); + //* DEBUG: */ $this->debugOutput(__METHOD__ . ': groupName=' . $groupName . ', entry=' . $entry . ', hash=' . $hash); + + // Remove it from the list ... + unset($this->listEntries[$hash]); + + // ... and hash list as well + unset($this->listIndex[array_search($hash, $this->listIndex)]); + //* DEBUG: */ $this->debugOutput(__METHOD__.'('.$this->__toString().'): '.$groupName . ' - FINISHED'); + } + /** * Generates a hash from given group, sub group and entry * diff --git a/application/hub/main/lists/groups/class_ListGroupList.php b/application/hub/main/lists/groups/class_ListGroupList.php index 19bae2743..8fabaf62e 100644 --- a/application/hub/main/lists/groups/class_ListGroupList.php +++ b/application/hub/main/lists/groups/class_ListGroupList.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/lists/pool/class_PoolEntriesList.php b/application/hub/main/lists/pool/class_PoolEntriesList.php index 8fce67eeb..802820a26 100644 --- a/application/hub/main/lists/pool/class_PoolEntriesList.php +++ b/application/hub/main/lists/pool/class_PoolEntriesList.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/lists/query/local/class_LocalQueryList.php b/application/hub/main/lists/query/local/class_LocalQueryList.php index 83475e098..82b314113 100644 --- a/application/hub/main/lists/query/local/class_LocalQueryList.php +++ b/application/hub/main/lists/query/local/class_LocalQueryList.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/lists/tasks/class_TaskList.php b/application/hub/main/lists/tasks/class_TaskList.php index 80746499c..170fd7a9f 100644 --- a/application/hub/main/lists/tasks/class_TaskList.php +++ b/application/hub/main/lists/tasks/class_TaskList.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/nodes/boot/class_HubBootNode.php b/application/hub/main/nodes/boot/class_HubBootNode.php index 7ba796889..e4cf363dc 100644 --- a/application/hub/main/nodes/boot/class_HubBootNode.php +++ b/application/hub/main/nodes/boot/class_HubBootNode.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/nodes/class_ b/application/hub/main/nodes/class_ index b7a73281c..02a4cbd63 100644 --- a/application/hub/main/nodes/class_ +++ b/application/hub/main/nodes/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 6236d7be8..b6ec9d84e 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -25,16 +25,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // Exception constants const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00; - /** - * Node id - */ - private $nodeId = ''; - - /** - * Session id - */ - private $sessionId = ''; - /** * IP/port number of bootstrapping node */ @@ -51,14 +41,15 @@ class BaseHubNode extends BaseHubSystem implements Updateable { private $listenerPoolInstance = null; /** - * Wether the hub is active (true/false) + * Wether this node is anncounced (KEEP ON false!) + * @deprecated */ - private $hubIsActive = false; + private $hubIsAnnounced = false; /** - * Wether this node is anncounced (KEEP ON false!) + * Node state instance */ - private $hubIsAnnounced = false; + private $nodeStateInstance = null; /** * Protected constructor @@ -69,6 +60,20 @@ class BaseHubNode extends BaseHubSystem implements Updateable { protected function __construct ($className) { // Call parent constructor parent::__construct($className); + + // Init node state which sets the state to 'init' + $this->initNodeState(); + } + + /** + * Initializes the node's state which sets it to 'init' + * + * @return void + */ + private function initNodeState() { + // Get the state factory and create the initial state, we don't need + // the state instance here + NodeStateFactory::createNodeStateInstanceByName('init', $this); } /** @@ -78,16 +83,18 @@ class BaseHubNode extends BaseHubSystem implements Updateable { * @return void */ private final function setNodeId ($nodeId) { - $this->nodeId = (string) $nodeId; + // Set it config now + $this->getConfigInstance()->setConfigEntry('node_id', (string) $nodeId); } /** * Getter for node id * - * @return $nodeId Our new node id + * @return $nodeId Current node id */ private final function getNodeId () { - return $this->nodeId; + // Get it from config + return $this->getConfigInstance()->getConfigEntry('node_id'); } /** @@ -109,6 +116,25 @@ class BaseHubNode extends BaseHubSystem implements Updateable { return $this->listenerPoolInstance; } + /** + * Setter for node state instance + * + * @param $nodeStateInstance Node's current state instance + * @return void + */ + public final function setNodeStateInstance (NodeStateable $nodeStateInstance) { + $this->nodeStateInstance = $nodeStateInstance; + } + + /** + * Getter for node state instance + * + * @return $nodeStateInstance Node's current state instance + */ + public final function getNodeStateInstance () { + return $this->nodeStateInstance; + } + /** * Setter for session id * @@ -116,16 +142,16 @@ class BaseHubNode extends BaseHubSystem implements Updateable { * @return void */ private final function setSessionId ($sessionId) { - $this->sessionId = (string) $sessionId; + $this->getConfigInstance()->setConfigEntry('session_id', (string) $sessionId); } /** * Getter for session id * - * @return $sessionId Our new session id + * @return $sessionId Current session id */ public final function getSessionId () { - return $this->sessionId; + return $this->getConfigInstance()->getConfigEntry('session_id'); } /** @@ -156,6 +182,26 @@ class BaseHubNode extends BaseHubSystem implements Updateable { return $this->bootIpPort; } + /** + * "Getter" for a printable state name + */ + public final function getPrintableState () { + // Default is 'null' + $stateName = 'null'; + + // Get the state instance + $stateInstance = $this->getNodeStateInstance(); + + // Is it an instance of NodeStateable? + if ($stateInstance instanceof NodeStateable) { + // Then use that state name + $stateName = $stateInstance->getStateName(); + } // END - if + + // Return result + return $stateName; + } + /** * Checks wether the given IP address matches one of the bootstrapping nodes * @@ -217,7 +263,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // Output all lines $this->debugOutput(' '); $this->debugOutput($app->getAppName() . ' v' . $app->getAppVersion() . ' - ' . $this->getRequestInstance()->getRequestElement('mode') . ' mode active'); - $this->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009 Hub Developer Team'); + $this->debugOutput('Copyright (c) 2007 - 2008 Roland Haeder, 2009, 2010 Hub Developer Team'); $this->debugOutput(' '); $this->debugOutput('This program comes with ABSOLUTELY NO WARRANTY; for details see docs/COPYING.'); $this->debugOutput('This is free software, and you are welcome to redistribute it under certain'); @@ -230,9 +276,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable { * based on many pseudo-random data. On any later run, unless the id * got not removed from database, it will be restored from the database. * + * @param $requestInstance A Requestable class + * @param $responseInstance A Responseable class * @return void */ - public function bootstrapAcquireHubId () { + public function bootstrapAcquireHubId (Requestable $requestInstance, Responseable $responseInstance) { // Get a wrapper instance $wrapperInstance = ObjectFactory::createObjectByConfiguredName('node_info_db_wrapper_class'); @@ -304,6 +352,9 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // Output message $this->debugOutput('BOOTSTRAP: Created new session-id: ' . $this->getSessionId() . ''); + + // Change the state because the node has auired a hub id + $this->getNodeStateInstance()->nodeGeneratedSessionId(); } /** @@ -383,24 +434,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $this->getResultInstance()->add2UpdateQueue($updateInstance); } - /** - * Getter for $hubIsActive attribute - * - * @return $hubIsActive Wether the hub is activer - */ - public final function isHubActive () { - return $this->hubIsActive; - } - - /** - * Setter for $hubIsActive attribute - * - * @param $hubIsActive Wether the hub is activer - */ - public final function enableHubIsActive ($hubIsActive = true) { - $this->hubIsActive = $hubIsActive; - } - /** * Announces this hub to the upper (bootstrap or list) hubs. After this is * successfully done the given task is unregistered from the handler. @@ -408,6 +441,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { * @param $taskInstance The task instance running this announcement * @return void * @throws HubAlreadyAnnouncedException If this hub is already announced + * @todo Change the first if() block to check for a specific state */ public function announceSelfToUpperNodes (Taskable $taskInstance) { // Is this hub node announced? @@ -416,12 +450,30 @@ class BaseHubNode extends BaseHubSystem implements Updateable { throw new HubAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED); } // END - if + // Debug output + $this->debugOutput('HUB: Self-announcement: START (taskInstance=' . $taskInstance->__toString(). ')'); + // Get a helper instance $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_descriptor_class', array($this)); // Load the announcement descriptor $helperInstance->loadAnnouncementDescriptor(); - die("\n"); + + // Set some dummy configuration entries, e.g. node_status + $this->getConfigInstance()->setConfigEntry('node_status', $this->getNodeStateInstance()->getStateName()); + + // Compile all variables + $helperInstance->getTemplateInstance()->compileConfigInVariables(); + + // "Publish" the descriptor by sending it to the bootstrap/list nodes + $helperInstance->publishAnnouncementDescriptor(); + + // Change the state, this should be the last line except debug output + $this->getNodeStateInstance()->nodeAnnouncedToUpperHubs(); + die("OK!\n"); + + // Debug output + $this->debugOutput('HUB: Self-announcement: FINISHED'); } /** @@ -434,8 +486,8 @@ class BaseHubNode extends BaseHubSystem implements Updateable { */ public function activateHub (Requestable $requestInstance, Responseable $responseInstance) { // Checks wether a listener is still active and shuts it down if one - // is still listening - if (($this->determineIfListenerIsActive()) && ($this->isHubActive())) { + // is still listening. + if (($this->determineIfListenerIsActive()) && ($this->determineIfHubIsActive())) { // Shutdown them down before they can hurt anything $this->shutdownListenerPool(); } // END - if @@ -448,7 +500,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // ----------------------- Last step from here ------------------------ // Activate the hub. This is ALWAYS the last step in this method - $this->enableHubIsActive(); + $this->getNodeStateInstance()->nodeIsActivated(); // ---------------------- Last step until here ------------------------ } @@ -549,6 +601,20 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // Debug output $this->debugOutput('HUB: Restore node list: FINISHED.'); } + + /** + * Determines wether the hub is active by checking its current state + * + * @return $isActive Wether the hub is active + */ + public function determineIfHubIsActive () { + // Check the state + // @TODO Add more states e.g. 'firewalled', 'senior' + $isActive = ($this->getNodeStateInstance() instanceof NodeActiveState); + + // Return value + return $isActive; + } } // [EOF] diff --git a/application/hub/main/nodes/list/class_HubListNode.php b/application/hub/main/nodes/list/class_HubListNode.php index 7b6f59cc8..2390e9d65 100644 --- a/application/hub/main/nodes/list/class_HubListNode.php +++ b/application/hub/main/nodes/list/class_HubListNode.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/nodes/master/class_HubMasterNode.php b/application/hub/main/nodes/master/class_HubMasterNode.php index e00cab0c3..036b24f00 100644 --- a/application/hub/main/nodes/master/class_HubMasterNode.php +++ b/application/hub/main/nodes/master/class_HubMasterNode.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/nodes/regular/class_HubRegularNode.php b/application/hub/main/nodes/regular/class_HubRegularNode.php index 23b1be87f..260d4a329 100644 --- a/application/hub/main/nodes/regular/class_HubRegularNode.php +++ b/application/hub/main/nodes/regular/class_HubRegularNode.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/pools/class_ b/application/hub/main/pools/class_ index 716176243..cf78a8c34 100644 --- a/application/hub/main/pools/class_ +++ b/application/hub/main/pools/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/pools/class_BasePool.php b/application/hub/main/pools/class_BasePool.php index 5908ad52d..724540425 100644 --- a/application/hub/main/pools/class_BasePool.php +++ b/application/hub/main/pools/class_BasePool.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -80,7 +80,7 @@ class BasePool extends BaseHubSystem implements Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/pools/client/class_DefaultClientPool.php b/application/hub/main/pools/client/class_DefaultClientPool.php index dd4c6c2d1..a0ceb977c 100644 --- a/application/hub/main/pools/client/class_DefaultClientPool.php +++ b/application/hub/main/pools/client/class_DefaultClientPool.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/pools/listener/class_DefaultListenerPool.php b/application/hub/main/pools/listener/class_DefaultListenerPool.php index dccbfcc34..f828fb549 100644 --- a/application/hub/main/pools/listener/class_DefaultListenerPool.php +++ b/application/hub/main/pools/listener/class_DefaultListenerPool.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/queries/class_ b/application/hub/main/queries/class_ index 9c113c025..22f13e8d3 100644 --- a/application/hub/main/queries/class_ +++ b/application/hub/main/queries/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/queries/class_BaseQuery.php b/application/hub/main/queries/class_BaseQuery.php index e85325e42..e7a7a9441 100644 --- a/application/hub/main/queries/class_BaseQuery.php +++ b/application/hub/main/queries/class_BaseQuery.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/queries/local/class_LocalQuery.php b/application/hub/main/queries/local/class_LocalQuery.php index 3848075b8..9815604f3 100644 --- a/application/hub/main/queries/local/class_LocalQuery.php +++ b/application/hub/main/queries/local/class_LocalQuery.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class LocalQuery extends BaseQuery implements Queryable, Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/queues/class_ b/application/hub/main/queues/class_ index 9a39e85a2..683076dec 100644 --- a/application/hub/main/queues/class_ +++ b/application/hub/main/queues/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/queues/class_BaseQueue.php b/application/hub/main/queues/class_BaseQueue.php index 1a34610f7..e8de605ca 100644 --- a/application/hub/main/queues/class_BaseQueue.php +++ b/application/hub/main/queues/class_BaseQueue.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/queues/client/class_LocalClientQueue.php b/application/hub/main/queues/client/class_LocalClientQueue.php index 76f9d1ce8..07ffe19b0 100644 --- a/application/hub/main/queues/client/class_LocalClientQueue.php +++ b/application/hub/main/queues/client/class_LocalClientQueue.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/resolver/command/console/class_HubConsoleCommandResolver.php b/application/hub/main/resolver/command/console/class_HubConsoleCommandResolver.php index 54d2304f2..a3c1978d9 100644 --- a/application/hub/main/resolver/command/console/class_HubConsoleCommandResolver.php +++ b/application/hub/main/resolver/command/console/class_HubConsoleCommandResolver.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/resolver/controller/console/class_HubConsoleControllerResolver.php b/application/hub/main/resolver/controller/console/class_HubConsoleControllerResolver.php index c8f291c7a..774a69341 100644 --- a/application/hub/main/resolver/controller/console/class_HubConsoleControllerResolver.php +++ b/application/hub/main/resolver/controller/console/class_HubConsoleControllerResolver.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/resolver/state/class_BaseStateResolver.php b/application/hub/main/resolver/state/class_BaseStateResolver.php index a7dbc979c..c74170509 100644 --- a/application/hub/main/resolver/state/class_BaseStateResolver.php +++ b/application/hub/main/resolver/state/class_BaseStateResolver.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/resolver/state/network/class_NetworkStateResolver.php b/application/hub/main/resolver/state/network/class_NetworkStateResolver.php index ddba4be42..e37e8380f 100644 --- a/application/hub/main/resolver/state/network/class_NetworkStateResolver.php +++ b/application/hub/main/resolver/state/network/class_NetworkStateResolver.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/states/class_ b/application/hub/main/states/class_ index 1b30ac4bc..f83cbf34f 100644 --- a/application/hub/main/states/class_ +++ b/application/hub/main/states/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -30,6 +30,9 @@ class ???State extends BaseState implements ??Stateable { protected function __construct () { // Call parent constructor parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('!!!'); } } diff --git a/application/hub/main/states/class_BaseState.php b/application/hub/main/states/class_BaseState.php index 0117115a0..4511f3e10 100644 --- a/application/hub/main/states/class_BaseState.php +++ b/application/hub/main/states/class_BaseState.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -22,6 +22,12 @@ * along with this program. If not, see . */ class BaseState extends BaseHubSystem implements Stateable { + /** + * State name for printing out (except debug output where you want to use + * $stateInstance->__toString() instead of this). + */ + private $stateName = ''; + /** * Protected constructor * @@ -32,6 +38,25 @@ class BaseState extends BaseHubSystem implements Stateable { // Call parent constructor parent::__construct($className); } + + /** + * Getter for state name + * + * @return $stateName Name of this state in a printable maner + */ + public final function getStateName () { + return $this->stateName; + } + + /** + * Setter for state name + * + * @param $stateName Name of this state in a printable maner + * @return void + */ + protected final function setStateName ($stateName) { + $this->stateName = $stateName; + } } // [EOF] diff --git a/application/hub/main/states/client/class_BaseClientState.php b/application/hub/main/states/client/class_BaseClientState.php index ec1916b8e..627b5db70 100644 --- a/application/hub/main/states/client/class_BaseClientState.php +++ b/application/hub/main/states/client/class_BaseClientState.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/states/hub/class_BaseHubState.php b/application/hub/main/states/hub/class_BaseHubState.php index 8e52c1f32..e49d6a326 100644 --- a/application/hub/main/states/hub/class_BaseHubState.php +++ b/application/hub/main/states/hub/class_BaseHubState.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/states/node/.htaccess b/application/hub/main/states/node/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/states/node/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/states/node/active/.htaccess b/application/hub/main/states/node/active/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/states/node/active/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/states/node/active/class_NodeActiveState.php b/application/hub/main/states/node/active/class_NodeActiveState.php new file mode 100644 index 000000000..6dd80ce50 --- /dev/null +++ b/application/hub/main/states/node/active/class_NodeActiveState.php @@ -0,0 +1,60 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NodeActiveState extends BaseState implements NodeStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('active'); + } + + /** + * Creates an instance of this class + * + * @param $nodeInstance An instance of a NodeHelper class + * @return $stateInstance An instance of a NodeStateable class + */ + public final static function createNodeActiveState (NodeHelper $nodeInstance) { + // Get new instance + $stateInstance = new NodeActiveState(); + + // Debug message + $stateInstance->debugOutput("NODE-STATE: Has changed from " . $nodeInstance->getPrintableState() . " to " . $stateInstance->getStateName() . "."); + + // Set the node instance + $stateInstance->setNodeInstance($nodeInstance); + + // Return the prepared instance + return $stateInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/states/node/class_ b/application/hub/main/states/node/class_ new file mode 100644 index 000000000..7d73f8d30 --- /dev/null +++ b/application/hub/main/states/node/class_ @@ -0,0 +1,60 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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???State extends BaseState implements NodeStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('!!!'); + } + + /** + * Creates an instance of this class + * + * @param $nodeInstance An instance of a NodeHelper class + * @return $stateInstance An instance of a NodeStateable class + */ + public final static function createNode???State (NodeHelper $nodeInstance) { + // Get new instance + $stateInstance = new Node???State(); + + // Debug message + $stateInstance->debugOutput("NODE-STATE: Has changed from " . $nodeInstance->getPrintableState() . " to " . $stateInstance->getStateName() . "."); + + // Set the node instance + $stateInstance->setNodeInstance($nodeInstance); + + // Return the prepared instance + return $stateInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/states/node/class_BaseNodeState.php b/application/hub/main/states/node/class_BaseNodeState.php new file mode 100644 index 000000000..5e8765999 --- /dev/null +++ b/application/hub/main/states/node/class_BaseNodeState.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 BaseNodeState extends BaseState { + /** + * 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/states/node/init/.htaccess b/application/hub/main/states/node/init/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/states/node/init/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/states/node/init/class_NodeInitState.php b/application/hub/main/states/node/init/class_NodeInitState.php new file mode 100644 index 000000000..4d64f2e8a --- /dev/null +++ b/application/hub/main/states/node/init/class_NodeInitState.php @@ -0,0 +1,70 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NodeInitState extends BaseState implements NodeStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructo + parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('init'); + } + + /** + * Creates an instance of this class + * + * @param $nodeInstance An instance of a NodeHelper class + * @return $stateInstance An instance of a NodeStateable class + */ + public final static function createNodeInitState (NodeHelper $nodeInstance) { + // Get new instance + $stateInstance = new NodeInitState(); + + // Debug message + $stateInstance->debugOutput("NODE-STATE: Has changed from " . $nodeInstance->getPrintableState() . " to " . $stateInstance->getStateName() . "."); + + // Set the node instance + $stateInstance->setNodeInstance($nodeInstance); + + // Return the prepared instance + return $stateInstance; + } + + /** + * State change for if the node has just generated a session id. This makes + * nodes with current state 'init' now 'virgin'. + */ + public function nodeGeneratedSessionId () { + // Create the new state instance + NodeStateFactory::createNodeStateInstanceByName('virgin', $this->getNodeInstance()); + } + +} + +// [EOF] +?> diff --git a/application/hub/main/states/node/virgin/.htaccess b/application/hub/main/states/node/virgin/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/states/node/virgin/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/states/node/virgin/class_NodeVirginState.php b/application/hub/main/states/node/virgin/class_NodeVirginState.php new file mode 100644 index 000000000..aeb122358 --- /dev/null +++ b/application/hub/main/states/node/virgin/class_NodeVirginState.php @@ -0,0 +1,74 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NodeVirginState extends BaseState implements NodeStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + + // Set state name + $this->setStateName('virgin'); + } + + /** + * Creates an instance of this class + * + * @param $nodeInstance An instance of a NodeHelper class + * @return $stateInstance An instance of a NodeStateable class + */ + public final static function createNodeVirginState (NodeHelper $nodeInstance) { + // Get new instance + $stateInstance = new NodeVirginState(); + + // Debug message + $stateInstance->debugOutput("NODE-STATE: Has changed from " . $nodeInstance->getPrintableState() . " to " . $stateInstance->getStateName() . "."); + + // Set the node instance + $stateInstance->setNodeInstance($nodeInstance); + + // Return the prepared instance + return $stateInstance; + } + + /** + * Change the state to 'activate' when the hub has initialized all + * listeners, tasks, queues, etc. An active hub does not imply that it + * can be reached from outside so we have to deal with that state with + * yet another state class. + * + * @return void + */ + public function nodeIsActivated () { + // Create the new state instance + NodeStateFactory::createNodeStateInstanceByName('active', $this->getNodeInstance()); + } + +} + +// [EOF] +?> diff --git a/application/hub/main/tasks/class_ b/application/hub/main/tasks/class_ index b0b42b375..cae03fc15 100644 --- a/application/hub/main/tasks/class_ +++ b/application/hub/main/tasks/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class ???Task extends BaseTask implements Taskable, Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/tasks/class_BaseTask.php b/application/hub/main/tasks/class_BaseTask.php index 5334b727d..c85f47fff 100644 --- a/application/hub/main/tasks/class_BaseTask.php +++ b/application/hub/main/tasks/class_BaseTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php b/application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php index 38617ec17..13218ea7f 100644 --- a/application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php +++ b/application/hub/main/tasks/hub/announcement/class_HubSelfAnnouncementTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class HubSelfAnnouncementTask extends BaseTask implements Taskable, Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/tasks/hub/class_HubSelfConnectTask.php b/application/hub/main/tasks/hub/class_HubSelfConnectTask.php index 59d02ecb8..97cb9d4f3 100644 --- a/application/hub/main/tasks/hub/class_HubSelfConnectTask.php +++ b/application/hub/main/tasks/hub/class_HubSelfConnectTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class HubSelfConnectTask extends BaseTask implements Taskable, Visitable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/tasks/hub/ping/class_HubPingTask.php b/application/hub/main/tasks/hub/ping/class_HubPingTask.php index ba3d37dd2..6df69fb60 100644 --- a/application/hub/main/tasks/hub/ping/class_HubPingTask.php +++ b/application/hub/main/tasks/hub/ping/class_HubPingTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -56,7 +56,7 @@ class HubPingTask extends BaseTask implements Visitable, Taskable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php b/application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php index 5cc4b9a8b..5d7c810da 100644 --- a/application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php +++ b/application/hub/main/tasks/hub/update/class_HubUpdateCheckTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class HubUpdateCheckTask extends BaseTask implements Visitable, Taskable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void diff --git a/application/hub/main/tasks/idle/class_IdleLoopTask.php b/application/hub/main/tasks/idle/class_IdleLoopTask.php index f8299a6c0..500dcf837 100644 --- a/application/hub/main/tasks/idle/class_IdleLoopTask.php +++ b/application/hub/main/tasks/idle/class_IdleLoopTask.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -46,7 +46,7 @@ class IdleLoopTask extends BaseTask implements Visitable, Taskable { } /** - * Accepts the visitor to rpocess the visit "request" + * Accepts the visitor to process the visit "request" * * @param $visitorInstance An instance of a Visitor class * @return void @@ -65,6 +65,16 @@ class IdleLoopTask extends BaseTask implements Visitable, Taskable { // Idle here a little (2 milliseconds) $this->idle(2); } + + /** + * Shutdown this task, this does nothing here, just supply the method. + * + * @return void + */ + public function doShutdown () { + // Debug message + $this->debugOutput('IDLE-TASK: Shutting down...'); + } } // [EOF] diff --git a/application/hub/main/template/announcement/class_AnnouncementTemplateEngine.php b/application/hub/main/template/announcement/class_AnnouncementTemplateEngine.php index f8b1e43d3..7a6dbcc0c 100644 --- a/application/hub/main/template/announcement/class_AnnouncementTemplateEngine.php +++ b/application/hub/main/template/announcement/class_AnnouncementTemplateEngine.php @@ -27,14 +27,22 @@ class AnnouncementTemplateEngine extends BaseTemplateEngine implements Compileab */ private $mainNodes = array( 'announcement', - 'annoucement-data' ); /** * Sub nodes in the XML tree */ private $subNodes = array( + 'announcement-data', + 'listener', + 'hub-listener', + 'client-listener', 'node-id', + 'node-status', + 'tcp-port', + 'udp-port', + 'session-id', + 'object-type-list', ); /** @@ -258,7 +266,7 @@ class AnnouncementTemplateEngine extends BaseTemplateEngine implements Compileab // Assign the found characters to variable and use the last entry from // stack as the name - parent::assignVariable($this->getStackerInstance()->getNamed('current_node'), $characters); + parent::assignVariable($this->getStackerInstance()->getNamed('announcement'), $characters); } /** @@ -272,10 +280,10 @@ class AnnouncementTemplateEngine extends BaseTemplateEngine implements Compileab // Is the template dependency set? if ((!empty($templateDependency)) && (!isset($this->dependencyContent[$node]))) { // Get a temporay menu template instance - $templateInstance = ObjectFactory::createObjectByConfiguredName('menu_template_class', array($this->getApplicationInstance(), $this->getMenuInstance())); + $templateInstance = ObjectFactory::createObjectByConfiguredName('announcement_template_class', array($this->getApplicationInstance())); // Then load it - $templateInstance->loadMenuTemplate($templateDependency); + $templateInstance->loadAnnouncementTemplate($templateDependency); // Get an XmlParser instance $templateInstance->renderXmlContent(); @@ -286,7 +294,7 @@ class AnnouncementTemplateEngine extends BaseTemplateEngine implements Compileab } /** - * Getter for menu cache file (FQFN) + * Getter for cache file (FQFN) * * @return $fqfn Full-qualified file name of the menu cache */ @@ -307,6 +315,246 @@ class AnnouncementTemplateEngine extends BaseTemplateEngine implements Compileab // Return it return $fqfn; } + + /** + * Starts the announcement + * + * @return void + */ + private function startAnnouncement () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'announcement'); + } + + /** + * Starts the announcement data + * + * @return void + */ + private function startAnnouncementData () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'announcement-data'); + } + + /** + * Starts the node id + * + * @return void + */ + private function startNodeId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'node-id'); + } + + /** + * Starts the node status + * + * @return void + */ + private function startNodeStatus () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'node-status'); + } + + /** + * Starts the listener + * + * @return void + */ + private function startListener () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'listener'); + } + + /** + * Starts the client listener + * + * @return void + */ + private function startClientListener () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'client-listener'); + } + + /** + * Starts the hub listener + * + * @return void + */ + private function startHubListener () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'hub-listener'); + } + + /** + * Starts the TCP port + * + * @return void + */ + private function startTcpPort () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'tcp-port'); + } + + /** + * Starts the UDP port + * + * @return void + */ + private function startUdpPort () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'udp-port'); + } + + /** + * Starts the session id + * + * @return void + */ + private function startSessionId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'session-id'); + } + + /** + * Starts the object type list + * + * @return void + */ + private function startObjectTypeList () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'object-type-list'); + } + + /** + * Starts the object type + * + * @return void + */ + private function startObjectType () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('announcement', 'object-type'); + } + + /** + * Finishes the object type + * + * @return void + */ + private function finishObjectType () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the object type list + * + * @return void + */ + private function finishObjectTypeList () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the session id + * + * @return void + */ + private function finishSessionId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the UDP port + * + * @return void + */ + private function finishUdpPort () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the TCP port + * + * @return void + */ + private function finishTcpPort () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the hub listener + * + * @return void + */ + private function finishHubListener () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the client listener + * + * @return void + */ + private function finishClientListener () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the listener + * + * @return void + */ + private function finishListener () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the node status + * + * @return void + */ + private function finishNodeStatus () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the node id + * + * @return void + */ + private function finishNodeId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the announcement data + * + * @return void + */ + private function finishAnnouncementData () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } + + /** + * Finishes the announcement + * + * @return void + */ + private function finishAnnouncement () { + // Pop the last entry + $this->getStackerInstance()->popNamed('announcement'); + } } // [EOF] diff --git a/application/hub/main/visitor/class_ b/application/hub/main/visitor/class_ index d64d546e6..6442569ad 100644 --- a/application/hub/main/visitor/class_ +++ b/application/hub/main/visitor/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/visitor/class_BaseVisitor.php b/application/hub/main/visitor/class_BaseVisitor.php index 3c9050f96..13e253b62 100644 --- a/application/hub/main/visitor/class_BaseVisitor.php +++ b/application/hub/main/visitor/class_BaseVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/visitor/pool/class_ b/application/hub/main/visitor/pool/class_ index 2174af554..bd3bd3554 100644 --- a/application/hub/main/visitor/pool/class_ +++ b/application/hub/main/visitor/pool/class_ @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/visitor/pool/handler/class_Handler b/application/hub/main/visitor/pool/handler/class_Handler index 54b3463d2..b640baae0 100644 --- a/application/hub/main/visitor/pool/handler/class_Handler +++ b/application/hub/main/visitor/pool/handler/class_Handler @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/visitor/pool/shutdown/class_Shutdown b/application/hub/main/visitor/pool/shutdown/class_Shutdown index 04f7e6c36..5d697f19f 100644 --- a/application/hub/main/visitor/pool/shutdown/class_Shutdown +++ b/application/hub/main/visitor/pool/shutdown/class_Shutdown @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub; Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php b/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php index 8d48dbd0a..6c622e400 100644 --- a/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php +++ b/application/hub/main/visitor/pool/shutdown/class_ShutdownListenerPoolVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -64,6 +64,40 @@ class ShutdownListenerPoolVisitor extends BaseVisitor implements PoolVisitor { // Debug message $this->debugOutput('VISITOR: Visit of ' . $poolInstance->__toString() . ' - FINISHED'); } + + /** + * Visits the given decorator instance + * + * @param $decoratorInstance A Listenable decorator instance + * @return void + */ + public function visitDecorator (Listenable $decoratorInstance) { + // Debug message + $this->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - START'); + + // Pre-shutdown the pool + $decoratorInstance->doShutdown(); + + // Debug message + $this->debugOutput('VISITOR: Visit of ' . $decoratorInstance->__toString() . ' - FINISHED'); + } + + /** + * Visits the given listener instance + * + * @param $listenerInstance A Listenable class instance + * @return void + */ + public function visitListener (Listenable $listenerInstance) { + // Debug message + $this->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - START'); + + // Pre-shutdown the pool + $listenerInstance->doShutdown(); + + // Debug message + $this->debugOutput('VISITOR: Visit of ' . $listenerInstance->__toString() . ' - FINISHED'); + } } // diff --git a/application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php b/application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php index ecfe21bef..e352a9a6e 100644 --- a/application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php +++ b/application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -101,7 +101,9 @@ class ActiveTaskVisitor extends BaseVisitor implements TaskVisitor, QueryConnect */ public function visitListener (Listenable $listenerInstance) { // Do "listen" here + //* DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - START'); $listenerInstance->doListen(); + //* DEBUG: */ $this->debugOutput('VISITOR: Visiting ' . $listenerInstance->__toString() . ' - FINISH'); } /** diff --git a/application/hub/starter.php b/application/hub/starter.php index 39633a9fa..d7524678c 100644 --- a/application/hub/starter.php +++ b/application/hub/starter.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * diff --git a/application/hub/templates/xml/announcement/self_announcement.xml b/application/hub/templates/xml/announcement/self_announcement.xml index 825a2caa8..8d740d1b7 100644 --- a/application/hub/templates/xml/announcement/self_announcement.xml +++ b/application/hub/templates/xml/announcement/self_announcement.xml @@ -24,7 +24,7 @@ along with this program. If not, see //--> - + {?node_id?} @@ -33,21 +33,19 @@ along with this program. If not, see - {?hub_tcp_port?} - {?hub_udp_port?} + {?node_tcp_listen_port?} + {?node_udp_listen_port?} - {?client_tcp_port?} - {?client_udp_port?} + {?node_tcp_listen_port?} + {?node_udp_listen_port?} {?session_id?} - - {?object_type?} - + -- 2.39.5