From: Roland Häder Date: Wed, 27 Jun 2012 17:17:06 +0000 (+0000) Subject: Introduced updateNodeData() to update/refresh node data ... ;) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0c2b6e1be646b6fa765848b54cd9c94ce7e8b11e;p=hub.git Introduced updateNodeData() to update/refresh node data ... ;) --- diff --git a/application/hub/interfaces/nodes/class_NodeHelper.php b/application/hub/interfaces/nodes/class_NodeHelper.php index d969b2735..d995d202b 100644 --- a/application/hub/interfaces/nodes/class_NodeHelper.php +++ b/application/hub/interfaces/nodes/class_NodeHelper.php @@ -131,6 +131,13 @@ interface NodeHelper extends FrameworkInterface { * @return void */ function addElementsToDataSet (StoreableCriteria $criteriaInstance, Requestable $requestInstance); + + /** + * Updates/refreshes node data (e.g. state). + * + * @return void + */ + function updateNodeData (); } // [EOF] diff --git a/application/hub/main/factories/states/node/class_NodeStateFactory.php b/application/hub/main/factories/states/node/class_NodeStateFactory.php index 2fd672477..5909cad06 100644 --- a/application/hub/main/factories/states/node/class_NodeStateFactory.php +++ b/application/hub/main/factories/states/node/class_NodeStateFactory.php @@ -53,6 +53,9 @@ class NodeStateFactory extends ObjectFactory { // Once we have that state, set it in the node instance $nodeInstance->setStateInstance($stateInstance); + // Update node data + $nodeInstance->updateNodeData(); + // For any purposes, return the state instance return $stateInstance; } diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 58cdde153..821ae67db 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -395,9 +395,6 @@ class BaseHubNode extends BaseHubSystem implements Updateable { throw new HubAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED); } // END - if - // Set some dummy configuration entries, e.g. node_status - $this->getConfigInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName()); - // Debug output $this->debugOutput('HUB-Announcement: START (taskInstance=' . $taskInstance->__toString(). ')'); @@ -643,6 +640,17 @@ class BaseHubNode extends BaseHubSystem implements Updateable { // Return it return $addressPort; } + + /** + * Updates/refreshes node data (e.g. state). + * + * @return void + * @todo Find more to do here + */ + public function updateNodeData () { + // Set some dummy configuration entries, e.g. node_status + $this->getConfigInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName()); + } } // [EOF] diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index b57155aba..361d9c4ea 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -544,7 +544,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R * @return $signature Signature as BASE64-encoded string */ private function generatePackageSignature ($content, $senderId) { - // ash content and sender id together, use md5() as last algo + // Hash content and sender id together, use md5() as last algo $hash = md5($this->getCryptoInstance()->hashString($senderId . $content, $this->getNodeId(), false)); // Encrypt the content again with the hash as a key @@ -586,6 +586,7 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R public function enqueueRawDataFromTemplate (HelpableHub $helperInstance, $protocolName) { // Get the raw content ... $content = $helperInstance->getTemplateInstance()->getRawTemplateData(); + //* DEBUG: */ $this->debugOutput('content(' . strlen($content) . ')=' . $content); // ... and compress it $content = $this->getCompressorInstance()->compressStream($content);