37#include "BESRequestHandlerList.h"
38#include "BESRequestHandler.h"
39#include "BESInternalError.h"
46static std::once_flag d_euc_init_once;
48BESRequestHandlerList::BESRequestHandlerList() {}
50BESRequestHandlerList::~BESRequestHandlerList() {}
63 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
66 _handler_list[handler_name] = handler_object;
87 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
90 BESRequestHandlerList::Handler_iter i;
91 i = _handler_list.find(handler_name);
92 if (i != _handler_list.end()) {
94 _handler_list.erase(i);
108 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
110 BESRequestHandlerList::Handler_citer i;
111 i = _handler_list.find(handler_name);
112 if (i != _handler_list.end()) {
127 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
129 return _handler_list.begin();
139 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
141 return _handler_list.end();
153 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
156 bool first_name =
true;
157 BESRequestHandlerList::Handler_citer i = _handler_list.begin();
158 for (; i != _handler_list.end(); i++) {
159 if (!first_name) ret +=
", ";
188 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
217 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
221 for (; i != ie; i++) {
279 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
300 if (!request_handler_method) {
302 +
"' does not handle the response type '" + dhi.
action +
"'", __FILE__, __LINE__);
307 request_handler_method(dhi);
320 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
322 strm << BESIndent::LMarg <<
"BESRequestHandlerList::dump - (" << (
void *)
this <<
")" << endl;
324 if (_handler_list.size()) {
325 strm << BESIndent::LMarg <<
"registered handlers:" << endl;
327 BESRequestHandlerList::Handler_citer i = _handler_list.begin();
328 BESRequestHandlerList::Handler_citer ie = _handler_list.end();
329 for (; i != ie; i++) {
333 BESIndent::UnIndent();
336 strm << BESIndent::LMarg <<
"registered handlers: none" << endl;
338 BESIndent::UnIndent();
342BESRequestHandlerList::TheList()
344 std::call_once(d_euc_init_once,BESRequestHandlerList::initialize_instance);
348void BESRequestHandlerList::initialize_instance() {
351 atexit(delete_instance);
355void BESRequestHandlerList::delete_instance() {
std::string get_symbolic_name() const
retrieve the symbolic name for this container
virtual std::string access()=0
returns the true name of this container
std::string get_container_type() const
retrieve the type of data this container holds, such as cedar or netcdf.
Structure storing information used by the BES to handle the request.
std::string action
the response object requested, e.g. das, dds
void first_container()
set the container pointer to the first container in the containers list
BESContainer * container
pointer to current container in this interface
void next_container()
set the container pointer to the next * container in the list, null if at the end or no containers in...
exception thrown if internal error encountered
The list of registered request handlers for this server; a singleton.
virtual void execute_all(BESDataHandlerInterface &dhi)
for all of the registered request handlers, execute the given request
virtual std::string get_handler_names()
Returns a comma separated string of request handlers registered with the server.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual bool add_handler(const std::string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
virtual Handler_citer get_last_handler()
return a constant iterator pointing to the end of the list
virtual void execute_current(BESDataHandlerInterface &dhi)
Execute a single method for the current container that will fill in the response object rather than i...
virtual void execute_each(BESDataHandlerInterface &dhi)
for each container in the given data handler interface, execute the given request
virtual Handler_citer get_first_handler()
return an iterator pointing to the first request handler in the list
virtual BESRequestHandler * find_handler(const std::string &handler_name)
find and return the specified request handler
Represents a specific data type request handler.
virtual p_request_handler_method find_method(const std::string &name)
find the method that can handle the specified response object type
virtual void dump(std::ostream &strm) const
dumps information about this object