28 #include <sys/types.h>
39 #include "ShowBesKeyCommand.h"
40 #include "ShowBesKeyResponseHandler.h"
45 #include "BESInfoList.h"
46 #include "BESDataNames.h"
47 #include "TheBESKeys.h"
49 #include "BESStopWatch.h"
53 ShowBesKeyResponseHandler::ShowBesKeyResponseHandler(
const string &name) :
58 ShowBesKeyResponseHandler::~ShowBesKeyResponseHandler()
76 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"ShowBesKeyResponseHandler::execute", dhi.
data[REQUEST_ID]);
78 BESInfo *info = BESInfoList::TheList()->build_info();
79 d_response_object = info;
81 string requested_bes_key = dhi.
data[BES_KEY];
83 BESDEBUG(SBK_DEBUG_KEY, __func__ <<
"() - requested key: " << requested_bes_key << endl);
85 vector<string> key_values;
86 getBesKeyValue(requested_bes_key, key_values);
88 map<string, string> attrs;
90 attrs[KEY] = requested_bes_key;
96 map<string, string> emptyAttrs;
97 for(
unsigned long i = 0; i < key_values.size(); ++i)
98 info->add_tag(
"value", key_values[i], &emptyAttrs);
101 info->end_response();
118 if (d_response_object) {
133 strm << BESIndent::LMarg <<
"ShowBesKeyResponseHandler::dump - (" << (
void *)
this <<
")" << std::endl;
136 BESIndent::UnIndent();
140 ShowBesKeyResponseHandler::ShowBesKeyResponseBuilder(
const string &name)
145 void ShowBesKeyResponseHandler::getBesKeyValue(
string key, vector<string> &values)
151 BESDEBUG(SBK_DEBUG_KEY, __func__ <<
"() Failed to located BES key '" << key <<
"'" << endl);
152 throw BESError(
"Ouch! The Key name '"+key+
"' was not found in BESKeys",BES_NOT_FOUND_ERROR, __FILE__, __LINE__);