From: Roland Häder Date: Wed, 30 Jan 2013 21:48:53 +0000 (+0000) Subject: Field answer_status becomes more generic now X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=39dfb6a3efe19d1fc7393c78629a9a5b5acd083d;p=hub.git Field answer_status becomes more generic now --- diff --git a/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php b/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php index a25eb165c..97868cb38 100644 --- a/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php +++ b/application/hub/main/filter/tags/answer/class_PackageAnnouncementAnswerTagFilter.php @@ -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 => '', ); } diff --git a/application/hub/main/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php b/application/hub/main/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php index a271bde08..84ef085a1 100644 --- a/application/hub/main/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php +++ b/application/hub/main/filter/tags/answer/class_PackageRequestNodeListAnswerTagFilter.php @@ -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 => '', ); } diff --git a/application/hub/main/handler/answer-status/class_BaseAnserStatusHandler.php b/application/hub/main/handler/answer-status/class_BaseAnserStatusHandler.php index f5d6ff1ab..18826e561 100644 --- a/application/hub/main/handler/answer-status/class_BaseAnserStatusHandler.php +++ b/application/hub/main/handler/answer-status/class_BaseAnserStatusHandler.php @@ -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]); } } diff --git a/application/hub/main/nodes/class_BaseHubNode.php b/application/hub/main/nodes/class_BaseHubNode.php index 5f1618157..1dca6472a 100644 --- a/application/hub/main/nodes/class_BaseHubNode.php +++ b/application/hub/main/nodes/class_BaseHubNode.php @@ -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); diff --git a/application/hub/main/package/class_NetworkPackage.php b/application/hub/main/package/class_NetworkPackage.php index b00ba909f..c646ba0a7 100644 --- a/application/hub/main/package/class_NetworkPackage.php +++ b/application/hub/main/package/class_NetworkPackage.php @@ -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 */ diff --git a/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php b/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php index 0e2239426..953d68130 100644 --- a/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/announcement/class_XmlAnnouncementAnswerTemplateEngine.php @@ -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 * diff --git a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php index ea2f1ea75..cc051e047 100644 --- a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php @@ -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