bes  Updated for version 3.20.6
GatewayPathInfoCommand.cc
1 
2 #include "GatewayPathInfoCommand.h"
3 #include "BESDataNames.h"
4 #include "BESDebug.h"
5 #include "BESUtil.h"
6 #include "BESXMLUtils.h"
7 #include "BESSyntaxUserError.h"
8 
9 using std::endl;
10 using std::ostream;
11 using std::string;
12 using std::map;
13 
14 GatewayPathInfoCommand::GatewayPathInfoCommand(const BESDataHandlerInterface &base_dhi) :
15  BESXMLCommand(base_dhi)
16 {
17 
18 }
19 
27 {
28  string name;
29  string value;
30  map<string, string> props;
31  BESXMLUtils::GetNodeInfo(node, name, value, props);
32  if (name != SHOW_GATEWAY_PATH_INFO_RESPONSE_STR) {
33  string err = "The specified command " + name + " is not a gateway show path info command";
34  throw BESSyntaxUserError(err, __FILE__, __LINE__);
35  }
36 
37  // the action is to show the path info response
38  d_xmlcmd_dhi.action = SHOW_GATEWAY_PATH_INFO_RESPONSE;
39  d_xmlcmd_dhi.data[SHOW_GATEWAY_PATH_INFO_RESPONSE] = SHOW_GATEWAY_PATH_INFO_RESPONSE;
40  d_cmd_log_info = "show gatewayPathInfo";
41 
42  // node is an optional property, so could be empty string
43  d_xmlcmd_dhi.data[CONTAINER] = props["node"];
44  if (!d_xmlcmd_dhi.data[CONTAINER].empty()) {
45  d_cmd_log_info += " for " + d_xmlcmd_dhi.data[CONTAINER];
46  }
47  d_cmd_log_info += ";";
48 
49  BESDEBUG(SPI_DEBUG_KEY, "Built BES Command: '" << d_cmd_log_info << "'"<< endl );
50 
51  // now that we've set the action, go get the response handler for the
52  // action by calling set_response() in our parent class
54 }
55 
62 void GatewayPathInfoCommand::dump(ostream &strm) const
63 {
64  strm << BESIndent::LMarg << "GatewayPathInfoCommand::dump - (" << (void *) this << ")" << endl;
65  BESIndent::Indent();
66  BESXMLCommand::dump(strm);
67  BESIndent::UnIndent();
68 }
69 
71 GatewayPathInfoCommand::CommandBuilder(const BESDataHandlerInterface &base_dhi)
72 {
73  return new GatewayPathInfoCommand(base_dhi);
74 }
75 
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
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
GatewayPathInfoCommand::parse_request
virtual void parse_request(xmlNode *node)
parse a show command. No properties or children elements
Definition: GatewayPathInfoCommand.cc:26
GatewayPathInfoCommand
Definition: GatewayPathInfoCommand.h:12
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
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
GatewayPathInfoCommand::dump
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: GatewayPathInfoCommand.cc:62