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"
50BESSetContextResponseHandler::BESSetContextResponseHandler(
const string &name) :
55BESSetContextResponseHandler::~BESSetContextResponseHandler()
77 dhi.action_name = SET_CONTEXT_STR;
78 BESInfo *info =
new BESSilentInfo();
79 d_response_object = info;
84 string name = dhi.
data[CONTEXT_NAME];
86 string e =
"No context name was specified in set context command";
90 string value = dhi.
data[CONTEXT_VALUE];
92 BESContextManager::TheManager()->
set_context(name, value);
110 if (d_response_object) {
112 if (!info)
throw BESInternalError(
"Expected an Info object.", __FILE__, __LINE__);
126 strm << BESIndent::LMarg <<
"BESSetContextResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
129 BESIndent::UnIndent();
133BESSetContextResponseHandler::SetContextResponseBuilder(
const string &name)
virtual void set_context(const std::string &name, const std::string &value)
set context in the BES
Structure storing information used by the BES to handle the request.
std::map< std::string, std::string > data
the map of string data that will be required for the current request.
informational response object
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the informational object
exception thrown if internal error encountered
handler object that knows how to create a specific response object
virtual void dump(std::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
virtual void execute(BESDataHandlerInterface &dhi)
executes the command to set context within the BES
virtual void dump(std::ostream &strm) const
dumps information about this object
error thrown if there is a user syntax error in the request or any other user error