OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FONgRequestHandler.cc
Go to the documentation of this file.
1 // FONgRequestHandler.cc
2 
3 // This file is part of BES GDAL File Out Module
4 
5 // Copyright (c) 2012 OPeNDAP, Inc.
6 // Author: James Gallagher <jgallagher@opendap.org>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 //
22 // You can contact University Corporation for Atmospheric Research at
23 // 3080 Center Green Drive, Boulder, CO 80301
24 
25 #include "FONgRequestHandler.h"
26 #include <BESResponseHandler.h>
27 #include <BESResponseNames.h>
28 #include <BESVersionInfo.h>
29 #include <BESDataNames.h>
30 #include <BESDataNames.h>
31 #include <TheBESKeys.h>
32 #include "config.h"
33 
43  BESRequestHandler(name)
44 {
47 }
48 
52 {
53 }
54 
67 {
69  BESInfo *info = dynamic_cast<BESInfo *>(response);
70  if (!info)
71  throw BESInternalError("cast error", __FILE__, __LINE__);
72 
73  bool found = false;
74  string key = "FONg.Reference";
75  string ref;
76  TheBESKeys::TheKeys()->get_value(key, ref, found);
77  if (ref.empty())
78  ref = "http://docs.opendap.org/index.php/BES_-_Modules_-_FileOut_GDAL";
79 
80  map<string, string> attrs;
81  attrs["name"] = MODULE_NAME ;
82  attrs["version"] = MODULE_VERSION ;
83 #if 0
84  attrs["name"] = PACKAGE_NAME;
85  attrs["version"] = PACKAGE_VERSION;
86 #endif
87  attrs["reference"] = ref;
88  info->begin_tag("module", &attrs);
89  info->end_tag("module");
90 
91  return true;
92 }
93 
102 {
104  BESVersionInfo *info = dynamic_cast<BESVersionInfo *>(response);
105  if (!info)
106  throw BESInternalError("cast error", __FILE__, __LINE__);
107 
108 #if 0
110 #endif
111  info->add_module(MODULE_NAME, MODULE_VERSION);
112 
113  return true;
114 }
115 
122 void FONgRequestHandler::dump(ostream &strm) const
123 {
124  strm << BESIndent::LMarg << "FONgRequestHandler::dump - (" << (void *) this << ")" << endl;
128 }
129 
brief represents simple text information in a response object, such as version and help inforamtion...
static bool build_help(BESDataHandlerInterface &dhi)
adds help information for FileOut GDAL to a help request
exception thrown if inernal error encountered
FONgRequestHandler(const string &name)
Constructor for FileOut GDAL module.
static void Indent()
Definition: BESIndent.cc:38
#define HELP_RESPONSE
static bool build_version(BESDataHandlerInterface &dhi)
add version information to a version response
virtual ~FONgRequestHandler(void)
Any cleanup that needs to take place.
informational response object
Definition: BESInfo.h:68
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.
virtual void dump(ostream &strm) const
dumps information about this object
#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