37#include "BESXMLGetCommand.h"
38#include "BESDefinitionStorageList.h"
39#include "BESDefinitionStorage.h"
41#include "BESDataNames.h"
42#include "BESResponseNames.h"
43#include "BESDapNames.h"
45#include "BESXMLUtils.h"
47#include "BESSyntaxUserError.h"
74 map<string, string> props;
77 if (name != GET_RESPONSE) {
78 string err =
"The specified command " + name +
" is not a get command";
84 string type = props[
"type"];
86 string err = name +
" command: Must specify data product type";
91 string new_cmd = (string) GET_RESPONSE +
"." + type;
95 _sub_cmd = bldr(d_xmlcmd_dhi);
97 string err = (string)
"Failed to build command object for " + new_cmd;
102 _sub_cmd->parse_request(node);
132 _definition = props[
"definition"];
133 if (_definition.empty())
138 _space = props[
"space"];
140 if (!_space.empty())
d_cmd_log_info.append(
" in ").append(_space);
145 if (props[
"returnAs"].empty()) {
146 d_xmlcmd_dhi.data[RETURN_CMD] = DAP_FORMAT;
149 d_xmlcmd_dhi.data[RETURN_CMD] = props[
"returnAs"];
152 if (!props[
"returnAs"].empty()) {
156 d_xmlcmd_dhi.data[STORE_RESULT] = props[STORE_RESULT];
157 d_xmlcmd_dhi.data[ASYNC] = props[ASYNC];
159 d_xmlcmd_dhi.action =
"get.";
162 BESDEBUG(
"besxml",
"Converted xml element name to command " << d_xmlcmd_dhi.action << endl);
174 if (_sub_cmd)
return _sub_cmd->get_xmlcmd_dhi();
191 _sub_cmd->prep_request();
197 if (!_space.empty()) {
204 d = BESDefinitionStorageList::TheList()->look_for(_definition);
208 string s = (string)
"Unable to find definition " + _definition;
212 BESDefine::containers_citer i = d->first_container();
213 BESDefine::containers_citer ie = d->end_container();
215 d_xmlcmd_dhi.containers.push_back(*i);
220 d_xmlcmd_dhi.data[AGG_CMD] = d->get_agg_cmd();
221 d_xmlcmd_dhi.data[AGG_HANDLER] = d->get_agg_handler();
232 strm << BESIndent::LMarg <<
"BESXMLGetCommand::dump - (" << (
void *)
this <<
")" << endl;
235 BESIndent::UnIndent();
Structure storing information used by the BES to handle the request.
provides persistent storage for a specific view of different containers including contraints and aggr...
virtual BESDefine * look_for(const std::string &def_name)=0
looks for a definition in this persistent store with the given name
exception thrown if internal error encountered
error thrown if there is a user syntax error in the request or any other user error
static std::string lowercase(const std::string &s)
Base class for the BES's commands.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void set_response()
The request has been parsed, use the command action name to set the response handler.
std::string d_cmd_log_info
Used only for the log.
static p_xmlcmd_builder find_command(const std::string &cmd_str)
Find the BESXMLCommand creation function with the given name.
virtual void parse_request(xmlNode *node)
parse a get command.
virtual void prep_request()
Prepare any information needed to execute the request of this get command.
virtual void parse_basic_get(const std::string &type, std::map< std::string, std::string > &props)
Extract information from the 'props' map.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual BESDataHandlerInterface & get_xmlcmd_dhi()
returns the BESDataHandlerInterface of either a sub command, if one exists, or this command's
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