]> git.mxchange.org Git - hub.git/commitdiff
Field answer_status becomes more generic now
authorRoland Häder <roland@mxchange.org>
Wed, 30 Jan 2013 21:48:53 +0000 (21:48 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 30 Jan 2013 21:48:53 +0000 (21:48 +0000)
application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php
application/hub/main/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php
application/hub/main/handler/answer-status/class_BaseAnserStatusHandler.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/package/class_NetworkPackage.php
application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php
application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php

index a25eb165c0440ebf9a5278b112fbf15bea1e1c56..97868cb38076965ba0ecd8ed66229912e03e0112 100644 (file)
@@ -39,7 +39,7 @@ class PackageAnnouncementAnswerTagFilter extends BaseNodeFilter implements Filte
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID    => '',
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_TCP_PORT      => 9060,
                        XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_UDP_PORT      => 9060,
-                       XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_ANSWER_STATUS => '',
+                       NetworkPackage::MESSAGE_DATA_ANSWER_STATUS                           => '',
                );
        }
 
index a271bde08f75a261e34a5e4ca653bd8826edc03f..84ef085a1bb21c05b68809e2a58c40281f874882 100644 (file)
@@ -33,9 +33,9 @@ class PackageRequestNodeListAnswerTagFilter extends BaseNodeFilter implements Fi
 
                // Init array
                $this->dataXmlNodes = array(
-                       XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_SESSION_ID    => '',
-                       XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST     => '',
-                       XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_ANSWER_STATUS => '',
+                       XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_SESSION_ID => '',
+                       XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_NODE_LIST  => '',
+                       NetworkPackage::MESSAGE_DATA_ANSWER_STATUS                      => '',
                );
        }
 
index f5d6ff1abb8f621caef44ffae17bcbd3bcaf21e0..18826e561101d915531a8a634fe8b23f9c2b2a71 100644 (file)
@@ -53,7 +53,7 @@ abstract class BaseAnserStatusHandler extends BaseDataHandler {
         */
        public function addArrayToDataSet (StoreableCriteria $dataSetInstance, array $messageData) {
                // Add some generic data all messageData arrays provide
-               $dataSetInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $messageData[XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_ANSWER_STATUS]);
+               $dataSetInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]);
                $dataSetInstance->addCriteria(NodeListDatabaseWrapper::DB_COLUMN_MESSAGE_TYPE , $messageData[NetworkPackage::MESSAGE_ARRAY_TYPE]);
        }
 }
index 5f16181572a4d3eeb8aa6275d74ed24423c904c8..1dca6472acb233e396c83f8dd0aaddc78cacae61 100644 (file)
@@ -826,8 +826,11 @@ class BaseHubNode extends BaseHubSystem implements Updateable {
         * @todo        Handle thrown exception
         */
        public function handleAnswerStatusByMessageData (array $messageData, Receivable $packageInstance) {
+               // Is it not empty?
+               assert(!empty($messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]));
+
                // Construct configuration entry for handling class' name
-               $classConfigEntry = strtolower($messageData[NetworkPackage::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_ANSWER_STATUS]) . '_handler_class';
+               $classConfigEntry = strtolower($messageData[NetworkPackage::MESSAGE_ARRAY_TYPE] . '_status_' . $messageData[NetworkPackage::MESSAGE_DATA_ANSWER_STATUS]) . '_handler_class';
 
                // Try to get a class
                $handlerInstance = ObjectFactory::createObjectByConfiguredName($classConfigEntry);
index b00ba909f0ac91898ebec892567f0598c715ce13..c646ba0a79bc7e4cddb61b2fc5578819f6cdd496 100644 (file)
@@ -116,6 +116,11 @@ class NetworkPackage extends BaseHubSystem implements Deliverable, Receivable, R
        const MESSAGE_ARRAY_DATA = 'message_data';
        const MESSAGE_ARRAY_TYPE = 'message_type';
 
+       /**
+        * Generic answer status field
+        */
+       const MESSAGE_DATA_ANSWER_STATUS = 'answer_status';
+
        /**
         * Tags separator
         */
index 0e2239426e6035cd5008300e6582d4894629d14f..953d681308a3e785b6afa31715df344d3a4c1b20 100644 (file)
@@ -32,7 +32,6 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlTemplateEngine implemen
        const ANNOUNCEMENT_DATA_INTERNAL_IP   = 'my-internal-ip';
        const ANNOUNCEMENT_DATA_TCP_PORT      = 'my-tcp-port';
        const ANNOUNCEMENT_DATA_UDP_PORT      = 'my-udp-port';
-       const ANNOUNCEMENT_DATA_ANSWER_STATUS = 'answer-status';
 
        /**
         * Protected constructor
@@ -59,8 +58,6 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlTemplateEngine implemen
                        'your-external-ip',
                        'your-internal-ip',
                        'your-session-id',
-                       // Answer status (code)
-                       self::ANNOUNCEMENT_DATA_ANSWER_STATUS
                );
        }
 
@@ -350,26 +347,6 @@ class XmlAnnouncementAnswerTemplateEngine extends BaseXmlTemplateEngine implemen
                $this->getStackerInstance()->popNamed('node_announcement_answer');
        }
 
-       /**
-        * Starts the answer-status
-        *
-        * @return      void
-        */
-       protected function startAnswerStatus () {
-               // Push the node name on the stacker
-               $this->getStackerInstance()->pushNamed('node_announcement_answer', self::ANNOUNCEMENT_DATA_ANSWER_STATUS);
-       }
-
-       /**
-        * Finishes the answer-status
-        *
-        * @return      void
-        */
-       protected function finishAnswerStatus () {
-               // Pop the last entry
-               $this->getStackerInstance()->popNamed('node_announcement_answer');
-       }
-
        /**
         * Finishes the announcement-answer
         *
index ea2f1ea75bb569e0bdb519998be46ab2b2215a9b..cc051e047e46627d951136a3d12d6f6a49fbe949 100644 (file)
@@ -26,7 +26,6 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlTemplateEngine imple
        // Constants for array elements
        const REQUEST_DATA_SESSION_ID    = 'session-id';
        const REQUEST_DATA_NODE_LIST     = 'node-list';
-       const REQUEST_DATA_ANSWER_STATUS = 'answer-status';
 
        /**
         * Protected constructor