36 #include "BESDapModule.h" 38 #include "BESDapRequestHandler.h" 39 #include "BESRequestHandlerList.h" 41 #include "BESDapNames.h" 43 #include "BESResponseHandlerList.h" 45 #include "BESDASResponseHandler.h" 46 #include "BESDDSResponseHandler.h" 47 #include "BESDataResponseHandler.h" 48 #include "BESDDXResponseHandler.h" 49 #include "BESDataDDXResponseHandler.h" 50 #include "BESDMRResponseHandler.h" 51 #include "BESDap4ResponseHandler.h" 53 #include "BESCatalogResponseHandler.h" 55 #include "BESServiceRegistry.h" 58 #include "BESDapNullAggregationServer.h" 60 #include "BESAggFactory.h" 62 #include "BESDapTransmit.h" 63 #include "BESTransmitter.h" 64 #include "BESReturnManager.h" 65 #include "BESTransmitterNames.h" 68 #include "BESInternalFatalError.h" 69 #include "BESExceptionManager.h" 70 #include "BESDapError.h" 72 void BESDapModule::initialize(
const string &modname)
74 BESDEBUG(
"dap",
"Initializing DAP Modules:" << endl);
76 BESDEBUG(
"dap",
" adding " << modname <<
" request handler" << endl);
79 BESDEBUG(
"dap",
" adding " << DAS_RESPONSE <<
" response handler" << endl);
80 BESResponseHandlerList::TheList()->
add_handler(DAS_RESPONSE, BESDASResponseHandler::DASResponseBuilder);
82 BESDEBUG(
"dap",
" adding " << DDS_RESPONSE <<
" response handler" << endl );
83 BESResponseHandlerList::TheList()->
add_handler( DDS_RESPONSE, BESDDSResponseHandler::DDSResponseBuilder );
85 BESDEBUG(
"dap",
" adding " << DDX_RESPONSE <<
" response handler" << endl);
86 BESResponseHandlerList::TheList()->
add_handler(DDX_RESPONSE, BESDDXResponseHandler::DDXResponseBuilder);
88 BESDEBUG(
"dap",
" adding " << DATA_RESPONSE <<
" response handler" << endl);
89 BESResponseHandlerList::TheList()->
add_handler(DATA_RESPONSE, BESDataResponseHandler::DataResponseBuilder);
91 BESDEBUG(
"dap",
" adding " << DATADDX_RESPONSE <<
" response handler" << endl);
92 BESResponseHandlerList::TheList()->
add_handler(DATADDX_RESPONSE, BESDataDDXResponseHandler::DataDDXResponseBuilder);
94 BESDEBUG(
"dap",
" adding " << DMR_RESPONSE <<
" response handler" << endl);
95 BESResponseHandlerList::TheList()->
add_handler(DMR_RESPONSE, BESDMRResponseHandler::DMRResponseBuilder);
97 BESDEBUG(
"dap",
" adding " << DAP4DATA_RESPONSE <<
" response handler" << endl);
98 BESResponseHandlerList::TheList()->
add_handler(DAP4DATA_RESPONSE, BESDap4ResponseHandler::Dap4ResponseBuilder);
100 BESDEBUG(
"dap",
" adding " << CATALOG_RESPONSE <<
" response handler" << endl);
101 BESResponseHandlerList::TheList()->
add_handler(CATALOG_RESPONSE, BESCatalogResponseHandler::CatalogResponseBuilder);
103 BESDEBUG(
"dap",
"Adding " << OPENDAP_SERVICE <<
" services:" << endl);
106 registry->
add_to_service(OPENDAP_SERVICE, DAS_SERVICE, DAS_DESCRIPT, DAP2_FORMAT);
107 registry->
add_to_service(OPENDAP_SERVICE, DDS_SERVICE, DDS_DESCRIPT, DAP2_FORMAT);
108 registry->
add_to_service(OPENDAP_SERVICE, DDX_SERVICE, DDX_DESCRIPT, DAP2_FORMAT);
109 registry->
add_to_service(OPENDAP_SERVICE, DATA_SERVICE, DATA_DESCRIPT, DAP2_FORMAT);
110 registry->
add_to_service(OPENDAP_SERVICE, DATADDX_SERVICE, DATADDX_DESCRIPT, DAP2_FORMAT);
112 registry->
add_to_service(OPENDAP_SERVICE, DMR_SERVICE, DMR_DESCRIPT, DAP2_FORMAT);
113 registry->
add_to_service(OPENDAP_SERVICE, DAP4DATA_SERVICE, DAP4DATA_DESCRIPT, DAP2_FORMAT);
115 BESDEBUG(
"dap",
"Initializing DAP Basic Transmitters:" << endl);
116 BESReturnManager::TheManager()->add_transmitter(DAP2_FORMAT,
new BESDapTransmit());
119 BESDEBUG(
"dap",
" adding dap exception handler" << endl);
124 BESDEBUG(
"dap",
" adding null aggregation handler" << endl);
128 BESAggFactory::TheFactory()->
add_handler(
"sequence.aggregation", BESDapSequenceAggregationServer::NewBESDapSequenceAggregationServer);
131 BESDEBUG(
"dap",
" adding dap debug context" << endl);
134 BESDEBUG(
"dap",
"Done Initializing DAP Modules:" << endl);
137 void BESDapModule::terminate(
const string &modname)
139 BESDEBUG(
"dap",
"Removing DAP Modules:" << endl);
145 BESResponseHandlerList::TheList()->
remove_handler(DATADDX_RESPONSE);
146 BESResponseHandlerList::TheList()->
remove_handler(CATALOG_RESPONSE);
149 BESResponseHandlerList::TheList()->
remove_handler(DAP4DATA_RESPONSE);
151 BESResponseHandlerList::TheList()->
remove_handler(CATALOG_RESPONSE);
153 BESDEBUG(
"dap",
" removing " << OPENDAP_SERVICE <<
" services" << endl);
154 BESServiceRegistry::TheRegistry()->
remove_service(OPENDAP_SERVICE);
156 BESDEBUG(
"dap",
" removing dap Request Handler " << modname << endl);
160 BESReturnManager::TheManager()->del_transmitter(DAP2_FORMAT);
165 BESDEBUG(
"dap",
"Done Removing DAP Modules:" << endl);
176 strm << BESIndent::LMarg <<
"BESDapModule::dump - (" << (
void *)
this <<
")" << endl;
static BESAggregationServer * NewBESDapNullAggregationServer(const string &name)
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual void add_service(const string &name)
Add a service to the BES.
The service registry allows modules to register services with the BES that they provide.
virtual void add_to_service(const string &service, const string &cmd, const string &cmd_descript, const string &format)
This function allows callers to add to a service that already exists.
virtual void add_ehm_callback(p_bes_ehm ehm)
Register an exception handler with the manager.
virtual void remove_service(const string &name)
remove a service from the BES
virtual bool remove_handler(const string &handler_name)
removes a response handler from the list
virtual bool add_handler(const string &handler, p_response_handler handler_method)
add a response handler to the list
Represents a specific data type request handler.
virtual bool remove_handler(const string &handler)
removes a response handler from the list
static int handleException(BESError &e, BESDataHandlerInterface &dhi)
handles exceptions if the error context is set to dap2
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool add_handler(const string &handler_name, p_agg_handler handler_method)
add an aggregation handler to the list
static void Register(const string &flagName)
register the specified debug flag
virtual BESRequestHandler * remove_handler(const string &handler_name)
remove and return the specified request handler