OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FONgModule.cc
Go to the documentation of this file.
1 // FONgModule.cc
2 
3 // This file is part of BES GDAL File Out Module
4 
5 // Copyright (c) 2012 OPeNDAP, Inc.
6 // Author: James Gallagher <jgallagher@opendap.org>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 #include "config.h"
26 
27 #include <iostream>
28 
29 using std::endl;
30 
31 #include "FONgModule.h"
32 #include "GeoTiffTransmitter.h"
33 #include "JPEG2000Transmitter.h"
34 #include "FONgRequestHandler.h"
35 #include "BESRequestHandlerList.h"
36 
37 #include <BESReturnManager.h>
38 
39 #include <BESServiceRegistry.h>
40 #include <BESDapNames.h>
41 
42 #include <TheBESKeys.h>
43 #include <BESDebug.h>
44 
45 #define RETURNAS_GEOTIFF "geotiff"
46 #define RETURNAS_JPEG2000 "jpeg2000"
47 
48 #define JP2 1
49 
50 
61 void FONgModule::initialize(const string &modname)
62 {
63  BESDEBUG( "fong", "Initializing module " << modname << endl );
64 
65  BESRequestHandler *handler = new FONgRequestHandler(modname);
66  BESRequestHandlerList::TheList()->add_handler(modname, handler);
67 
68  BESDEBUG( "fong", " adding " << RETURNAS_GEOTIFF << " transmitter" << endl );
70 
71 #if JP2
72  BESDEBUG( "fong", " adding " << RETURNAS_JPEG2000 << " transmitter" << endl );
74 #endif
75 
76  BESDEBUG( "fong", " adding geotiff service to dap" << endl );
78 
79 #if JP2
80  BESDEBUG( "fong", " adding jpeg2000 service to dap" << endl );
82 #endif
83 
84  BESDebug::Register("fong");
85  BESDEBUG( "fong", "Done Initializing module " << modname << endl );
86 }
87 
96 void FONgModule::terminate(const string &modname)
97 {
98  BESDEBUG( "fong", "Cleaning module " << modname << endl );
99  BESDEBUG( "fong", " removing " << RETURNAS_GEOTIFF << " transmitter" << endl );
100 
102 
103 #if JP2
104  BESDEBUG( "fong", " removing " << RETURNAS_JPEG2000 << " transmitter" << endl );
106 #endif
107 
108  BESDEBUG( "fong", " removing " << modname << " request handler " << endl );
109 
111  if (rh)
112  delete rh;
113 
114  BESDEBUG( "fong", "Done Cleaning module " << modname << endl );
115 }
116 
123 void FONgModule::dump(ostream &strm) const
124 {
125  strm << BESIndent::LMarg << "FONgModule::dump - (" << (void *) this << ")" << endl;
126 }
127 
131 extern "C"
133 {
134  return new FONgModule;
135 }
136 
#define DATA_SERVICE
Definition: BESDapNames.h:71
virtual bool del_transmitter(const string &name)
#define RETURNAS_JPEG2000
Definition: FONgModule.cc:46
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
#define OPENDAP_SERVICE
macros representing the default response objects handled
Definition: BESDapNames.h:52
#define RETURNAS_GEOTIFF
Definition: FONgModule.cc:45
BESTransmitter class named "geotiff" that transmits an OPeNDAP data object as a geotiff file...
virtual bool add_transmitter(const string &name, BESTransmitter *transmitter)
A Request Handler for the Fileout GDAL request.
virtual void dump(ostream &strm) const
dumps information about this object for debugging purposes
Definition: FONgModule.cc:123
static BESReturnManager * TheManager()
static BESServiceRegistry * TheRegistry()
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
virtual void add_format(const string &service, const string &cmd, const string &format)
add a format response to a command of a service
Represents a specific data type request handler.
static BESRequestHandlerList * TheList()
virtual void terminate(const string &modname)
removes any registered callbacks or objects from the framework
Definition: FONgModule.cc:96
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
Module that allows for OPeNDAP Data objects to be returned as geotiff files.
Definition: FONgModule.h:46
static void Register(const string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
virtual void initialize(const string &modname)
initialize the module by adding call backs and registering objects with the framework ...
Definition: FONgModule.cc:61
BESTransmitter class named "geotiff" that transmits an OPeNDAP data object as a geotiff file...
virtual BESRequestHandler * remove_handler(const string &handler_name)
remove and return the specified request handler
BESAbstractModule * maker()
A c function that adds this module to the list of modules to be dynamically loaded.
Definition: FONgModule.cc:132