application/hub/main/database/wrapper/.htaccess -text
application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php -text
application/hub/main/filter/.htaccess -text
+application/hub/main/filter/activation/.htaccess -text
+application/hub/main/filter/activation/class_ -text
application/hub/main/filter/bootstrap/.htaccess -text
application/hub/main/filter/bootstrap/class_ -text
application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php -text
application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php -text
application/hub/main/filter/bootstrap/class_HubBootstrapGenSessionIdFilter.php -text
application/hub/main/filter/bootstrap/class_HubBootstrapInitQueuesFilter.php -text
+application/hub/main/filter/bootstrap/class_HubBootstrapListenerPoolFilter.php -text
application/hub/main/filter/bootstrap/class_HubBootstrapRestoreNodeListFilter.php -text
+application/hub/main/filter/class_ -text
application/hub/main/filter/console/.htaccess -text
application/hub/main/filter/console/class_Console -text
application/hub/main/filter/console/class_ConsoleWelcomeTeaserFilter.php -text
// CFG: HUB-BOOTSTRAP-EXTRA-BOOTSTRAP-FILTER
$cfg->setConfigEntry('hub_bootstrap_extra_bootstrap_filter', 'HubBootstrapExtraBootstrappingFilter');
+// CFG: HUB-BOOTSTRAP-LISTENER-POOL-FILTER
+$cfg->setConfigEntry('hub_bootstrap_listener_pool_filter', 'HubBootstrapListenerPoolFilter');
+
// CFG: NEWS-READER-CLASS
$cfg->setConfigEntry('news_reader_class', 'ConsoleNewsReader');
* Activates the hub by doing some final preparation and setting
* $hubIsActive to true
*
+ * @param $requestInstance A Requestable class
+ * @param $responseInstance A Responseable class
* @return void
*/
- function activateHub ();
+ function activateHub (Requestable $requestInstance, Responseable $responseInstance);
}
//
// -------------------------- Hub activation --------------------------
// Activates the hub by doing some final preparation steps and setting
// the attribute $hubIsActive to true
- $nodeInstance->activateHub();
+ $nodeInstance->activateHub($requestInstance, $responseInstance);
// ----------------------------- Main loop ----------------------------
// This is the main loop. Queried calls should come back here very fast
* @param $controllerInstance A controller instance
* @param $requestInstance An instance of a class with an Requestable interface
* @return void
+ * @todo Should we add some more filters?
*/
public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
// Add pre filters
$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_restore_nodelist_filter'));
$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_init_queues_filter'));
$controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_extra_bootstrap_filter'));
+ $controllerInstance->addBootstrapFilter(ObjectFactory::createObjectByConfiguredName('hub_bootstrap_listener_pool_filter'));
+
+ // Add hub activation filters
}
}
// Init additional filter groups
$this->initFilterChain('bootstrap');
+ $this->initFilterChain('hub_activation');
}
/**
public function executeBootstrapFilters (Requestable $requestInstance, Responseable $responseInstance) {
$this->executeFilters('bootstrap', $requestInstance, $responseInstance);
}
+
+ /**
+ * Add a hub activation filter
+ *
+ * @param $filterInstance A Filterable class
+ * @return void
+ */
+ public function addHubActivationFilter (Filterable $filterInstance) {
+ $this->addFilter('hub_activation', $filterInstance);
+ }
+
+ /**
+ * Executes all hub activation filters
+ *
+ * @param $requestInstance A Requestable class
+ * @param $responseInstance A Responseable class
+ * @return void
+ */
+ public function executeHubActivationFilters (Requestable $requestInstance, Responseable $responseInstance) {
+ $this->executeFilters('hub_activation', $requestInstance, $responseInstance);
+ }
}
// [EOF]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A ??? filter for hub activation
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubActivation???Filter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createHubActivation???Filter () {
+ // Get a new instance
+ $filterInstance = new HubActivation???Filter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get 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
+
+ // Now do something
+ $this->partialStub('Please implement this step.');
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ListenerPool filter for bootstrapping
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HubBootstrapListenerPoolFilter 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 createHubBootstrapListenerPoolFilter () {
+ // Get a new instance
+ $filterInstance = new HubBootstrapListenerPoolFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get node instance
+ $nodeInstance = Registry::getRegistry()->getInstance('node');
+
+ // Sanity-check on it
+ if (is_null($nodeInstance)) {
+ // Throws a FilterChainException to stop further processing
+ throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
+ } // END - if
+
+ // Now do something
+ $nodeInstance->initializeListenerPool();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A ??? filter for !!!
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Hub!!!???Filter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createHub!!!???Filter () {
+ // Get a new instance
+ $filterInstance = new Hub!!!???Filter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo 0% done
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get 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
+
+ // Now do something
+ $this->partialStub('Please implement this step.');
+ }
+}
+
+// [EOF]
+?>
return $this->hubIsActive;
}
+ /**
+ * Setter for $hubIsActive attribute
+ *
+ * @param $hubIsActive Wether the hub is activer
+ */
+ public final function enableHubIsActive ($hubIsActive = true) {
+ $this->hubIsActive = $hubIsActive;
+ }
+
/**
* Activates the hub by doing some final preparation and setting
* $hubIsActive to true
*
+ * @param $requestInstance A Requestable class
+ * @param $responseInstance A Responseable class
* @return void
*/
- public function activateHub () {
+ 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())) {
$this->shutdownListenerPool();
} // END - if
- // Initialize the TCP/UDP listener pool
- $this->initializeListenerPool();
+ // Get the controller here
+ $controllerInstance = Registry::getRegistry()->getInstance('controller');
- // @TODO Do some final preparation
- $this->partialStub('Do some final preparation before the hub gots activated.');
+ // Run all filters for the hub activation
+ $controllerInstance->executeHubActivationFilters($requestInstance, $responseInstance);
// ----------------------- Last step from here ------------------------
// Activate the hub. This is ALWAYS the last step in this method
- $this->hubIsActive = true;
+ $this->enableHubIsActive();
// ---------------------- Last step until here ------------------------
}
*
* @return void
*/
- private function initializeListenerPool () {
+ public function initializeListenerPool () {
+ // Debug output
+ $this->debugOutput('HUB: Initializing listeners...');
+
// Get a new pool instance
$this->listenerPoolInstance = ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this));
// Add this listener to the pool
$this->listenerPoolInstance->addListener($decoratorInstance);
+
+ // Debug output
+ $this->debugOutput('HUB: All listeners are initialized.');
}
}