]> git.mxchange.org Git - hub.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Fri, 4 Dec 2020 04:11:40 +0000 (05:11 +0100)
committerRoland Häder <roland@mxchange.org>
Fri, 4 Dec 2020 04:11:40 +0000 (05:11 +0100)
- got rid of deprecated message<->config copying stuff, it should be done more
  naturally

Signed-off-by: Roland Häder <roland@mxchange.org>
14 files changed:
application/hub/classes/dht/node/class_NodeDhtFacade.php
application/hub/classes/handler/chunks/class_ChunkHandler.php
application/hub/classes/handler/data/answer-status/announcement/class_NodeAnnouncementAnswerOkayHandler.php
application/hub/classes/handler/data/answer-status/requests/class_RequestNodeListAnswerOkayHandler.php
application/hub/classes/handler/data/class_BaseDataHandler.php
application/hub/classes/handler/data/message-types/announcement/class_NodeMessageAnnouncementHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageAnnouncementAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageDhtBootstrapAnswerHandler.php
application/hub/classes/handler/data/message-types/answer/class_NodeMessageRequestNodeListAnswerHandler.php
application/hub/classes/handler/data/message-types/dht/class_NodeMessageDhtBootstrapHandler.php
application/hub/classes/handler/data/message-types/requests/class_NodeMessageRequestNodeListHandler.php
application/hub/classes/handler/data/message-types/self-connect/class_NodeMessageSelfConnectHandler.php
application/hub/classes/handler/package/class_NetworkPackageHandler.php
application/hub/classes/lists/recipient/class_RecipientList.php

index c44e1159ab5f8df0c903198531f1560f169824c0..25687795389f1f3c11f099f208becd31999427c5 100644 (file)
@@ -439,7 +439,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                        $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)));
+                       //* 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
@@ -491,7 +491,7 @@ class NodeDhtFacade extends BaseDht implements DistributableNode, Registerable {
                        $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)));
+                       //* 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
index de5cac4188bb86fb8658c82bb4e7f5460bbe0151..e295acd52c5761e5d1a23e4c012ce4ff1993edf0 100644 (file)
@@ -459,7 +459,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
         * @return      $isValid        Whether the final (last) chunk is valid
         * @throws      UnexpectedValueException        If some unexpected value was found
         */
-       private function isValidFinalChunk (array $chunks) {
+       private function isFinalChunkValid (array $chunks) {
                // Default is all fine
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: chunks()=%d - CALLED!', count($chunks)));
                $isValid = TRUE;
@@ -472,7 +472,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
                $chunkSplits = explode(PackageFragmenter::CHUNK_DATA_HASH_SEPARATOR, $chunk);
 
                // Make sure chunks with only 3 elements are parsed (for details see ChunkHandler)
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: eopChunk=%s,chunkSplits=%s', $chunks[count($chunks) - 1], print_r($chunkSplits, TRUE)));
+               //* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: eopChunk=%s,chunkSplits=%s', $chunks[count($chunks) - 1], print_r($chunkSplits, TRUE)));
                if (count($chunkSplits) != 3) {
                        // Must be 3 elements exact
                        throw new UnexpectedValueException(sprintf('chunk=%s has %d splits, must be exact 3.', $chunk, count($chunkSplits)));
@@ -504,7 +504,7 @@ class ChunkHandler extends BaseHubHandler implements HandleableChunks, Registera
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CHUNK-HANDLER: chunks()=%d - CALLED!', count($chunks)));
                try {
                        // Validate final chunk
-                       $this->isValidFinalChunk($chunks);
+                       $this->isFinalChunkValid($chunks);
                } catch (AssertionException $e) {
                        // Last chunk is not valid
                        throw new FinalChunkVerificationException(array($this, $chunks, $e), self::EXCEPTION_FINAL_CHUNK_VERIFICATION);
index 8face50262efd094ed9edd510d3699e14e1038b7..7e49a7778e249dcae367939048de94b9e5456ddf 100644 (file)
@@ -107,46 +107,4 @@ class NodeAnnouncementAnswerOkayHandler extends BaseAnswerStatusHandler implemen
                $this->prepareNextMessage($messageInstance, $handlerInstance);
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * The following array is being handled over:
-        *
-        *   my-external-address => 1.2.3.4
-        *   my-internal-address => 5.6.7.8
-        *   my-status           => reachable
-        *   my-node-id          => aaabbbcccdddeeefff123456789
-        *   my-session-id       => aaabbbcccdddeeefff123456789
-        *   my-tcp-port         => 9060
-        *   my-udp-port         => 9060
-        *   answer-status       => OKAY
-        *   message_type        => announcement_answer
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Get node instance
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-MESSAGE-HANDLER: Creating node instance ...');
-               $nodeInstance = NodeObjectFactory::createNodeInstance();
-
-               // Get an array of all accepted object types
-               $objectList = $nodeInstance->getListFromAcceptedObjectTypes();
-
-               // Add missing (temporary) configuration 'accepted_object_types'
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ACCEPTED_OBJECTS, implode(BaseHubNode::OBJECT_LIST_SEPARATOR, $objectList));
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration. For content of $messageInstance see method comment above.
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Remove temporay configuration
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ACCEPTED_OBJECTS);
-       }
-
 }
