65 string value, name, action;
66 map<string, string> props;
68 if (action != SET_CONTEXTS_STR) {
69 string err =
"The specified command " + action +
" is not a set context command";
73 xmlNode *current_node = node->children;
74 while (current_node) {
75 if (current_node->type == XML_ELEMENT_NODE) {
78 map<string, string> attributes;
81 if (name !=
"context")
83 + name +
"'."), __FILE__, __LINE__);
86 throw BESSyntaxUserError(
string(
"The 'context' element must contain a value"), __FILE__,
89 if (attributes.size() != 1 || attributes[
"name"].empty())
90 throw BESSyntaxUserError(
string(
"The 'context' element must contain a 'name' attribute."),
94#if USE_CONTEXTS_RESPONSE_HANDLER
101 string context_key = string(CONTEXT_PREFIX).append(attributes[
"name"]);
102 d_xmlcmd_dhi.data[CONTEXT_NAMES] = d_xmlcmd_dhi.data[CONTEXT_NAMES].append(
" ").append(context_key);
103 d_xmlcmd_dhi.data[context_key] = value;
105 BESDEBUG(
"besxml",
"d_xmlcmd_dhi.data[" << context_key <<
"] = " << value << endl);
107 BESDEBUG(
"besxml",
"In " << __func__ <<
" BESContextManager::TheManager()->set_context("
108 << name <<
", " << value <<
")" << endl);
110 BESContextManager::TheManager()->set_context(attributes[
"name"], value);
114 current_node = current_node->next;
117 d_cmd_log_info = string(
"set contexts for ").append(d_xmlcmd_dhi.data[CONTEXT_NAMES]);
120#if USE_CONTEXTS_RESPONSE_HANDLER
122 d_xmlcmd_dhi.action = SET_CONTEXTS_ACTION;
127 d_xmlcmd_dhi.action_name = SET_CONTEXTS_STR;
128 d_xmlcmd_dhi.action = NULL_ACTION;
static void GetNodeInfo(xmlNode *node, std::string &name, std::string &value, std::map< std::string, std::string > &props)
get the name, value if any, and any properties for the specified node
virtual void parse_request(xmlNode *node)
parse a setContexts command.
virtual void dump(std::ostream &strm) const
dumps information about this object