bes  Updated for version 3.20.6
BESRequestHandlerList Class Reference

The list of registered request handlers for this server; a singleton. More...

#include <BESRequestHandlerList.h>

Collaboration diagram for BESRequestHandlerList:
Collaboration graph

Public Types

typedef std::map< std::string, BESRequestHandler * >::const_iterator Handler_citer
 
typedef std::map< std::string, BESRequestHandler * >::iterator Handler_iter
 

Public Member Functions

virtual bool add_handler (const std::string &handler_name, BESRequestHandler *handler)
 add a request handler to the list of registered handlers for this server More...
 
virtual void dump (std::ostream &strm) const
 dumps information about this object More...
 
virtual void execute_all (BESDataHandlerInterface &dhi)
 for all of the registered request handlers, execute the given request More...
 
virtual void execute_current (BESDataHandlerInterface &dhi)
 Execute a single method for the current container that will fill in the response object rather than iterating over the list of containers or request handlers. More...
 
virtual void execute_each (BESDataHandlerInterface &dhi)
 for each container in the given data handler interface, execute the given request More...
 
virtual BESRequestHandlerfind_handler (const std::string &handler_name)
 find and return the specified request handler More...
 
virtual Handler_citer get_first_handler ()
 return an iterator pointing to the first request handler in the list More...
 
virtual std::string get_handler_names ()
 Returns a comma separated string of request handlers registered with the server. More...
 
virtual Handler_citer get_last_handler ()
 return a constant iterator pointing to the end of the list More...
 
virtual BESRequestHandlerremove_handler (const std::string &handler_name)
 remove and return the specified request handler More...
 

Static Public Member Functions

static BESRequestHandlerListTheList ()
 

Detailed Description

The list of registered request handlers for this server; a singleton.

For a type of data to be read by the BES, there must be a request handler that can read those data. Typically, a request handler reads information from files stored on the computer running the BES, although it is possible for a request handler to read data from remote machines, other data services, relational databases, et cetera.

Instances of BESRequestHandler use the BESDataHandlerInterface object to get a ResponseObject that they then 'fill in' with the 'requested' information. The ResponseObject holds instances of other objects like DAS, DDS, DMR, or version.

The request handlers are registered with this request handler list using a short std::string as the key value. Other parts of the BES can access this singleton class to find a specific handler using that std::string.

See also
BESDapModule::initialize() to see where various handlers used to process requests for DAP2 and DAP4 responses are registered along with the std::strings that can be used to access the handlers using this class' file_handler() method.

Definition at line 70 of file BESRequestHandlerList.h.

Member Function Documentation

◆ add_handler()

bool BESRequestHandlerList::add_handler ( const std::string &  handler_name,
BESRequestHandler handler_object 
)
virtual

add a request handler to the list of registered handlers for this server

Parameters
handler_namename of the data type handled by this request handler
handler_objectthe request handler object that knows how to fill in specific response objects
Returns
true if successfully added, false if already exists
See also
BESRequestHandler

Definition at line 54 of file BESRequestHandlerList.cc.

◆ dump()

void BESRequestHandlerList::dump ( std::ostream &  strm) const
virtual

dumps information about this object

Displays the pointer value of this instance along with information about each of the registered request handlers.

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

Implements BESObj.

Definition at line 288 of file BESRequestHandlerList.cc.

◆ execute_all()

void BESRequestHandlerList::execute_all ( BESDataHandlerInterface dhi)
virtual

for all of the registered request handlers, execute the given request

In some cases, such as a version or help request, it is necessary to iterate over all of the registered request handlers to fill in the response object. If a request handler does not know how to fill in the response object, i.e. doesn't handle the response type, then simply move on to the next. No exception is thrown in this case.

Note
This method is currently only used by the help and version requests. jhrg 2/23/16
Parameters
dhidata handler interface that contains the necessary information to fill in the response object.
See also
BESDataHandlerInterface
BESRequestHandler
BESResponseObject

Definition at line 194 of file BESRequestHandlerList.cc.

◆ execute_current()

void BESRequestHandlerList::execute_current ( BESDataHandlerInterface dhi)
virtual

Execute a single method for the current container that will fill in the response object rather than iterating over the list of containers or request handlers.

The request is passed * off to the request handler for the current container in the data handler interface.

Parameters
dhidata handler interface that contains the necessary information to fill in the response object
Exceptions
BESInternalErrorif the request handler cannot be found for the current containers data type or if the request handler cannot fill in the specified response object.
See also
BESDataHandlerInterface
BESContainer
BESResponseObject

Definition at line 251 of file BESRequestHandlerList.cc.

◆ execute_each()

void BESRequestHandlerList::execute_each ( BESDataHandlerInterface dhi)
virtual

for each container in the given data handler interface, execute the given request

For some response objects it is necessary to iterate over all of the containers listed in the specified data handler interface. For each container, get the type of data represented by that container, find the request handler for that data type, find the method within that request handler that knows how to handle the response object to be filled in, and execute that method.

Parameters
dhithe data handler interface that contains the list of containers to be iterated over
Exceptions
BESInternalErrorif any one of the request handlers does not know how to fill in the specified response object or if any one of the request handlers does not exist.
See also
BESDataHandlerInterface
BESContainer
BESRequestHandler
BESResponseObject

Definition at line 167 of file BESRequestHandlerList.cc.

◆ find_handler()

BESRequestHandler * BESRequestHandlerList::find_handler ( const std::string &  handler_name)
virtual

find and return the specified request handler

Parameters
handler_namename of the data type request handler
Returns
the request handler for the specified data type, NULL if not found
See also
BESRequestHandler

Definition at line 95 of file BESRequestHandlerList.cc.

◆ get_first_handler()

BESRequestHandlerList::Handler_citer BESRequestHandlerList::get_first_handler ( )
virtual

return an iterator pointing to the first request handler in the list

Returns
a constant iterator pointing to the first request handler in the list
See also
BESRequestHandler

Definition at line 112 of file BESRequestHandlerList.cc.

◆ get_handler_names()

string BESRequestHandlerList::get_handler_names ( )
virtual

Returns a comma separated string of request handlers registered with the server.

Returns
comma separated string of request handler names registered with the server.
See also
BESRequestHandler

Definition at line 134 of file BESRequestHandlerList.cc.

◆ get_last_handler()

BESRequestHandlerList::Handler_citer BESRequestHandlerList::get_last_handler ( )
virtual

return a constant iterator pointing to the end of the list

Returns
a constant iterator pointing to the end of the list
See also
BESRequestHandler

Definition at line 122 of file BESRequestHandlerList.cc.

◆ remove_handler()

BESRequestHandler * BESRequestHandlerList::remove_handler ( const std::string &  handler_name)
virtual

remove and return the specified request handler

Finds, removes and returns the specified request handler. if the handler exists then it is removed from the list, but not deleted. Deleting the request handler is the responsibility of the caller. The request handler is then returned to the caller. If not found, NULL is returned

Parameters
handler_namename of the data type request handler to be removed and returned
Returns
returns the request handler if found, NULL otherwise
See also
BESRequestHandler

Definition at line 76 of file BESRequestHandlerList.cc.


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