index c0bcab027742b2f5d58f6397797fdf827178197a..9c99343e82ade0eaf16064953d0c9890dbf6b05b 100644 (file)
@@ -98,36 +98,4 @@ class RequestNodeListAnswerOkayHandler extends BaseAnswerStatusHandler implement
                // @TODO $this->prepareNextMessage($messageInstance, $handlerInstance);
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * The following array is being handled over:
-        *
-        *   session-id    => aaabbbcccdddeeefff123456789
-        *   node-list     => aabb:ccdd:eeff
-        *   answer-status => OKAY
-        *   message_type  => request_node_list_answer
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @todo        0% done
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               $this->partialStub('Please implement this method.');
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration. For content of $messageInstance see method comment above.
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @todo        0% done
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               $this->partialStub('Please implement this method.');
-       }
 }
-
-// [EOF]
-?>
index c452b7425fc71b48aa15f557019b1d3f33f107fe..2f541a58dc7d8f69d777e87cd5d601963e052696 100644 (file)
@@ -51,17 +51,6 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
         */
        protected $messageDataElements = [];
 
-       /**
-        * Array for translating message data elements (other node's data mostly)
-        * into configuration elements.
-        */
-       protected $messageToConfig = [];
-
-       /**
-        * Array for copying configuration entries
-        */
-       protected $configCopy = [];
-
        /**
         * Protected constructor
         *
@@ -120,12 +109,6 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                // Load descriptor XML
                $helperInstance->loadDescriptorXml($nodeInstance);
 
-               /*
-                * Set missing (temporary) configuration data, mostly it needs to be
-                * copied from message data array.
-                */
-               $this->initMessageConfigurationData($messageInstance);
-
                // Compile any configuration variables
                $helperInstance->getTemplateInstance()->compileConfigInVariables();
 
@@ -133,11 +116,6 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('BASE-DATA-HANDLER: Calling helperInstance->sendPackage(%s) ...', $nodeInstance->__toString()));
                $helperInstance->sendPackage($nodeInstance);
 
-               /*
-                * Remove temporary configuration
-                */
-               $this->removeMessageConfigurationData($messageInstance);
-
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER: Answer message has been prepared.');
        }
@@ -162,12 +140,6 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                // Load descriptor XML
                $helperInstance->loadDescriptorXml($nodeInstance);
 
-               /*
-                * Set missing (temporary) configuration data, mostly it needs to be
-                * copied from message data array.
-                */
-               $this->initMessageConfigurationData($messageInstance);
-
                // Compile any configuration variables
                $helperInstance->getTemplateInstance()->compileConfigInVariables();
 
@@ -175,30 +147,8 @@ abstract class BaseDataHandler extends BaseHubHandler implements HubInterface {
                /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: Calling helperInstance->sendPackage(%s) ...', $nodeInstance->__toString()));
                $helperInstance->sendPackage($nodeInstance);
 
-               /*
-                * Remove temporary configuration
-                */
-               $this->removeMessageConfigurationData($messageInstance);
-
                // Debug message
                //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('BASE-DATA-HANDLER:Next message has been prepared.');
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       abstract protected function initMessageConfigurationData (DeliverableMessage $messageInstance);
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       abstract protected function removeMessageConfigurationData (DeliverableMessage $messageInstance);
-
 }
