44 using std::ostringstream;
66 list < p_bes_init > BESInterface::_init_list;
67 list < p_bes_end > BESInterface::_end_list;
70 : _strm( output_stream ),
75 string err =
"output stream must be set in order to output responses" ;
121 string err =
"DataHandlerInterface can not be null" ;
127 pid_t thepid = getpid() ;
143 <<
" request received" << endl ;
162 string serr =
"BES out of memory" ;
167 string serr =
"An undefined exception has been thrown" ;
197 string serr =
"BES out of memory" ;
203 string serr =
"An undefined exception has been thrown" ;
246 (*
BESLog::TheLog()) <<
"Unknown problem reporting request" << endl ;
272 string serr =
"Finish_with_error called with no error object" ;
283 _init_list.push_back(init);
295 bool do_continue =
true;
296 init_iter i = _init_list.begin();
298 for( ; i != _init_list.end() && do_continue ==
true; i++ )
301 do_continue = p( *
_dhi ) ;
307 string se =
"Initialization callback failed, exiting";
348 string se =
"The response handler \"" +
_dhi->
action
349 +
"\" does not exist" ;
410 BESDEBUG(
"bes",
" transmitting error info using transmitter ... "
411 << endl << strm.str() << endl ) ;
416 BESDEBUG(
"bes",
" transmitting response using transmitter ... " << endl ) ;
424 BESDEBUG(
"bes",
" transmitting error info using cout ... " << endl ) ;
429 BESDEBUG(
"bes",
" Unable to transmit the response ... FAILED " << endl ) ;
430 string err =
"Unable to transmit the response, no transmitter" ;
459 <<
" ... " << endl ) ;
469 _end_list.push_back( end ) ;
481 end_iter i = _end_list.begin();
482 for( ; i != _end_list.end(); i++ )
539 << (
void *)
this <<
")" << endl;
542 if (_init_list.size()) {
545 init_iter i = _init_list.begin();
546 for (; i != _init_list.end(); i++) {
554 if (_end_list.size()) {
557 end_iter i = _end_list.begin();
558 for (; i != _end_list.end(); i++) {
static BESReporterList * TheList()
void clean()
clean up any information created within this data handler interface
void(* p_bes_end)(BESDataHandlerInterface &dhi)
void dump(ostream &strm) const
dumps information about this object
exception thrown if an internal error is found and is fatal to the BES
exception thrown if inernal error encountered
void set_output_stream(ostream *strm)
virtual void report(BESDataHandlerInterface &dhi)
static BESAggFactory * TheFactory()
virtual void initialize()
Initialize the BES object.
void next_container()
set the container pointer to the next * container in the list, null if at the end or no containers in...
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the response object built by the execute command using the specified transmitter object ...
static void add_end_callback(p_bes_end end)
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)=0
transmit the informational object
virtual void execute(BESDataHandlerInterface &dhi)=0
knows how to build a requested response object
virtual int exception_manager(BESError &e)
Manage any exceptions thrown during the whole process.
virtual void aggregate(BESDataHandlerInterface &dhi)=0
aggregate the response object
static void add_init_callback(p_bes_init init)
static BESExceptionManager * TheEHM()
virtual void transmit_data()
Transmit the resulting response object.
BESTransmitter * _transmitter
bool(* p_bes_init)(BESDataHandlerInterface &dhi)
virtual string get_message()
get the error message for this exception
handler object that knows how to create a specific response object
virtual int finish_with_error(int status)
Abstract exception class for the BES with basic string message.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void report_request()
Report the request and status of the request to BESReporterList::TheList()
BESResponseHandler * response_handler
static ostream & LMarg(ostream &strm)
virtual BESAggregationServer * find_handler(string handler_name)
returns the aggregation handler with the given name in the list
virtual void validate_data_request()
Validate the incoming request information.
virtual void build_data_request_plan()=0
Build the data request plan.
virtual void clean()
Clean up after the request.
virtual void invoke_aggregation()
Aggregate the resulting response object.
map< string, string > data
the map of string data that will be required for the current request.
virtual void end_request()
End the BES request.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void log_status()
Log the status of the request.
void first_container()
set the container pointer to the first container in the containers list
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
BESInfo * error_info
error information object
virtual int handle_exception(BESError &e, BESDataHandlerInterface &dhi)
Manage any exceptions thrown during the handling of a request.
BESInterface(ostream *strm)
Abstraction representing mechanism for aggregating data.
virtual void execute_data_request_plan()
Execute the data request plan.
virtual int execute_request(const string &from)
Executes the given request to generate a specified response object.
virtual void print(ostream &strm)
print the information from this informational object to the specified stream
virtual int finish(int status)
BESDataHandlerInterface * _dhi
string action
the response object requested, e.g.
BESContainer * container
pointer to current container in this interface