From d61d5e02c5a5eec8afb6e7b193d95e37eebf9a25 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 29 Oct 2020 18:16:02 +0100 Subject: [PATCH] WIP-continued: - rewrites towards DeliverableMessage (not Package) interface MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../chains/class_PackageFilterChain.php | 2 +- ...odeDistributedHashTableDatabaseWrapper.php | 4 +-- .../classes/dht/node/class_NodeDhtFacade.php | 10 +++--- .../classes/filter/class_BaseHubFilter.php | 2 +- ...ass_PackageAnnouncementAnswerTagFilter.php | 2 +- ...ass_PackageDhtBootstrapAnswerTagFilter.php | 2 +- ..._PackageRequestNodeListAnswerTagFilter.php | 2 +- .../class_PackageAnnouncementTagFilter.php | 2 +- .../class_PackageDhtBootstrapTagFilter.php | 2 +- .../class_PackageRequestNodeListTagFilter.php | 2 +- .../class_PackageSelfConnectTagFilter.php | 2 +- ...lass_NodeAnnouncementAnswerOkayHandler.php | 8 ++--- ...class_RequestNodeListAnswerOkayHandler.php | 8 ++--- .../handler/data/class_BaseDataHandler.php | 8 ++--- .../class_NodeMessageAnnouncementHandler.php | 10 +++--- ...s_NodeMessageAnnouncementAnswerHandler.php | 12 +++---- ...s_NodeMessageDhtBootstrapAnswerHandler.php | 8 ++--- ...odeMessageRequestNodeListAnswerHandler.php | 12 +++---- .../class_BaseMessageHandler.php | 6 ++-- .../class_NodeMessageDhtBootstrapHandler.php | 10 +++--- ...lass_NodeMessageRequestNodeListHandler.php | 12 +++---- .../class_NodeMessageSelfConnectHandler.php | 8 ++--- .../package/class_NetworkPackageHandler.php | 2 +- ...ss_NodeAnnouncementMessageAnswerHelper.php | 2 +- .../node/answer/class_BaseHubAnswerHelper.php | 2 +- ...ss_NodeDhtBootstrapMessageAnswerHelper.php | 2 +- ...NodeRequestNodeListMessageAnswerHelper.php | 2 +- .../hub/classes/nodes/class_BaseHubNode.php | 2 +- .../frontend/class_NodeDhtWrapper.php | 4 +-- .../{ => delivery}/messages/.htaccess | 0 .../messages/class_DeliverableMessage.php | 32 +++++++++++++++++++ .../node/class_DistributableNode.php | 6 ++-- .../filter/class_FilterablePackage.php | 2 +- .../class_HandleableAnswerStatus.php | 4 +-- .../message-types/class_HandleableMessage.php | 4 +-- .../hub/interfaces/nodes/class_Node.php | 2 +- .../interfaces/receiver/class_Receivable.php | 6 ++-- core | 2 +- 38 files changed, 119 insertions(+), 89 deletions(-) rename application/hub/interfaces/{ => delivery}/messages/.htaccess (100%) create mode 100644 application/hub/interfaces/delivery/messages/class_DeliverableMessage.php diff --git a/application/hub/classes/chains/class_PackageFilterChain.php b/application/hub/classes/chains/class_PackageFilterChain.php index 00909698d..eda0e0ab9 100644 --- a/application/hub/classes/chains/class_PackageFilterChain.php +++ b/application/hub/classes/chains/class_PackageFilterChain.php @@ -62,7 +62,7 @@ class PackageFilterChain extends FilterChain { * @return void * @todo This may be slow if a message with a lot tags arrived */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get all filters and "run" them foreach ($this->getFilters() as $filterInstance) { // Try to process it diff --git a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php index 55d52a8e6..cc4b9f4a9 100644 --- a/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php +++ b/application/hub/classes/database/frontend/node/class_NodeDistributedHashTableDatabaseWrapper.php @@ -355,7 +355,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp * @param $handlerInstance An instance of a HandleableDataSet class * @return void */ - public function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance) { + public function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: handlerInstance=' . $handlerInstance->__toString() . ' - CALLED!'); @@ -386,7 +386,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseHubDatabaseWrapper imp * @param $searchInstance An instance of LocalSearchCriteria class * @return void */ - public function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance) { + public function updateNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!'); diff --git a/application/hub/classes/dht/node/class_NodeDhtFacade.php b/application/hub/classes/dht/node/class_NodeDhtFacade.php index 5e17db99a..9f7391435 100644 --- a/application/hub/classes/dht/node/class_NodeDhtFacade.php +++ b/application/hub/classes/dht/node/class_NodeDhtFacade.php @@ -237,7 +237,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { * @return void * @throws NodeSessionIdVerficationException If the node was not found and update is forced */ - public function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, $forceUpdate = FALSE) { + 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))); $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); @@ -266,10 +266,10 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { // Is there already an entry? if ($resultInstance->valid()) { // Entry found, so update it - $this->getWrapperInstance()->updateNodeByMessageData($messageData, $handlerInstance, $searchInstance); + $this->getWrapperInstance()->updateNodeByMessageInstance($messageData, $handlerInstance, $searchInstance); } elseif ($forceUpdate === FALSE) { // Nothing found, so register it - $this->getWrapperInstance()->registerNodeByMessageData($messageData, $handlerInstance); + $this->getWrapperInstance()->registerNodeByMessageInstance($messageData, $handlerInstance); } else { /* * Do not register non-existent nodes here. This is maybe fatal, @@ -293,7 +293,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { * @param $separator Sepator char (1st parameter for explode() call) * @return $nodeList An array with all found nodes */ - public function queryLocalNodeListExceptByMessageData (array $messageData, HandleableDataSet $handlerInstance, $excludeKey, $andKey, $separator) { + 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]))); @@ -359,7 +359,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable { /** * Inserts given node list array (from earlier database result produced by * an other node) into the DHT. This array origins from above method - * queryLocalNodeListExceptByMessageData(). + * queryLocalNodeListExceptByMessageInstance(). * * @param $nodeList An array from an earlier database result instance * @return void diff --git a/application/hub/classes/filter/class_BaseHubFilter.php b/application/hub/classes/filter/class_BaseHubFilter.php index 6ba29c1de..9bd3f7acf 100644 --- a/application/hub/classes/filter/class_BaseHubFilter.php +++ b/application/hub/classes/filter/class_BaseHubFilter.php @@ -66,7 +66,7 @@ abstract class BaseHubFilter extends BaseFilter { * @return void * @todo Exceptions from renderXmlContent() are currently unhandled */ - protected function genericProcessMessage ($messageType, array $messageData, Receivable $packageInstance) { + 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])); diff --git a/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php index dde919815..20b3587ae 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php @@ -92,7 +92,7 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process message in generic way $this->genericProcessMessage('announcement_answer', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php index e64ccceb7..e10aec193 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageDhtBootstrapAnswerTagFilter.php @@ -89,7 +89,7 @@ class PackageDhtBootstrapAnswerTagFilter extends BaseNodeFilter implements Filte * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process message in generic way $this->genericProcessMessage('dht_bootstrap_answer', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php b/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php index 304813304..27d564528 100644 --- a/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php +++ b/application/hub/classes/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php @@ -89,7 +89,7 @@ class PackageRequestNodeListAnswerTagFilter extends BaseNodeFilter implements Fi * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process message in generic way $this->genericProcessMessage('request_node_list_answer', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php b/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php index 3427c0fc4..a6e28e266 100644 --- a/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageAnnouncementTagFilter.php @@ -98,7 +98,7 @@ class PackageAnnouncementTagFilter extends BaseNodeFilter implements FilterableP * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process message generic $this->genericProcessMessage('announcement', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php index 300dbb43c..22829a6da 100644 --- a/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageDhtBootstrapTagFilter.php @@ -97,7 +97,7 @@ class PackageDhtBootstrapTagFilter extends BaseNodeFilter implements FilterableP * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process message generic $this->genericProcessMessage('dht_bootstrap', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php b/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php index 7aa05897d..62fd58ab7 100644 --- a/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageRequestNodeListTagFilter.php @@ -86,7 +86,7 @@ class PackageRequestNodeListTagFilter extends BaseNodeFilter implements Filterab * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process messasge generic $this->genericProcessMessage('request_node_list', $messageData, $packageInstance); } diff --git a/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php b/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php index 855ea0dd3..32649f819 100644 --- a/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php +++ b/application/hub/classes/filter/tags/class_PackageSelfConnectTagFilter.php @@ -95,7 +95,7 @@ class PackageSelfConnectTagFilter extends BaseNodeFilter implements FilterablePa * @param $packageInstance An instance of a Receivable class * @return void */ - public function processMessage (array $messageData, Receivable $packageInstance) { + public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Process generic $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageData, $packageInstance); } diff --git a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php index fb926640e..097b0c30d 100644 --- a/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php +++ b/application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php @@ -78,12 +78,12 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen * @return void * @todo Do some more here: Handle karma, et cetera? */ - public function handleAnswerMessageData (array $messageData, Receivable $packageInstance) { + public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { /* * Query DHT and force update (which will throw an exception if the * node is not found). */ - DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageData($messageData, $this, TRUE); + DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this, TRUE); // Get handler instance $handlerInstance = GenericRegistry::getRegistry()->getInstance('task_handler'); @@ -123,7 +123,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen * @param $messageData An array with all message data * @return void */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -142,7 +142,7 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen * @param $messageData An array with all message data * @return void */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // Remove temporay configuration $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS); } diff --git a/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php b/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php index f599cd2e1..e573ad4ca 100644 --- a/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php +++ b/application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php @@ -74,7 +74,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement * @throws NodeSessionIdVerficationException If the provided session id is not matching * @todo Do some more here: Handle karma, et cetera? */ - public function handleAnswerMessageData (array $messageData, Receivable $packageInstance) { + public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Make sure node-list is found in array assert(isset($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST])); @@ -94,7 +94,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement * Query DHT and force update (which will throw an exception if the * node is not found). */ - DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageData($messageData, $this, TRUE); + DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this, TRUE); // Prepare next message ("hello" message to all returned nodes) //$this->prepareNextMessage($messageData, $packageInstance); @@ -114,7 +114,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement * @return void * @todo 0% done */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { $this->partialStub('Please implement this method.'); } @@ -126,7 +126,7 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement * @return void * @todo 0% done */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { $this->partialStub('Please implement this method.'); } } diff --git a/application/hub/classes/handler/data/class_BaseDataHandler.php b/application/hub/classes/handler/data/class_BaseDataHandler.php index 380c9439e..75bffb707 100644 --- a/application/hub/classes/handler/data/class_BaseDataHandler.php +++ b/application/hub/classes/handler/data/class_BaseDataHandler.php @@ -107,7 +107,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface { * @param $packageInstance An instance of a Deliverable instance * @return void */ - protected function prepareAnswerMessage (array $messageData, Deliverable $packageInstance) { + protected function prepareAnswerMessage (DeliverableMessage $messageInstance, Deliverable $packageInstance) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Going to send an answer message for ' . $this->getHandlerName() . ' ...'); @@ -150,7 +150,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface { * @param $packageInstance An instance of a Deliverable instance * @return void */ - protected function prepareNextMessage (array $messageData, Deliverable $packageInstance) { + protected function prepareNextMessage (DeliverableMessage $messageInstance, Deliverable $packageInstance) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Going to send next message ...'); @@ -191,7 +191,7 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface { * @param $messageData An array with all message data * @return void */ - abstract protected function initMessageConfigurationData (array $messageData); + abstract protected function initMessageConfigurationData (DeliverableMessage $messageInstance); /** * Removes configuration data with given message data array from global @@ -200,6 +200,6 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface { * @param $messageData An array with all message data * @return void */ - abstract protected function removeMessageConfigurationData (array $messageData); + abstract protected function removeMessageConfigurationData (DeliverableMessage $messageInstance); } diff --git a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php index b24545478..300ac8970 100644 --- a/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php +++ b/application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php @@ -107,7 +107,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl * @return void * @throws AnnouncementNotAcceptedException If this node does not accept announcements */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -122,7 +122,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl } // END - if // Register the announcing node with this node - $this->registerNodeByMessageData($messageData); + $this->registerNodeByMessageInstance($messageData); // Prepare answer message to be delivered back to the other node $this->prepareAnswerMessage($messageData, $packageInstance); @@ -135,7 +135,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -156,7 +156,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Debug message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageData=' . print_r($messageData, TRUE)); @@ -192,7 +192,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // "Walk" throught the translation array again foreach ($this->messageToConfig as $dummy => $configKey) { // Now unset this configuration entry (to save some memory) diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php index 272f70a08..6b0413e91 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php @@ -109,7 +109,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements * @return void * @throws NoAnnouncementAttemptedException If this node has not attempted to announce itself */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -124,10 +124,10 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements } // END - if // Register the announcing node with this node - $this->registerNodeByMessageData($messageData); + $this->registerNodeByMessageInstance($messageData); // Handle the answer status element - $nodeInstance->handleAnswerStatusByMessageData($messageData, $packageInstance); + $nodeInstance->handleAnswerStatusByMessageInstance($messageData, $packageInstance); } /** @@ -137,7 +137,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -161,7 +161,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements * @return void * @throws UnsupportedOperationException If this method is called */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -174,7 +174,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements * @return void * @throws UnsupportedOperationException If this method is called */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php index 3ec90a8bf..856de438f 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php @@ -107,7 +107,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements * @throws NoDhtBootstrapAttemptedException If this DHT has not attempted to bootstrap * @todo ~30% done */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get DHT instance $dhtInstance = DhtObjectFactory::createDhtInstance('node'); @@ -131,7 +131,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -155,7 +155,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements * @return void * @throws UnsupportedOperationException If this method is called */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -168,7 +168,7 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements * @return void * @throws UnsupportedOperationException If this method is called */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php index bf552b046..8cfaacb3a 100644 --- a/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php +++ b/application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php @@ -92,7 +92,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme * @return void * @throws NoRequestNodeListAttemptedException If this node has not attempted to announce itself */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -107,10 +107,10 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme } // END - if // Register the announcing node with this node - $this->registerNodeByMessageData($messageData); + $this->registerNodeByMessageInstance($messageData); // Handle the answer status element - $nodeInstance->handleAnswerStatusByMessageData($messageData, $packageInstance); + $nodeInstance->handleAnswerStatusByMessageInstance($messageData, $packageInstance); } /** @@ -120,7 +120,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -150,7 +150,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme * @return void * @throws UnsupportedOperationException If this method is called */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -163,7 +163,7 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme * @return void * @throws UnsupportedOperationException If this method is called */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php b/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php index cc2f962ac..e6c451171 100644 --- a/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php +++ b/application/hub/classes/handler/data/message-types/class_BaseMessageHandler.php @@ -76,12 +76,12 @@ abstract class BaseMessageHandler extends BaseDataHandler { * @param $messageArray An array with all minimum message data * @return void */ - protected function registerNodeByMessageData (array $messageData) { + protected function registerNodeByMessageInstance (DeliverableMessage $messageInstance) { // Check if searchData has entries assert(count($this->getSearchData()) > 0); // Let the DHT facade do the work - DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageData($messageData, $this); + DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageData, $this); } /** @@ -91,7 +91,7 @@ abstract class BaseMessageHandler extends BaseDataHandler { * @param $packageInstance An instance of a Receivable class * @return void */ - public function postHandleMessageData (array $messageData, Receivable $packageInstance) { + public function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { /* * Feed hash to miner by handling over the whole array as also the * sender and tags are needed. diff --git a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php index 266699eed..9c1a4b473 100644 --- a/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php +++ b/application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php @@ -102,7 +102,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl * @return void * @throws DhtBootstrapNotAcceptedException If this node does not accept DHT bootstrap requests */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Is this node accepting DHT bootstrap requests? /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); if (!NodeObjectFactory::createNodeInstance()->isAcceptingDhtBootstrap()) { @@ -113,7 +113,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl } // END - if // Register the DHT bootstrap requesting node with this node - $this->registerNodeByMessageData($messageData); + $this->registerNodeByMessageInstance($messageData); // Prepare answer message to be delivered back to the other node $this->prepareAnswerMessage($messageData, $packageInstance); @@ -126,7 +126,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -146,7 +146,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Debug message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageData=' . print_r($messageData, TRUE)); @@ -196,7 +196,7 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl * @param $messageData An array with all message data * @return void */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // "Walk" throught the translation array again foreach ($this->messageToConfig as $dummy => $configKey) { // Now unset this configuration entry (to save some memory) diff --git a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php index c01178a7d..0f7624d2e 100644 --- a/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -87,7 +87,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @return void * @throws RequestNotAcceptedException If this node does not accept this request */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -102,7 +102,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha } // END - if // Register the announcing node with this node - $this->registerNodeByMessageData($messageData); + $this->registerNodeByMessageInstance($messageData); // Prepare answer message to be delivered back to the other node $this->prepareAnswerMessage($messageData, $packageInstance); @@ -115,7 +115,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @param $messageData An array with all message data * @return void */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -135,7 +135,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @param $messageData An array with all message data * @return void */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Debug message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageData=' . print_r($messageData, TRUE)); @@ -149,7 +149,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha } // END - foreach // Query local DHT for nodes except given session id - $nodeList = DhtObjectFactory::createDhtInstance('node')->queryLocalNodeListExceptByMessageData( + $nodeList = DhtObjectFactory::createDhtInstance('node')->queryLocalNodeListExceptByMessageInstance( $messageData, $this, XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID, @@ -177,7 +177,7 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @param $messageData An array with all message data * @return void */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // "Walk" throught the config-copy array again foreach ($this->configCopy as $configKey => $dummy) { // Now unset this configuration entry (to save some memory again) diff --git a/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php b/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php index adcd2b4c4..d419a8d37 100644 --- a/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php +++ b/application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php @@ -70,7 +70,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * @param $packageInstance An instance of a Receivable class * @return void */ - public function handleMessageData (array $messageData, Receivable $packageInstance) { + public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Get node instance /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...'); $nodeInstance = NodeObjectFactory::createNodeInstance(); @@ -97,7 +97,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * @return void * @throws UnsupportedOperationException If this method is called */ - public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) { + public function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance) { // Add generic first parent::addArrayToDataSet($dataSetInstance, $messageData); @@ -112,7 +112,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * @return void * @throws UnsupportedOperationException If this method is called */ - protected function initMessageConfigurationData (array $messageData) { + protected function initMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method! throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } @@ -124,7 +124,7 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle * @return void * @throws UnsupportedOperationException If this method is called */ - protected function removeMessageConfigurationData (array $messageData) { + protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) { // Please don't call this method! throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION); } diff --git a/application/hub/classes/handler/package/class_NetworkPackageHandler.php b/application/hub/classes/handler/package/class_NetworkPackageHandler.php index 03a5073b1..7a9b00cd3 100644 --- a/application/hub/classes/handler/package/class_NetworkPackageHandler.php +++ b/application/hub/classes/handler/package/class_NetworkPackageHandler.php @@ -1585,7 +1585,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei * @return void * @todo ~10% done? */ - public function feedHashToMiner (array $messageData) { + public function feedHashToMiner (DeliverableMessage $messageInstance) { // Debug message //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: messageData()=%d - CALLED!', count($messageData))); diff --git a/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php index 94bc6648d..4727af384 100644 --- a/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/announcement/class_NodeAnnouncementMessageAnswerHelper.php @@ -56,7 +56,7 @@ class NodeAnnouncementMessageAnswerHelper extends BaseHubAnswerHelper implements * @param $messageData An array with all message data * @return $helperInstance A prepared instance of this helper */ - public final static function createNodeAnnouncementMessageAnswerHelper (array $messageData) { + public final static function createNodeAnnouncementMessageAnswerHelper (DeliverableMessage $messageInstance) { // Get new instance $helperInstance = new NodeAnnouncementMessageAnswerHelper(); diff --git a/application/hub/classes/helper/node/answer/class_BaseHubAnswerHelper.php b/application/hub/classes/helper/node/answer/class_BaseHubAnswerHelper.php index 6a846590c..f4c1dbe3e 100644 --- a/application/hub/classes/helper/node/answer/class_BaseHubAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/class_BaseHubAnswerHelper.php @@ -49,7 +49,7 @@ abstract class BaseHubAnswerHelper extends BaseNodeHelper { * * @return $messageData An array with message data */ - protected final function setMessageData (array $messageData) { + protected final function setMessageData (DeliverableMessage $messageInstance) { $this->messageData = $messageData; } diff --git a/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php index d31748f88..17742a1cb 100644 --- a/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/dht/class_NodeDhtBootstrapMessageAnswerHelper.php @@ -56,7 +56,7 @@ class NodeDhtBootstrapMessageAnswerHelper extends BaseHubAnswerHelper implements * @param $messageData An array with all message data * @return $helperInstance A prepared instance of this helper */ - public final static function createNodeDhtBootstrapMessageAnswerHelper (array $messageData) { + public final static function createNodeDhtBootstrapMessageAnswerHelper (DeliverableMessage $messageInstance) { // Get new instance $helperInstance = new NodeDhtBootstrapMessageAnswerHelper(); diff --git a/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php b/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php index eeac765d1..41bdfb70f 100644 --- a/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php +++ b/application/hub/classes/helper/node/answer/requests/class_NodeRequestNodeListMessageAnswerHelper.php @@ -56,7 +56,7 @@ class NodeRequestNodeListMessageAnswerHelper extends BaseHubAnswerHelper impleme * @param $messageData An array with all message data * @return $helperInstance A prepared instance of this helper */ - public final static function createNodeRequestNodeListMessageAnswerHelper (array $messageData) { + public final static function createNodeRequestNodeListMessageAnswerHelper (DeliverableMessage $messageInstance) { // Get new instance $helperInstance = new NodeRequestNodeListMessageAnswerHelper(); diff --git a/application/hub/classes/nodes/class_BaseHubNode.php b/application/hub/classes/nodes/class_BaseHubNode.php index 749d15b9d..d83b0054f 100644 --- a/application/hub/classes/nodes/class_BaseHubNode.php +++ b/application/hub/classes/nodes/class_BaseHubNode.php @@ -804,7 +804,7 @@ abstract class BaseHubNode extends BaseHubSystem implements Updateable, AddableC * @return void * @todo Handle thrown exception */ - public function handleAnswerStatusByMessageData (array $messageData, Receivable $packageInstance) { + public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance) { // Is it not empty? assert(!empty($messageData[BaseXmlAnswerTemplateEngine::ANSWER_STATUS])); diff --git a/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php b/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php index 54d46158e..acbd2b18d 100644 --- a/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php +++ b/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php @@ -87,7 +87,7 @@ interface NodeDhtWrapper extends DatabaseWrapper { * @param $handlerInstance An instance of a HandleableDataSet class * @return void */ - function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance); + function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance); /** * Updates an existing entry in node list @@ -97,7 +97,7 @@ interface NodeDhtWrapper extends DatabaseWrapper { * @param $searchInstance An instance of LocalSearchCriteria class * @return void */ - function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance); + function updateNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance); /** * Determines whether the given node data is already inserted in the DHT diff --git a/application/hub/interfaces/messages/.htaccess b/application/hub/interfaces/delivery/messages/.htaccess similarity index 100% rename from application/hub/interfaces/messages/.htaccess rename to application/hub/interfaces/delivery/messages/.htaccess diff --git a/application/hub/interfaces/delivery/messages/class_DeliverableMessage.php b/application/hub/interfaces/delivery/messages/class_DeliverableMessage.php new file mode 100644 index 000000000..625af2bf1 --- /dev/null +++ b/application/hub/interfaces/delivery/messages/class_DeliverableMessage.php @@ -0,0 +1,32 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2018 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +interface DeliverableMessage extends HubInterface { + +} diff --git a/application/hub/interfaces/distributable/node/class_DistributableNode.php b/application/hub/interfaces/distributable/node/class_DistributableNode.php index 108ff06a7..a8af1d62d 100644 --- a/application/hub/interfaces/distributable/node/class_DistributableNode.php +++ b/application/hub/interfaces/distributable/node/class_DistributableNode.php @@ -61,7 +61,7 @@ interface DistributableNode extends Distributable { * @param $forceUpdate Optionally force update, don't register (default: register if not found) * @return void */ - function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, $forceUpdate = FALSE); + function registerNodeByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, $forceUpdate = FALSE); /** * Queries the local DHT data(base) for a node list with all supported @@ -74,12 +74,12 @@ interface DistributableNode extends Distributable { * @param $separator Sepator char (1st parameter for explode() call) * @return $nodeList An array with all found nodes */ - function queryLocalNodeListExceptByMessageData (array $messageData, HandleableDataSet $handlerInstance, $excludeKey, $andKey, $separator); + function queryLocalNodeListExceptByMessageInstance (DeliverableMessage $messageInstance, HandleableDataSet $handlerInstance, $excludeKey, $andKey, $separator); /** * Inserts given node list array (from earlier database result produced by * an other node) into the DHT. This array origins from above method - * queryLocalNodeListExceptByMessageData(). + * queryLocalNodeListExceptByMessageInstance(). * * @param $nodeList An array from an earlier database result instance * @return void diff --git a/application/hub/interfaces/filter/class_FilterablePackage.php b/application/hub/interfaces/filter/class_FilterablePackage.php index 2bd46a102..53a3501e0 100644 --- a/application/hub/interfaces/filter/class_FilterablePackage.php +++ b/application/hub/interfaces/filter/class_FilterablePackage.php @@ -38,7 +38,7 @@ interface FilterablePackage extends Filterable { * @param $packageInstance An instance of a Receivable class * @return void */ - function processMessage (array $messageData, Receivable $packageInstance); + function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance); /** * Post-processes the stacked message. Do not call popNamed() as then no diff --git a/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php b/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php index c995706b0..f3883719f 100644 --- a/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php +++ b/application/hub/interfaces/handler/answer-status/class_HandleableAnswerStatus.php @@ -40,7 +40,7 @@ interface HandleableAnswerStatus extends HandleableDataSet, HubInterface { * @param $packageInstance An instance of a Receivable class * @return void */ - function handleAnswerMessageData (array $messageData, Receivable $packageInstance); + function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); /** * Adds all required elements from given array into data set instance @@ -49,6 +49,6 @@ interface HandleableAnswerStatus extends HandleableDataSet, HubInterface { * @param $messageData An array with all message data * @return void */ - function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData); + function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance); } diff --git a/application/hub/interfaces/handler/message-types/class_HandleableMessage.php b/application/hub/interfaces/handler/message-types/class_HandleableMessage.php index 0c83de160..0f3859200 100644 --- a/application/hub/interfaces/handler/message-types/class_HandleableMessage.php +++ b/application/hub/interfaces/handler/message-types/class_HandleableMessage.php @@ -39,7 +39,7 @@ interface HandleableMessage extends HandleableDataSet, HubInterface { * @param $packageInstance An instance of a Receivable class * @return void */ - function handleMessageData (array $messageData, Receivable $packageInstance); + function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); /** * Posty-handles data array of the message @@ -48,6 +48,6 @@ interface HandleableMessage extends HandleableDataSet, HubInterface { * @param $packageInstance An instance of a Receivable class * @return void */ - function postHandleMessageData (array $messageData, Receivable $packageInstance); + function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance); } diff --git a/application/hub/interfaces/nodes/class_Node.php b/application/hub/interfaces/nodes/class_Node.php index 5ef756c2c..9c3b976a6 100644 --- a/application/hub/interfaces/nodes/class_Node.php +++ b/application/hub/interfaces/nodes/class_Node.php @@ -170,7 +170,7 @@ interface Node extends FrameworkInterface { * @param $packageInstance An instance of a Receivable class * @return void */ - function handleAnswerStatusByMessageData (array $messageData, Receivable $packageInstance); + function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance); /** * "Getter" for an array of all accepted object types diff --git a/application/hub/interfaces/receiver/class_Receivable.php b/application/hub/interfaces/receiver/class_Receivable.php index df10735e0..14554adc6 100644 --- a/application/hub/interfaces/receiver/class_Receivable.php +++ b/application/hub/interfaces/receiver/class_Receivable.php @@ -154,8 +154,6 @@ interface Receivable extends HubInterface { * @param $messageData Array with message data * @return void */ - function feedHashToMiner (array $messageData); -} + function feedHashToMiner (DeliverableMessage $messageInstance); -// [EOF] -?> +} diff --git a/core b/core index cd4ba5256..c53e9c725 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit cd4ba5256a2b12e69dd95d8d4489f70e1ec5343f +Subproject commit c53e9c7252290aa3e4107717419429c0418a6945 -- 2.39.5