index f8718cde1ddb079f9b9bd9f8cafbb9c6f761e822..a52d142f3aaadf2940010e2a416d731f8ae11950 100644 (file)
@@ -54,7 +54,7 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                $this->setHandlerName('message_announcement');
 
                // Init message data array
-               $this->messageDataElements = array(
+               $this->messageDataElements = [
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
@@ -62,30 +62,27 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_ID,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
-               );
+               ];
 
                // Init message-data->configuration translation array
-               $this->messageToConfig = array(
+               /*
+               $this->messageToConfig = [
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'your_external_address',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'your_internal_address',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_ID          => 'your_node_id',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'your_session_id',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH => 'your_private_key_hash',
-               );
-
-               // Init config-copy array
-               $this->configCopy = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'external_address',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'internal_address',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => 'node_status',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'session_id',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH => 'private_key_hash',
-               );
+               ];
+               */
 
                // Init array
-               $this->searchData = array(
+               $this->searchData = [
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS
-               );
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
+                       XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
+               ];
        }
 
        /**
@@ -152,61 +149,4 @@ class NodeMessageAnnouncementHandler extends BaseMessageHandler implements Handl
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // "Walk" throught the translation array
-               /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
-               foreach ($this->messageToConfig as $messageKey => $configKey) {
-                       // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
-
-                       // Set the element in configuration
-                       FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
-               } // END - foreach
-
-               // "Walk" throught the config-copy array
-               foreach ($this->configCopy as $targetKey => $sourceKey) {
-                       // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
-
-                       // Copy from source to targetKey
-                       FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
-               } // END - foreach
-
-               // Translate last exception into a status code
-               $statusCode = $this->getTranslatedStatusFromLastException();
-
-               // Set it in configuration (temporarily)
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS, $statusCode);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageData    An instance of a DeliverableMessage class
-        * @return      void
-        */
-       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)
-                       FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
-               } // END - foreach
-
-               // "Walk" throught the config-copy array again
-               foreach ($this->configCopy as $configKey => $dummy) {
-                       // Now unset this configuration entry (to save some memory again)
-                       FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
-               } // END - foreach
-
-               // Remove NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS as well
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS);
-       }
-
 }
index b489a9593b91401e6da66ed30210798580a78f09..716c099f44f5c6339ae3149d4fbc7c8059e28acf 100644 (file)
@@ -53,7 +53,7 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                $this->setHandlerName('message_announcement_answer');
 
                // Init message data array
-               $this->messageDataElements = array(
+               $this->messageDataElements = [
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
@@ -61,32 +61,26 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
                        BaseXmlAnswerTemplateEngine::ANSWER_STATUS,
-               );
+               ];
 
                // Init message-data->configuration translation array
-               $this->messageToConfig = array(
                /*
+               $this->messageToConfig = [
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'your_external_address',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'your_internal_address',
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'your_session_id'
                        XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH => 'your_private_key_hash'
+               ];
                */
-               );
-
-               // Init config-copy array
-               $this->configCopy = array(
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS => 'external_address',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS => 'internal_address',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS      => 'node_status',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID       => 'session_id',
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH => 'private_key_hash',
-               );
 
                // Init array
-               $this->searchData = array(
+               $this->searchData = [
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_ADDRESS,
-               );
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_ADDRESS,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
+                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_PRIVATE_KEY_HASH,
+               ];
        }
 
        /**
@@ -155,29 +149,4 @@ class NodeMessageAnnouncementAnswerHandler extends BaseMessageHandler implements
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
 }
index 587c1701e113401df05b2e831abd88b8c08ba554..fcb3afda47c40ef8c1bd28d0d1fb29619e32d58b 100644 (file)
@@ -62,27 +62,22 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                ];
 
                // Init message-data->configuration translation array
-               $this->messageToConfig = [
                /*
+               $this->messageToConfig = [
                        @TODO Why commented out?
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address',
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address',
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'your_session_id'
-               */
-               ];
-
-               // Init config-copy array
-               $this->configCopy = [
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => 'node_status',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'session_id',
                ];
