]> git.mxchange.org Git - hub.git/commitdiff
WIP-continued:
authorRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2020 17:46:06 +0000 (18:46 +0100)
committerRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2020 17:46:06 +0000 (18:46 +0100)
- rewrites towards DeliverableMessage (not Package) interface

Signed-off-by: Roland Häder <roland@mxchange.org>
35 files changed:
application/hub/classes/chains/class_PackageFilterChain.php
application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/filter/class_BaseHubFilter.php
application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php
application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php
application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php
application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php
application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php
application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php
application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php
application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php
application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php
application/hub/classes/handler/data/class_BaseDataHandler.php
application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php
application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php
application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php
application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php
application/hub/classes/helper/node/answer/class_BaseHubAnswerHelper.php
application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php
application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php
application/hub/classes/nodes/class_BaseHubNode.php
application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php
application/hub/interfaces/distributable/node/class_DistributableNode.php
application/hub/interfaces/filter/class_FilterablePackage.php
application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php
application/hub/interfaces/handler/message-types/class_HandleableMessage.php
application/hub/interfaces/nodes/class_Node.php
application/hub/interfaces/receiver/class_Receivable.php

index eda0e0ab9730292596b043665bad43b070f3bc44..6b02d776b8c8d65593922bc4270c9e30b9cc72f6 100644 (file)
@@ -3,6 +3,7 @@
 namespace Org\Shipsimu\Hub\FilterChain\Package;
 
 // Import application-specific stuff
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
@@ -57,7 +58,7 @@ class PackageFilterChain extends FilterChain {
        /**
         * Processes the given raw message content through all filters
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @todo        This may be slow if a message with a lot tags arrived
@@ -67,7 +68,7 @@ class PackageFilterChain extends FilterChain {
                foreach ($this->getFilters() as $filterInstance) {
                        // Try to process it
                        try {
-                               $filterInstance->processMessage($messageData, $packageInstance);
+                               $filterInstance->processMessage($messageInstance, $packageInstance);
                        } catch (FilterChainException $e) {
                                // This exception can be thrown to just skip any further processing
                                self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('Failed to execute lase filter ' . $filterInstance->__toString() . ': ' . $e->getMessage());
index cc4b9f4a97e8a9246bcf35960bc1a6aadef7b65b..0fc3de48d121ade928bdc8aaf4a504f30afa82f6 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Database\Frontend\Node\Dht;
 use Org\Shipsimu\Hub\Database\Frontend\BaseHubDatabaseWrapper;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 use Org\Shipsimu\Hub\Node\BaseHubNode;
 
@@ -351,7 +352,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp
        /**
         * Registeres a node by given message data.
         *
-        * @param       $messageData            An array of all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @return      void
         */
@@ -366,7 +367,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp
                $dataSetInstance->setUniqueKey(self::DB_COLUMN_SESSION_ID);
 
                // Add all array elements
-               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
+               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Remove 'node_list'
                $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST);
@@ -381,7 +382,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp
        /**
         * Updates an existing entry in node list
         *
-        * @param       $messageData            An array of all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $searchInstance         An instance of LocalSearchCriteria class
         * @return      void
@@ -400,7 +401,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp
                $dataSetInstance->setUniqueKey(self::DB_COLUMN_SESSION_ID);
 
                // Add all array elements
-               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
+               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Remove 'node_list'
                $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST);
index 9f73914357adcad01f7ebd85853a7fe8994c7f72..741db76e9837ad3d778edcd38690a12d95839a54 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Dht\BaseDht;
 use Org\Shipsimu\Hub\Dht\Distributable;
 use Org\Shipsimu\Hub\Generic\BaseHubSystem;
 use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 
 // Import framework stuff
@@ -231,7 +232,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
-        * @param       $messageArray           An array with all minimum message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $forceUpdate            Optionally force update, don't register (default: register if not found)
         * @return      void
@@ -239,7 +240,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         */
        public function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, $forceUpdate = FALSE) {
                // Get a search criteria class
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageData()=%d,handlerInstance=%s,forceUpdate=%d - CALLED', $this->getPrintableState(), count($messageData), $handlerInstance->__toString(), intval($forceUpdate)));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageInstance=%s,handlerInstance=%s,forceUpdate=%d - CALLED', $this->getPrintableState(), $messageInstance->__toString(), $handlerInstance->__toString(), intval($forceUpdate)));
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Search for the node's session id and external address/hostname + TCP/UDP listen port
@@ -266,16 +267,16 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                // Is there already an entry?
                if ($resultInstance->valid()) {
                        // Entry found, so update it
-                       $this->getWrapperInstance()->updateNodeByMessageInstance($messageData, $handlerInstance, $searchInstance);
+                       $this->getWrapperInstance()->updateNodeByMessageInstance($messageInstance, $handlerInstance, $searchInstance);
                } elseif ($forceUpdate === FALSE) {
                        // Nothing found, so register it
-                       $this->getWrapperInstance()->registerNodeByMessageInstance($messageData, $handlerInstance);
+                       $this->getWrapperInstance()->registerNodeByMessageInstance($messageInstance, $handlerInstance);
                } else {
                        /*
                         * Do not register non-existent nodes here. This is maybe fatal,
                         * caused by "stolen" session id and/or not matching address.
                         */
-                       throw new NodeSessionIdVerficationException(array($this, $messageData), BaseHubSystem::EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING);
+                       throw new NodeSessionIdVerficationException(array($this, $messageInstance), BaseHubSystem::EXCEPTION_NODE_SESSION_ID_NOT_VERIFYING);
                }
 
                // Save last exception
