33 #include "BESSetContextResponseHandler.h" 36 #include "BESSilentInfo.h" 40 #include "BESContextManager.h" 41 #include "BESDataNames.h" 42 #include "BESSyntaxUserError.h" 43 #include "BESResponseNames.h" 44 #include "BESDataHandlerInterface.h" 46 BESSetContextResponseHandler::BESSetContextResponseHandler(
const string &name) :
51 BESSetContextResponseHandler::~BESSetContextResponseHandler()
73 dhi.action_name = SET_CONTEXT_STR;
74 BESInfo *info =
new BESSilentInfo();
75 d_response_object = info;
80 string name = dhi.
data[CONTEXT_NAME];
82 string e =
"No context name was specified in set context command";
86 string value = dhi.
data[CONTEXT_VALUE];
88 BESContextManager::TheManager()->
set_context(name, value);
106 if (d_response_object) {
107 BESInfo *info = dynamic_cast<BESInfo *>(d_response_object);
108 if (!info)
throw BESInternalError(
"Expected an Info object.", __FILE__, __LINE__);
122 strm << BESIndent::LMarg <<
"BESSetContextResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
125 BESIndent::UnIndent();
129 BESSetContextResponseHandler::SetContextResponseBuilder(
const string &name)
virtual void set_context(const string &name, const string &value)
set context in the BES
exception thrown if inernal error encountered
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the informational object
error thrown if there is a user syntax error in the request or any other user error
handler object that knows how to create a specific response object
informational response object
virtual void dump(ostream &strm) const
dumps information about this object
response handler that set context within the BES as a simple name/value pair
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object
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 dump(std::ostream &strm) const
dumps information about this object
virtual void execute(BESDataHandlerInterface &dhi)
executes the command to set context within the BES