OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESWWWModule.cc
Go to the documentation of this file.
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 <iostream>
33 
34 using std::endl;
35 
36 #include "BESWWWModule.h"
37 #include "BESDebug.h"
38 
39 #include "BESWWWNames.h"
40 #include "BESDapNames.h"
41 #include "BESResponseNames.h"
42 #include "BESResponseHandlerList.h"
43 #include "BESWWWResponseHandler.h"
44 
45 #include "BESWWWRequestHandler.h"
46 #include "BESRequestHandlerList.h"
47 
48 #include "BESDapService.h"
49 
50 #include "BESWWWTransmit.h"
51 #include "BESTransmitter.h"
52 #include "BESReturnManager.h"
53 #include "BESTransmitterNames.h"
54 
55 #include "BESXMLWWWGetCommand.h"
56 
57 void
58  BESWWWModule::initialize(const string & modname)
59 {
60  BESDEBUG( "www", "Initializing OPeNDAP WWW module " << modname << endl ) ;
61 
62  BESDEBUG( "www", " adding " << modname << " request handler" << endl ) ;
63  BESRequestHandler *handler = new BESWWWRequestHandler( modname ) ;
64  BESRequestHandlerList::TheList()->add_handler( modname, handler ) ;
65 
66  BESDEBUG( "www", " adding " << WWW_RESPONSE
67  << " response handler" << endl ) ;
70  WWWResponseBuilder);
71 
72  BESDEBUG( "www", "Adding to dap services" << endl ) ;
74  "OPeNDAP HTML Form for data constraints and access" ) ;
75 
76  BESTransmitter *t =
78  if( t )
79  {
80  BESDEBUG( "www", " adding basic " << WWW_TRANSMITTER
81  << " transmit function" << endl ) ;
83  }
84 
85  BESDEBUG( "www", " adding " << WWW_RESPONSE << " command" << endl) ;
86  /* old-style string command
87  BESCommand *cmd = new BESWWWGetCommand(WWW_RESPONSE);
88  BESCommand::add_command(WWW_RESPONSE, cmd);
89  */
92 
93  BESDEBUG( "www", "Adding www context to BESDebug" << endl ) ;
94  BESDebug::Register( "www" ) ;
95 
96  BESDEBUG( "www", "Done Initializing OPeNDAP WWW module "
97  << modname << endl ) ;
98 }
99 
100 void BESWWWModule::terminate(const string & modname)
101 {
102  BESDEBUG( "www", "Cleaning OPeNDAP WWW module " << modname << endl ) ;
103 
104  BESDEBUG( "www", " removing " << modname <<
105  " request handler " << endl ) ;
107  if( rh ) delete rh ;
108 
109  BESDEBUG( "www", " removing " << WWW_RESPONSE
110  << " response handler" << endl ) ;
112 
113  BESDEBUG( "www", " removing " << WWW_RESPONSE << " command" << endl ) ;
115 
116  BESTransmitter *t =
118  if( t )
119  {
120  BESDEBUG( "www", " removing basic " << WWW_TRANSMITTER
121  << " transmit function" << endl ) ;
123  }
124 
126  if( t )
127  {
128  BESDEBUG( "www", " removing http " << WWW_TRANSMITTER
129  << " transmit function" << endl ) ;
131  }
132 
133  BESDEBUG( "www", "Done Cleaning OPeNDAP WWW module " << modname << endl ) ;
134 }
135 
142 void BESWWWModule::dump(ostream & strm) const
143 {
144  strm << BESIndent::LMarg << "BESWWWModule::dump - ("
145  << (void *) this << ")" << endl;
146 }
147 
148 extern "C" BESAbstractModule *maker() {
149  return new BESWWWModule;
150 }
virtual BESTransmitter * find_transmitter(const string &name)
static bool del_command(const string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.
static void add_to_dap_service(const string &cmd, const string &desc)
static function to add commands to the dap service
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
static void send_basic_form(BESResponseObject *obj, BESDataHandlerInterface &dhi)
virtual void dump(ostream &strm) const
dumps information about this object
virtual bool add_method(string method_name, p_transmitter trans_method)
#define WWW_SERVICE
Definition: BESWWWNames.h:46
response handler that builds an OPeNDAP WWW response object
static BESReturnManager * TheManager()
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
virtual bool add_handler(const string &handler, p_response_handler handler_method)
add a response handler to the list
#define DAP2_FORMAT
Definition: BESDapNames.h:53
Represents a specific data type request handler.
BESAbstractModule * maker()
static BESRequestHandlerList * TheList()
virtual bool remove_handler(const string &handler)
removes a response handler from the list
#define WWW_RESPONSE
macros representing the WWW response objects handled
Definition: BESWWWNames.h:45
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
virtual void terminate(const string &modname)
static void Register(const string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
virtual bool remove_method(string method_name)
static BESXMLCommand * CommandBuilder(const BESDataHandlerInterface &base_dhi)
#define WWW_TRANSMITTER
static BESResponseHandlerList * TheList()
virtual BESRequestHandler * remove_handler(const string &handler_name)
remove and return the specified request handler
virtual void initialize(const string &modname)
Definition: BESWWWModule.cc:58