@@ -286,7 +287,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * Queries the local DHT data(base) for a node list with all supported
         * object types except the node by given session id.
         *
-        * @param       $messageData            An array with message data from a node_list request
+        * @param       $messageInstance                An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $excludeKey                     Array key which should be excluded
         * @param       $andKey                         Array of $separator-separated list of elements which all must match
@@ -294,14 +295,9 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
         * @return      $nodeList                       An array with all found nodes
         */
        public function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, $excludeKey, $andKey, $separator) {
-               // Make sure both keys are there
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: messageData()=%d,handlerInstance=%s,excludeKey=%s,andKey=%s,separator=%s - CALLED!', count($messageData), $handlerInstance->__toString(), $excludeKey, $andKey, $separator));
-               assert((isset($messageData[$excludeKey])) && (isset($messageData[$andKey])));
-
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-DHT-FACADE: state=' . $this->getPrintableState() . ',messageData=' . print_r($messageData, TRUE));
-
                // Get a search criteria class
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: messageInstance=%s,handlerInstance=%s,excludeKey=%s,andKey=%s,separator=%s - CALLED!', $messageInstance->__toString(), $handlerInstance->__toString(), $excludeKey, $andKey, $separator));
+               /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: state=%s,messageInstance=%s', $this->getPrintableState(), print_r($messageInstance, TRUE)));
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add all keys
index 9bd3f7acfcd73bda0390e1f8efc18f6b335043f9..3eaf201637c320c61c369a56e1906fe2d3ab6153 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\Filter;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
@@ -61,18 +62,12 @@ abstract class BaseHubFilter extends BaseFilter {
         *                            well-formed
         *
         * @param       $messageType            Type of message
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @todo        Exceptions from renderXmlContent() are currently unhandled
         */
        protected function genericProcessMessage ($messageType, DeliverableMessage $messageInstance, Receivable $packageInstance) {
-               // Make sure the wanted element is there
-               assert(isset($messageData[NetworkPackageHandler::PACKAGE_CONTENT_MESSAGE]));
-               assert(isset($messageData[NetworkPackageHandler::PACKAGE_CONTENT_SENDER]));
-               assert(isset($messageData[NetworkPackageHandler::PACKAGE_CONTENT_HASH]));
-               assert(isset($messageData[NetworkPackageHandler::PACKAGE_CONTENT_TAGS]));
-
                // Get a template instance from the factory
                $templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance(sprintf('node_%s_template_class', $messageType));
 
index 20b3587aed2f51cdedf91533f2cd24a6d3224c1a..77158e47071b2583f234b2acd92e8391cac14ab9 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Answer\Announcement;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
@@ -88,13 +89,13 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte
         * Processes the given raw message content. The method renderXmlContent
         * may throw (not the method itself) several exceptions:
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process message in generic way
-               $this->genericProcessMessage('announcement_answer', $messageData, $packageInstance);
+               $this->genericProcessMessage('announcement_answer', $messageInstance, $packageInstance);
        }
 
        /**
@@ -109,7 +110,5 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index e10aec193ca14677aed6deee9460d3475c1d9c92..0adce52318f07b927ba96175a1a6c8ba1a45bd2f 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Answer\Dht\Bootstrap;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap\XmlDhtBootstrapAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
@@ -85,13 +86,13 @@ class PackageDhtBootstrapAnswerTagFilter extends BaseNodeFilter implements Filte
         * Processes the given raw message content. The method renderXmlContent
         * may throw (not the method itself) several exceptions:
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process message in generic way
-               $this->genericProcessMessage('dht_bootstrap_answer', $messageData, $packageInstance);
+               $this->genericProcessMessage('dht_bootstrap_answer', $messageInstance, $packageInstance);
        }
 
        /**
@@ -106,7 +107,5 @@ class PackageDhtBootstrapAnswerTagFilter extends BaseNodeFilter implements Filte
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 27d5645288b87d18f8b9f3a9c392a605352eeeea..cbb8932d57e0740f1e40c915759b0a8096fa10f0 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Answer\Request\NodeList;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Request\NodeList\XmlRequestNodeListAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
@@ -85,13 +86,13 @@ class PackageRequestNodeListAnswerTagFilter extends BaseNodeFilter implements Fi
         * Processes the given raw message content. The method renderXmlContent
         * may throw (not the method itself) several exceptions:
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process message in generic way
-               $this->genericProcessMessage('request_node_list_answer', $messageData, $packageInstance);
+               $this->genericProcessMessage('request_node_list_answer', $messageInstance, $packageInstance);
        }
 
        /**
@@ -106,7 +107,5 @@ class PackageRequestNodeListAnswerTagFilter extends BaseNodeFilter implements Fi
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index a6e28e2663783e5a2c720336bdbf4beb832f05cd..d832eef11c82f6371dd1093d300c2816f498c651 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Announcement;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Announcement\XmlAnnouncementTemplateEngine;
 
 // Import framework stuff
@@ -94,13 +95,13 @@ class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterableP
         * XmlParserException       - If the XML message is damaged or not
         *                            well-formed
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process message generic
-               $this->genericProcessMessage('announcement', $messageData, $packageInstance);
+               $this->genericProcessMessage('announcement', $messageInstance, $packageInstance);
        }
 
        /**
@@ -115,7 +116,5 @@ class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterableP
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 22829a6dac8df7954cc8052d64d95cb896da283f..966ef7a0cf7baca79538ce9c96f379333972c40a 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Dht\Bootstrap;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
 
@@ -93,13 +94,13 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP
         * XmlParserException       - If the XML message is damaged or not
         *                            well-formed
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process message generic
-               $this->genericProcessMessage('dht_bootstrap', $messageData, $packageInstance);
+               $this->genericProcessMessage('dht_bootstrap', $messageInstance, $packageInstance);
        }
 
        /**
@@ -114,7 +115,5 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 62fd58ab72ca56c80c39d68599743c572a091689..93525df2c49150defa4bd659c1250fdf4b18517f 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\Request\NodeList;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
 
@@ -82,13 +83,13 @@ class PackageRequestNodeListTagFilter extends BaseNodeFilter implements Filterab
        /**
         * Processes the given raw message content.
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process messasge generic
-               $this->genericProcessMessage('request_node_list', $messageData, $packageInstance);
+               $this->genericProcessMessage('request_node_list', $messageInstance, $packageInstance);
        }
 
        /**
@@ -103,7 +104,5 @@ class PackageRequestNodeListTagFilter extends BaseNodeFilter implements Filterab
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 32649f8192ca2d9f40f527b27e7977a56c234bde..bc373090ff517cd72efedb377a7841e702caacb1 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Filter\Tag\Network\SelfConnect;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Filter\Network\FilterablePackage;
 use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Tag\Tagable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\SelfConnect\XmlSelfConnectTemplateEngine;
@@ -91,13 +92,13 @@ class PackageSelfConnectTagFilter extends BaseNodeFilter implements FilterablePa
         * XmlParserException       - If the XML message is damaged or not
         *                            well-formed
         *
-        * @param       $messageData            Raw message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
        public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
                // Process generic
-               $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageData, $packageInstance);
+               $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageInstance, $packageInstance);
        }
 
        /**
index 097b0c30d0dd8e43c4d9c94ff63ad6fff82bb080..13ef618f1a74535eaf86a4a5400f37e1483858a7 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Database\Frontend\Node\Dht\NodeDistributedHashTableDatabase
 use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Node\BaseHubNode;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
@@ -73,7 +74,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
        /**
         * Handles given message data array
         *
-        * @param       $messageData            An array of message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @todo        Do some more here: Handle karma, et cetera?
@@ -83,7 +84,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
                 * Query DHT and force update (which will throw an exception if the
                 * node is not found).
                 */
-               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this, TRUE);
+               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageInstance, $this, TRUE);
 
                // Get handler instance
                $handlerInstance = GenericRegistry::getRegistry()->getInstance('task_handler');
