33 #include "BESCatalogResponseHandler.h" 34 #include "BESInfoList.h" 36 #include "BESRequestHandlerList.h" 37 #include "BESRequestHandler.h" 39 #include "BESDataNames.h" 40 #include "BESCatalogList.h" 41 #include "BESCatalog.h" 42 #include "BESCatalogEntry.h" 43 #include "BESCatalogUtils.h" 44 #include "BESSyntaxUserError.h" 45 #include "BESNotFoundError.h" 47 #include "BESStopWatch.h" 49 BESCatalogResponseHandler::BESCatalogResponseHandler(
const string &name) :
54 BESCatalogResponseHandler::~BESCatalogResponseHandler()
70 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"BESCatalogResponseHandler::execute", dhi.
data[REQUEST_ID]);
72 BESInfo *info = BESInfoList::TheList()->build_info();
73 d_response_object = info;
76 string container = dhi.
data[CONTAINER];
77 string::size_type notslash = container.find_first_not_of(
"/", 0);
78 if (notslash != string::npos) {
79 container = container.substr(notslash);
81 if (container.empty()) container =
"/";
84 string catalog = dhi.
data[CATALOG];
94 string err = (string)
"Not able to find the catalog '" + catalog +
"'";
104 string err = (string)
"Failed to find node " + container;
111 dhi.action_name = CATALOG_RESPONSE_STR;
114 BESCatalogUtils::display_entry(entry, info);
116 BESCatalogEntry::catalog_citer ei = entry->get_beginning_entry();
117 BESCatalogEntry::catalog_citer ee = entry->get_ending_entry();
118 for (; ei != ee; ei++) {
119 BESCatalogUtils::display_entry((*ei).second, info);
120 info->end_tag(
"dataset");
123 info->end_tag(
"dataset");
126 info->end_response();
144 if (d_response_object) {
145 BESInfo *info = dynamic_cast<BESInfo *>(d_response_object);
159 strm << BESIndent::LMarg <<
"BESCatalogResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
162 BESIndent::UnIndent();
166 BESCatalogResponseHandler::CatalogResponseBuilder(
const string &name)
error thrown if the resource requested cannot be found
response handler that returns nodes or leaves within the catalog either at the root or at a specified...
virtual std::string get_catalog_name() const
Get the name for this catalog.
exception thrown if inernal error encountered
virtual void execute(BESDataHandlerInterface &dhi)
Execute the showCatalog command.
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the informational object
virtual void dump(ostream &strm) const
dumps information about this object
virtual BESCatalogEntry * show_catalog(const std::string &container, BESCatalogEntry *entry)=0
virtual bool start(string name)
handler object that knows how to create a specific response object
informational response object
Catalogs provide a hierarchical organization for data.
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 void begin_response(const string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual BESCatalog * default_catalog() const
The the default catalog.
static BESCatalogList * TheCatalogList()
Get the singleton BESCatalogList instance.
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object