bes
Updated for version 3.20.6
|
28 #include <sys/types.h>
39 #include "ShowBesKeyCommand.h"
40 #include "SiteMapResponseHandler.h"
43 #include "BESTextInfo.h"
44 #include "BESDataNames.h"
46 #include "TheBESKeys.h"
47 #include "BESCatalog.h"
48 #include "BESCatalogList.h"
52 #include "BESStopWatch.h"
56 SiteMapResponseHandler::SiteMapResponseHandler(
const string &name) :
61 SiteMapResponseHandler::~SiteMapResponseHandler()
78 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"SiteMapResponseHandler::execute", dhi.
data[REQUEST_ID]);
83 d_response_object = info;
85 if (dhi.
data[SITE_MAP_RESPONSE] != SITE_MAP_RESPONSE)
86 throw BESInternalError(
"Not a Site Map command in SiteMapResponseHandler::execute().", __FILE__, __LINE__);
89 if (*(dhi.
data[PREFIX].end()-1) ==
'/')
90 dhi.
data[PREFIX].erase(dhi.
data[PREFIX].end()-1);
100 if (dhi.
data[CATALOG].empty()) {
101 BESCatalogList::catalog_citer i = catalog_list->
first_catalog();
102 BESCatalogList::catalog_citer e = catalog_list->
end_catalog();
103 for (; i != e; ++i) {
106 throw BESInternalError(
string(
"Build site map found a null catalog in the catalog list."), __FILE__, __LINE__);
113 catalog->get_site_map(prefix, dhi.
data[NODE_SUFFIX], dhi.
data[LEAF_SUFFIX], oss,
"/");
124 BESCatalog *catalog = catalog_list->find_catalog(dhi.
data[CATALOG]);
126 throw BESInternalError(
string(
"Build site map could not find the catalog: ") + dhi.
data[CATALOG], __FILE__, __LINE__);
129 catalog->get_site_map(prefix, dhi.
data[NODE_SUFFIX], dhi.
data[LEAF_SUFFIX], oss,
"/");
138 info->end_response();
154 if (d_response_object) {
156 if (!info)
throw BESInternalError(
"Could not get the Info object in SiteMapResponseHandler::transmit()", __FILE__, __LINE__);
169 strm << BESIndent::LMarg <<
"SiteMapResponseHandler::dump - (" << (
void *)
this <<
")" << std::endl;
172 BESIndent::UnIndent();
176 SiteMapResponseHandler::SiteMapResponseBuilder(
const string &name)
virtual bool start(std::string name)
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 void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object
virtual void dump(std::ostream &strm) const
dumps information about this object
static BESCatalogList * TheCatalogList()
Get the singleton BESCatalogList instance.
List of all registered catalogs.
virtual void execute(BESDataHandlerInterface &dhi)
executes the command 'show catalog|leaves [for <node>];' by returning nodes or leaves at the top leve...
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
virtual void add_data(const std::string &s)
add data to this informational object. If buffering is not set then the information is output directl...
Catalogs provide a hierarchical organization for data.
virtual void begin_response(const std::string &response_name, BESDataHandlerInterface &dhi)
begin the informational response
Structure storing information used by the BES to handle the request.
virtual std::string default_catalog_name() const
The name of the default catalog.
virtual catalog_citer first_catalog() const
Iterator to the first catalog.
Response handler that returns a site map.
represents simple text information in a response object, such as version and help information.