@@ -102,7 +103,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
                $nodeInstance->getStateInstance()->nodeAnnouncementSuccessful();
 
                // Prepare next message
-               $this->prepareNextMessage($messageData, $packageInstance);
+               $this->prepareNextMessage($messageInstance, $packageInstance);
        }
 
        /**
@@ -120,7 +121,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
         *   answer-status       => OKAY
         *   message_type        => announcement_answer
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
@@ -137,9 +138,9 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
 
        /**
         * Removes configuration data with given message data array from global
-        * configuration. For content of $messageData see method comment above.
+        * configuration. For content of $messageInstance see method comment above.
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
index e573ad4ca7878ccffda85c23b5279d80b633604f..4977bac570499f038b3feaa2c349dcc467584ece 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Handler\Answer\Okay\NodeList;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Request\NodeList\XmlRequestNodeListAnswerTemplateEngine;
 
@@ -68,16 +69,13 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement
        /**
         * Handles given message data array
         *
-        * @param       $messageData            An array of message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      NodeSessionIdVerficationException       If the provided session id is not matching
         * @todo        Do some more here: Handle karma, et cetera?
         */
        public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
-               // Make sure node-list is found in array
-               assert(isset($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
-
                // Save node list
                $nodeList = json_decode(base64_decode($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
 
@@ -94,10 +92,10 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement
                 * Query DHT and force update (which will throw an exception if the
                 * node is not found).
                 */
-               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this, TRUE);
+               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageInstance, $this, TRUE);
 
                // Prepare next message ("hello" message to all returned nodes)
-               //$this->prepareNextMessage($messageData, $packageInstance);
+               // @TODO $this->prepareNextMessage($messageInstance, $packageInstance);
        }
 
        /**
@@ -110,7 +108,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement
         *   answer-status => OKAY
         *   message_type  => request_node_list_answer
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @todo        0% done
         */
@@ -120,9 +118,9 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement
 
        /**
         * Removes configuration data with given message data array from global
-        * configuration. For content of $messageData see method comment above.
+        * configuration. For content of $messageInstance see method comment above.
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @todo        0% done
         */
index 75bffb7076dcd630d67d2ec4ad35e96c57817b12..48e04bc1cbcf9b82e66ba25f60d34835688ee2eb 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Generic\HubInterface;
 use Org\Shipsimu\Hub\Handler\BaseHubHandler;
 use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
@@ -103,7 +104,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
        /**
         * Prepares a message as answer for given message data for delivery.
         *
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Deliverable instance
         * @return      void
         */
@@ -112,7 +113,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Going to send an answer message for ' . $this->getHandlerName() . ' ...');
 
                // Get a helper instance based on this handler's name
-               $helperInstance = ObjectFactory::createObjectByConfiguredName('node_answer_' . $this->getHandlerName() . '_helper_class', array($messageData));
+               $helperInstance = ObjectFactory::createObjectByConfiguredName('node_answer_' . $this->getHandlerName() . '_helper_class', array($messageInstance));
 
                // Get node instance
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER: Creating node instance ...');
@@ -125,7 +126,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                 * Set missing (temporary) configuration data, mostly it needs to be
                 * copied from message data array.
                 */
-               $this->initMessageConfigurationData($messageData);
+               $this->initMessageConfigurationData($messageInstance);
 
                // Compile any configuration variables
                $helperInstance->getTemplateInstance()->compileConfigInVariables();
@@ -137,7 +138,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                /*
                 * Remove temporary configuration
                 */
-               $this->removeMessageConfigurationData($messageData);
+               $this->removeMessageConfigurationData($messageInstance);
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Answer message has been prepared.');
@@ -146,7 +147,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
        /**
         * Prepares the next message
         *
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Deliverable instance
         * @return      void
         */
@@ -155,7 +156,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Going to send next message ...');
 
                // Get a helper instance based on this handler's name
-               $helperInstance = ObjectFactory::createObjectByConfiguredName('node_next_' . $this->getHandlerName() . '_helper_class', array($messageData));
+               $helperInstance = ObjectFactory::createObjectByConfiguredName('node_next_' . $this->getHandlerName() . '_helper_class', array($messageInstance));
 
                // Get node instance
                $nodeInstance = NodeObjectFactory::createNodeInstance();
@@ -167,7 +168,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                 * Set missing (temporary) configuration data, mostly it needs to be
                 * copied from message data array.
                 */
-               $this->initMessageConfigurationData($messageData);
+               $this->initMessageConfigurationData($messageInstance);
 
                // Compile any configuration variables
                $helperInstance->getTemplateInstance()->compileConfigInVariables();
@@ -179,7 +180,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                /*
                 * Remove temporary configuration
                 */
-               $this->removeMessageConfigurationData($messageData);
+               $this->removeMessageConfigurationData($messageInstance);
 
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Next message has been prepared.');
@@ -188,7 +189,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        abstract protected function initMessageConfigurationData (DeliverableMessage $messageInstance);
@@ -197,7 +198,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        abstract protected function removeMessageConfigurationData (DeliverableMessage $messageInstance);
index 300ac897012e4f245e09a5187361ce8c6be26867..d583bfd6cc4879d3154a76356b4af478bf93d14c 100644 (file)
@@ -8,6 +8,7 @@ use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Generic\BaseHubSystem;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Announcement\XmlAnnouncementTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
@@ -102,7 +103,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      AnnouncementNotAcceptedException        If this node does not accept announcements
@@ -118,26 +119,26 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                         * This node is not accepting announcements, then someone wants to
                         * announce his node to a non-bootstrap and non-master node.
                         */
-                       throw new AnnouncementNotAcceptedException(array($this, $nodeInstance, $messageData), BaseHubSystem::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
+                       throw new AnnouncementNotAcceptedException(array($this, $nodeInstance, $messageInstance), BaseHubSystem::EXCEPTION_ANNOUNCEMENT_NOT_ACCEPTED);
                } // END - if
 
                // Register the announcing node with this node
-               $this->registerNodeByMessageInstance($messageData);
+               $this->registerNodeByMessageInstance($messageInstance);
 
                // Prepare answer message to be delivered back to the other node
-               $this->prepareAnswerMessage($messageData, $packageInstance);
+               $this->prepareAnswerMessage($messageInstance, $packageInstance);
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -153,14 +154,12 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, TRUE));
-
                // "Walk" throught the translation array
