BESInterface Class Reference

Entry point into BES, building responses to given requests. More...

#include <BESInterface.h>

Inheritance diagram for BESInterface:

Inheritance graph
[legend]
Collaboration diagram for BESInterface:

Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual int execute_request (const string &from)
 Executes the given request to generate a specified response object.
virtual void dump (ostream &strm) const
 dumps information about this object

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 int exception_manager (BESException &e)
 Manage any exceptions thrown during the whole process.
virtual void initialize ()
 Initialize the BES object.
virtual void validate_data_request ()
 Validate the incoming request information.
virtual void build_data_request_plan ()
 Build the data request plan.
virtual void execute_data_request_plan ()
 Execute the data request plan.
virtual void invoke_aggregation ()
 Aggregate the resulting response object.
virtual void transmit_data ()
 Transmit the resulting response object.
virtual void log_status ()
 Log the status of the request.
virtual void report_request ()
 Report the request and status of the request to BESReporterList::TheList().
virtual void end_request ()
 End the BES request.
virtual void clean ()
 Clean up after the request.
 BESInterface ()
 BESInterface (ostream *strm)
virtual ~BESInterface ()

Protected Attributes

BESDataHandlerInterface _dhi
BESTransmitter_transmitter


Detailed Description

Entry point into BES, building responses to given requests.

BESInterface is an abstract class providing the entry point into the retrieval of information using the BES framework. There are eight steps to retrieving a response to a given request:

  1. initialize the BES environment
  2. validate the incoming information to make sure that all information is available to perform the query
  3. build the request plan to retrieve the information. A response can be generated for multiple files using multiple server types (cedar, cdf, netcdf, etc...)
  4. execute the request plan and build the response object
  5. transmit the response object
  6. log the status of the request
  7. send out report information that can be reported on by any number of reporters registered with the system.
  8. end the request

The way in which the response is generated is as follows. A BESResponseHandler is found that knows how to build the requested response object. The built-in response handlers are for the response objects das, dds, ddx, data, help, version. These response handlers are added to a response handler list during initialization. Additional response handlers can be added to this list. For example, in Cedar, response handlers are registered to build flat, tab, info, and stream responses.

To build the response objects a user can make many requests. For example, a das object can be built using as many different files as is requested, say for file1,file2,file3,file4. And each of these files could be of a different data type. For example, file1 and file3 could be cedar files, file2 could be cdf file and file4 could be a netcdf file.

The structure that holds all of the requested information is the BESDataHandlerInterface. It holds on to a list of containers, each of which has the data type (cedar, cdf, nph, etc...) and the file to be read. The BESDataHandlerInterface is built in the build request method.

The response handlers know how to build the specified response object, such as DAS, DDS, help, status, version, etc...

For each container in the BESDataHandlerInterface find the request handler (BESRequestHandler) for the containers data type. Each request handler registers functions that know how to fill in a certain type of response (DAS, DDS, etc...). Find that function and invoke it. So, for example, there is a CedarRequestHandler class that registers functions that knows how to fill in the different response objects from cedar files.

Once the response object is filled it is transmitted using a specified BESTransmitter.

The status is then logged (default is to not log any status. It is up to derived classes of BESInterface to implement the log_status method.)

The request and status are then reported. The default action is to pass off the reporting to BESReporterList::TheList(), which has a list of registered reporters and passes off the information to each of those reporters. For example, if the Cedar project wants to report on any cedar access then it can register a reporter with BESReporterList::TheList().

See also:
BESGlobalInit

BESKeys

BESResponseHandler

BESRequestHandler

BESTransmitter

BESLog

BESReporter

Definition at line 123 of file BESInterface.h.


Constructor & Destructor Documentation

BESInterface::BESInterface (  )  [inline, protected]

Definition at line 149 of file BESInterface.h.

BESInterface::BESInterface ( ostream *  strm  )  [protected]

Definition at line 67 of file BESInterface.cc.

References _dhi, and _BESDataHandlerInterface::set_output_stream().

Here is the call graph for this function:

BESInterface::~BESInterface (  )  [protected, virtual]

