bes  Updated for version 3.20.5
W10nShowPathInfoCommand.cc
1 
2 #include "W10nShowPathInfoCommand.h"
3 #include "W10NNames.h"
4 #include "BESDataNames.h"
5 #include "BESDebug.h"
6 #include "BESUtil.h"
7 #include "BESXMLUtils.h"
8 #include "BESSyntaxUserError.h"
9 
10 #define W10N_SHOW_PATH_INFO_DHI_TAG "show.w10nPathInfo"
11 
12 W10nShowPathInfoCommand::W10nShowPathInfoCommand(const BESDataHandlerInterface &base_dhi) :
13  BESXMLCommand(base_dhi)
14 {
15 }
16 
24 {
25  string name;
26  string value;
27  map<string, string> props;
28  BESXMLUtils::GetNodeInfo(node, name, value, props);
29  if (name != W10N_SHOW_PATH_INFO_REQUEST) {
30  string err = "The specified command " + name + " is not a show w10n command";
31  throw BESSyntaxUserError(err, __FILE__, __LINE__);
32  }
33 
34  // the the action is to show the w10n info response
35  d_xmlcmd_dhi.action = W10N_SHOW_PATH_INFO_DHI_TAG;
36  d_xmlcmd_dhi.data[W10N_SHOW_PATH_INFO_DHI_TAG] = W10N_SHOW_PATH_INFO_DHI_TAG;
37  d_cmd_log_info = "show w10nPathInfo";
38 
39  // node is an optional property, so could be empty string
40  d_xmlcmd_dhi.data[CONTAINER] = props["node"];
41  if (!d_xmlcmd_dhi.data[CONTAINER].empty()) {
42  d_cmd_log_info += " for " + d_xmlcmd_dhi.data[CONTAINER];
43  }
44  d_cmd_log_info += ";";
45 
46  BESDEBUG(W10N_DEBUG_KEY, "Built BES Command: '" << d_cmd_log_info << "'"<< endl );
47 
48  // now that we've set the action, go get the response handler for the
49  // action by calling set_response() in our parent class
51 }
52 
59 void W10nShowPathInfoCommand::dump(ostream &strm) const
60 {
61  strm << BESIndent::LMarg << "W10nShowPathInfoCommand::dump - (" << (void *) this << ")" << endl;
62  BESIndent::Indent();
63  BESXMLCommand::dump(strm);
64  BESIndent::UnIndent();
65 }
66 
68 W10nShowPathInfoCommand::CommandBuilder(const BESDataHandlerInterface &base_dhi)
69 {
70  return new W10nShowPathInfoCommand(base_dhi);
71 }
72 
virtual void dump(ostream &strm) const
dumps information about this object
static void GetNodeInfo(xmlNode *node, string &name, string &value, map< string, string > &props)
get the name, value if any, and any properties for the specified node
Definition: BESXMLUtils.cc:101
virtual void parse_request(xmlNode *node)
parse a show command. No properties or children elements
error thrown if there is a user syntax error in the request or any other user error
virtual void set_response()
The request has been parsed, use the command action name to set the response handler.
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
virtual void dump(ostream &strm) const
dumps information about this object
Base class for the BES's commands.
Definition: BESXMLCommand.h:63
string action
the response object requested, e.g. das, dds
std::string d_cmd_log_info
Used only for the log.
Definition: BESXMLCommand.h:74