// Init message data array
$this->messageDataElements = array(
XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP,
+ XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP,
XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_NODE_STATUS,
XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID,
XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_TCP_PORT,
XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_UDP_PORT
);
+
+ // Init message-data->configuration translation array
+ $this->messageToConfig = array(
+ XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_EXTERNAL_IP => 'other_external_ip',
+ XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_INTERNAL_IP => 'other_internal_ip',
+ XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID => 'other_session_id'
+ );
}
/**
$dataSetInstance->addCriteria('node_' . $key, $messageData[$key]);
} // END - foreach
}
+
+ /**
+ * Initializes configuration data from given message data array
+ *
+ * @param $messageData An array with all message data
+ * @return void
+ */
+ protected function initMessageConfigurationData (array $messageData) {
+ // "Walk" throught the translation array
+ foreach ($this->messageToConfig as $messageKey => $configKey) {
+ // Set the element in configuration
+ $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
+ } // END - foreach
+
+ // Translate last exception into a status code
+ $statusCode = $this->getTranslatedStatusFromLastException();
+
+ // Set it in configuration (temporarily)
+ $this->getConfigInstance()->setConfigEntry('answer_status', $statusCode);
+ }
+
+ /**
+ * Removes configuration data with given message data array from global
+ * configuration
+ *
+ * @param $messageData An array with all message data
+ * @return void
+ */
+ protected function removeMessageConfigurationData (array $messageData) {
+ // "Walk" throught the translation array again
+ foreach ($this->messageToConfig as $dummy => $configKey) {
+ // Now unset this configuration entry (to save some memory)
+ $this->getConfigInstance()->unsetConfigEntry($configKey);
+ } // END - foreach
+
+ // Remove 'answer_status' as well
+ $this->getConfigInstance()->unsetConfigEntry('answer_status');
+ }
}
// [EOF]