37#include <libdap/DDS.h>
38#include <libdap/DAS.h>
39#include <libdap/DataDDS.h>
40#include <libdap/BaseTypeFactory.h>
41#include <libdap/Ancillary.h>
43#include <libdap/DMR.h>
44#include <libdap/D4BaseTypeFactory.h>
45#include <libdap/mime_util.h>
46#include <libdap/InternalErr.h>
48#include <BESDASResponse.h>
49#include <BESDDSResponse.h>
50#include <BESDataDDSResponse.h>
51#include <BESDMRResponse.h>
54#include <BESContainer.h>
55#include <BESVersionInfo.h>
56#include <BESDataNames.h>
57#include <BESDapNames.h>
58#include <BESResponseHandler.h>
59#include <BESResponseNames.h>
60#include <BESVersionInfo.h>
61#include <BESTextInfo.h>
62#include <BESConstraintFuncs.h>
63#include <BESDapError.h>
68#include "CSVRequestHandler.h"
71#define prolog std::string("CSVRequestHandler::").append(__func__).append("() - ")
74CSVRequestHandler::CSVRequestHandler(
string name) :
77 add_method(DAS_RESPONSE, CSVRequestHandler::csv_build_das);
78 add_method(DDS_RESPONSE, CSVRequestHandler::csv_build_dds);
79 add_method(DATA_RESPONSE, CSVRequestHandler::csv_build_data);
86 add_method(VERS_RESPONSE, CSVRequestHandler::csv_build_vers);
87 add_method(HELP_RESPONSE, CSVRequestHandler::csv_build_help);
90CSVRequestHandler::~CSVRequestHandler()
102 das = bdas->get_das();
108 csv_read_attributes(*das, accessed);
109 Ancillary::read_ancillary_das(*das, accessed);
112 catch (libdap::InternalErr &e) {
113 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
115 catch (libdap::Error &e) {
116 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
122 throw BESDapError(prolog +
"Caught unknown error building the DAS response",
false, unknown_error, __FILE__, __LINE__);
138 dds->set_factory(&factory);
142 dds->filename(accessed);
143 csv_read_descriptors(*dds, accessed);
144 Ancillary::read_ancillary_dds(*dds, accessed);
147 csv_read_attributes(das, accessed);
148 Ancillary::read_ancillary_das(das, accessed);
149 dds->transfer_attributes(&das);
154 catch (libdap::InternalErr &e) {
155 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
157 catch (libdap::Error &e) {
158 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
164 throw BESDapError(prolog +
"Caught unknown error building the DDS response",
false, unknown_error, __FILE__, __LINE__);
175 dds = bdds->get_dds();
180 dds->set_factory(&factory);
184 dds->filename(accessed);
185 csv_read_descriptors(*dds, accessed);
186 Ancillary::read_ancillary_dds(*dds, accessed);
190 BESDEBUG(MODULE, prolog <<
"Data ACCESS build_data(): set the including attribute flag to false: "<<accessed << endl);
191 bdds->set_ia_flag(
false);
194 catch (libdap::InternalErr &e) {
195 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
197 catch (libdap::Error &e) {
198 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
204 throw BESDapError(prolog +
"Caught unknown error building the DataDDS response",
false, unknown_error, __FILE__, __LINE__);
225 BaseTypeFactory factory;
226 DDS dds(&factory, name_path(data_path),
"3.2");
227 dds.filename(data_path);
230 csv_read_descriptors(dds, data_path);
235 csv_read_attributes(das, data_path);
236 Ancillary::read_ancillary_das(das, data_path);
237 dds.transfer_attributes(&das);
239 catch (libdap::InternalErr &e) {
240 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
242 catch (libdap::Error &e) {
243 throw BESDapError(e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
249 throw BESDapError(prolog +
"Caught unknown error building the DMR response",
false, unknown_error, __FILE__, __LINE__);
261 DMR *dmr = bdmr.get_dmr();
262 D4BaseTypeFactory MyD4TypeFactory;
263 dmr->set_factory(&MyD4TypeFactory);
265 dmr->build_using_dds(dds);
287 info->add_module(MODULE_NAME, MODULE_VERSION);
297 map<string, string> attrs;
298 attrs[
"name"] = PACKAGE_NAME;
299 attrs[
"version"] = PACKAGE_VERSION;
300 string handles = (string) DAS_RESPONSE +
"," + DDS_RESPONSE +
"," + DATA_RESPONSE +
"," + HELP_RESPONSE +
","
302 attrs[
"handles"] = handles;
303 info->begin_tag(
"module", &attrs);
304 info->end_tag(
"module");
311 strm << BESIndent::LMarg <<
"CSVRequestHandler::dump - (" << (
void *)
this <<
")" << endl;
314 BESIndent::UnIndent();
324 DDS *dds = bdds->get_dds();
327 csv_read_attributes(das, dataset_name);
328 Ancillary::read_ancillary_das(das, dataset_name);
329 dds->transfer_attributes(&das);
330 BESDEBUG(MODULE, prolog <<
"Data ACCESS in add_attributes(): set the including attribute flag to true: "<<dataset_name << endl);
331 bdds->set_ia_flag(
true);
virtual std::string access()=0
returns the true name of this container
Represents an OPeNDAP DAS DAP2 data object within the BES.
Holds a DDS object within the BES.
Represents an OPeNDAP DMR DAP4 data object within the BES.
error object created from libdap error objects and can handle those errors
virtual void set_dap4_function(BESDataHandlerInterface &dhi)
set the constraint depending on the context
virtual void set_dap4_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
virtual void set_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
Structure storing information used by the BES to handle the request.
BESContainer * container
pointer to current container in this interface
Base exception class for the BES with basic string message.
informational response object
exception thrown if internal error encountered
Represents a specific data type request handler.
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.
virtual void dump(std::ostream &strm) const
dumps information about this object
static bool csv_build_dmr(BESDataHandlerInterface &dhi)