bes
Updated for version 3.20.6
|
30 #include "BESInfoList.h"
32 #include "BESCatalogList.h"
33 #include "BESCatalog.h"
36 #include "BESDataNames.h"
40 #include "BESStopWatch.h"
41 #include "BESSyntaxUserError.h"
43 #include "CatalogNode.h"
44 #include "CatalogItem.h"
45 #include "ShowNodeResponseHandler.h"
51 #define prolog string("ShowNodeResponseHandler::").append(__func__).append("() - ")
65 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"ShowNodeResponseHandler::execute", dhi.
data[REQUEST_ID]);
69 string container = dhi.
data[CONTAINER];
71 BESDEBUG(MODULE, prolog <<
"Requested container: " << container << endl);
79 vector<string> path_tokens;
81 if (!path_tokens.empty()) {
89 container = container.substr(container.find(catalog_name) + catalog_name.length());
91 BESDEBUG(MODULE, prolog <<
"Modified container/path value to: " << container << endl);
99 if (!catalog)
throw BESInternalError(
string(
"Could not find the default catalog."), __FILE__, __LINE__);
102 BESDEBUG(MODULE, prolog <<
"Using the '" << catalog->
get_catalog_name() <<
"' catalog."<< endl);
103 BESDEBUG(MODULE, prolog <<
"use_container: " << container << endl);
106 auto_ptr<CatalogNode> node(catalog->get_node(container));
112 if (dhi.
data[CONTAINER] ==
"/") {
114 BESDEBUG(MODULE, prolog <<
"Adding additional catalog nodes to top level node." << endl);
118 for (; i != e; i++) {
119 string catalog_name = i->first;
122 BESDEBUG(MODULE, prolog <<
"Checking catalog '" << catalog_name <<
"' ptr: " << (
void *) catalog << endl);
126 node->add_node(collection);
128 BESDEBUG(MODULE, prolog <<
"Added catalog node " << catalog_name <<
" to top level node." << endl);
133 BESInfo *info = BESInfoList::TheList()->build_info();
139 node->encode_node(info);
141 info->end_response();
144 dhi.action_name = NODE_RESPONSE_STR;
145 d_response_object = info;
161 if (d_response_object) {
163 if (!info)
throw BESInternalError(
"Expected the Response Object to be a BESInfo instance.", __FILE__, __LINE__);
176 strm << BESIndent::LMarg <<
"ShowNodeResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
179 BESIndent::UnIndent();
183 ShowNodeResponseHandler::ShowNodeResponseBuilder(
const string &name)
virtual bool start(std::string name)
virtual void execute(BESDataHandlerInterface &dhi)
Execute the showNode command.
static void tokenize(const std::string &str, std::vector< std::string > &tokens, const std::string &delimiters="/")
virtual catalog_citer end_catalog() const
Iterator to the last catalog.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the informational object
informational response object
virtual std::string get_catalog_name() const
Get the name for this catalog.
static std::string get_time(bool use_local_time=false)
virtual BESCatalog * default_catalog() const
The the default catalog.
Evaluate a showNode command.
static BESCatalogList * TheCatalogList()
Get the singleton BESCatalogList instance.
std::map< std::string, std::string > data
the map of string data that will be required for the current request.
exception thrown if internal error encountered
handler object that knows how to create a specific response object
Catalogs provide a hierarchical organization for data.
virtual void begin_response(const std::string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void dump(std::ostream &strm) const
dumps information about this object
Structure storing information used by the BES to handle the request.
virtual catalog_citer first_catalog() const
Iterator to the first catalog.
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object