* @return void
* @todo This may be slow if a message with a lot tags arrived
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get all filters and "run" them
foreach ($this->getFilters() as $filterInstance) {
// Try to process it
try {
- $filterInstance->processMessage($messageInstance, $packageInstance);
+ $filterInstance->processMessage($messageInstance, $handlerInstance);
} 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());
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Get all filters and "run" them
foreach ($this->getPostFilters() as $filterInstance) {
// Try to process it
try {
- $filterInstance->postProcessMessage($packageInstance);
+ $filterInstance->postProcessMessage($handlerInstance);
} 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());
}
} // END - foreach
}
-}
-// [EOF]
-?>
+}
*/
public static final function getAllElements () {
// Create array and ...
- $elements = array(
+ $elements = [
self::DB_COLUMN_NODE_ID,
self::DB_COLUMN_SESSION_ID,
self::DB_COLUMN_EXTERNAL_ADDRESS,
self::DB_COLUMN_NODE_MODE,
self::DB_COLUMN_ACCEPTED_OBJECTS,
self::DB_COLUMN_NODE_LIST
- );
+ ];
// ... return it
return $elements;
*/
public function findFirstNodeData () {
// Is there cache?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FRONTEND: CALLED!');
if (!isset($GLOBALS[__METHOD__])) {
// Now get a search criteria instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
$resultInstance = $this->doSelectByCriteria($searchInstance);
// Is it valid?
- $GLOBALS[__METHOD__] = ($resultInstance->next() ? $resultInstance : NULL);
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FRONTEND: resultInstance->valid()=%d', intval($resultInstance->valid())));
+ $GLOBALS[__METHOD__] = ($resultInstance->valid() ? $resultInstance : NULL);
}
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FRONTEND: resultInstance[]=%s - EXIT!', gettype($GLOBALS[__METHOD__])));
return $GLOBALS[__METHOD__];
}
$resultInstance = $this->doSelectByCriteria($searchInstance);
// Do we have an entry? This should always the case
- if (!$resultInstance->next()) {
+ if (!$resultInstance->valid()) {
// No next record!
throw new UnexpectedValueException(sprintf('resultInstance=%s,count()=%d has no next entry', $resultInstance->__toString(), $resultInstance->count()));
}
}
// "Walk" through all entries
- while ($resultInstance->next()) {
+ while ($resultInstance->valid()) {
// Get current entry
$current = $resultInstance->current();
// ... and push it to the next stack
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DHT: Pushing entry with ' . count($current) . ' elements to stack ' . self::STACKER_NAME_PENDING_PUBLISHING . ' ...');
$this->getStackInstance()->pushNamed(self::STACKER_NAME_PENDING_PUBLISHING, $current);
+
+ // Advanced to next entry
+ $resultInstance->next();
}
// Trace message
assert($resultInstance instanceof SearchableResult);
// Is the next entry valid?
- if (($resultInstance->valid()) && ($resultInstance->next())) {
+ if ($resultInstance->valid()) {
/*
* Then load the first entry (more entries are being ignored and
* should not happen).
assert($resultInstance instanceof SearchableResult);
// Is the next entry valid?
- if (($resultInstance->valid()) && ($resultInstance->next())) {
+ if ($resultInstance->valid()) {
/*
* Then load the first entry (more entries are being ignored and
* should not happen).
$nodeList = [];
// Get node list
- while ($resultInstance->next()) {
+ while ($resultInstance->valid()) {
// Get current element (it should be an array, and have at least 1 entry)
$current = $resultInstance->current();
assert(is_array($current));
// Add this entry
array_push($nodeList, $current);
+
+ // Advanced to next entry
+ $resultInstance->next();
}
// Save last exception
$recipients = [];
// Search for all recipients
- while ($resultInstance->next()) {
+ while ($resultInstance->valid()) {
// Get current entry
$current = $resultInstance->current();
// Add instance to recipient list
/* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: current=%s', print_r($current, TRUE)));
array_push($recipients, $current);
+
+ // Advanced to next entry
+ $resultInstance->next();
}
// Return filled array
$recipients = [];
// "Walk" through all entries
- while ($resultInstance->next()) {
+ while ($resultInstance->valid()) {
// Get current entry
$current = $resultInstance->current();
// Add instance to recipient list
/* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: current=%s', print_r($current, TRUE)));
array_push($recipients, $current);
+
+ // Advanced to next entry
+ $resultInstance->next();
}
// Return filled array
* @param $packageInstance An instance of a Receivable instance
* @return $assemblerInstance An instance of a Assembler instance
*/
- public static final function createAssemblerInstance (Receivable $packageInstance) {
+ public static final function createAssemblerInstance (Receivable $handlerInstance) {
// If there is no assembler?
if (GenericRegistry::getRegistry()->instanceExists('package_assembler')) {
// Get assembler from registry
$assemblerInstance = GenericRegistry::getRegistry()->getInstance('package_assembler');
} else {
// Get the assembler instance
- $assemblerInstance = self::createObjectByConfiguredName('package_assembler_class', array($packageInstance));
+ $assemblerInstance = self::createObjectByConfiguredName('package_assembler_class', array($handlerInstance));
// Add it to the registry
GenericRegistry::getRegistry()->addInstance('package_assembler', $assemblerInstance);
* may throw (not the method itself) several exceptions:
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process message in generic way
- $this->genericProcessMessage('announcement_answer', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('announcement_answer', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* may throw (not the method itself) several exceptions:
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process message in generic way
- $this->genericProcessMessage('dht_bootstrap_answer', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('dht_bootstrap_answer', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* may throw (not the method itself) several exceptions:
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process message in generic way
- $this->genericProcessMessage('request_node_list_answer', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('request_node_list_answer', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* well-formed
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process message generic
- $this->genericProcessMessage('announcement', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('announcement', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* well-formed
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process message generic
- $this->genericProcessMessage('dht_bootstrap', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('dht_bootstrap', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* Processes the given raw message content.
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process messasge generic
- $this->genericProcessMessage('request_node_list', $messageInstance, $packageInstance);
+ $this->genericProcessMessage('request_node_list', $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* well-formed
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Process generic
- $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageInstance, $packageInstance);
+ $this->genericProcessMessage(Tagable::TAG_SELF_CONNECT, $messageInstance, $handlerInstance);
}
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws UnsupportedOperationException If this method is called, please use processMessage() instead!
*/
- public function postProcessMessage (Receivable $packageInstance) {
+ public function postProcessMessage (Receivable $handlerInstance) {
// Please don't call this method
throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
}
* Handles given message data array
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @todo Do some more here: Handle karma, et cetera?
*/
- public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
/*
* Query DHT and force update (which will throw an exception if the
* node is not found).
$nodeInstance->getStateInstance()->nodeAnnouncementSuccessful();
// Prepare next message
- $this->prepareNextMessage($messageInstance, $packageInstance);
+ $this->prepareNextMessage($messageInstance, $handlerInstance);
}
/**
* Handles given message data array
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance 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) {
+ public function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Save node list
$nodeList = json_decode(base64_decode($messageData[XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST]));
DhtObjectFactory::createDhtInstance('node')->registerNodeByMessageInstance($messageInstance, $this, TRUE);
// Prepare next message ("hello" message to all returned nodes)
- // @TODO $this->prepareNextMessage($messageInstance, $packageInstance);
+ // @TODO $this->prepareNextMessage($messageInstance, $handlerInstance);
}
/**
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws AnnouncementNotAcceptedException If this node does not accept announcements
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get node instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
$nodeInstance = NodeObjectFactory::createNodeInstance();
$this->registerNodeByMessageInstance($messageInstance);
// Prepare answer message to be delivered back to the other node
- $this->prepareAnswerMessage($messageInstance, $packageInstance);
+ $this->prepareAnswerMessage($messageInstance, $handlerInstance);
}
/**
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws NoDhtBootstrapAttemptedException If this DHT has not attempted to bootstrap
* @todo ~30% done
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get DHT instance
$dhtInstance = DhtObjectFactory::createDhtInstance('node');
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws NoRequestNodeListAttemptedException If this node has not attempted to announce itself
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get node instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
$nodeInstance = NodeObjectFactory::createNodeInstance();
$this->registerNodeByMessageInstance($messageInstance);
// Handle the answer status element
- $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $packageInstance);
+ $nodeInstance->handleAnswerStatusByMessageInstance($messageInstance, $handlerInstance);
}
/**
* Posty-handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
/*
* Feed hash to miner by handling over the whole array as also the
* sender and tags are needed.
*/
- $packageInstance->feedHashToMiner($messageInstance);
+ $handlerInstance->feedHashToMiner($messageInstance);
}
}
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws DhtBootstrapNotAcceptedException If this node does not accept DHT bootstrap requests
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Is this node accepting DHT bootstrap requests?
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
if (!NodeObjectFactory::createNodeInstance()->isAcceptingDhtBootstrap()) {
$this->registerNodeByMessageInstance($messageInstance);
// Prepare answer message to be delivered back to the other node
- $this->prepareAnswerMessage($messageInstance, $packageInstance);
+ $this->prepareAnswerMessage($messageInstance, $handlerInstance);
}
/**
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @throws RequestNotAcceptedException If this node does not accept this request
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get node instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
$nodeInstance = NodeObjectFactory::createNodeInstance();
$this->registerNodeByMessageInstance($messageInstance);
// Prepare answer message to be delivered back to the other node
- $this->prepareAnswerMessage($messageInstance, $packageInstance);
+ $this->prepareAnswerMessage($messageInstance, $handlerInstance);
}
/**
* Handles data array of the message
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- public function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get node instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
$nodeInstance = NodeObjectFactory::createNodeInstance();
* Sends waiting packages out for delivery
*
* @return void
+ * @throws UnexpectedValueException If $sessionId is empty
*/
public function sendWaitingPackage () {
// Debug message
// Get session id and set it back
$sessionId = HubTools::resolveSessionIdByUniversalNodeLocator($locatorInstance);
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sessionId=%s found, setting ...', $sessionId));
+
+ // Is it empty?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: sessionId[%s]=%s', gettype($sessionId), $sessionId));
+ if (empty($sessionId)) {
+ // HubTools was not able to resolve this
+ throw new UnexpectedValueException('sessionId is empty');
+ }
+
+ // Set it
$packageInstance->setRecipientId($sessionId);
}
use Org\Mxchange\CoreFramework\Traits\Database\Frontend\DatabaseFrontendTrait;
use Org\Mxchange\CoreFramework\Traits\State\StateableTrait;
+// Import SPL stuff
+use \InvalidArgumentException;
+use \UnexpectedValueException;
+
/**
* A general hub node class
*
/**
* Node id
*/
- private $nodeId = 'invalid';
+ private $nodeId = '';
/**
* Private key
*/
- private $privateKey = 'invalid';
+ private $privateKey = '';
/**
* Node's private-key hash
*/
- private $nodePrivateKeyHash = 'invalid';
+ private $nodePrivateKeyHash = '';
/**
* Session id
*/
- private $sessionId = 'invalid';
+ private $sessionId = '';
/**
* Protected constructor
// Stop further searching
break;
}
- } // END - foreach
+ }
// Return the result
return $isFound;
if (NULL == $locatorInstance) {
// Throw NPE
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } // END - if
+ }
// There are 2 UNLs, internal and external.
if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('allow_publish_internal_address') == 'N') {
// Non-public "internal" UNL address
$GLOBALS[__METHOD__] = $locatorInstance->getInternalUnl();
}
- } // END - if
+ }
// Return it
return $GLOBALS[__METHOD__];
*/
public function bootstrapAcquireNodeId (Requestable $requestInstance, Responseable $responseInstance) {
// Find node by id
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: requestInstance=%s,responseInstance=%s - CALLED!', $requestInstance->__toString(), $responseInstance->__toString()));
$resultInstance = $this->getFrontendInstance()->findFirstNodeData();
// Is there a node id?
- /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: resultInstance[]=%s', gettype($resultInstance)));
+ //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE)));
if ($resultInstance instanceof SearchableResult && $resultInstance->valid()) {
// Get current record
$nodeData = $resultInstance->current();
// Get the node id from result and set it
- /* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
- $this->setNodeId($resultInstance->getField(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID));
+ //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
+ $this->setNodeId($nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID]);
// Output message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: Re-using found node-id: %s', $this->getNodeId()));
// Output message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BOOTSTRAP: Created new node-id: %s', $this->getNodeId()));
}
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
*/
public function bootstrapGenerateSessionId () {
// Now get a search criteria instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
// Search for the node number one which is hard-coded the default
// Change the state because the node has aquired a session id
$this->getStateInstance()->nodeGeneratedSessionId();
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
* Generate a private key for en-/decryption
*
* @return void
+ * @throws UnexpectedValueException If private_key_hash is "invalid"
*/
public function bootstrapGeneratePrivateKey () {
// Find node by id
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$resultInstance = $this->getFrontendInstance()->findFirstNodeData();
// Is it valid?
- if ($resultInstance->valid()) {
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: resultInstance[]=%s', gettype($resultInstance)));
+ //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: resultInstance=%s', __METHOD__, __LINE__, print_r($resultInstance, TRUE)));
+ if ($resultInstance instanceof SearchableResult && $resultInstance->valid()) {
+ // Get current element
+ $current = $resultInstance->current();
+
// Is the element set?
- if (is_null($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY))) {
+ if (is_null($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY])) {
/*
* Auto-generate the private key for e.g. out-dated database
* "tables". This allows a smooth update for the underlaying
$this->generatePrivateKeyAndHash($this->getSearchInstance());
} else {
// Get the node id from result and set it
- $this->setPrivateKey(base64_decode($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY)));
- $this->setNodePrivateKeyHash($this->getFrontendInstance()->getField(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH));
+ $this->setPrivateKey(base64_decode($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY]));
+ $this->setNodePrivateKeyHash($current[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH]);
// Output message
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BOOTSTRAP: Re-using found private key hash: ' . $this->getNodePrivateKeyHash() . '');
*/
$this->generatePrivateKeyAndHash($this->getSearchInstance());
}
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
*/
public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
// Get request instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: criteriaInstance=%s - CALLED!', $criteriaInstance->__toString()));
$requestInstance = FrameworkBootstrap::getRequestInstance();
// Add node number and type
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR , 1);
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE, $requestInstance->getRequestElement('mode'));
-
- // Add the node id
- $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID, $this->getNodeId());
+ $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID , $this->getNodeId());
// Add the session id if acquired
- if ($this->getSessionId() != '') {
+ if (!empty($this->getSessionId())) {
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_SESSION_ID, $this->getSessionId());
- } // END - if
+ }
// Add the private key if acquired
- if ($this->getPrivateKey() != '') {
- $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY, base64_encode($this->getPrivateKey()));
+ if (!empty($this->getPrivateKey())) {
+ $criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY , base64_encode($this->getPrivateKey()));
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH, $this->getNodePrivateKeyHash());
- } // END - if
+ }
// Add own external and internal addresses as UNLs
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL, HubTools::determineOwnInternalAddress());
$criteriaInstance->addCriteria(NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL, HubTools::determineOwnExternalAddress());
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
*/
public function announceToUpperNodes (Taskable $taskInstance) {
// Is this hub node announced?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NOCE: taskInstance=%s - CALLED!', $taskInstance->__toString()));
if ($this->hubIsAnnounced === TRUE) {
// Already announced!
throw new NodeAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED);
- } // END - if
+ }
// Debug output
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('HUB-Announcement: START (taskInstance=' . $taskInstance->__toString(). ')');
*/
public function doSelfConnection (Taskable $taskInstance) {
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Self Connection: START (taskInstance=' . $taskInstance->__toString(). ')');
// Get a helper instance
$helperInstance = ObjectFactory::createObjectByConfiguredName('node_self_connect_helper_class', array($this));
$helperInstance->sendPackage($this);
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Self Connection: FINISHED');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Self Connection: FINISHED');
}
/**
if (($this->determineIfListenerIsActive()) && ($this->isNodeActive())) {
// Shutdown them down before they can hurt anything
$this->shutdownListenerPool();
- } // END - if
+ }
// Get the controller here
$controllerInstance = GenericRegistry::getRegistry()->getInstance('controller');
*/
public function initializeListenerPool () {
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: START');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Initialize listener: START');
// Get a new pool instance
$this->setListenerPoolInstance(ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this)));
$this->getListenerPoolInstance()->addListener($decoratorInstance);
// Debug output
- self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Initialize listener: FINISHED.');
+ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Initialize listener: FINISHED.');
}
/**
* @return void
*/
public final function enableAcceptDhtBootstrap (bool $acceptDhtBootstrap = TRUE) {
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: Enabling DHT bootstrap requests ...');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: Enabling DHT bootstrap requests ...');
$this->acceptDhtBootstrap = $acceptDhtBootstrap;
}
*/
public final function isAcceptingAnnouncements () {
// Check it (this node must be active and not shutdown!)
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$acceptAnnouncements = (($this->acceptAnnouncements === TRUE) && ($this->isNodeActive()));
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptAnnouncements=%d - EXIT!', intval($acceptAnnouncements)));
return $acceptAnnouncements;
}
*/
public final function isAcceptingDhtBootstrap () {
// Check it (this node must be active and not shutdown!)
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$acceptDhtBootstrap = (($this->acceptDhtBootstrap === TRUE) && ($this->isNodeActive()));
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptDhtBootstrap=%d - EXIT!', intval($acceptDhtBootstrap)));
return $acceptDhtBootstrap;
}
* @todo Add checking if this node has been announced to the sender node
*/
public function ifNodeIsAnnouncing () {
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): state=' . $this->getStateInstance()->getStateName());
-
// Simply check the state of this node
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: state=' . $this->getStateInstance()->getStateName());
$hasAnnounced = ($this->getStateInstance() instanceof NodeAnnouncingState);
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeIsAnnouncing(): hasAnnounced=' . intval($hasAnnounced));
-
// Return it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: hasAnnounced=' . intval($hasAnnounced));
return $hasAnnounced;
}
* @todo Add checking if this node has been announced to the sender node
*/
public function ifNodeHasAnnouncementCompleted () {
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): state=' . $this->getStateInstance()->getStateName());
-
// Simply check the state of this node
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: state=' . $this->getStateInstance()->getStateName());
$hasAnnouncementCompleted = ($this->getStateInstance() instanceof NodeAnnouncementCompletedState);
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: ifNodeHasAnnouncementCompleted(): hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted));
-
// Return it
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: hasAnnouncementCompleted=' . intval($hasAnnouncementCompleted));
return $hasAnnouncementCompleted;
}
* HubRegularNode is faster, but if e.g. HubRegularI2PNode will be
* added then the next check will be TRUE.
*/
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$acceptsRequest = ((!$this instanceof HubRegularNode) && (FrameworkBootstrap::getRequestInstance()->getRequestElement('mode') != self::NODE_TYPE_REGULAR));
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: acceptsRequests=%d - EXIT!', intval($hasAnnouncementCompleted)));
return $acceptsRequest;
}
* @return $locatorInstance An instance of a LocateableNode class for this node
*/
public function determineUniversalNodeLocator () {
- // Debug message
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: CALLED!');
-
// Is there cache?
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
if (!isset($GLOBALS[__METHOD__])) {
// Determine UNL based on this node:
// 1) Get discovery class
// 2) "Determine" it
$GLOBALS[__METHOD__] = $discoveryInstance->discoverUniversalNodeLocatorByNode($this);
- } // END - if
+ }
// Return it
- //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: locatorInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!');
+ //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: locatorInstance= ' . $GLOBALS[__METHOD__]->__toString() . ' - EXIT!');
return $GLOBALS[__METHOD__];
}
* Handles message answer by given data array
*
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @todo Handle thrown exception
*/
- public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ public function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Construct configuration entry for handling class' name
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: messageInstance=%s,handlerInstance=%s - CALLED!', $messageInstance->__toString(), $handlerInstance->__toString()));
$classConfigEntry = strtolower($messageData[NetworkPackageHandler::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[BaseXmlAnswerTemplateEngine::ANSWER_STATUS]) . '_handler_class';
// Try to get a class
- $handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);
+ $statusHandlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);
// Handle it there
- $handlerInstance->handleAnswerMessageData($messageInstance, $packageInstance);
+ $statusHandlerInstance->handleAnswerMessageData($messageInstance, $handlerInstance);
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
*/
public function getListFromAcceptedObjectTypes () {
// Get registry instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$objectRegistryInstance = ObjectTypeRegistryFactory::createObjectTypeRegistryInstance();
// Get all entries
$objectList = $objectRegistryInstance->getEntries(XmlObjectRegistryTemplateEngine::OBJECT_TYPE_DATA_NAME);
// ... and return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: objectList()=%d - EXIT!', count($objectList)));
return $objectList;
}
* @param $dataSetInstance An instance of a StoreableCriteria class
* @param $nodeData An array with valid node data
* @return void
+ * @throws InvalidArgumentException If $nodeData is empty
*/
public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $nodeData) {
+ // Validate parameter
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: dataSetInstance=%s,nodeData()=%d - EXIT!', $dataSetInstance->__toString(), count($nodeData)));
+ if (count($nodeData) == 0) {
+ // Throw IAE
+ throw new InvalidArgumentException('nodeData array is empty');
+ }
+
// Add all data the array provides
foreach (NodeDistributedHashTableDatabaseFrontend::getAllElements() as $element) {
// Is the element there?
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: element=%s', $element));
if (isset($nodeData[$element])) {
// Add it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: Adding element=%s ...', $element));
$dataSetInstance->addCriteria($element, $nodeData[$element]);
} else {
// Output warning message
- /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE: addArrayToDataSet(): Element ' . $element . ' not found in nodeData array.');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: Element %s not found in nodeData array.', $element));
}
- } // END - foreac
+ }
+
+ // Trace message
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: EXIT!');
}
/**
*/
public function createNodeDataArray () {
// Get request instance
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-HUB-NODE: CALLED!');
$requestInstance = FrameworkBootstrap::getRequestInstance();
// Create array with all available data
- $nodeData = array(
- NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR => NULL,
- NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE => $requestInstance->getRequestElement('mode'),
- NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID => $this->getNodeId(),
+ $nodeData = [
+ NodeInformationDatabaseFrontend::DB_COLUMN_NODE_NR => NULL,
+ NodeInformationDatabaseFrontend::DB_COLUMN_NODE_MODE => $requestInstance->getRequestElement('mode'),
+ NodeInformationDatabaseFrontend::DB_COLUMN_NODE_ID => $this->getNodeId(),
NodeInformationDatabaseFrontend::DB_COLUMN_INTERNAL_UNL => HubTools::determineOwnInternalAddress(),
NodeInformationDatabaseFrontend::DB_COLUMN_EXTERNAL_UNL => HubTools::determineOwnExternalAddress(),
- );
+ ];
// Add the session id if acquired
- if ($this->getSessionId() != '') {
+ if (!empty($this->getSessionId())) {
$nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_SESSION_ID] = $this->getSessionId();
- } // END - if
+ }
// Add the private key if acquired
- if ($this->getPrivateKey() != '') {
+ if (!empty($this->getPrivateKey())) {
$nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY] = base64_encode($this->getPrivateKey());
$nodeData[NodeInformationDatabaseFrontend::DB_COLUMN_PRIVATE_KEY_HASH] = $this->getNodePrivateKeyHash();
- } // END - if
-
- // Debugging:
- //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
+ }
// Return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-HUB-NODE: nodeData()=%d - EXIT!', count($nodeData)));
+ //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: nodeData=%s', __METHOD__, __LINE__, print_r($nodeData, TRUE)));
return $nodeData;
}
/**
* Creates an instance of this class
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return $assemblerInstance An instance of an Assembler class
*/
- public static final function createPackageAssembler (Receivable $packageInstance) {
+ public static final function createPackageAssembler (Receivable $handlerInstance) {
// Get new instance
$assemblerInstance = new PackageAssembler();
// Set package instance here
- $assemblerInstance->setPackageHandlerInstance($packageInstance);
+ $assemblerInstance->setPackageHandlerInstance($handlerInstance);
// Create an instance of a raw data input stream
$streamInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_input_stream_class');
$resultInstance = $nodeInstance->getFrontendInstance()->doSelectByCriteria($searchInstance);
// Is the result valid?
- if ((!$resultInstance->valid()) || (!$resultInstance->next())) {
+ if ((!$resultInstance->valid()) || (!$resultInstance->valid())) {
/*
* Node not found in database, this happens on first startup. So
* let's get a prepared array from the node instance.
}
// Return result
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId=%s - EXIT!', $sessionId));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-TOOLS: sessionId[%s]=%s - EXIT!', gettype($sessionId), $sessionId));
return $sessionId;
}
* Processes the given raw message content.
*
* @param $messageData Raw message data array
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function processMessage (DeliverableMessage $messageInstance, Receivable $packageInstance);
+ function processMessage (DeliverableMessage $messageInstance, Receivable $handlerInstance);
/**
* Post-processes the stacked message. Do not call popNamed() as then no
* other class can process the message.
*
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function postProcessMessage (Receivable $packageInstance);
+ function postProcessMessage (Receivable $handlerInstance);
}
* Handles given message data array
*
* @param $messageData An array of message data
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance);
+ function handleAnswerMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance);
/**
* Adds all required elements from given array into data set instance
* Handles data array of the message
*
* @param $messageData An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function handleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance);
+ function handleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance);
/**
* Posty-handles data array of the message
*
* @param $messageData An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $packageInstance);
+ function postHandleMessageData (DeliverableMessage $messageInstance, Receivable $handlerInstance);
}
* Handles message answer by given data array
*
* @param $messageData A valid answer message data array
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
*/
- function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $packageInstance);
+ function handleAnswerStatusByMessageInstance (DeliverableMessage $messageInstance, Receivable $handlerInstance);
/**
* "Getter" for an array of all accepted object types
-Subproject commit 0a198892c079422ef72d679321caad9310b417f4
+Subproject commit ddbb50472e5383629958295be9f063cf8124b41f