33 #include "BESXMLGetCommand.h" 34 #include "BESDefinitionStorageList.h" 35 #include "BESDefinitionStorage.h" 36 #include "BESDefine.h" 37 #include "BESDataNames.h" 38 #include "BESResponseNames.h" 39 #include "BESDapNames.h" 40 #include "BESXMLUtils.h" 42 #include "BESSyntaxUserError.h" 60 map<string, string> props;
62 if (name != GET_RESPONSE) {
63 string err =
"The specified command " + name +
" is not a get command";
69 string type = props[
"type"];
71 string err = name +
" command: Must specify data product type";
74 string new_cmd = (string) GET_RESPONSE +
"." + type;
78 _sub_cmd = bldr(_dhi);
80 string err = (string)
"Failed to build command object for " + new_cmd;
91 parse_basic_get(node, name, type, value, props);
99 void BESXMLGetCommand::parse_basic_get(xmlNode *,
const string &name,
const string &type,
100 const string &, map<string, string> &props)
102 _str_cmd = (string)
"get " + type;
103 _definition = props[
"definition"];
104 if (_definition.empty()) {
105 string err = name +
" command: Must specify definition";
108 _str_cmd +=
" for " + _definition;
110 _space = props[
"space"];
111 if (!_space.empty()) _str_cmd +=
" in " + _space;
113 string returnAs = props[
"returnAs"];
114 if (returnAs.empty()) {
115 returnAs = DAP2_FORMAT;
117 _dhi.
data[RETURN_CMD] = returnAs;
119 _dhi.
data[STORE_RESULT] = props[STORE_RESULT];
120 _dhi.
data[ASYNC] = props[ASYNC];
122 _str_cmd +=
" return as " + returnAs;
126 BESDEBUG(
"besxml",
"Converted xml element name to command " << _dhi.
action << endl);
138 if (_sub_cmd)
return _sub_cmd->
get_dhi();
160 if (!_space.empty()) {
167 d = BESDefinitionStorageList::TheList()->
look_for(_definition);
171 string s = (string)
"Unable to find definition " + _definition;
175 BESDefine::containers_citer i = d->first_container();
176 BESDefine::containers_citer ie = d->end_container();
178 _dhi.containers.push_back(*i);
182 _dhi.
data[AGG_CMD] = d->get_agg_cmd();
183 _dhi.
data[AGG_HANDLER] = d->get_agg_handler();
194 strm << BESIndent::LMarg <<
"BESXMLGetCommand::dump - (" << (
void *)
this <<
")" << endl;
197 BESIndent::UnIndent();
provides persistent storage for a specific view of different containers including contraints and aggr...
exception thrown if inernal error encountered
virtual void dump(ostream &strm) const
dumps information about this object
virtual BESDefine * look_for(const string &def_name)
look for the specified definition in the list of defintion stores.
static string lowercase(const string &s)
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
virtual void parse_request(xmlNode *node)=0
Parse the XML request document begining at the given node.
virtual void parse_request(xmlNode *node)
parse a get command.
virtual BESDefinitionStorage * find_persistence(const string &persist_name)
find the persistence store with the given name
virtual BESDataHandlerInterface & get_dhi()
Return the current BESDataHandlerInterface.
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.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void prep_request()
Prepare any information needed to execute the request of this command.
virtual void prep_request()
Prepare any information needed to execute the request of this get command.
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 BESDefine * look_for(const string &def_name)=0
looks for a definition in this persistent store with the given name
string action
the response object requested, e.g. das, dds
virtual BESDataHandlerInterface & get_dhi()
returns the BESDataHandlerInterface of either a sub command, if one exists, or this command's ...
static p_xmlcmd_builder find_command(const string &cmd_str)
Find the BESXMLCommand creation function with the given name.