+               /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
                foreach ($this->messageToConfig as $messageKey => $configKey) {
                        // Debug message
                        /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
@@ -189,7 +188,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageData    An instance of a DeliverableMessage class
         * @return      void
         */
        protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
index 6b0413e913533470eb7dd85cd3b0dbc81fe5ec7a..b489a9593b91401e6da66ed30210798580a78f09 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Handler\Node\Answer\Announcement;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Announcement\XmlAnnouncementTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
@@ -104,7 +105,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      NoAnnouncementAttemptedException        If this node has not attempted to announce itself
@@ -120,26 +121,26 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                         * This node has never announced itself, so it doesn't expect
                         * announcement answer messages.
                         */
-                       throw new NoAnnouncementAttemptedException(array($this, $nodeInstance, $messageData), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
+                       throw new NoAnnouncementAttemptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
                } // END - if
 
                // Register the announcing node with this node
-               $this->registerNodeByMessageInstance($messageData);
+               $this->registerNodeByMessageInstance($messageInstance);
 
                // Handle the answer status element
-               $nodeInstance->handleAnswerStatusByMessageInstance($messageData, $packageInstance);
+               $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $packageInstance);
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -157,7 +158,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
@@ -170,7 +171,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
@@ -178,7 +179,5 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                // Please don't call this method
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
-}
 
-// [EOF]
-?>
+}
index 856de438f23ba4ab01e77f9879fd17045464900d..078a3cc5da31365ac96501a1ebff0deb8271a492 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Handler\Answer\Node\DhtBootstrap;
 use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap\XmlDhtBootstrapAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
@@ -101,7 +102,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      NoDhtBootstrapAttemptedException        If this DHT has not attempted to bootstrap
@@ -117,23 +118,23 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                         * This DHT has never bootstrapped, so it doesn't expect
                         * announcement answer messages.
                         */
-                       throw new NoDhtBootstrapAttemptedException(array($this, $dhtInstance, $messageData), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED);
+                       throw new NoDhtBootstrapAttemptedException(array($this, $dhtInstance, $messageInstance), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ATTEMPTED);
                } // END - if
 
                // Unfinished
