OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
W10NModule.cc
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset:4 -*-
2 //
3 // W10NModule.cc
4 //
5 // This file is part of BES w10n handler
6 //
7 // Copyright (c) 2015v OPeNDAP, Inc.
8 // Author: Nathan Potter <ndp@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 // Please read the full copyright statement in the file COPYRIGHT_URI.
26 //
27 
28 #include <iostream>
29 
30 #include "BESDebug.h"
31 #include "BESResponseHandlerList.h"
32 #include "BESReturnManager.h"
33 #include "BESRequestHandler.h"
34 #include "BESRequestHandlerList.h"
35 #include "BESXMLCommand.h"
36 
37 #include "W10NModule.h"
38 #include "W10NNames.h"
39 #include "W10nJsonTransmitter.h"
40 #include "W10nJsonRequestHandler.h"
42 #include "ShowPathInfoCommand.h"
43 #include "w10n_utils.h"
44 
45 #define RETURNAS_W10N "w10n"
46 
47 
48 void
49 W10NModule::initialize( const string &modname )
50 {
51  BESDEBUG(W10N_DEBUG_KEY, "Initializing w10n Modules:" << endl ) ;
52 
53  BESRequestHandler *handler = new W10nJsonRequestHandler(modname);
54  BESRequestHandlerList::TheList()->add_handler(modname, handler);
55 
56 
57 
58  BESDEBUG( W10N_DEBUG_KEY, " adding " << SHOW_PATH_INFO_RESPONSE_STR << " command" << endl ) ;
60 
61  BESDEBUG(W10N_DEBUG_KEY, " adding " << SHOW_PATH_INFO_RESPONSE << " response handler" << endl ) ;
63 
64  BESDEBUG( W10N_DEBUG_KEY, " adding " << RETURNAS_W10N << " transmitter" << endl );
66 
67 
69  BESDEBUG(W10N_DEBUG_KEY, "Done Initializing w10n Modules." << endl ) ;
70 }
71 
72 void
73 W10NModule::terminate( const string &modname )
74 {
75  BESDEBUG(W10N_DEBUG_KEY, "Removing w10n Modules:" << endl ) ;
76 
78 
79 
80  BESDEBUG(W10N_DEBUG_KEY, "Done Removing w10n Modules." << endl ) ;
81 }
82 
89 void
90 W10NModule::dump( ostream &strm ) const
91 {
92  strm << BESIndent::LMarg << "W10NModule::dump - ("
93  << (void *)this << ")" << std::endl ;
94 }
95 
96 extern "C"
97 {
99  {
100  return new W10NModule ;
101  }
102 }
103 
static BESXMLCommand * CommandBuilder(const BESDataHandlerInterface &base_dhi)
static void add_command(const string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
BESTransmitter class named "json" that transmits an OPeNDAP data object as a JSON file...
virtual void terminate(const string &modname)
Definition: W10NModule.cc:73
#define RETURNAS_W10N
Definition: W10NModule.cc:45
virtual bool add_transmitter(const string &name, BESTransmitter *transmitter)
virtual void dump(ostream &strm) const
dumps information about this object
Definition: W10NModule.cc:90
static BESReturnManager * TheManager()
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
virtual void initialize(const string &modname)
Definition: W10NModule.cc:49
virtual bool add_handler(const string &handler, p_response_handler handler_method)
add a response handler to the list
#define W10N_DEBUG_KEY
Definition: W10NNames.h:4
#define SHOW_PATH_INFO_RESPONSE
Definition: W10NNames.h:12
Represents a specific data type request handler.
#define SHOW_PATH_INFO_RESPONSE_STR
Definition: W10NNames.h:13
A Request Handler for the Fileout NetCDF request.
static BESRequestHandlerList * TheList()
static BESResponseHandler * ShowPathInfoResponseBuilder(const string &name)
BESAbstractModule * maker()
Definition: W10NModule.cc:98
virtual bool remove_handler(const string &handler)
removes a response handler from the list
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
static void Register(const string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
static BESResponseHandlerList * TheList()