From 8152066f9e43226342f638a283285edf9ccb95cc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 30 Jan 2013 20:42:18 +0000 Subject: [PATCH] Added handling methods, implemented configuration copy/removal methods --- ...lass_NodeMessageRequestNodeListHandler.php | 23 ++++++++++- ...XmlRequestNodeListAnswerTemplateEngine.php | 40 +++++++++++++++++++ 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php index d503cad54..ff5f030e6 100644 --- a/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php +++ b/application/hub/main/handler/message-types/requests/class_NodeMessageRequestNodeListHandler.php @@ -39,6 +39,11 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha XmlRequestNodeListTemplateEngine::REQUEST_DATA_ACCEPTED_OBJECT_TYPES, ); + // Init config-copy array + $this->configCopy = array( + XmlRequestNodeListAnswerTemplateEngine::REQUEST_DATA_SESSION_ID => 'session_id', + ); + // Init search data array $this->searchData = array( XmlRequestNodeListTemplateEngine::REQUEST_DATA_SESSION_ID, @@ -111,7 +116,17 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @return void */ protected function initMessageConfigurationData (array $messageData) { - $this->partialStub('Please implement this method.'); + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput(' REQUEST-HANDLER: messageData=' . print_r($messageData, true)); + + // "Walk" throught the config-copy array + foreach ($this->configCopy as $targetKey => $sourceKey) { + // Debug message + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('REQUEST-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...'); + + // Copy from source to targetKey + $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey)); + } // END - foreach } /** @@ -122,7 +137,11 @@ class NodeMessageRequestNodeListHandler extends BaseMessageHandler implements Ha * @return void */ protected function removeMessageConfigurationData (array $messageData) { - $this->partialStub('Please implement this method.'); + // "Walk" throught the config-copy array again + foreach ($this->configCopy as $configKey => $dummy) { + // Now unset this configuration entry (to save some memory again) + $this->getConfigInstance()->unsetConfigEntry($configKey); + } // END - foreach } } diff --git a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php index fd0bf4520..3dee4a960 100644 --- a/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php +++ b/application/hub/main/template/answer/requests/class_XmlRequestNodeListAnswerTemplateEngine.php @@ -115,6 +115,46 @@ class XmlRequestNodeListAnswerTemplateEngine extends BaseXmlTemplateEngine imple $this->getStackerInstance()->pushNamed('node_request_node_list_answer', 'request-node-list-answer'); } + /** + * Starts the my-session-id + * + * @return void + */ + protected function startMySessionId () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_SESSION_ID); + } + + /** + * Starts the node-list + * + * @return void + */ + protected function startNodeList () { + // Push the node name on the stacker + $this->getStackerInstance()->pushNamed('node_request_node_list_answer', self::REQUEST_DATA_NODE_LIST); + } + + /** + * Finishes the node-list + * + * @return void + */ + protected function finishNodeList () { + // Pop the last entry + $this->getStackerInstance()->popNamed('node_request_node_list_answer'); + } + + /** + * Finishes the my-session-id + * + * @return void + */ + protected function finishMySessionId () { + // Pop the last entry + $this->getStackerInstance()->popNamed('node_request_node_list_answer'); + } + /** * Finishes the 'request-node-list-answer' * -- 2.39.5