DRDE/ACTK1_0/se/LPE/LPChkRespExtension.cpp

56 lines
1.4 KiB
C++

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