#include <BESCmdInterface.h>
Public Member Functions | |
BESCmdInterface (const string &cmd, ostream *strm) | |
virtual | ~BESCmdInterface () |
virtual int | execute_request (const string &from) |
Override execute_request in order to register memory pool. | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
virtual int | finish_with_error (int status) |
Static Public Member Functions | |
static void | add_init_callback (p_bes_init init) |
static void | add_end_callback (p_bes_end end) |
Protected Member Functions | |
virtual void | initialize () |
Initialize the BES. | |
virtual void | validate_data_request () |
Validate the incoming request information. | |
virtual void | build_data_request_plan () |
Build the data request plan using the BESCmdParser. | |
virtual void | execute_data_request_plan () |
Execute the data request plan. | |
virtual void | invoke_aggregation () |
Invoke the aggregation server, if there is one. | |
virtual void | transmit_data () |
Transmit the response object. | |
virtual void | log_status () |
Log the status of the request to the BESLog file. | |
virtual void | clean () |
Clean up after the request is completed. | |
virtual int | exception_manager (BESError &e) |
Manage any exceptions thrown during the whole process. | |
virtual int | finish (int status) |
virtual void | report_request () |
Report the request and status of the request to BESReporterList::TheList(). | |
virtual void | end_request () |
End the BES request. | |
Protected Attributes | |
BESDataHandlerInterface | _dhi |
BESTransmitter * | _transmitter |
The format of the request looks somethink like:
set container in catalog values c,nc/mplot.nc; define d as c; get das for d;
In this example a DAS object response is being requested. The DAS object is to be built from the definition 'd', where d is defined using the data container c. The data container c is created using the real file nc/mplot.nc
BESCmdInterface uses BESParser to parse through the request string, building up a plan to be used during the execute method. Most implementations simply log information to the BESLog file before calling the parent class method.
BESParser
BESCmdInterface::BESCmdInterface | ( | const string & | cmd, | |
ostream * | strm | |||
) |
References BESInterface::_dhi, _BESDataHandlerInterface::data, and DATA_REQUEST.
BESCmdInterface::~BESCmdInterface | ( | ) | [virtual] |
void BESInterface::add_end_callback | ( | p_bes_end | end | ) | [static, inherited] |
void BESInterface::add_init_callback | ( | p_bes_init | init | ) | [static, inherited] |
void BESCmdInterface::build_data_request_plan | ( | ) | [protected, virtual] |
Build the data request plan using the BESCmdParser.
Reimplemented from BESInterface.
References BESInterface::_dhi, BESInterface::_transmitter, BESDEBUG, _BESDataHandlerInterface::data, DATA_REQUEST, _BESDataHandlerInterface::dump(), BESReturnManager::find_transmitter(), BESDebug::GetStrm(), BESDebug::IsSet(), BESCmdParser::parse(), REQUEST_FROM, RETURN_CMD, SERVER_PID, BESLog::TheLog(), and BESReturnManager::TheManager().
void BESCmdInterface::clean | ( | ) | [protected, virtual] |
Clean up after the request is completed.
Calls the parent method clean and then logs to the BESLog file saying that we are done and exiting the process. The exit actually takes place in the module code.
Reimplemented from BESInterface.
References BESInterface::_dhi, _BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
Referenced by BESApacheInterface::~BESApacheInterface(), and ~BESCmdInterface().
void BESCmdInterface::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance
strm | C++ i/o stream to dump the information to |
Reimplemented from BESInterface.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
void BESInterface::end_request | ( | ) | [protected, virtual, inherited] |
End the BES request.
This method allows developers to add callbacks at the end of a request, to do any cleanup or do any extra work at the end of a request
References BESInterface::_dhi, BESDEBUG, _BESDataHandlerInterface::container, _BESDataHandlerInterface::data, DATA_REQUEST, _BESDataHandlerInterface::first_container(), _BESDataHandlerInterface::next_container(), and BESContainer::release().
Referenced by BESInterface::finish().
int BESInterface::exception_manager | ( | BESError & | e | ) | [protected, virtual, inherited] |
Manage any exceptions thrown during the whole process.
Specific responses are generated given a specific Exception caught. If additional exceptions are thrown within derived systems then implement those in the derived exception_manager methods. This is a catch-all manager and should be called once derived methods have caught their exceptions.
e | BESError to be managed |
Reimplemented in BESApacheInterface.
References BESInterface::_dhi, BESExceptionManager::handle_exception(), and BESExceptionManager::TheEHM().
Referenced by BESInterface::execute_request(), BESInterface::finish(), and BESInterface::finish_with_error().
void BESCmdInterface::execute_data_request_plan | ( | ) | [protected, virtual] |
Execute the data request plan.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
References BESInterface::_dhi, _BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
int BESCmdInterface::execute_request | ( | const string & | from | ) | [virtual] |
Override execute_request in order to register memory pool.
Once the memory pool is initialized hand over control to parent class to execute the request. Once completed, unregister the memory pool.
This needs to be done here instead of the initialization method because???
Reimplemented from BESInterface.
int BESInterface::finish | ( | int | status | ) | [protected, virtual, inherited] |
References BESInterface::_dhi, BESInterface::end_request(), _BESDataHandlerInterface::error_info, BESInterface::exception_manager(), BESError::get_message(), BESInterface::log_status(), BESInfo::print(), BESInterface::report_request(), BESLog::TheLog(), and BESInterface::transmit_data().
Referenced by BESInterface::execute_request(), and BESInterface::finish_with_error().
int BESInterface::finish_with_error | ( | int | status | ) | [virtual, inherited] |
References BESInterface::_dhi, _BESDataHandlerInterface::error_info, BESInterface::exception_manager(), and BESInterface::finish().
Referenced by BESApacheWrapper::call_BES().
void BESCmdInterface::initialize | ( | ) | [protected, virtual] |
Initialize the BES.
Determines what transmitter this BES will be using to transmit response objects and then calls the parent initialization method in order to initialize all global variables.
Reimplemented from BESInterface.
Reimplemented in BESApacheInterface.
References BESInterface::_dhi, BESInterface::_transmitter, BASIC_TRANSMITTER, BESDEBUG, BESReturnManager::find_transmitter(), HTTP_TRANSMITTER, BESReturnManager::TheManager(), and _BESDataHandlerInterface::transmit_protocol.
void BESCmdInterface::invoke_aggregation | ( | ) | [protected, virtual] |
Invoke the aggregation server, if there is one.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
References BESInterface::_dhi, AGG_CMD, AGG_HANDLER, _BESDataHandlerInterface::data, DATA_REQUEST, BESAggFactory::find_handler(), BESLog::is_verbose(), REQUEST_FROM, SERVER_PID, BESAggFactory::TheFactory(), and BESLog::TheLog().
void BESCmdInterface::log_status | ( | ) | [protected, virtual] |
Log the status of the request to the BESLog file.
Reimplemented from BESInterface.
References BESInterface::_dhi, _BESDataHandlerInterface::data, DATA_REQUEST, _BESDataHandlerInterface::error_info, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
void BESInterface::report_request | ( | ) | [protected, virtual, inherited] |
Report the request and status of the request to BESReporterList::TheList().
If interested in reporting the request and status of the request then one must register a BESReporter with BESReporterList::TheList().
If no BESReporter objects are registered then nothing happens.
References BESInterface::_dhi, BESDEBUG, DATA_REQUEST, BESReporterList::report(), and BESReporterList::TheList().
Referenced by BESInterface::finish().
void BESCmdInterface::transmit_data | ( | ) | [protected, virtual] |
Transmit the response object.
Simply calls the parent method. Prior to calling the parent method logs a message to the dods log file.
Reimplemented from BESInterface.
References BESInterface::_dhi, _BESDataHandlerInterface::data, DATA_REQUEST, REQUEST_FROM, SERVER_PID, and BESLog::TheLog().
void BESCmdInterface::validate_data_request | ( | ) | [protected, virtual] |
Validate the incoming request information.
Reimplemented from BESInterface.
Reimplemented in BESApacheInterface.
BESDataHandlerInterface BESInterface::_dhi [protected, inherited] |
Referenced by BESCgiInterface::BESCgiInterface(), BESCmdInterface(), BESInterface::BESInterface(), build_data_request_plan(), BESCgiInterface::build_data_request_plan(), BESInterface::clean(), clean(), BESInterface::dump(), BESInterface::end_request(), BESInterface::exception_manager(), BESApacheInterface::exception_manager(), BESInterface::execute_data_request_plan(), execute_data_request_plan(), BESInterface::execute_request(), BESInterface::finish(), BESInterface::finish_with_error(), BESInterface::initialize(), initialize(), BESApacheInterface::initialize(), BESInterface::invoke_aggregation(), invoke_aggregation(), log_status(), BESInterface::report_request(), BESInterface::transmit_data(), and transmit_data().
BESTransmitter* BESInterface::_transmitter [protected, inherited] |