+               */
 
                // Init array
                $this->searchData = [
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
                        XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS,
+                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
                ];
        }
 
@@ -149,31 +144,4 @@ class NodeMessageDhtBootstrapAnswerHandler extends BaseMessageHandler implements
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
 }
-
-// [EOF]
-?>
index d18f99fc3011dc57980028afac512ae6f11fc55c..d3ab2e9b607d07ee450a04701523b6f56e1cfb54 100644 (file)
@@ -53,23 +53,23 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                $this->setHandlerName('message_request_node_list_answer');
 
                // Init message data array
-               $this->messageDataElements = array(
+               $this->messageDataElements = [
                        XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_SESSION_ID,
                        XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST,
                        BaseXmlAnswerTemplateEngine::ANSWER_STATUS,
-               );
+               ];
 
                // Init message-data->configuration translation array
-               $this->messageToConfig = array(
                /*
+               $this->messageToConfig = [
                        XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID  => 'your_session_id'
+               ];
                */
-               );
 
                // Init search data array
-               $this->searchData = array(
+               $this->searchData = [
                        XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_SESSION_ID,
-               );
+               ];
        }
 
        /**
@@ -144,29 +144,4 @@ class NodeMessageRequestNodeListAnswerHandler extends BaseMessageHandler impleme
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
 }
index 37fc745eb542e901fe385aac7c0432f2a8e1364f..6701a57ffd2224e3624b44a73b8ec638f913cbee 100644 (file)
@@ -63,24 +63,21 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                ];
 
                // Init message-data->configuration translation array
+               /*
                $this->messageToConfig = [
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'your_external_address',
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'your_internal_address',
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'your_session_id'
                ];
-
-               // Init config-copy array
-               $this->configCopy = [
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS => 'external_address',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS => 'internal_address',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS      => 'node_status',
-                       XmlDhtBootstrapAnswerTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID       => 'session_id',
-               ];
+               */
 
                // Init array
-               $this->searchData = array(
+               $this->searchData = [
                        XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_EXTERNAL_ADDRESS,
-               );
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_INTERNAL_ADDRESS,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_NODE_STATUS,
+                       XmlDhtBootstrapTemplateEngine::DHT_BOOTSTRAP_DATA_SESSION_ID,
+               ];
        }
 
        /**
@@ -142,74 +139,4 @@ class NodeMessageDhtBootstrapHandler extends BaseMessageHandler implements Handl
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // "Walk" throught the translation array
-               /* PRINTR-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
-               foreach ($this->messageToConfig as $messageKey => $configKey) {
-                       // Set the element in configuration
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
-                       FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
-               } // END - foreach
-
-               // "Walk" throught the config-copy array
-               foreach ($this->configCopy as $targetKey => $sourceKey) {
-                       // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
-
-                       // Copy from source to target key
-                       FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
-               } // END - foreach
-
-               // Translate last exception into a status code
-               $statusCode = $this->getTranslatedStatusFromLastException();
-
-               // Set it in configuration (temporarily)
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS, $statusCode);
-
-               /*
-                * Use the DHT instance to get a list of recipients. This means that all
-                * DHT nodes that accept bootstrap requests are read from the DHT
-                * database.
-                */
-               $nodeList = DhtObjectFactory::createDhtInstance('node')->findRecipientsByKey(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ACCEPT_BOOTSTRAP, 'Y');
-
-               // Make sure it is an array and has at least one entry
-               assert(is_array($nodeList));
-               assert(count($nodeList) > 0);
-
-               // Set it in configuration
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('dht_nodes', base64_encode(json_encode($nodeList)));
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       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)
-                       FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
-               } // END - foreach
-
-               // "Walk" throught the config-copy array again
-               foreach ($this->configCopy as $configKey => $dummy) {
-                       // Now unset this configuration entry (to save some memory again)
-                       FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
-               } // END - foreach
-
-               // Remove temporary "special" values as well
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS);
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry('dht_nodes');
-       }
-
 }
index 52b13ac86138565a133af3252b3669131fc54c31..ab644e7add936a05d3f6679c2db5892971666d1f 100644 (file)
@@ -54,18 +54,14 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                $this->setHandlerName('message_request_node_list');
 
                // Init message data array
