36 #include <mime_util.h>
37 #include <D4BaseTypeFactory.h>
38 #include <InternalErr.h>
39 #include <Ancillary.h>
50 #include <InternalErr.h>
56 #include <Ancillary.h>
68 #define GDAL_NAME "gdal"
72 bool GDALRequestHandler::_show_shared_dims =
false;
73 bool GDALRequestHandler::_show_shared_dims_set =
false;
74 bool GDALRequestHandler::_ignore_unknown_types =
false;
75 bool GDALRequestHandler::_ignore_unknown_types_set =
false;
96 if (GDALRequestHandler::_show_shared_dims_set ==
false) {
97 bool key_found =
false, context_found =
false;
108 if (doset ==
"true" || doset ==
"yes") {
109 GDALRequestHandler::_show_shared_dims =
true;
112 else if (context_found) {
114 if (version_ge(context_value, 3.2))
115 GDALRequestHandler::_show_shared_dims =
false;
117 GDALRequestHandler::_show_shared_dims =
true;
121 GDALRequestHandler::_show_shared_dims =
true;
124 GDALRequestHandler::_show_shared_dims_set =
true;
127 if (GDALRequestHandler::_ignore_unknown_types_set ==
false) {
128 bool key_found =
false;
133 if (doset ==
"true" || doset ==
"yes")
134 GDALRequestHandler::_ignore_unknown_types =
true;
136 GDALRequestHandler::_ignore_unknown_types =
false;
140 GDALRequestHandler::_ignore_unknown_types =
false;
143 GDALRequestHandler::_ignore_unknown_types_set =
true;
163 Ancillary::read_ancillary_das(*das, accessed);
169 catch (InternalErr & e) {
170 throw BESDapError(e.get_error_message(),
true, e.get_error_code(), __FILE__, __LINE__);
173 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
184 DBG(cerr <<
"In GDALRequestHandler::gdal_build_dds" << endl);
196 dds->filename(filename);
197 dds->set_dataset_name(filename.substr(filename.find_last_of(
'/') + 1));
208 Ancillary::read_ancillary_das(*das, filename);
210 dds->transfer_attributes(das);
218 catch (InternalErr & e) {
219 throw BESDapError(e.get_error_message(),
true, e.get_error_code(), __FILE__, __LINE__);
222 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
233 DBG(cerr <<
"In GDALRequestHandler::gdal_build_data" << endl);
256 gdds->filename(filename);
257 gdds->set_dataset_name(filename.substr(filename.find_last_of(
'/') + 1));
269 Ancillary::read_ancillary_das(*das, filename);
271 gdds->transfer_attributes(das);
279 catch (InternalErr & e) {
280 throw BESDapError(e.get_error_message(),
true, e.get_error_code(), __FILE__, __LINE__);
283 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
299 BaseTypeFactory factory;
300 DDS dds(&factory, name_path(data_path),
"3.2");
301 dds.filename(data_path);
303 GDALDatasetH hDS = 0;
310 Ancillary::read_ancillary_das(das, data_path);
311 dds.transfer_attributes(&das);
313 catch (InternalErr &e) {
314 throw BESDapError(e.get_error_message(),
true, e.get_error_code(), __FILE__, __LINE__);
317 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
320 throw BESDapError(
"Caught unknown error building GDAL DMR response",
true, unknown_error, __FILE__, __LINE__);
334 D4BaseTypeFactory d4_factory;
335 dmr->set_factory(&d4_factory);
336 dmr->build_using_dds(dds);
340 gdal_dmr->set_factory(0);
363 map < string, string > attrs;
364 attrs[
"name"] = MODULE_NAME ;
365 attrs[
"version"] = MODULE_VERSION ;
370 list < string > services;
372 if (services.size() > 0) {
374 attrs[
"handles"] = handles;
392 info->
add_module(MODULE_NAME, MODULE_VERSION);
brief represents simple text information in a response object, such as version and help inforamtion...
#define DAP4DATA_RESPONSE
void set_dds(DataDDS *ddsIn)
Set the response object's DDS.
exception thrown if an internal error is found and is fatal to the BES
exception thrown if inernal error encountered
This specialization of DMR is used to manage the 'resource' of the open GDAL dataset handle so that t...
string get_symbolic_name() const
retrieve the symbolic name for this container
static string lowercase(const string &s)
Convert a string to all lower case.
This specialization of DDS is used to manage the 'resource' of the open GDAL dataset handle so that t...
Represents an OPeNDAP DDS DAP2 data object within the BES.
virtual void clear_container()
clear the container in the DAP response object
static bool gdal_build_das(BESDataHandlerInterface &dhi)
static bool gdal_build_dmr(BESDataHandlerInterface &dhi)
virtual void set_dap4_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
GDALRequestHandler(const string &name)
virtual string get_context(const string &name, bool &found)
retrieve the value of the specified context from the BES
static bool gdal_build_help(BESDataHandlerInterface &dhi)
virtual ~GDALRequestHandler(void)
static class NCMLUtil overview
virtual string access()=0
returns the true name of this container
virtual void clear_container()
clear the container in the DAP response object
virtual void set_dap4_function(BESDataHandlerInterface &dhi)
set the constraint depending on the context
informational response object
static string implode(const list< string > &values, char delim)
implode a list of values into a single string delimited by delim
virtual BESResponseObject * get_response_object()
return the current response object
Abstract exception class for the BES with basic string message.
static BESServiceRegistry * TheRegistry()
BESResponseHandler * response_handler
virtual void set_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
Represents an OPeNDAP DMR DAP4 data object within the BES.
virtual void set_container(const string &cn)
set the container in the DAP response object
error object created from libdap error objects and can handle those errors
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
void setGDALDataset(const GDALDatasetH &hDSIn)
virtual void clear_container()
clear the container in the DAP response object
Represents a specific data type request handler.
void gdal_read_dataset_attributes(DAS &das, const string &filename)
static BESContextManager * TheManager()
void get_value(const string &s, string &val, bool &found)
Retrieve the value of a given key, if set.
Structure storing information used by the BES to handle the request.
GDALDatasetH gdal_read_dataset_variables(DDS *dds, const string &filename)
virtual void set_container(const string &cn)
set the container in the DAP response object
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 ...
Represents an OPeNDAP DAS DAP2 data object within the BES.
void setGDALDataset(const GDALDatasetH &hDSIn)
static BESKeys * TheKeys()
virtual void set_container(const string &cn)
set the container in the DAP response 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...
static bool gdal_build_version(BESDataHandlerInterface &dhi)
static bool gdal_build_data(BESDataHandlerInterface &dhi)
BESContainer * container
pointer to current container in this interface
virtual void end_tag(const string &tag_name)
virtual void services_handled(const string &handler, list< string > &services)
returns the list of servies provided by the handler in question
static bool gdal_build_dds(BESDataHandlerInterface &dhi)