-               $this->partialStub('UNHANDLED: messageData=' . print_r($messageData, TRUE));
+               $this->partialStub('UNHANDLED: messageInstance=' . print_r($messageInstance, TRUE));
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -151,7 +152,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
@@ -164,7 +165,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
index 8cfaacb3ab699bde5cd4eb20c89681b7c030ba07..dbc65a5a11f5baee09d88ca159bbbc9093541c6a 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Handler\Node\Answer\Request\NodeList;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Request\NodeList\XmlRequestNodeListAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
@@ -87,7 +88,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      NoRequestNodeListAttemptedException     If this node has not attempted to announce itself
@@ -103,29 +104,29 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                         * This node has never announced itself, so it doesn't expect
                         * request-node-list answer messages.
                         */
-                       throw new NoRequestNodeListAttemptedException(array($this, $nodeInstance, $messageData), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
+                       throw new NoRequestNodeListAttemptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_ANNOUNCEMENT_NOT_ATTEMPTED);
                } // END - if
 
                // Register the announcing node with this node
-               $this->registerNodeByMessageInstance($messageData);
+               $this->registerNodeByMessageInstance($messageInstance);
 
                // Handle the answer status element
-               $nodeInstance->handleAnswerStatusByMessageInstance($messageData, $packageInstance);
+               $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $packageInstance);
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageData=' . print_r($messageData, TRUE));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANSWER-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -146,7 +147,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
@@ -159,7 +160,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
index e6c451171f9d029ca01470b2211ce81c53f453aa..742f3791bd23a293ec49758a907d063eaba3a16d 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Handler\Message;
 use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Generic\BaseHubSystem;
 use Org\Shipsimu\Hub\Handler\Data\BaseDataHandler;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
@@ -73,7 +74,7 @@ abstract class BaseMessageHandler extends BaseDataHandler {
         * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
-        * @param       $messageArray   An array with all minimum message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function registerNodeByMessageInstance (DeliverableMessage $messageInstance) {
@@ -81,13 +82,13 @@ abstract class BaseMessageHandler extends BaseDataHandler {
                assert(count($this->getSearchData()) > 0);
 
                // Let the DHT facade do the work
-               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this);
+               DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageInstance, $this);
        }
 
        /**
         * Posty-handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
@@ -96,7 +97,7 @@ abstract class BaseMessageHandler extends BaseDataHandler {
                 * Feed hash to miner by handling over the whole array as also the
                 * sender and tags are needed.
                 */
-               $packageInstance->feedHashToMiner($messageData);
+               $packageInstance->feedHashToMiner($messageInstance);
        }
 
 }
index 9c1a4b47363e9ba83e3d5874a1237b1669534baf..f4950bf575c7da2052bd54d437c5b9034b55b875 100644 (file)
@@ -8,6 +8,7 @@ use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Dht\Bootstrap\XmlDhtBootstrapAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
@@ -97,7 +98,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      DhtBootstrapNotAcceptedException        If this node does not accept DHT bootstrap requests
@@ -109,26 +110,26 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                        /*
                         * This node is not accepting DHT bootstrap requests.
                         */
-                       throw new DhtBootstrapNotAcceptedException(array($this, $messageData), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
+                       throw new DhtBootstrapNotAcceptedException(array($this, $messageInstance), self::EXCEPTION_DHT_BOOTSTRAP_NOT_ACCEPTED);
                } // END - if
 
                // Register the DHT bootstrap requesting node with this node
-               $this->registerNodeByMessageInstance($messageData);
+               $this->registerNodeByMessageInstance($messageInstance);
 
                // Prepare answer message to be delivered back to the other node
-               $this->prepareAnswerMessage($messageData, $packageInstance);
+               $this->prepareAnswerMessage($messageInstance, $packageInstance);
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -143,19 +144,15 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageData=' . print_r($messageData, TRUE));
-
                // "Walk" throught the translation array
+               /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
                foreach ($this->messageToConfig as $messageKey => $configKey) {
-                       // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
-
                        // Set the element in configuration
+                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
                        $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
                } // END - foreach
 
@@ -193,7 +190,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
index 0f7624d2e4ec9a6a95cb8eb03210f1a391bf3840..9c08b8c5aa6c84caae0284a32d5df181f3940a98 100644 (file)
@@ -8,6 +8,7 @@ use Org\Shipsimu\Hub\Factory\Dht\DhtObjectFactory;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Node\BaseHubNode;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
@@ -82,7 +83,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @throws      RequestNotAcceptedException             If this node does not accept this request
@@ -98,26 +99,26 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                         * This node is not accepting node list requests. Throw an
                         * exception to abort any further processing.
                         */
-                       throw new RequestNotAcceptedException(array($this, $nodeInstance, $messageData), self::EXCEPTION_REQUEST_NOT_ACCEPTED);
+                       throw new RequestNotAcceptedException(array($this, $nodeInstance, $messageInstance), self::EXCEPTION_REQUEST_NOT_ACCEPTED);
                } // END - if
 
                // Register the announcing node with this node
-               $this->registerNodeByMessageInstance($messageData);
+               $this->registerNodeByMessageInstance($messageInstance);
 
                // Prepare answer message to be delivered back to the other node