Definition at line 78 of file BESInterface.cc.


Member Function Documentation

int BESInterface::exception_manager ( BESException e  )  [protected, virtual]

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.

Parameters:
e BESException to be managed
Returns:
status after exception is handled
See also:
BESException

Reimplemented in BESApacheInterface.

Definition at line 393 of file BESInterface.cc.

References _dhi, BESExceptionManager::handle_exception(), and BESExceptionManager::TheEHM().

Referenced by BESApacheInterface::exception_manager().

Here is the call graph for this function:

void BESInterface::initialize (  )  [protected, virtual]

Initialize the BES object.

This method must be called by all derived classes as it will initialize the environment

Reimplemented in BESApacheInterface, and BESCmdInterface.

Definition at line 191 of file BESInterface.cc.

References _dhi, BESDEBUG, _BESDataHandlerInterface::data, and DATA_REQUEST.

Referenced by execute_request(), and BESCmdInterface::initialize().

void BESInterface::validate_data_request (  )  [protected, virtual]

Validate the incoming request information.

Reimplemented in BESApacheInterface, and BESCmdInterface.

Definition at line 214 of file BESInterface.cc.

Referenced by execute_request(), and BESCmdInterface::validate_data_request().

void BESInterface::build_data_request_plan (  )  [protected, virtual]

Build the data request plan.

It is the responsibility of the derived class to build the request plan. In other words, the container list must be filled in and the action set in the BESDataHandlerInterface structure.

See also:
_BESDataHandlerInterface

Reimplemented in BESCgiInterface, and BESCmdInterface.

Definition at line 227 of file BESInterface.cc.

Referenced by execute_request().

void BESInterface::execute_data_request_plan (  )  [protected, virtual]

Execute the data request plan.

Given the information in the BESDataHandlerInterface, execute the request. To do this we simply find the response handler given the action in the BESDataHandlerInterface and tell it to execute.

If no BESResponseHandler can be found given the action then an exception is thrown.

See also:
_BESDataHandlerInterface

BESResponseHandler

BESResponseObject

Reimplemented in BESCmdInterface.

Definition at line 245 of file BESInterface.cc.

References _dhi, _BESDataHandlerInterface::action, BESDEBUG, _BESDataHandlerInterface::data, DATA_REQUEST, BESResponseHandler::execute(), and _BESDataHandlerInterface::response_handler.

Referenced by BESCmdInterface::execute_data_request_plan(), and execute_request().

Here is the call graph for this function:

void BESInterface::invoke_aggregation (  )  [protected, virtual]

Aggregate the resulting response object.

Reimplemented in BESCmdInterface.

Definition at line 263 of file BESInterface.cc.

References _dhi, AGG_CMD, AGG_HANDLER, BESAggregationServer::aggregate(), BESDEBUG, _BESDataHandlerInterface::data, BESAggFactory::find_handler(), and BESAggFactory::TheFactory().

Referenced by execute_request(), and BESCmdInterface::invoke_aggregation().

Here is the call graph for this function:

void BESInterface::transmit_data (  )  [protected, virtual]

Transmit the resulting response object.

The derived classes are responsible for specifying a transmitter object for use in transmitting the response object. Again, the BESResponseHandler knows how to transmit itself.

If no response handler or no response object or no transmitter is specified then do nothing here.

See also:
BESResponseHandler

BESResponseObject

BESTransmitter

Reimplemented in BESCmdInterface.

Definition at line 296 of file BESInterface.cc.

References _dhi, _transmitter, BESDEBUG, _BESDataHandlerInterface::data, DATA_REQUEST, _BESDataHandlerInterface::error_info, BESInfo::print(), _BESDataHandlerInterface::response_handler, BESResponseHandler::transmit(), and BESInfo::transmit().

Referenced by BESCmdInterface::transmit_data().

Here is the call graph for this function:

void BESInterface::log_status (  )  [protected, virtual]

Log the status of the request.

Reimplemented in BESCmdInterface.

Definition at line 323 of file BESInterface.cc.

void BESInterface::report_request (  )  [protected, virtual]

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.

See also:
BESReporterList

BESReporter

