bes Updated for version 3.20.10
FONgRequestHandler.cc
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 <gdal.h>
26
27#include <BESResponseHandler.h>
28#include <BESResponseNames.h>
29#include <BESVersionInfo.h>
30
31#include <TheBESKeys.h>
32
33#include "config.h"
34
35#include "FONgRequestHandler.h"
36
37using std::endl;
38using std::ostream;
39using std::string;
40using std::map;
41
42// Added hrg 3/20/19
43bool FONgRequestHandler::d_use_byte_for_geotiff_bands = true;
44
55{
58
59 FONgRequestHandler::d_use_byte_for_geotiff_bands = TheBESKeys::TheKeys()->read_bool_key("FONg.GeoTiff.band.type.byte", true);
60
61 GDALAllRegister();
62 CPLSetErrorHandler(CPLQuietErrorHandler);
63}
64
68{
69}
70
83{
84 BESResponseObject *response = dhi.response_handler->get_response_object();
85 BESInfo *info = dynamic_cast<BESInfo *>(response);
86 if (!info)
87 throw BESInternalError("cast error", __FILE__, __LINE__);
88
89 bool found = false;
90 string key = "FONg.Reference";
91 string ref;
92 TheBESKeys::TheKeys()->get_value(key, ref, found);
93 if (ref.empty())
94 ref = "https://docs.opendap.org/index.php/BES_-_Modules_-_FileOut_GDAL";
95
96 map<string, string> attrs;
97 attrs["name"] = MODULE_NAME ;
98 attrs["version"] = MODULE_VERSION ;
99
100 attrs["reference"] = ref;
101 info->begin_tag("module", &attrs);
102 info->end_tag("module");
103
104 return true;
105}
106
115{
116 BESResponseObject *response = dhi.response_handler->get_response_object();
117 BESVersionInfo *info = dynamic_cast<BESVersionInfo *>(response);
118 if (!info)
119 throw BESInternalError("cast error", __FILE__, __LINE__);
120
121 info->add_module(MODULE_NAME, MODULE_VERSION);
122
123 return true;
124}
125
132void FONgRequestHandler::dump(ostream &strm) const
133{
134 strm << BESIndent::LMarg << "FONgRequestHandler::dump - (" << (void *) this << ")" << endl;
135 BESIndent::Indent();
137 BESIndent::UnIndent();
138}
139
Structure storing information used by the BES to handle the request.
informational response object
Definition: BESInfo.h:63
exception thrown if internal error encountered
Represents a specific data type request handler.
virtual bool add_method(const std::string &name, p_request_handler_method method)
add a handler method to the request handler that knows how to fill in a specific response object
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual BESResponseObject * get_response_object()
return the current response object
Abstract base class representing a specific set of information in response to a request to the BES.
static bool build_help(BESDataHandlerInterface &dhi)
adds help information for FileOut GDAL to a help request
FONgRequestHandler(const std::string &name)
Constructor for FileOut GDAL module.
virtual void dump(std::ostream &strm) const
dumps information about this object
static bool build_version(BESDataHandlerInterface &dhi)
add version information to a version response
virtual ~FONgRequestHandler(void)
Any cleanup that needs to take place.
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
Definition: TheBESKeys.cc:340
static TheBESKeys * TheKeys()
Definition: TheBESKeys.cc:71
bool read_bool_key(const std::string &key, bool default_value)
Read a boolean-valued key from the bes.conf file.
Definition: TheBESKeys.cc:398