31#include <dispatch/BESRequestHandlerList.h>
32#include <dispatch/BESContainerStorageList.h>
33#include <dispatch/BESFileContainerStorage.h>
34#include <dispatch/BESCatalogDirectory.h>
35#include <dispatch/BESCatalogList.h>
36#include <dispatch/BESReturnManager.h>
37#include <dispatch/BESServiceRegistry.h>
38#include <dispatch/BESDebug.h>
40#include <dap/BESDapNames.h>
41#include <dap/BESDapService.h>
43#include "GDALModule.h"
44#include "GDALRequestHandler.h"
45#include "writer/GeoTiffTransmitter.h"
46#include "writer/JPEG2000Transmitter.h"
48#define GDAL_CATALOG "catalog"
49#define RETURNAS_GEOTIFF "geotiff"
50#define RETURNAS_JPEG2000 "jpeg2000"
56void GDALModule::initialize(
const string & modname)
58 BESDEBUG(
"gdal",
"Initializing GDAL module " << modname << endl);
60 BESRequestHandler *handler =
new GDALRequestHandler(modname);
61 BESRequestHandlerList::TheList()->add_handler(modname, handler);
67 if (!BESCatalogList::TheCatalogList()->ref_catalog(GDAL_CATALOG)) {
68 BESCatalogList::TheCatalogList()-> add_catalog(
new BESCatalogDirectory(GDAL_CATALOG));
71 if (!BESContainerStorageList::TheList()->ref_persistence(GDAL_CATALOG)) {
72 BESFileContainerStorage *csc =
new BESFileContainerStorage(GDAL_CATALOG);
73 BESContainerStorageList::TheList()->add_persistence(csc);
77 BESReturnManager::TheManager()->add_transmitter(RETURNAS_GEOTIFF,
new GeoTiffTransmitter());
78 BESServiceRegistry::TheRegistry()->
add_format(OPENDAP_SERVICE, DATA_SERVICE, RETURNAS_GEOTIFF);
81 BESReturnManager::TheManager()->add_transmitter(RETURNAS_JPEG2000,
new JPEG2000Transmitter());
82 BESServiceRegistry::TheRegistry()->
add_format(OPENDAP_SERVICE, DATA_SERVICE, RETURNAS_JPEG2000);
87 BESDEBUG(
"gdal",
"Done Initializing GDAL module " << modname << endl);
90void GDALModule::terminate(
const string & modname)
92 BESDEBUG(
"gdal",
"Cleaning GDAL module " << modname << endl);
94 BESContainerStorageList::TheList()->deref_persistence(GDAL_CATALOG);
96 BESCatalogList::TheCatalogList()->deref_catalog(GDAL_CATALOG);
98 BESReturnManager::TheManager()->del_transmitter(RETURNAS_GEOTIFF);
100 BESReturnManager::TheManager()->del_transmitter(RETURNAS_JPEG2000);
103 delete BESRequestHandlerList::TheList()->remove_handler(modname);
105 BESDEBUG(
"gdal",
"Done Cleaning GDAL module " << modname << endl);
116 strm << BESIndent::LMarg <<
"GDALModule::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
dumps information about this object