Definition at line 339 of file BESInterface.cc.

References _dhi, BESDEBUG, DATA_REQUEST, BESReporterList::report(), and BESReporterList::TheList().

Here is the call graph for this function:

void BESInterface::end_request (  )  [protected, virtual]

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

Definition at line 359 of file BESInterface.cc.

References _dhi, BESDEBUG, _BESDataHandlerInterface::data, and DATA_REQUEST.

void BESInterface::clean (  )  [protected, virtual]

Clean up after the request.

Reimplemented in BESCmdInterface.

Definition at line 373 of file BESInterface.cc.

References _dhi, and _BESDataHandlerInterface::response_handler.

Referenced by BESCmdInterface::clean(), and BESCgiInterface::~BESCgiInterface().

int BESInterface::execute_request ( const string &  from  )  [virtual]

Executes the given request to generate a specified response object.

Execute the request by: 1. initializing BES 2. validating the request, make sure all elements are present 3. build the request plan (ie filling in the BESDataHandlerInterface) 4. execute the request plan using the BESDataHandlerInterface 5. transmit the resulting response object 6. log the status of the execution 7. notify the reporters of the request 8. end the request, which allows developers to add callbacks to notify them of the end of the request

If an exception is thrown in any of these steps the exception is handed over to the exception manager in order to generate the proper response.

Returns:
status of the execution of the request, 0 if okay, !0 otherwise
See also:
initialize

validate_data_request

build_data_request_plan

execute_data_request_plan

transmit_data

log_status

report_request

end_request

exception_manager

Reimplemented in BESCmdInterface.

Definition at line 110 of file BESInterface.cc.

References _dhi, build_data_request_plan(), _BESDataHandlerInterface::data, DATA_REQUEST, execute_data_request_plan(), initialize(), invoke_aggregation(), REQUEST_FROM, SERVER_PID, BESLog::TheLog(), and validate_data_request().

Referenced by BESCmdInterface::execute_request().

Here is the call graph for this function:

void BESInterface::dump ( ostream &  strm  )  const [virtual]

dumps information about this object

Displays the pointer value of this instance along with information about BESDataHandlerInterface, the BESTransmitter being used, and the number of initialization and termimation callbacks.

Parameters:
strm C++ i/o stream to dump the information to

Implements BESObj.

Reimplemented in BESCgiInterface, and BESCmdInterface.

Definition at line 407 of file BESInterface.cc.

References _dhi, _transmitter, BESTransmitter::dump(), _BESDataHandlerInterface::dump(), BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().

Referenced by BESCmdInterface::dump().

Here is the call graph for this function:

void BESInterface::add_init_callback ( p_bes_init  init  )  [static]

Definition at line 180 of file BESInterface.cc.

void BESInterface::add_end_callback ( p_bes_end  end  )  [static]

Definition at line 348 of file BESInterface.cc.


Member Data Documentation

BESDataHandlerInterface BESInterface::_dhi [protected]

Definition at line 134 of file BESInterface.h.

Referenced by BESCgiInterface::BESCgiInterface(), BESCmdInterface::BESCmdInterface(), BESInterface(), BESCmdInterface::build_data_request_plan(), BESCgiInterface::build_data_request_plan(), clean(), BESCmdInterface::clean(), dump(), end_request(), exception_manager(), BESApacheInterface::exception_manager(), execute_data_request_plan(), BESCmdInterface::execute_data_request_plan(), execute_request(), initialize(), BESCmdInterface::initialize(), BESApacheInterface::initialize(), invoke_aggregation(), BESCmdInterface::invoke_aggregation(), BESCmdInterface::log_status(), report_request(), transmit_data(), and BESCmdInterface::transmit_data().

BESTransmitter* BESInterface::_transmitter [protected]

Definition at line 135 of file BESInterface.h.

Referenced by BESCgiInterface::BESCgiInterface(), BESCmdInterface::build_data_request_plan(), dump(), BESCmdInterface::initialize(), transmit_data(), and BESCgiInterface::~BESCgiInterface().


The documentation for this class was generated from the following files:
Generated on Sat Jan 19 04:14:17 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.4