-               $this->prepareAnswerMessage($messageData, $packageInstance);
+               $this->prepareAnswerMessage($messageInstance, $packageInstance);
        }
 
        /**
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Add all ements
                foreach ($this->messageDataElements as $key) {
@@ -132,12 +133,12 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
                // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageData=' . print_r($messageData, TRUE));
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
 
                // "Walk" throught the config-copy array
                foreach ($this->configCopy as $targetKey => $sourceKey) {
@@ -150,7 +151,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
 
                // Query local DHT for nodes except given session id
                $nodeList = DhtObjectFactory::createDhtInstance('node')->queryLocalNodeListExceptByMessageInstance(
-                       $messageData,
+                       $messageInstance,
                        $this,
                        XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
                        XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
@@ -174,7 +175,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
         * Removes configuration data with given message data array from global
         * configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
index d419a8d37b3dcb0cea07998a14b45c0f3f6fe80a..f7981a76366eb92889b4ab289a55eca96cb378a6 100644 (file)
@@ -6,6 +6,7 @@ namespace Org\Shipsimu\Hub\Handler\Node\Message\SelfConnect;
 use Org\Shipsimu\Hub\Factory\Node\NodeObjectFactory;
 use Org\Shipsimu\Hub\Handler\Message\BaseMessageHandler;
 use Org\Shipsimu\Hub\Handler\Message\HandleableMessage;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\SelfConnect\XmlSelfConnectTemplateEngine;
 
@@ -66,7 +67,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
@@ -85,7 +86,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
                } else {
                        // Something really horrible happened
                        // @TODO Throw an exception here instead of dying
-                       $this->debugInstance(sprintf('[%s:%d]: ids mismatching! messageData=%s', __METHOD__, __LINE__, print_r($messageData, TRUE)));
+                       $this->debugInstance(sprintf('[%s:%d]: ids mismatching! messageInstance=%s', __METHOD__, __LINE__, print_r($messageInstance, TRUE)));
                }
        }
 
@@ -93,13 +94,13 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
         * Adds all required elements from given array into data set instance
         *
         * @param       $dataSetInstance        An instance of a StoreableCriteria class
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) {
                // Add generic first
-               parent::addArrayToDataSet($dataSetInstance, $messageData);
+               parent::addArrayToDataSet($dataSetInstance, $messageInstance);
 
                // Please don't call this method!
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
@@ -108,7 +109,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
        /**
         * Initializes configuration data from given message data array
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
@@ -120,7 +121,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
        /**
         * Removes configuration data with given message data array from global configuration
         *
-        * @param       $messageData    An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @throws      UnsupportedOperationException   If this method is called
         */
index 7a9b00cd36b2fd4383a4c2f10818fe9455860db6..548078ff5291e138fb2392196fc0f01802967472 100644 (file)
@@ -21,6 +21,7 @@ use Org\Shipsimu\Hub\Helper\Connection\ConnectionHelper;
 use Org\Shipsimu\Hub\Helper\HubHelper;
 use Org\Shipsimu\Hub\Information\ShareableInfo;
 use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Networkable;
 use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\PackageFragmenter;