-               $this->messageDataElements = array(
+               $this->messageDataElements = [
                        XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
-               );
-
-               // Init config-copy array
-               $this->configCopy = array(
-               );
+               ];
 
                // Init search data array
-               $this->searchData = array(
+               $this->searchData = [
                        XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
-               );
+               ];
        }
 
        /**
@@ -131,64 +127,4 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha
                } // END - foreach
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: messageInstance=' . print_r($messageInstance, TRUE));
-
-               // "Walk" throught the config-copy array
-               foreach ($this->configCopy as $targetKey => $sourceKey) {
-                       // Debug message
-                       /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
-
-                       // Copy from source to targetKey
-                       FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
-               } // END - foreach
-
-               // Query local DHT for nodes except given session id
-               $nodeList = DhtObjectFactory::createDhtInstance('node')->queryLocalNodeListExceptByMessageInstance(
-                       $messageInstance,
-                       $this,
-                       XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID,
-                       XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES,
-                       BaseHubNode::OBJECT_LIST_SEPARATOR
-               );
-
-               // Debug message
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Got a node list of ' . count($nodeList) . ' entry/-ies back.');
-
-               // Set it serialized in configuration (temporarily)
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList)));
-
-               // Translate last exception into a status code
-               $statusCode = $this->getTranslatedStatusFromLastException();
-
-               // Set it in configuration (temporarily)
-               FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS, $statusCode);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global
-        * configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        */
-       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)
-                       FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
-               } // END - foreach
-
-               // Remove answer status/node list as well
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseFrontend::DB_COLUMN_ANSWER_STATUS);
-               FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry('node_list');
-       }
-
 }
index 34a5bceb0a6d9605144f87f000388d8a2d42db3c..605dc05a8267a0c9d7f03eb0ba9118cb6fd140e6 100644 (file)
@@ -106,30 +106,4 @@ class NodeMessageSelfConnectHandler extends BaseMessageHandler implements Handle
                throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
        }
 
-       /**
-        * Initializes configuration data from given message data array
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function initMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method!
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
-
-       /**
-        * Removes configuration data with given message data array from global configuration
-        *
-        * @param       $messageInstance        An instance of a DeliverableMessage class
-        * @return      void
-        * @throws      UnsupportedOperationException   If this method is called
-        */
-       protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
-               // Please don't call this method!
-               throw new UnsupportedOperationException(array($this, __FUNCTION__), self::EXCEPTION_UNSPPORTED_OPERATION);
-       }
 }
-
-// [EOF]
-?>
index b7e537db73b4b8b1e93243b0e61321a640abda92..cc1ce6d1b9d67e37edbea7d27f054ff6185dfeb9 100644 (file)
@@ -1622,7 +1622,7 @@ class NetworkPackageHandler extends BaseHubHandler implements Deliverable, Recei
 
                // Generate the hash of comparing it
                //* DEBUG-DIE: */ ApplicationEntryPoint::exitApplication(sprintf('[%s:%d]: packageInstance=%s', __METHOD__, __LINE__, print_r($packageInstance, TRUE)));
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance=%s,senderId=%s,senderPrivateKeyHash=%s', $packageInstance->__toString(), $packageInstance->getSenderId(), $packageInstance->getSenderPrivateKeyHash()));
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NETWORK-PACKAGE-HANDLER: packageInstance=%s,senderId=%s,senderPrivateKeyHash=%s', $packageInstance->__toString(), $packageInstance->getSenderId(), $packageInstance->getSenderPrivateKeyHash()));
                if (empty($packageInstance->getSenderId())) {
                        // Invalid $packageInstance
                        throw new InvalidArgumentException('packageInstance does not contain senderId');
index 8b1e7010a062d4cf805ed035d192231da340965c..de2c3f61cd735bb436f62eecc8dc1aeb5096ee6c 100644 (file)
@@ -76,9 +76,7 @@ class RecipientList extends BaseList implements Listable, Registerable {
         */
        public function clearList () {
                // Clear both groups
-               $this->clearGroups(array('unl', 'session_id'));
+               $this->clearGroups(['unl', 'session_id']);
        }
-}
 
-// [EOF]
-?>
+}