From b0d8fbacd76b1973dc0bb1a49a2047c7e79fbba7 Mon Sep 17 00:00:00 2001 From: Ren RenJuan Date: Mon, 27 Jan 2014 03:33:17 +0000 Subject: [PATCH] * --- ACTK1_0/se/LPE/LPChkRespExtension.cpp | 113 ++++---------------------- ACTK1_0/se/LPE/LPChkRespExtension.hpp | 49 ++--------- AusRegCliever/server/mdAusReg.cpp | 2 +- 3 files changed, 24 insertions(+), 140 deletions(-) diff --git a/ACTK1_0/se/LPE/LPChkRespExtension.cpp b/ACTK1_0/se/LPE/LPChkRespExtension.cpp index 9caf9fe..786d93d 100644 --- a/ACTK1_0/se/LPE/LPChkRespExtension.cpp +++ b/ACTK1_0/se/LPE/LPChkRespExtension.cpp @@ -2,120 +2,41 @@ #include "se/Response.hpp" #include "se/ResponseExtension.hpp" #include "se/LPE/LPChkRespExtension.hpp" +#include +#include + +extern mdLogger mdLog; /* * Have to use static funcion instead of static variable * since there is not guarantee about the construct/destruct * order of a static instance of any types */ -const std::string LPChkRespExtension::KVLIST_EXPR() +const std::string LPChkRespExtension::CKCLAIM_EXPR() { - return EXTENSION_EXPR() + "/launch:claims"; + return EXTENSION_EXPR() + "/launch:cd/launch:name"; } -LPChkRespExtension::LPChkRespExtension() : - initialised(false), - kvLists() +LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true) { } void LPChkRespExtension::fromXML(XMLDocument *xmlDoc) { - int kvListCount = xmlDoc->getNodeCount("count(" + KVLIST_EXPR() + ")"); + const std::string respElement = CKCLAIM_EXPR(); - if (kvListCount == 0) - { - initialised = false; - } - else - { - for (int i = 1; i <= kvListCount; i++) - { - const std::string currentKVListXPath = - ReceiveSE::replaceIndex(KVLIST_EXPR() + "[IDX]", i); - const std::string kvListName = - xmlDoc->getNodeValue(currentKVListXPath + "/@name"); + try { + const XalanNode * response = xmlDoc->getElement(respElement); + if (response) { - kvLists[kvListName] = createKVList(xmlDoc, currentKVListXPath); - } + } + } + catch(std::exception e) + { + mdLog.logN(1,"%s.",e.what()); + } - initialised = true; - } } -const std::set LPChkRespExtension::getLists() const -{ - std::set kvListNames; - ExtensionList::const_iterator extensionListIterator; - for (extensionListIterator = kvLists.begin(); - extensionListIterator != kvLists.end(); - extensionListIterator++) - { - kvListNames.insert(extensionListIterator->first); - } - - return kvListNames; -} - -const std::set LPChkRespExtension::getListItems( - const std::string &listName) const -{ - std::set itemNames; - ExtensionList::const_iterator extensionListIterator = kvLists.find(listName); - - if (extensionListIterator != kvLists.end()) - { - KeyValueList::const_iterator keyValueListIterator; - - for (keyValueListIterator = extensionListIterator->second.begin(); - keyValueListIterator != extensionListIterator->second.end(); - keyValueListIterator++) - { - itemNames.insert(keyValueListIterator->first); - } - } - - return itemNames; -} - -const std::string LPChkRespExtension::getItem( - const std::string &listName, - const std::string &key) const -{ - std::string itemValue; - ExtensionList::const_iterator extensionListIterator = kvLists.find(listName); - - if (extensionListIterator != kvLists.end()) - { - KeyValueList::const_iterator keyValueListIterator = - extensionListIterator->second.find(key); - - if (keyValueListIterator != extensionListIterator->second.end()) - { - itemValue = keyValueListIterator->second; - } - } - - return itemValue; -} - -const KeyValueList LPChkRespExtension::createKVList( - XMLDocument *xmlDoc, - const std::string &kvListXPath) -{ - int kvItemCount = xmlDoc->getNodeCount("count(" + kvListXPath + "/kv:item)"); - - KeyValueList kvList; - - for (int i = 1; i <= kvItemCount; i++) - { - std::string itemXPath = ReceiveSE::replaceIndex(kvListXPath + "/kv:item[IDX]", i); - std::string key = xmlDoc->getNodeValue(itemXPath + "/@key"); - std::string value = xmlDoc->getNodeValue(itemXPath); - kvList[key] = value; - } - - return kvList; -} diff --git a/ACTK1_0/se/LPE/LPChkRespExtension.hpp b/ACTK1_0/se/LPE/LPChkRespExtension.hpp index 93794d0..186b682 100644 --- a/ACTK1_0/se/LPE/LPChkRespExtension.hpp +++ b/ACTK1_0/se/LPE/LPChkRespExtension.hpp @@ -3,9 +3,8 @@ #include #include - +#include #include -#include "Drafttanepplaunchphase.hpp" class XMLDocument; @@ -15,52 +14,16 @@ class LPChkRespExtension : public ResponseExtension LPChkRespExtension(); virtual void fromXML(XMLDocument *xmlDoc); - virtual bool isInitialised() const; + bool affirmativeResponse(); - /** - * Retrieves the names of all key-value lists that have been added to the - * object. - * - * @return the set of list names - */ - const std::set getLists() const; - - /** - * Retrieves the names of all item keys, for a specified key-value list - * name. - * - * @param listName - * the name of the key-value list - * - * @return the set of item keys - */ - const std::set getListItems(const std::string &listName) const; - - /** - * Retrieves the value of a given key-value item. - * - * @param listName - * the name of the key-value list - * @param key - * the key of the item - * - * @return the value of the item - */ - const std::string getItem(const std::string &listName, const std::string &key) const; private: - const KeyValueList createKVList( - XMLDocument *xmlDoc, - const std::string &kvListXPath); + const XMLDocument *xmlDoc; - bool initialised; - ExtensionList kvLists; + bool typeIsClaims; // False implies type is availablity + bool response; // true/false attribute in reply - static const std::string KVLIST_EXPR(); + static const std::string CKCLAIM_EXPR(); }; -inline bool LPChkRespExtension::isInitialised() const -{ - return initialised; -} #endif /* LPCK_RESPONSE_EXTENSION_H_ */ diff --git a/AusRegCliever/server/mdAusReg.cpp b/AusRegCliever/server/mdAusReg.cpp index b109388..1843394 100644 --- a/AusRegCliever/server/mdAusReg.cpp +++ b/AusRegCliever/server/mdAusReg.cpp @@ -187,7 +187,7 @@ void ausRegEPPTK::doOTEB() theseLogs->logN(0,"Case %d Failed, harness catch.",cmd++); } - theseLogs->logN(1,"(%d) LPE Check of unicycles.bike",cmd++); + theseLogs->logN(1,"(%d) Perform Claims type Check of unicycles.bike",cmd++); DomainCheckCommand oteCommand_2("unicycles.bike"); LPChkCmdExtension chkE(&claims);