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.');
}
}