OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FONcModule.cc
Go to the documentation of this file.
1 // FONcModule.cc
2 
3 // This file is part of BES filout NetCDF Module.
4 
5 // Copyright (c) 2004,2005 University Corporation for Atmospheric Research
6 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
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 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
26 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
27 //
28 // Authors:
29 // pwest Patrick West <pwest@ucar.edu>
30 // jgarcia Jose Garcia <jgarcia@ucar.edu>
31 
32 #include "config.h"
33 
34 #include <iostream>
35 
36 using std::endl ;
37 
38 #include "FONcModule.h"
39 #include "FONcTransmitter.h"
40 #include "FONcRequestHandler.h"
41 #include "BESRequestHandlerList.h"
42 
43 #include <BESReturnManager.h>
44 
45 #include <BESServiceRegistry.h>
46 #include <BESDapNames.h>
47 
48 #include <TheBESKeys.h>
49 #include <BESDebug.h>
50 
51 #define RETURNAS_NETCDF "netcdf"
52 #define RETURNAS_NETCDF4 "netcdf-4"
53 
64 void
65 FONcModule::initialize( const string &modname )
66 {
67  BESDEBUG( "fonc", "Initializing module " << modname << endl ) ;
68 
69  BESDEBUG( "fonc", " adding " << modname << " request handler" << endl ) ;
70  BESRequestHandler *handler = new FONcRequestHandler( modname ) ;
71  BESRequestHandlerList::TheList()->add_handler( modname, handler ) ;
72 
73  BESDEBUG( "fonc", " adding " << RETURNAS_NETCDF << " transmitter"
74  << endl ) ;
76  new FONcTransmitter( ) ) ;
77 
78  BESDEBUG( "fonc", " adding fonc netcdf service to dap" << endl ) ;
81  RETURNAS_NETCDF ) ;
82 
83  BESDEBUG( "fonc", " adding " << RETURNAS_NETCDF4 << " transmitter"
84  << endl ) ;
86  new FONcTransmitter( ) ) ;
87 
88  BESDEBUG( "fonc", " adding fonc netcdf4 service to dap" << endl ) ;
92 
93 
94  BESDEBUG( "fonc", " adding fonc debug context" << endl ) ;
95  BESDebug::Register( "fonc" ) ;
96 
97  BESDEBUG( "fonc", "Done Initializing module " << modname << endl ) ;
98 }
99 
108 void
109 FONcModule::terminate( const string &modname )
110 {
111  BESDEBUG( "fonc", "Cleaning module " << modname << endl ) ;
112 
113  BESDEBUG( "fonc", " removing " << RETURNAS_NETCDF << " transmitter"
114  << endl ) ;
116 
117  BESDEBUG( "fonc", " removing " << RETURNAS_NETCDF4 << " transmitter "
118  << endl ) ;
119 
121 
122  BESDEBUG( "fonc", " removing " << modname << " request handler "
123  << endl ) ;
124  BESRequestHandler *rh =
126  if( rh ) delete rh ;
127 
128  BESDEBUG( "fonc", "Done Cleaning module " << modname << endl ) ;
129 }
130 
137 void
138 FONcModule::dump( ostream &strm ) const
139 {
140  strm << BESIndent::LMarg << "FONcModule::dump - ("
141  << (void *) this << ")" << endl;
142 }
143 
147 extern "C"
148 {
150  {
151  return new FONcModule ;
152  }
153 }
154 
#define DATA_SERVICE
Definition: BESDapNames.h:71
virtual bool del_transmitter(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
#define OPENDAP_SERVICE
macros representing the default response objects handled
Definition: BESDapNames.h:52
Module that allows for OPeNDAP Data objects to be returned as netcdf files.
Definition: FONcModule.h:52
virtual bool add_transmitter(const string &name, BESTransmitter *transmitter)
A Request Handler for the Fileout NetCDF request.
virtual void initialize(const string &modname)
initialize the module by adding callbacks and registering objects with the framework ...
Definition: FONcModule.cc:65
static BESReturnManager * TheManager()
static BESServiceRegistry * TheRegistry()
#define RETURNAS_NETCDF4
Definition: FONcModule.cc:52
BESTransmitter class named "netcdf" that transmits an OPeNDAP data object as a netcdf file...
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
virtual void terminate(const string &modname)
removes any registered callbacks or objects from the framework
Definition: FONcModule.cc:109
Represents a specific data type request handler.
static BESRequestHandlerList * TheList()
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
virtual void dump(ostream &strm) const
dumps information about this object for debugging purposes
Definition: FONcModule.cc:138
static void Register(const string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
#define RETURNAS_NETCDF
Definition: FONcModule.cc:51
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: FONcModule.cc:149