bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
FoCovJsonModule.cc
1// -*- mode: c++; c-basic-offset:4 -*-
2//
3// FoCovJsonModule.cc
4//
5// This file is part of BES CovJSON File Out Module
6//
7// Copyright (c) 2018 OPeNDAP, Inc.
8// Author: Corey Hemphill <hemphilc@oregonstate.edu>
9// Author: River Hendriksen <hendriri@oregonstate.edu>
10// Author: Riley Rimer <rrimer@oregonstate.edu>
11//
12// Adapted from the File Out JSON module implemented by Nathan Potter
13//
14// This library is free software; you can redistribute it and/or
15// modify it under the terms of the GNU Lesser General Public
16// License as published by the Free Software Foundation; either
17// version 2.1 of the License, or (at your option) any later version.
18//
19// This library is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22// Lesser General Public License for more details.
23//
24// You should have received a copy of the GNU Lesser General Public
25// License along with this library; if not, write to the Free Software
26// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27//
28
29#include "config.h"
30
31#include <iostream>
32
33using std::endl;
34using std::ostream;
35using std::string;
36
37#include "FoCovJsonModule.h"
38#include "FoDapCovJsonTransmitter.h"
39#include "FoCovJsonRequestHandler.h"
40#include "BESRequestHandlerList.h"
41
42#include <BESReturnManager.h>
43
44#include <BESServiceRegistry.h>
45#include <BESDapNames.h>
46
47#include <TheBESKeys.h>
48#include <BESDebug.h>
49
50#define RETURNAS_COVJSON "covjson"
51#define RETURNAS_ICOVJSON "covjson"
52
53
64void FoCovJsonModule::initialize(const string &modname)
65{
66 BESDEBUG( "focovjson", "Initializing module " << modname << endl );
67
68 BESRequestHandler *handler = new FoCovJsonRequestHandler(modname);
69 BESRequestHandlerList::TheList()->add_handler(modname, handler);
70
71
72 BESDEBUG( "focovjson", " adding " << RETURNAS_COVJSON << " transmitter" << endl );
73 BESReturnManager::TheManager()->add_transmitter(RETURNAS_COVJSON, new FoDapCovJsonTransmitter());
74
75
76 BESDebug::Register("focovjson");
77 BESDEBUG( "focovjson", "Done Initializing module " << modname << endl );
78}
79
88void FoCovJsonModule::terminate(const string &modname)
89{
90 BESDEBUG( "focovjson", "Cleaning module " << modname << endl );
91 BESDEBUG( "focovjson", " removing " << RETURNAS_COVJSON << " transmitter" << endl );
92
93 BESReturnManager::TheManager()->del_transmitter(RETURNAS_COVJSON);
94
95 BESDEBUG( "focovjson", " removing " << modname << " request handler " << endl );
96
97 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
98 if (rh)
99 delete rh;
100
101 BESDEBUG( "focovjson", "Done Cleaning module " << modname << endl );
102}
103
110void FoCovJsonModule::dump(ostream &strm) const
111{
112 strm << BESIndent::LMarg << "FoCovJsonModule::dump - (" << (void *) this << ")" << endl;
113}
114
118extern "C"
119BESAbstractModule *maker()
120{
121 return new FoCovJsonModule;
122}
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
Represents a specific data type request handler.
Module that allows for OPeNDAP Data objects to be returned as geotiff files.
virtual void initialize(const std::string &modname)
initialize the module by adding call backs and registering objects with the framework
virtual void terminate(const std::string &modname)
removes any registered callbacks or objects from the framework
virtual void dump(std::ostream &strm) const
dumps information about this object for debugging purposes
A Request Handler for the Fileout NetCDF request.
BESTransmitter class named "json" that transmits an OPeNDAP data object as a JSON file.