bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESWWWModule.cc
1// BESWWWModule.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// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27// Please read the full copyright statement in the file COPYRIGHT_UCAR.
28//
29// Authors:
30// pwest Patrick West <pwest@ucar.edu>
31
32#include "config.h"
33
34#include <iostream>
35
36using std::endl;
37using std::ostream;
38using std::string;
39
40#include "BESWWWModule.h"
41#include "BESDebug.h"
42
43#include "BESWWWNames.h"
44#include "BESDapNames.h"
45#include "BESResponseNames.h"
46#include "BESResponseHandlerList.h"
47#include "BESWWWResponseHandler.h"
48
49#include "BESWWWRequestHandler.h"
50#include "BESRequestHandlerList.h"
51
52#include "BESDapService.h"
53
54#include "BESWWWTransmit.h"
55#include "BESTransmitter.h"
56#include "BESReturnManager.h"
57#include "BESTransmitterNames.h"
58
59#include "BESXMLWWWGetCommand.h"
60
61void BESWWWModule::initialize(const string &modname)
62{
63 BESDEBUG("www", "Initializing OPeNDAP WWW module " << modname << endl);
64
65 BESRequestHandler *handler = new BESWWWRequestHandler(modname);
66 BESRequestHandlerList::TheList()->add_handler(modname, handler);
67
68 BESResponseHandlerList::TheList()->add_handler(WWW_RESPONSE, BESWWWResponseHandler::WWWResponseBuilder);
69
70 BESDapService::add_to_dap_service(WWW_SERVICE, "OPeNDAP HTML Form for data constraints and access");
71
72 BESTransmitter *t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
73 if (t) {
74 t->add_method(WWW_TRANSMITTER, BESWWWTransmit::send_basic_form);
75 }
76
77 BESXMLCommand::add_command(WWW_RESPONSE, BESXMLWWWGetCommand::CommandBuilder);
78
79 BESDebug::Register("www");
80
81 BESDEBUG("www", "Done Initializing OPeNDAP WWW module " << modname << endl);
82}
83
84void BESWWWModule::terminate(const string &modname)
85{
86 BESDEBUG("www", "Cleaning OPeNDAP WWW module " << modname << endl);
87
88 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
89 if (rh) delete rh;
90
91 BESResponseHandlerList::TheList()->remove_handler(WWW_RESPONSE);
92
93 BESXMLCommand::del_command(WWW_RESPONSE);
94
95 BESTransmitter *t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
96 if (t) {
97 t->remove_method(WWW_TRANSMITTER);
98 }
99
100 t = BESReturnManager::TheManager()->find_transmitter(DAP_FORMAT);
101 if (t) {
102 t->remove_method(WWW_TRANSMITTER);
103 }
104
105 BESDEBUG("www", "Done Cleaning OPeNDAP WWW module " << modname << endl);
106}
107
114void BESWWWModule::dump(ostream &strm) const
115{
116 strm << BESIndent::LMarg << "BESWWWModule::dump - (" << (void *) this << ")" << endl;
117}
118
119extern "C" BESAbstractModule *maker()
120{
121 return new BESWWWModule;
122}
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
static void del_command(const std::string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const std::string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.