bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESInterface Class Referenceabstract

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

#include <BESInterface.h>

Inheritance diagram for BESInterface:
Inheritance graph
Collaboration diagram for BESInterface:
Collaboration graph

Public Member Functions

void dump (std::ostream &strm) const override
 dumps information about this object
 
virtual int execute_request (const std::string &from)
 The entry point for command execution; called by BESServerHandler::execute()
 
virtual int finish (int status)
 

Protected Member Functions

 BESInterface (std::ostream *strm)
 
virtual void build_data_request_plan ()=0
 
virtual void clean ()=0
 
void clear_bes_timeout ()
 Clear the bes timeout.
 
virtual void end_request ()
 End the BES request.
 
virtual void execute_data_request_plan ()=0
 
virtual void log_status ()=0
 
void set_bes_timeout ()
 Set the int 'd_bes_timeout' Use either the value of a 'bes_timeout' context or the value set in the BES keys to set the global volatile int 'bes_timeout'.
 
virtual void transmit_data ()=0
 

Static Protected Member Functions

static int handleException (const BESError &e, BESDataHandlerInterface &dhi)
 Make a BESXMLInfo object to hold the error information.
 

Protected Attributes

BESDataHandlerInterfaced_dhi_ptr {nullptr}
 Allocated by the child class.
 
BESTransmitterd_transmitter {nullptr}
 The Transmitter to use for the result.
 

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 118 of file BESInterface.h.

Constructor & Destructor Documentation

◆ BESInterface()

BESInterface::BESInterface ( std::ostream * strm)
explicitprotected

Definition at line 207 of file BESInterface.cc.

Member Function Documentation

◆ build_data_request_plan()

virtual void BESInterface::build_data_request_plan ( )
protectedpure virtual

Implemented in BESXMLInterface.

◆ clean()

virtual void BESInterface::clean ( )
protectedpure virtual

Implemented in BESXMLInterface.

◆ clear_bes_timeout()

void BESInterface::clear_bes_timeout ( )
protected

Clear the bes timeout.

Definition at line 308 of file BESInterface.cc.

◆ dump()

void BESInterface::dump ( std::ostream & strm) const
overridevirtual

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 termination callbacks.

Parameters
strmC++ i/o stream to dump the information to

Implements BESObj.

Reimplemented in BESXMLInterface.

Definition at line 504 of file BESInterface.cc.

◆ end_request()

void BESInterface::end_request ( )
protectedvirtual

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 485 of file BESInterface.cc.

◆ execute_data_request_plan()

virtual void BESInterface::execute_data_request_plan ( )
protectedpure virtual

Implemented in BESXMLInterface.

◆ execute_request()

int BESInterface::execute_request ( const std::string & from)
virtual

The entry point for command execution; called by BESServerHandler::execute()

Execute the request by:

  1. initializing BES
  2. build the request plan (i.e., filling in the BESDataHandlerInterface)
  3. execute the request plan using the BESDataHandlerInterface
  4. transmit the resulting response object
  5. log the status of the execution
  6. 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. Control is returned back to the calling method if an exception is thrown and it is the responsibility of the calling method to call finish_with_error in order to transmit the error message back to the client.

Parameters
fromA string that tells where this request came from. Literally, the IP and port number or the string 'standalone'. See void BESServerHandler::execute(Connection *c) or void StandAloneClient::executeCommand(const string & cmd, int repeat)
Returns
status of the execution of the request, 0 if okay, !0 otherwise
See also
initialize()
build_data_request_plan()
execute_data_request_plan()
finish()
finish_with_error()
transmit_data()
log_status()
end_request()
exception_manager()

Definition at line 354 of file BESInterface.cc.

◆ finish()

int BESInterface::finish ( int status)
virtual

Call this once execute_request() has completed.

Parameters
status
Returns
The status value.

Definition at line 455 of file BESInterface.cc.

◆ handleException()

int BESInterface::handleException ( const BESError & e,
BESDataHandlerInterface & dhi )
staticprotected

Make a BESXMLInfo object to hold the error information.

Get the admin email address and form an error response to pass back to the OLFS. The response is an XML document.

Parameters
eThe BESError object
dhiThe BESDataHandlerInterface object
Returns

Definition at line 242 of file BESInterface.cc.

◆ log_status()

virtual void BESInterface::log_status ( )
protectedpure virtual

Implemented in BESXMLInterface.

◆ set_bes_timeout()

void BESInterface::set_bes_timeout ( )
protected

Set the int 'd_bes_timeout' Use either the value of a 'bes_timeout' context or the value set in the BES keys to set the global volatile int 'bes_timeout'.

Definition at line 280 of file BESInterface.cc.

◆ transmit_data()

virtual void BESInterface::transmit_data ( )
protectedpure virtual

Implemented in BESXMLInterface.

Member Data Documentation

◆ d_dhi_ptr

BESDataHandlerInterface* BESInterface::d_dhi_ptr {nullptr}
protected

Allocated by the child class.

Definition at line 124 of file BESInterface.h.

◆ d_transmitter

BESTransmitter* BESInterface::d_transmitter {nullptr}
protected

The Transmitter to use for the result.

Definition at line 125 of file BESInterface.h.


The documentation for this class was generated from the following files: