From: Roland Häder Date: Sun, 26 Aug 2012 20:11:47 +0000 (+0000) Subject: Added nodeInstance parameter (NodeHelper interface) to all loadDescriptorXml() method... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8ea4170c16156f67ec278267d58973e0856f4d8f;p=hub.git Added nodeInstance parameter (NodeHelper interface) to all loadDescriptorXml() methods (and interface) to allow access on its methods without using the factory --- diff --git a/Doxyfile b/Doxyfile index d6b467765..037d9291f 100644 --- a/Doxyfile +++ b/Doxyfile @@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8 # The PROJECT_NAME tag is a single word (or a sequence of words surrounded # by quotes) that should identify the project. -PROJECT_NAME = GenericObjectSharingHub +PROJECT_NAME = "Generic Object Sharing Hub" # The PROJECT_NUMBER tag can be used to enter a project or revision number. # This could be handy for archiving the generated documentation or diff --git a/application/hub/interfaces/helper/hub/class_HelpableHub.php b/application/hub/interfaces/helper/hub/class_HelpableHub.php index 7b5747555..5c611a984 100644 --- a/application/hub/interfaces/helper/hub/class_HelpableHub.php +++ b/application/hub/interfaces/helper/hub/class_HelpableHub.php @@ -25,9 +25,10 @@ interface HelpableHub extends Helper { /** * Loads the descriptor XML file * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - function loadDescriptorXml (); + function loadDescriptorXml (NodeHelper $nodeInstance); /** * Send a package out diff --git a/application/hub/main/handler/class_BaseDataHandler.php b/application/hub/main/handler/class_BaseDataHandler.php index 8fd0b4163..c7575d684 100644 --- a/application/hub/main/handler/class_BaseDataHandler.php +++ b/application/hub/main/handler/class_BaseDataHandler.php @@ -92,8 +92,11 @@ abstract class BaseDataHandler extends BaseHandler { // Get a helper instance based on this handler's name $helperInstance = ObjectFactory::createObjectByConfiguredName('node_answer_' . $this->getHandlerName() . '_helper_class', array($messageData)); + // Get node instance + $nodeInstance = Registry::getRegistry()->getInstance('node'); + // Load descriptor XML - $helperInstance->loadDescriptorXml(); + $helperInstance->loadDescriptorXml($nodeInstance); /* * Set missing (temporary) configuration data, mostly it needs to be @@ -104,9 +107,6 @@ abstract class BaseDataHandler extends BaseHandler { // Compile any configuration variables $helperInstance->getTemplateInstance()->compileConfigInVariables(); - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); - // Deliver the package $helperInstance->sendPackage($nodeInstance); @@ -133,8 +133,11 @@ abstract class BaseDataHandler extends BaseHandler { // Get a helper instance based on this handler's name $helperInstance = ObjectFactory::createObjectByConfiguredName('node_next_' . $this->getHandlerName() . '_helper_class', array($messageData)); + // Get node instance + $nodeInstance = Registry::getRegistry()->getInstance('node'); + // Load descriptor XML - $helperInstance->loadDescriptorXml(); + $helperInstance->loadDescriptorXml($nodeInstance); /* * Set missing (temporary) configuration data, mostly it needs to be @@ -145,9 +148,6 @@ abstract class BaseDataHandler extends BaseHandler { // Compile any configuration variables $helperInstance->getTemplateInstance()->compileConfigInVariables(); - // Get node instance - $nodeInstance = Registry::getRegistry()->getInstance('node'); - // Deliver the package $helperInstance->sendPackage($nodeInstance); diff --git a/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php b/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php index 6e5768673..84f14e0f6 100644 --- a/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php +++ b/application/hub/main/helper/hub/announcement/class_HubAnnouncementHelper.php @@ -55,9 +55,10 @@ class HubAnnouncementHelper extends BaseHubHelper implements HelpableHub { /** * Loads the announcement descriptor for parsing * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function loadDescriptorXml () { + public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Starting with announcement to upper hubs...'); diff --git a/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php b/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php index abd7e024d..0fdb1918c 100644 --- a/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php +++ b/application/hub/main/helper/hub/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php @@ -59,9 +59,10 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements /** * Loads the descriptor XML file * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function loadDescriptorXml () { + public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer an announcement...'); diff --git a/application/hub/main/helper/hub/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php b/application/hub/main/helper/hub/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php index ba3104c70..30cc9cf84 100644 --- a/application/hub/main/helper/hub/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php +++ b/application/hub/main/helper/hub/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php @@ -59,9 +59,10 @@ class NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper impleme /** * Loads the descriptor XML file * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function loadDescriptorXml () { + public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to answer a request: node-list...'); diff --git a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php index 2a6c37cd5..255afe5c6 100644 --- a/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php +++ b/application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php @@ -55,9 +55,10 @@ class HubSelfConnectHelper extends BaseHubHelper implements HelpableHub { /** * Loads the descriptor XML file * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function loadDescriptorXml () { + public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting self-connect...'); diff --git a/application/hub/main/helper/hub/requests/class_NodeRequestNodeListHelper.php b/application/hub/main/helper/hub/requests/class_NodeRequestNodeListHelper.php index 8133f9962..3fea83238 100644 --- a/application/hub/main/helper/hub/requests/class_NodeRequestNodeListHelper.php +++ b/application/hub/main/helper/hub/requests/class_NodeRequestNodeListHelper.php @@ -55,9 +55,10 @@ class NodeRequestNodeListHelper extends BaseHubHelper implements HelpableHub { /** * Loads the descriptor XML file * + * @param $nodeInstance An instance of a NodeHelper class * @return void */ - public function loadDescriptorXml () { + public function loadDescriptorXml (NodeHelper $nodeInstance) { // Debug message self::createDebugInstance(__CLASS__)->debugOutput('HELPER: Attempting to request node list...'); diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index b596da7f0..d1f251a7a 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -501,7 +501,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_announcement_helper_class'); // Load the announcement descriptor - $helperInstance->loadDescriptorXml(); + $helperInstance->loadDescriptorXml($this); // Compile all variables $helperInstance->getTemplateInstance()->compileConfigInVariables(); @@ -532,7 +532,7 @@ class BaseHubNode extends BaseHubSystem implements Updateable { $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_self_connect_helper_class', array($this)); // Load the descriptor (XML) file - $helperInstance->loadDescriptorXml(); + $helperInstance->loadDescriptorXml($this); // Compile all variables $helperInstance->getTemplateInstance()->compileConfigInVariables();