* @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
* @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!');
* @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!');
* @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');
// 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,
* @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])));
/**
* 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
* @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]));
* @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);
}
* @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);
}
* @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);
}
* @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);
}
* @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);
}
* @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);
}
* @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);
}
* @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');
* @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();
* @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);
}
* @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]));
* 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);
* @return void
* @todo 0% done
*/
- protected function initMessageConfigurationData (array $messageData) {
+ protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
$this->partialStub('Please implement this method.');
}
* @return void
* @todo 0% done
*/
- protected function removeMessageConfigurationData (array $messageData) {
+ protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
$this->partialStub('Please implement this method.');
}
}
* @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() . ' ...');
* @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 ...');
* @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
* @param $messageData An array with all message data
* @return void
*/
- abstract protected function removeMessageConfigurationData (array $messageData);
+ abstract protected function removeMessageConfigurationData (DeliverableMessage $messageInstance);
}
* @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();
} // 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);
* @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);
* @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));
* @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)
* @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();
} // 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);
}
/**
* @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);
* @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);
}
* @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);
}
* @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');
* @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);
* @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);
}
* @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);
}
* @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();
} // 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);
}
/**
* @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);
* @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);
}
* @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);
}
* @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);
}
/**
* @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.
* @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()) {
} // 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);
* @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);
* @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));
* @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)
* @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();
} // 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);
* @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);
* @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));
} // 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,
* @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)
* @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();
* @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);
* @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);
}
* @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);
}
* @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)));
* @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();
*
* @return $messageData An array with message data
*/
- protected final function setMessageData (array $messageData) {
+ protected final function setMessageData (DeliverableMessage $messageInstance) {
$this->messageData = $messageData;
}
* @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();
* @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();
* @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]));
* @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
* @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
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Shipsimu\Hub\Network\Message;
+
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Generic\HubInterface;
+
+/**
+ * An interface for message delivery boys... ;-)
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @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 <http://www.gnu.org/licenses/>.
+ */
+interface DeliverableMessage extends HubInterface {
+
+}
* @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
* @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
* @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
* @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
* @param $messageData An array with all message data
* @return void
*/
- function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData);
+ function addArrayToDataSet (StoreableCriteria $dataSetInstance, DeliverableMessage $messageInstance);
}
* @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
* @param $packageInstance An instance of a Receivable class
* @return void
*/
- function postHandleMessageData (array $messageData, Receivable $packageInstance);
+ function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance);
}
+++ /dev/null
-Deny from all
* @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
* @param $messageData Array with message data
* @return void
*/
- function feedHashToMiner (array $messageData);
-}
+ function feedHashToMiner (DeliverableMessage $messageInstance);
-// [EOF]
-?>
+}
-Subproject commit cd4ba5256a2b12e69dd95d8d4489f70e1ec5343f
+Subproject commit c53e9c7252290aa3e4107717419429c0418a6945