OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FONcRequestHandler.cc
Go to the documentation of this file.
1 // FONcRequestHandler.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> and Jose Garcia <jgarcia@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 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 
34 #include "FONcRequestHandler.h"
35 #include <BESResponseHandler.h>
36 #include <BESResponseNames.h>
37 #include <BESVersionInfo.h>
38 #include <BESDataNames.h>
39 #include <BESDataNames.h>
40 #include <TheBESKeys.h>
41 #include "config.h"
42 
52  : BESRequestHandler( name )
53 {
56 }
57 
61 {
62 }
63 
75 bool
77 {
79  BESInfo *info = dynamic_cast < BESInfo * >(response) ;
80  if( !info )
81  throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
82 
83  bool found = false ;
84  string key = "FONc.Reference" ;
85  string ref ;
86  TheBESKeys::TheKeys()->get_value( key, ref, found ) ;
87  if( ref.empty() )
88  ref = "http://docs.opendap.org/index.php/BES_-_Modules_-_FileOut_Netcdf" ;
89  map<string,string> attrs ;
90  attrs["name"] = MODULE_NAME ;
91  attrs["version"] = MODULE_VERSION ;
92 #if 0
93  attrs["name"] = PACKAGE_NAME;
94  attrs["version"] = PACKAGE_VERSION;
95 #endif
96  attrs["reference"] = ref ;
97  info->begin_tag( "module", &attrs ) ;
98  info->end_tag( "module" ) ;
99 
100  return true ;
101 }
102 
110 bool
112 {
114  BESVersionInfo *info = dynamic_cast < BESVersionInfo * >(response) ;
115  if( !info )
116  throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
117 
118 #if 0
120 #endif
121  info->add_module(MODULE_NAME, MODULE_VERSION);
122 
123  return true ;
124 }
125 
132 void
133 FONcRequestHandler::dump( ostream &strm ) const
134 {
135  strm << BESIndent::LMarg << "FONcRequestHandler::dump - ("
136  << (void *)this << ")" << endl ;
138  BESRequestHandler::dump( strm ) ;
140 }
141 
brief represents simple text information in a response object, such as version and help inforamtion...
exception thrown if inernal error encountered
static bool build_help(BESDataHandlerInterface &dhi)
adds help information for FileOut NetCDF to a help request
static void Indent()
Definition: BESIndent.cc:38
#define HELP_RESPONSE
informational response object
Definition: BESInfo.h:68
FONcRequestHandler(const string &name)
Constructor for FileOut NetCDF module.
virtual BESResponseObject * get_response_object()
return the current response object
#define PACKAGE_NAME
Definition: config.h:244
BESResponseHandler * response_handler
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
Definition: BESInfo.cc:127
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
Represents a specific data type request handler.
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
Definition: BESKeys.cc:453
Structure storing information used by the BES to handle the request.
#define VERS_RESPONSE
virtual bool add_handler(const string &handler_name, p_request_handler handler_method)
add a handler method to the request handler that knows how to fill in a specific response object ...
#define PACKAGE_VERSION
Definition: config.h:256
static void UnIndent()
Definition: BESIndent.cc:44
static BESKeys * TheKeys()
Definition: TheBESKeys.cc:48
virtual void dump(ostream &strm) const
dumps information about this object
virtual void add_module(const string &n, const string &v)
Abstract base class representing a specific set of information in response to a request to the BES...
virtual void end_tag(const string &tag_name)
Definition: BESInfo.cc:132
virtual void dump(ostream &strm) const
dumps information about this object
virtual ~FONcRequestHandler(void)
Any cleanup that needs to take place.
static bool build_version(BESDataHandlerInterface &dhi)
add version information to a version response