24#include <BESRequestHandlerList.h>
27#include <BESDapService.h>
28#include <BESResponseNames.h>
29#include <BESContainerStorageList.h>
30#include <BESFileContainerStorage.h>
31#include <BESCatalogDirectory.h>
32#include <BESCatalogList.h>
34#include <BESReturnManager.h>
35#include <BESServiceRegistry.h>
36#include <BESDapNames.h>
38#include "DmrppModule.h"
39#include "DmrppRequestHandler.h"
41#include "writer/FODmrppTransmitter.h"
43#define RETURNAS_DMRPP "dmrpp"
47#define DAP_CATALOG "catalog"
49#define prolog string("DmrppModule::").append(__func__).append("() - ")
53void DmrppModule::initialize(
const string &modname)
57 BESDEBUG(modname, prolog <<
"Initializing DMR++ Reader Module " << modname << endl);
59 BESRequestHandlerList::TheList()->add_handler(modname,
new DmrppRequestHandler(modname));
63 if (!BESCatalogList::TheCatalogList()->ref_catalog(DAP_CATALOG)) {
64 BESCatalogList::TheCatalogList()->add_catalog(
new BESCatalogDirectory(DAP_CATALOG));
67 if (!BESContainerStorageList::TheList()->ref_persistence(DAP_CATALOG)) {
68 BESFileContainerStorage *csc =
new BESFileContainerStorage(DAP_CATALOG);
69 BESContainerStorageList::TheList()->add_persistence(csc);
76 BESReturnManager::TheManager()->add_transmitter(RETURNAS_DMRPP,
new FODmrppTransmitter());
77 BESServiceRegistry::TheRegistry()->
add_format(OPENDAP_SERVICE, DAP4DATA_SERVICE, RETURNAS_DMRPP);
79 BESDEBUG(modname, prolog <<
"Done Initializing DMR++ Reader Module " << modname << endl);
82void DmrppModule::terminate(
const string &modname)
84 BESDEBUG(modname, prolog <<
"Cleaning DMR++ Reader Module " << modname << endl);
86 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
89 BESContainerStorageList::TheList()->deref_persistence(DAP_CATALOG);
91 BESCatalogList::TheCatalogList()->deref_catalog(DAP_CATALOG);
93 BESDEBUG(modname, prolog <<
"Done Cleaning DMR++ Reader Module " << modname << endl);
97BESAbstractModule *maker()
105 strm << BESIndent::LMarg <<
"DmrppModule::dump - (" << (
void *)
this <<
")" << endl;
static void handle_dap_service(const std::string &handler)
static function to register a handler to handle the dap services
static void Register(const std::string &flagName)
register the specified debug flag
virtual void add_format(const std::string &service, const std::string &cmd, const std::string &format)
add a format response to a command of a service
virtual void dump(std::ostream &strm) const
dump the contents of this object to the specified ostream