@@ -1554,7 +1555,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
        public function handleProcessedMessage () {
                // Get it from the stacker, it is the full array with the processed message
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: CALLED!');
-               $messageArray = $this->getStackInstance()->popNamed(self::STACKER_NAME_PROCESSED_MESSAGE);
+               $messageInstance = $this->getStackInstance()->popNamed(self::STACKER_NAME_PROCESSED_MESSAGE);
 
                // Add type for later easier handling
                $messageArray[self::MESSAGE_ARRAY_DATA][self::MESSAGE_ARRAY_TYPE] = $messageArray[self::MESSAGE_ARRAY_TYPE];
@@ -1581,15 +1582,13 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
         * leads to an endless loop. You may wish to run the miner to get some
         * reward ("Hubcoins") for "mining" this hash.
         *
-        * @param       $messageData    Array with message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         * @todo        ~10% done?
         */
        public function feedHashToMiner (DeliverableMessage $messageInstance) {
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: messageData()=%d - CALLED!', count($messageData)));
-
                // Is the feature enabled?
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: messageInstance=%s - CALLED!', $messageInstance->__toString()));
                if (!FrameworkFeature::isFeatureAvailable('hubcoin_reward')) {
                        /*
                         * Feature is not enabled, don't feed the hash to the miner as it
@@ -1598,11 +1597,6 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                        return;
                } // END - if
 
-               // Make sure the required elements are there
-               assert(isset($messageData[self::MESSAGE_ARRAY_SENDER]));
-               assert(isset($messageData[self::MESSAGE_ARRAY_HASH]));
-               assert(isset($messageData[self::MESSAGE_ARRAY_DATA][self::MESSAGE_ARRAY_DATA_NODE_ID]));
-
                // Copy node id
                $messageData[self::MESSAGE_ARRAY_DATA_NODE_ID] = $messageData[self::MESSAGE_ARRAY_DATA][self::MESSAGE_ARRAY_DATA_NODE_ID];
 
@@ -1610,10 +1604,8 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                unset($messageData[self::MESSAGE_ARRAY_TYPE]);
                unset($messageData[self::MESSAGE_ARRAY_DATA]);
 
-               // Debug message
-               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: messageData=' . print_r($messageData, TRUE));
-
                // Resolve session id ('sender' is a session id) into node id
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: messageData=' . print_r($messageData, TRUE));
                $nodeId = HubTools::resolveNodeIdBySessionId($messageData[self::MESSAGE_ARRAY_SENDER]);
 
                // Is 'claim_reward' the message type?
@@ -1629,7 +1621,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
                unset($messageData[self::MESSAGE_ARRAY_TAGS]);
 
                // Unfinished stuff:
-               $this->partialStub(sprintf('[%s:%d]: @TODO nodeId=%s,messageData=%s', __METHOD__, __LINE__, $nodeId, print_r($messageData, TRUE)));
+               $this->partialStub(sprintf('[%s:%d]: @TODO nodeId=%s,messageInstance=%s', __METHOD__, __LINE__, $nodeId, print_r($messageInstance, TRUE)));
        }
 
 }
index 4727af3841b1fc0baf7abf78b2350f11772b9f14..f7a671fc313b22ff1228bb82ca27b3e655ecd22d 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Factory\Handler\Network\NetworkPackageHandlerFactory;
 use Org\Shipsimu\Hub\Factory\Network\NetworkPackageFactory;
 use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
 use Org\Shipsimu\Hub\Helper\Node\HelpableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Node\Node;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Announcement\XmlAnnouncementTemplateEngine;
 
@@ -53,7 +54,7 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements
        /**
         * Creates the helper class
         *
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      $helperInstance         A prepared instance of this helper
         */
        public final static function createNodeAnnouncementMessageAnswerHelper (DeliverableMessage $messageInstance) {
@@ -65,7 +66,7 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements
                $helperInstance->setRecipientId($messageData[XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID]);
 
                // Set message data
-               $helperInstance->setMessageData($messageData);
+               $helperInstance->setMessageData($messageInstance);
 
                // Return the prepared instance
                return $helperInstance;
index f4c1dbe3eee834e6f5fa183388bad6d3b0698ace..46fe7d598bdcea76278a64c940de5d2d39b34a09 100644 (file)
@@ -4,6 +4,7 @@ namespace Helper\Node\Answer;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Helper\Node\BaseNodeHelper;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 
 /**
  * A general hub message answer helper class
@@ -29,9 +30,9 @@ use Org\Shipsimu\Hub\Helper\Node\BaseNodeHelper;
  */
 abstract class BaseHubAnswerHelper extends BaseNodeHelper {
        /**
-        * Message data array
+        * Message instance
         */
-       private $messageData = array();
+       private $messageInstance = NULL;
 
        /**
         * Protected constructor
@@ -47,19 +48,19 @@ abstract class BaseHubAnswerHelper extends BaseNodeHelper {
        /**
         * Setter for message data
         *
-        * @return      $messageData    An array with message data
+        * @return      $messageInstance        An instance of a DeliverableMessage class
         */
-       protected final function setMessageData (DeliverableMessage $messageInstance) {
-               $this->messageData = $messageData;
+       protected final function setMessageInstance (DeliverableMessage $messageInstance) {
+               $this->messageInstance = $messageInstance;
        }
 
        /**
         * Getter for message data
         *
-        * @return      $messageData    An array with message data
+        * @return      $messageInstance        An instance of a DeliverableMessage class
         */
-       public final function getMessageData () {
-               return $this->messageData;
+       public final function getMessageInstance () {
+               return $this->messageInstance;
        }
 
 }
index 17742a1cb31b2418281a201e0171fbd56632a96e..936cc7c126ac56cead63f5e4a83107f83e840bec 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Factory\Handler\Network\NetworkPackageHandlerFactory;
 use Org\Shipsimu\Hub\Factory\Network\NetworkPackageFactory;
 use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
 use Org\Shipsimu\Hub\Helper\Node\HelpableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Node\Node;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
 
@@ -53,7 +54,7 @@ class NodeDhtBootstrapMessageAnswerHelper extends BaseHubAnswerHelper implements
        /**
         * Creates the helper class
         *
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      $helperInstance         A prepared instance of this helper
         */
        public final static function createNodeDhtBootstrapMessageAnswerHelper (DeliverableMessage $messageInstance) {
@@ -65,7 +66,7 @@ class NodeDhtBootstrapMessageAnswerHelper extends BaseHubAnswerHelper implements
                $helperInstance->setRecipientId($messageData[XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID]);
 
                // Set message data
-               $helperInstance->setMessageData($messageData);
+               $helperInstance->setMessageData($messageInstance);
 
                // Return the prepared instance
                return $helperInstance;
index 41bdfb70f7fad3d738ce32e4c65f29639a06a27c..8f7fe52b0d27e4f5796311a32354090f2eae6cea 100644 (file)
@@ -7,6 +7,7 @@ use Org\Shipsimu\Hub\Factory\Handler\Network\NetworkPackageHandlerFactory;
 use Org\Shipsimu\Hub\Factory\Network\NetworkPackageFactory;
 use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
 use Org\Shipsimu\Hub\Helper\Node\HelpableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Node\Node;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
 
@@ -53,7 +54,7 @@ class NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper impleme
        /**
         * Creates the helper class
         *
-        * @param       $messageData            An array with all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      $helperInstance         A prepared instance of this helper
         */
        public final static function createNodeRequestNodeListMessageAnswerHelper (DeliverableMessage $messageInstance) {
@@ -65,7 +66,7 @@ class NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper impleme
                $helperInstance->setRecipientId($messageData[XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID]);
 
                // Set message data
-               $helperInstance->setMessageData($messageData);
+               $helperInstance->setMessageData($messageInstance);
 
                // Return the prepared instance
                return $helperInstance;
index d83b0054f0ee9d32b7bb28199f06948386099d3b..88a432b1f83243cbf7936b9b41e551b4b4f69ffc 100644 (file)
@@ -10,6 +10,7 @@ use Org\Shipsimu\Hub\Factory\State\Node\NodeStateFactory;
 use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
 use Org\Shipsimu\Hub\Generic\BaseHubSystem;
 use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 use Org\Shipsimu\Hub\Template\Engine\Xml\Network\Answer\BaseXmlAnswerTemplateEngine;
 use Org\Shipsimu\Hub\Template\Engine\Xml\ObjectRegistry\XmlObjectRegistryTemplateEngine;
@@ -799,15 +800,12 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC
        /**
         * Handles message answer by given data array
         *
-        * @param       $messageData            A valid answer message data array
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         * @todo        Handle thrown exception
         */
        public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance) {
-               // Is it not empty?
-               assert(!empty($messageData[BaseXmlAnswerTemplateEngine::ANSWER_STATUS]));
-
                // Construct configuration entry for handling class' name
                $classConfigEntry = strtolower($messageData[NetworkPackageHandler::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[BaseXmlAnswerTemplateEngine::ANSWER_STATUS]) . '_handler_class';
 
@@ -815,7 +813,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC
                $handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);
 
                // Handle it there
-               $handlerInstance->handleAnswerMessageData($messageData, $packageInstance);
+               $handlerInstance->handleAnswerMessageData($messageInstance, $packageInstance);
        }
 
        /**
index acbd2b18dbdee1a71f1c923cd1839179230278cb..2949a8b25ecdaec1bc3304a3fd57bad07b1dc034 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\Database\Frontend\Node\Dht;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 
 // Import framework stuff
@@ -83,7 +84,7 @@ interface NodeDhtWrapper extends DatabaseWrapper {
        /**
         * Registeres a node by given message data.
         *
-        * @param       $messageData            An array of all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @return      void
         */
@@ -92,7 +93,7 @@ interface NodeDhtWrapper extends DatabaseWrapper {
        /**
         * Updates an existing entry in node list
         *
-        * @param       $messageData            An array of all message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $searchInstance         An instance of LocalSearchCriteria class
         * @return      void
index a8af1d62debe7fc1e8dbeadf5a215d93bac6240d..0699f318c3551130040552e09037d9bd0b923e10 100644 (file)
@@ -5,6 +5,7 @@ namespace Org\Shipsimu\Hub\Dht\Node;
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Dht\Distributable;
 use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 
 // Import framework stuff
 use Org\Mxchange\CoreFramework\Handler\DataSet\HandleableDataSet;
@@ -56,7 +57,7 @@ interface DistributableNode extends Distributable {
         * - external-address (hostname or IP number)
         * - listen-port (TCP/UDP listen port for inbound connections)
         *
-        * @param       $messageData            An array with all minimum message data
+        * @param       $messageData    An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $forceUpdate            Optionally force update, don't register (default: register if not found)
         * @return      void
@@ -67,7 +68,7 @@ interface DistributableNode extends Distributable {
         * Queries the local DHT data(base) for a node list with all supported
         * object types except the node by given session id.
         *
-        * @param       $messageData            An array with message data from a node_list request
+        * @param       $messageData            An instance of a DeliverableMessage class
         * @param       $handlerInstance        An instance of a HandleableDataSet class
         * @param       $excludeKey                     Array key which should be excluded
         * @param       $andKey                         Array of $separator-separated list of elements which all must match
index 53a3501e0c5d24defc656773022a64fd7f1f8990..fd27add6944fac3dfd7e44fac544c4356d1aa652 100644 (file)
@@ -3,6 +3,7 @@
 namespace Org\Shipsimu\Hub\Filter\Network;
 
 // Import application-specific stuff
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
@@ -48,7 +49,5 @@ interface FilterablePackage extends Filterable {
         * @return      void
         */
        function postProcessMessage (Receivable $packageInstance);
-}
 
-// [EOF]
-?>
+}
index f3883719fc18379faa6b6c81432ac4d9eab611a6..58c94f3839e4d902616cc78b781e0d53ecff75e4 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\AnswerStatus\Node;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Generic\HubInterface;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
index 0f3859200b26fb7d494494c02b7e246daf820efc..74042102ba458a35e2f49bfea431e4410bfdc9a8 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\Handler\Message;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Generic\HubInterface;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
@@ -35,7 +36,7 @@ interface HandleableMessage extends HandleableDataSet, HubInterface {
        /**
         * Handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageData            An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
@@ -44,7 +45,7 @@ interface HandleableMessage extends HandleableDataSet, HubInterface {
        /**
         * Posty-handles data array of the message
         *
-        * @param       $messageData            An array with message data to handle
+        * @param       $messageData            An instance of a DeliverableMessage class
         * @param       $packageInstance        An instance of a Receivable class
         * @return      void
         */
index 9c3b976a636f07f647e107f5984cc43205c19c6d..807f122e99c2e1fc1473c9e2037b174218856653 100644 (file)
@@ -3,6 +3,7 @@
 namespace Org\Shipsimu\Hub\Node;
 
 // Import application-specific stuff
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Receive\Receivable;
 
 // Import framework stuff
index 14554adc669aa2fe3ef13d74c7013a4642ecbded..efaa98af939714f6bbfc024198e15825fd7a57cd 100644 (file)
@@ -4,6 +4,7 @@ namespace Org\Shipsimu\Hub\Network\Receive;
 
 // Import application-specific stuff
 use Org\Shipsimu\Hub\Network\Networkable;
+use Org\Shipsimu\Hub\Network\Message\DeliverableMessage;
 use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
 
 // Import application-specific stuff
@@ -151,7 +152,7 @@ interface Receivable extends HubInterface {
         * leads to an endless loop. You may wish to run the miner to get some
         * reward ("Hubcoins") for "mining" this hash.
         *
-        * @param       $messageData    Array with message data
+        * @param       $messageInstance        An instance of a DeliverableMessage class
         * @return      void
         */
        function feedHashToMiner (DeliverableMessage $messageInstance);