bes  Updated for version 3.20.6
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 using std::endl;
11 using std::ostream;
12 using std::string;
13 using std::map;
14 
15 #define W10N_SHOW_PATH_INFO_DHI_TAG "show.w10nPathInfo"
16 
17 W10nShowPathInfoCommand::W10nShowPathInfoCommand(const BESDataHandlerInterface &base_dhi) :
18  BESXMLCommand(base_dhi)
19 {
20 }
21 
29 {
30  string name;
31  string value;
32  map<string, string> props;
33  BESXMLUtils::GetNodeInfo(node, name, value, props);
34  if (name != W10N_SHOW_PATH_INFO_REQUEST) {
35  string err = "The specified command " + name + " is not a show w10n command";
36  throw BESSyntaxUserError(err, __FILE__, __LINE__);
37  }
38 
39  // the the action is to show the w10n info response
40  d_xmlcmd_dhi.action = W10N_SHOW_PATH_INFO_DHI_TAG;
41  d_xmlcmd_dhi.data[W10N_SHOW_PATH_INFO_DHI_TAG] = W10N_SHOW_PATH_INFO_DHI_TAG;
42  d_cmd_log_info = "show w10nPathInfo";
43 
44  // node is an optional property, so could be empty string
45  d_xmlcmd_dhi.data[CONTAINER] = props["node"];
46  if (!d_xmlcmd_dhi.data[CONTAINER].empty()) {
47  d_cmd_log_info += " for " + d_xmlcmd_dhi.data[CONTAINER];
48  }
49  d_cmd_log_info += ";";
50 
51  BESDEBUG(W10N_DEBUG_KEY, "Built BES Command: '" << d_cmd_log_info << "'"<< endl );
52 
53  // now that we've set the action, go get the response handler for the
54  // action by calling set_response() in our parent class
56 }
57 
64 void W10nShowPathInfoCommand::dump(ostream &strm) const
65 {
66  strm << BESIndent::LMarg << "W10nShowPathInfoCommand::dump - (" << (void *) this << ")" << endl;
67  BESIndent::Indent();
68  BESXMLCommand::dump(strm);
69  BESIndent::UnIndent();
70 }
71 
73 W10nShowPathInfoCommand::CommandBuilder(const BESDataHandlerInterface &base_dhi)
74 {
75  return new W10nShowPathInfoCommand(base_dhi);
76 }
77 
BESXMLCommand::d_cmd_log_info
std::string d_cmd_log_info
Used only for the log.
Definition: BESXMLCommand.h:74
BESDataHandlerInterface::action
std::string action
the response object requested, e.g. das, dds
Definition: BESDataHandlerInterface.h:79
BESXMLCommand::set_response
virtual void set_response()
The request has been parsed, use the command action name to set the response handler.
Definition: BESXMLCommand.cc:63
W10nShowPathInfoCommand::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: W10nShowPathInfoCommand.cc:64
BESXMLUtils::GetNodeInfo
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
Definition: BESXMLUtils.cc:105
W10nShowPathInfoCommand::parse_request
virtual void parse_request(xmlNode *node)
parse a show command. No properties or children elements
Definition: W10nShowPathInfoCommand.cc:28
BESXMLCommand::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: BESXMLCommand.cc:119
BESSyntaxUserError
error thrown if there is a user syntax error in the request or any other user error
Definition: BESSyntaxUserError.h:41
W10nShowPathInfoCommand
Definition: W10nShowPathInfoCommand.h:11
BESDataHandlerInterface::data
std::map< std::string, std::string > data
the map of string data that will be required for the current request.
Definition: BESDataHandlerInterface.h:90
BESXMLCommand
Base class for the BES's commands.
Definition: BESXMLCommand.h:63
BESDataHandlerInterface
Structure storing information used by the BES to handle the request.
Definition: BESDataHandlerInterface.h:56