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
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
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
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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
// 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');
// 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);
// 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]
?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
* 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
//
?>
+
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for node states
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface NodeStateable extends Stateable {
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*/
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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @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
// ----------------------------- 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
// 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'));
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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()
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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()
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
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
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A factory class for ??? states
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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__);
+ }
+}
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
<?php
-/**
- * A ??? filter for bootstrapping
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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
?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
<?php
-/**
- * A GenSessionId filter for bootstrapping
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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
?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
// 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);
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @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
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
<?php
-/**
- * A ListenerPool filter for shutting down the node.
- *
- * @author Roland Haeder <webmaster@ship-simu.org>
- * @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 <http://www.gnu.org/licenses/>.
- */
-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
?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
--- /dev/null
+<?php
+/**
+ * A TaskHandler filter for shutting down the node.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
$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.
*
// 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]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
* 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');
// Render it here
$this->getTemplateInstance()->renderXmlContent($announcementContent);
- die(__METHOD__."\n");
}
}
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
$visitorInstance->visitDecorator($this);
// Visit the covered class
- $visitorInstance->visitListener($this);
+ $visitorInstance->visitListener($this->getListenerInstance());
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
// 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;
//* 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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
// Exception constants
const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00;
- /**
- * Node id
- */
- private $nodeId = '';
-
- /**
- * Session id
- */
- private $sessionId = '';
-
/**
* IP/port number of bootstrapping node
*/
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
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);
}
/**
* @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');
}
/**
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
*
* @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');
}
/**
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
*
// 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');
* 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');
// 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();
}
/**
$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.
* @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?
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');
}
/**
*/
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
// ----------------------- 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 ------------------------
}
// 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]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
+
+ // Set state name
+ $this->setStateName('!!!');
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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
*
// 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]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Active node state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? node state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+<?php
+/**
+ * A general Node state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Init node state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A Virgin node state class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+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]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
}
/**
- * 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
// 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]
*/
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',
);
/**
// 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);
}
/**
// 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();
}
/**
- * Getter for menu cache file (FQFN)
+ * Getter for cache file (FQFN)
*
* @return $fqfn Full-qualified file name of the menu cache
*/
// 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]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
// 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');
+ }
}
//
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
*/
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');
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @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
*
//-->
<announcement>
<!-- Announcement data like, node id, session id and object types. //-->
- <annoucement-data>
+ <announcement-data>
<!-- Our node id. This should be announced only to upper hubs. //-->
<node-id>{?node_id?}</node-id>
<!-- Status of this node, see node_status.xml for details. //-->
<listener>
<!-- Listener ports for hub connections //-->
<hub-listener>
- <tcp-port>{?hub_tcp_port?}</tcp-port>
- <udp-port>{?hub_udp_port?}</udp-port>
+ <tcp-port>{?node_tcp_listen_port?}</tcp-port>
+ <udp-port>{?node_udp_listen_port?}</udp-port>
</hub-listener>
<!-- Listener ports for client connections //-->
<client-listener>
- <tcp-port>{?client_tcp_port?}</tcp-port>
- <udp-port>{?client_udp_port?}</udp-port>
+ <tcp-port>{?node_tcp_listen_port?}</tcp-port>
+ <udp-port>{?node_udp_listen_port?}</udp-port>
</client-listener>
</listener>
<!-- The session id. This should be announced to all other hubs. //-->
<session-id>{?session_id?}</session-id>
<!-- A list of shared object types. //-->
<object-type-list>
- <!-- A single object type this hub shares. //-->
- <object-type>{?object_type?}</object-type>
</object-type-list>
- </annoucement-data>
+ </announcement-data>
</announcement>