38 #include <sys/types.h>
47 #include <ConstraintEvaluator.h>
50 #include <BESInternalError.h>
51 #include <BESDapError.h>
52 #include <TheBESKeys.h>
53 #include <BESContextManager.h>
54 #include <BESDataDDSResponse.h>
55 #include <BESDDSResponse.h>
56 #include <BESDapNames.h>
57 #include <BESDataNames.h>
58 #include <BESDapResponseBuilder.h>
60 #include <DapFunctionUtils.h>
62 #include "FoDapCovJsonTransmitter.h"
63 #include "FoDapCovJsonTransform.h"
67 #define FO_COVJSON_TEMP_DIR "/tmp"
69 string FoDapCovJsonTransmitter::temp_dir;
87 if (FoDapCovJsonTransmitter::temp_dir.empty()) {
90 string key =
"FoCovJson.Tempdir";
92 if (!found || FoDapCovJsonTransmitter::temp_dir.empty()) {
93 FoDapCovJsonTransmitter::temp_dir = FO_COVJSON_TEMP_DIR;
95 string::size_type len = FoDapCovJsonTransmitter::temp_dir.length();
96 if (FoDapCovJsonTransmitter::temp_dir[len - 1] ==
'/') {
97 FoDapCovJsonTransmitter::temp_dir = FoDapCovJsonTransmitter::temp_dir.substr(0, len - 1);
119 BESDEBUG(
"focovjson",
"FoDapCovJsonTransmitter::send_data - BEGIN" << endl);
124 BESDEBUG(
"focovjson",
"FoCovJsonTransmitter::send_data - Reading data into DataDDS" << endl);
137 ostream &o_strm = dhi.get_output_stream();
139 throw BESInternalError(
"Output stream is not set, can not return as COVJSON", __FILE__, __LINE__);
142 ft.transform(o_strm,
true,
false);
145 throw BESDapError(
"Failed to read data: " + e.get_error_message(),
false, e.get_error_code(), __FILE__, __LINE__);
150 catch (std::exception &e) {
151 throw BESInternalError(
"Failed to read data: STL Error: " +
string(e.what()), __FILE__, __LINE__);
154 throw BESInternalError(
"Failed to get read data: Unknown exception caught", __FILE__, __LINE__);
157 BESDEBUG(
"focovjson",
"FoDapCovJsonTransmitter::send_data - done transmitting COVJSON" << endl);
177 BESDEBUG(
"focovjson",
"FoDapCovJsonTransmitter::send_data - BEGIN transmitting COVJSON" << endl);
185 ostream &o_strm = dhi.get_output_stream();
187 throw BESInternalError(
"Output stream is not set, can not return as COVJSON", __FILE__, __LINE__);
195 ft.transform(o_strm,
false,
false);
198 throw BESDapError(
"Failed to transform data to COVJSON: " + e.get_error_message(),
false, e.get_error_code(),
205 throw BESInternalError(
"Failed to transform to COVJSON: Unknown exception caught", __FILE__, __LINE__);
208 BESDEBUG(
"focovjson",
"FoDapCovJsonTransmitter::send_data - done transmitting COVJSON" << endl);
error object created from libdap error objects and can handle those errors
virtual libdap::DDS * process_dap2_dds(BESResponseObject *obj, BESDataHandlerInterface &dhi)
Process a DDS (i.e., apply a constraint) for a non-DAP transmitter.
virtual libdap::DDS * intern_dap2_data(BESResponseObject *obj, BESDataHandlerInterface &dhi)
Structure storing information used by the BES to handle the request.
Abstract exception class for the BES with basic string message.
exception thrown if internal error encountered
Abstract base class representing a specific set of information in response to a request to the BES.
static void conditional_timeout_cancel()
static void send_data(BESResponseObject *obj, BESDataHandlerInterface &dhi)
The static method registered to transmit OPeNDAP data objects as a JSON file.
static void send_metadata(BESResponseObject *obj, BESDataHandlerInterface &dhi)
The static method registered to transmit OPeNDAP data objects as a JSON file.
FoDapCovJsonTransmitter()
Construct the FoW10nJsonTransmitter.
void get_value(const std::string &s, std::string &val, bool &found)
Retrieve the value of a given key, if set.
static TheBESKeys * TheKeys()