bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESXDModule.cc
1// BESXDModule.cc
2
3// This file is part of bes, A C++ back-end server implementation framework
4// for the OPeNDAP Data Access Protocol.
5
6// Copyright (c) 2004,2005 University Corporation for Atmospheric Research
7// Author: Patrick West <pwest@ucar.edu>
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Lesser General Public
11// License as published by the Free Software Foundation; either
12// version 2.1 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.
18//
19// You should have received a copy of the GNU Lesser General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22//
23// You can contact University Corporation for Atmospheric Research at
24// 3080 Center Green Drive, Boulder, CO 80301
25
26// Authors:
27// pwest Patrick West <pwest@ucar.edu>
28
29#include <iostream>
30
31using std::endl;
32using std::ostream;
33using std::string;
34
35#include <BESXDModule.h>
36#include <BESDebug.h>
37
38#include <BESDapNames.h>
39#include <BESResponseNames.h>
40#include <BESResponseHandlerList.h>
41#include <BESRequestHandlerList.h>
42
43#include <BESDapService.h>
44
45#include <BESTransmitter.h>
46#include <BESReturnManager.h>
47#include <BESTransmitterNames.h>
48
49#include "BESXDNames.h"
50#include "BESXDResponseHandler.h"
51#include "BESXDRequestHandler.h"
52#include "BESXDTransmit.h"
53
54void BESXDModule::initialize(const string &modname)
55{
56 BESDEBUG("xd", "Initializing OPeNDAP XD module " << modname << endl);
57
58 BESRequestHandler *handler = new BESXDRequestHandler(modname);
59 BESRequestHandlerList::TheList()->add_handler(modname, handler);
60
61 BESResponseHandlerList::TheList()->add_handler(XD_RESPONSE, BESXDResponseHandler::XDResponseBuilder);
62
63 BESDapService::add_to_dap_service(XD_SERVICE, "OPeNDAP xml data representation");
64
65 BESTransmitter *t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
66 if (t)
67 t->add_method(XD_TRANSMITTER, BESXDTransmit::send_basic_ascii);
68
70
71 BESDEBUG("xd", "Done Initializing OPeNDAP XD module " << modname << endl);
72}
73
74void BESXDModule::terminate(const string &modname)
75{
76 BESDEBUG("xd", "Cleaning OPeNDAP XD module " << modname << endl);
77
78 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
79 if (rh)
80 delete rh;
81
82 BESResponseHandlerList::TheList()->remove_handler(XD_RESPONSE);
83
84 BESTransmitter *t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
85 if (t)
86 t->remove_method(XD_TRANSMITTER);
87
88 t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
89 if (t)
90 t->remove_method(XD_TRANSMITTER);
91
92 BESDEBUG("xd", "Done Cleaning OPeNDAP XD module " << modname << endl);
93}
94
101void BESXDModule::dump(ostream &strm) const
102{
103 strm << BESIndent::LMarg << "BESXDModule::dump - (" << (void *) this << ")" << endl;
104}
105
106extern "C" {
107BESAbstractModule *maker()
108{
109 return new BESXDModule;
110}
111}
112
static void add_to_dap_service(const std::string &cmd, const std::string &desc)
static function to add commands to the dap service
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
virtual void dump(std::ostream &strm) const
dumps information about this object