DRDE/ACTK1_0/se/LPE/LPChkRespExtension.cpp

56 lines
1.4 KiB
C++
Raw Permalink Normal View History

2014-01-25 17:30:04 +00:00
#include "xml/XMLDocument.hpp"
#include "se/Response.hpp"
#include "se/ResponseExtension.hpp"
#include "se/LPE/LPChkRespExtension.hpp"
2014-01-27 03:33:17 +00:00
#include <xalanc/XalanDOM/XalanNamedNodeMap.hpp>
2014-01-28 18:16:48 +00:00
//#include <xalanc/XalanDOM/XalanDOMString.hpp>
2014-01-27 03:33:17 +00:00
extern mdLogger mdLog;
2014-01-25 17:30:04 +00:00
2014-01-28 18:16:48 +00:00
//XALAN_USING_XALAN(XalanDOMString)
2014-01-27 17:24:42 +00:00
2014-01-25 17:30:04 +00:00
/*
* 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
*/
2014-01-27 03:33:17 +00:00
const std::string LPChkRespExtension::CKCLAIM_EXPR()
2014-01-25 17:30:04 +00:00
{
2014-01-28 18:16:48 +00:00
return EXTENSION_EXPR() + "//*/@exists";
2014-01-25 17:30:04 +00:00
}
2014-01-28 18:16:48 +00:00
const std::string LPChkRespExtension::CKKEY_EXPR()
{
return EXTENSION_EXPR() + "//launch:claimKey";
}
const char *LPChkRespExtension::getClaimsKey() { return claimsKey.c_str(); }
2014-01-25 17:30:04 +00:00
2014-01-28 18:16:48 +00:00
LPChkRespExtension::LPChkRespExtension() : typeIsClaims(true), initialised(false), response(false),
claimsKey("")
2014-01-25 17:30:04 +00:00
{
}
void LPChkRespExtension::fromXML(XMLDocument *xmlDoc)
{
2014-01-28 18:16:48 +00:00
const std::string ckeyElement = CKKEY_EXPR();
2014-01-27 17:24:42 +00:00
const std::string respElement = CKCLAIM_EXPR();
2014-01-28 18:16:48 +00:00
const std::string respValue = xmlDoc->getNodeValue(respElement);
const std::string doesntExist("false");
2014-01-27 04:02:34 +00:00
2014-01-27 17:24:42 +00:00
initialised = true;
2014-01-28 18:16:48 +00:00
if (respValue.empty() ) {
2014-01-27 04:02:34 +00:00
mdLog.logN(0,"Parse error in LPChkResponse");
}
else {
2014-01-28 18:16:48 +00:00
if (respValue.compare(doesntExist) != 0) {
response = true;
const std::string claimKey= xmlDoc->getNodeValue(ckeyElement);
claimsKey = claimKey;
}
2014-01-27 04:02:34 +00:00
}
2014-01-25 17:30:04 +00:00
}