31 #ifdef HAVE_UUID_UUID_H 32 #include <uuid/uuid.h> 33 #elif defined(HAVE_UUID_H) 36 #error "Could not find UUID library header" 57 #define CLEAR_LOCAL_DATA 58 #undef USE_LOCAL_TIMEOUT_SCHEME 62 #include <Structure.h> 63 #include <ConstraintEvaluator.h> 64 #include <DDXParserSAX2.h> 65 #include <Ancillary.h> 66 #include <XDRStreamMarshaller.h> 67 #include <XDRFileUnMarshaller.h> 71 #include <XMLWriter.h> 72 #include <D4AsyncUtil.h> 73 #include <D4StreamMarshaller.h> 74 #include <chunked_ostream.h> 75 #include <chunked_istream.h> 76 #include <D4ConstraintEvaluator.h> 77 #include <D4FunctionEvaluator.h> 78 #include <D4BaseTypeFactory.h> 80 #include <ServerFunctionsList.h> 82 #include <mime_util.h> 85 #if USE_LOCAL_TIMEOUT_SCHEME 87 #include <SignalHandler.h> 88 #include <EventHandler.h> 89 #include <AlarmHandler.h> 93 #include "TheBESKeys.h" 94 #include "BESDapResponseBuilder.h" 95 #include "BESContextManager.h" 96 #include "BESDapFunctionResponseCache.h" 97 #include "BESStoredDapResultCache.h" 99 #include "BESResponseObject.h" 100 #include "BESDDSResponse.h" 101 #include "BESDataDDSResponse.h" 102 #include "BESDataHandlerInterface.h" 103 #include "BESInternalFatalError.h" 104 #include "BESDataNames.h" 107 #include "BESDebug.h" 108 #include "BESStopWatch.h" 109 #include "DapFunctionUtils.h" 114 const string CRLF =
"\r\n";
115 const string BES_KEY_TIMEOUT_CANCEL =
"BES.CancelTimeoutOnSend";
124 string cancel_timeout_on_send =
"";
126 if (found && !cancel_timeout_on_send.empty()) {
128 downcase(cancel_timeout_on_send);
129 if (cancel_timeout_on_send ==
"yes" || cancel_timeout_on_send ==
"true")
130 d_cancel_timeout_on_send =
true;
134 BESDapResponseBuilder::~BESDapResponseBuilder()
136 #if USE_LOCAL_TIMEOUT_SCHEME 140 delete dynamic_cast<AlarmHandler*
>(SignalHandler::instance()->remove_handler(SIGALRM));
167 d_dap2ce = www2id(_ce,
"%",
"%20");
190 d_dap4ce = www2id(_ce,
"%",
"%20");
198 return d_dap4function;
214 d_dap4function = www2id(_func,
"%",
"%20");
217 std::string BESDapResponseBuilder::get_store_result()
const 219 return d_store_result;
222 void BESDapResponseBuilder::set_store_result(std::string _sr)
224 d_store_result = _sr;
225 BESDEBUG(
"dap",
"BESDapResponseBuilder::set_store_result() - store_result: " << _sr << endl);
228 std::string BESDapResponseBuilder::get_async_accepted()
const 230 return d_async_accepted;
233 void BESDapResponseBuilder::set_async_accepted(std::string _aa)
235 d_async_accepted = _aa;
236 BESDEBUG(
"dap",
"BESDapResponseBuilder::set_async_accepted() - async_accepted: " << _aa << endl);
264 d_dataset = www2id(ds,
"%",
"%20");
292 #if USE_LOCAL_TIMEOUT_SCHEME 307 #if USE_LOCAL_TIMEOUT_SCHEME 330 if (d_cancel_timeout_on_send)
344 #if USE_LOCAL_TIMEOUT_SCHEME 346 SignalHandler *sh = SignalHandler::instance();
347 EventHandler *old_eh = sh->register_handler(SIGALRM,
new AlarmHandler());
361 #if USE_LOCAL_TIMEOUT_SCHEME 364 SignalHandler *sh = SignalHandler::instance();
365 EventHandler *old_eh = sh->register_handler(SIGALRM,
new AlarmHandler());
387 static string::size_type find_closing_paren(
const string &ce, string::size_type pos)
394 pos = ce.find_first_of(
"()", pos + 1);
395 if (pos == string::npos)
396 throw Error(malformed_expr,
"Expected to find a matching closing parenthesis in " + ce);
416 BESDEBUG(
"dap",
"BESDapResponseBuilder::split_ce() - source expression: " << expr << endl);
424 string btp_function_ce =
"";
425 string::size_type pos = 0;
429 string::size_type first_paren = ce.find(
"(", pos);
430 string::size_type closing_paren = string::npos;
431 if (first_paren != string::npos) closing_paren = find_closing_paren(ce, first_paren);
433 while (first_paren != string::npos && closing_paren != string::npos) {
435 string name = ce.substr(pos, first_paren - pos);
439 if (eval.find_function(name, &f)) {
441 if (!btp_function_ce.empty()) btp_function_ce +=
",";
442 btp_function_ce += ce.substr(pos, closing_paren + 1 - pos);
443 ce.erase(pos, closing_paren + 1 - pos);
444 if (ce[pos] ==
',') ce.erase(pos, 1);
447 pos = closing_paren + 1;
449 if (pos < ce.length() && ce.at(pos) ==
',') ++pos;
452 first_paren = ce.find(
"(", pos);
453 closing_paren = ce.find(
")", pos);
457 d_btp_func_ce = btp_function_ce;
459 BESDEBUG(
"dap",
"BESDapResponseBuilder::split_ce() - Modified constraint: " << d_dap2ce << endl);
460 BESDEBUG(
"dap",
"BESDapResponseBuilder::split_ce() - BTP Function part: " << btp_function_ce << endl);
461 BESDEBUG(
"dap",
"BESDapResponseBuilder::split_ce() - END" << endl);
478 void BESDapResponseBuilder::send_das(ostream &out, DAS &das,
bool with_mime_headers)
const 480 if (with_mime_headers) set_mime_text(out, dods_das, x_plain, last_modified_time(d_dataset),
"2.0");
504 void BESDapResponseBuilder::send_das(ostream &out, DDS **dds, ConstraintEvaluator &eval,
bool constrained,
505 bool with_mime_headers)
507 #if USE_LOCAL_TIMEOUT_SCHEME 509 establish_timeout(out);
510 dds.set_timeout(d_timeout);
513 if (with_mime_headers) set_mime_text(out, dods_das, x_plain, last_modified_time(d_dataset),
"2.0");
515 conditional_timeout_cancel();
517 (*dds)->print_das(out);
528 if (!d_btp_func_ce.empty()) {
529 ConstraintEvaluator func_eval;
533 if (responseCache && responseCache->can_be_cached(*dds, get_btp_func_ce())) {
537 func_eval.parse_constraint(get_btp_func_ce(), **dds);
538 fdds = func_eval.eval_function_clauses(**dds);
541 delete *dds; *dds = 0;
544 if (with_mime_headers)
545 set_mime_text(out, dods_das, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
547 conditional_timeout_cancel();
549 (*dds)->print_das(out);
552 eval.parse_constraint(d_dap2ce, **dds);
554 if (with_mime_headers)
555 set_mime_text(out, dods_das, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
557 conditional_timeout_cancel();
559 (*dds)->print_das(out);
585 bool with_mime_headers)
588 if (with_mime_headers)
589 set_mime_text(out, dods_dds, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
591 conditional_timeout_cancel();
598 #if USE_LOCAL_TIMEOUT_SCHEME 600 establish_timeout(out);
601 dds.set_timeout(d_timeout);
610 if (!d_btp_func_ce.empty()) {
611 ConstraintEvaluator func_eval;
616 if (responseCache && responseCache->can_be_cached(*dds, get_btp_func_ce())) {
620 func_eval.parse_constraint(get_btp_func_ce(), **dds);
621 fdds = func_eval.eval_function_clauses(**dds);
624 delete *dds; *dds = 0;
632 (*dds)->mark_all(
false);
644 promote_function_output_structures(*dds);
646 eval.parse_constraint(d_dap2ce, **dds);
648 if (with_mime_headers)
649 set_mime_text(out, dods_dds, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
652 conditional_timeout_cancel();
654 (*dds)->print_constrained(out);
657 eval.parse_constraint(d_dap2ce, **dds);
659 if (with_mime_headers)
660 set_mime_text(out, dods_dds, x_plain, last_modified_time(d_dataset),(*dds)->get_dap_version());
662 conditional_timeout_cancel();
664 (*dds)->print_constrained(out);
670 #ifdef DAP2_STORED_RESULTS 685 bool BESDapResponseBuilder::store_dap2_result(ostream &out, DDS &dds, ConstraintEvaluator &eval)
687 if (get_store_result().empty())
return false;
689 string serviceUrl = get_store_result();
700 string *stylesheet_ref = 0, ss_ref_value;
702 if (found && ss_ref_value.length() > 0) {
703 stylesheet_ref = &ss_ref_value;
707 if (resultCache == NULL) {
714 string msg =
"The Stored Result request cannot be serviced. ";
715 msg +=
"Unable to acquire StoredResultCache instance. ";
716 msg +=
"This is most likely because the StoredResultCache is not (correctly) configured.";
718 BESDEBUG(
"dap",
"[WARNING] " << msg << endl);
720 d4au.writeD4AsyncResponseRejected(xmlWrtr, UNAVAILABLE, msg, stylesheet_ref);
721 out << xmlWrtr.get_doc();
724 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap2_result() - Sent AsyncRequestRejected" << endl);
726 else if (get_async_accepted().length() != 0) {
731 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap2_result() - serviceUrl="<< serviceUrl << endl);
734 string storedResultId =
"";
735 storedResultId = resultCache->store_dap2_result(dds, get_ce(),
this, &eval);
738 "BESDapResponseBuilder::store_dap2_result() - storedResultId='"<< storedResultId <<
"'" << endl);
741 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap2_result() - targetURL='"<< targetURL <<
"'" << endl);
744 d4au.writeD4AsyncAccepted(xmlWrtr, 0, 0, targetURL, stylesheet_ref);
745 out << xmlWrtr.get_doc();
748 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap2_result() - sent DAP4 AsyncAccepted response" << endl);
755 d4au.writeD4AsyncRequired(xmlWrtr, 0, 0, stylesheet_ref);
756 out << xmlWrtr.get_doc();
759 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap2_result() - sent DAP4 AsyncRequired response" << endl);
773 if (BESISDEBUG(TIMING_LOG)) sw.
start(
"BESDapResponseBuilder::serialize_dap2_data_dds",
"");
775 BESDEBUG(
"dap",
"BESDapResponseBuilder::serialize_dap2_data_dds() - BEGIN" << endl);
777 (*dds)->print_constrained(out);
781 XDRStreamMarshaller m(out);
785 conditional_timeout_cancel();
788 for (DDS::Vars_iter i = (*dds)->var_begin(); i != (*dds)->var_end(); i++) {
789 if ((*i)->send_p()) {
790 (*i)->serialize(eval, **dds, m, ce_eval);
791 #ifdef CLEAR_LOCAL_DATA 792 (*i)->clear_local_data();
797 BESDEBUG(
"dap",
"BESDapResponseBuilder::serialize_dap2_data_dds() - END" << endl);
800 #ifdef DAP2_STORED_RESULTS 809 void BESDapResponseBuilder::serialize_dap2_data_ddx(ostream &out, DDS **dds, ConstraintEvaluator &eval,
810 const string &boundary,
const string &start,
bool ce_eval)
812 BESDEBUG(
"dap", __PRETTY_FUNCTION__ <<
" BEGIN" << endl);
815 libdap::set_mime_ddx_boundary(out, boundary, start, dods_ddx, x_plain);
821 uuid_unparse(uu, &uuid[0]);
823 if (getdomainname(domain, 255) != 0 || strlen(domain) == 0) strncpy(domain,
"opendap.org", 255);
825 string cid = string(&uuid[0]) +
"@" + string(&domain[0]);
829 (*dds)->print_xml_writer(out,
true, cid);
832 set_mime_data_boundary(out, boundary, cid, dods_data_ddx , x_plain);
834 XDRStreamMarshaller m(out);
836 conditional_timeout_cancel();
840 for (DDS::Vars_iter i = (*dds)->var_begin(); i != (*dds)->var_end(); i++) {
841 if ((*i)->send_p()) {
842 (*i)->serialize(eval, **dds, m, ce_eval);
843 #ifdef CLEAR_LOCAL_DATA 844 (*i)->clear_local_data();
849 BESDEBUG(
"dap", __PRETTY_FUNCTION__ <<
" END" << endl);
871 #if USE_LOCAL_TIMEOUT_SCHEME 892 BESDEBUG(
"dap",
"BESDapResponseBuilder::process_dap2_dds() - BEGIN"<< endl);
901 set_dataset_name(dds->filename());
902 set_ce(dhi.
data[POST_CONSTRAINT]);
903 set_async_accepted(dhi.
data[ASYNC]);
904 set_store_result(dhi.
data[STORE_RESULT]);
906 ConstraintEvaluator &eval = bdds->
get_ce();
914 if (!d_btp_func_ce.empty()) {
917 ConstraintEvaluator func_eval;
919 if (responseCache && responseCache->can_be_cached(dds, get_btp_func_ce())) {
923 func_eval.parse_constraint(get_btp_func_ce(), *dds);
924 fdds = func_eval.eval_function_clauses(*dds);
931 dds->mark_all(
false);
933 promote_function_output_structures(dds);
936 eval.parse_constraint(d_dap2ce, *dds);
961 BESDEBUG(
"dap",
"BESDapResponseBuilder::intern_dap2_data() - BEGIN"<< endl);
966 if (!bdds)
throw BESInternalFatalError(
"Expected a BESDataDDSResponse instance", __FILE__, __LINE__);
968 DDS *dds = bdds->get_dds();
970 set_dataset_name(dds->filename());
971 set_ce(dhi.
data[POST_CONSTRAINT]);
972 set_async_accepted(dhi.
data[ASYNC]);
973 set_store_result(dhi.
data[STORE_RESULT]);
975 ConstraintEvaluator &eval = bdds->get_ce();
983 if (!get_btp_func_ce().empty()) {
985 "BESDapResponseBuilder::intern_dap2_data() - Found function(s) in CE: " << get_btp_func_ce() << endl);
989 ConstraintEvaluator func_eval;
991 if (responseCache && responseCache->can_be_cached(dds, get_btp_func_ce())) {
995 func_eval.parse_constraint(get_btp_func_ce(), *dds);
996 fdds = func_eval.eval_function_clauses(*dds);
1008 dds->mark_all(
false);
1019 promote_function_output_structures(dds);
1023 eval.parse_constraint(get_ce(), *dds);
1025 dds->tag_nested_sequences();
1027 if (dds->get_response_limit() != 0 && dds->get_request_size(
true) > dds->get_response_limit()) {
1028 string msg =
"The Request for " + long_to_string(dds->get_request_size(
true) / 1024)
1029 +
"KB is too large; requests for this user are limited to " 1030 + long_to_string(dds->get_response_limit() / 1024) +
"KB.";
1036 for (DDS::Vars_iter i = dds->var_begin(), e = dds->var_end(); i != e; ++i) {
1037 if ((*i)->send_p()) {
1038 (*i)->intern_data(eval, *dds);
1042 BESDEBUG(
"dap",
"BESDapResponseBuilder::intern_dap2_data() - END"<< endl);
1061 bool with_mime_headers)
1063 BESDEBUG(
"dap",
"BESDapResponseBuilder::send_dap2_data() - BEGIN"<< endl);
1065 #if USE_LOCAL_TIMEOUT_SCHEME 1067 establish_timeout(data_stream);
1068 dds.set_timeout(d_timeout);
1077 if (!get_btp_func_ce().empty()) {
1079 "BESDapResponseBuilder::send_dap2_data() - Found function(s) in CE: " << get_btp_func_ce() << endl);
1083 ConstraintEvaluator func_eval;
1085 if (response_cache && response_cache->can_be_cached(*dds, get_btp_func_ce())) {
1089 func_eval.parse_constraint(get_btp_func_ce(), **dds);
1090 fdds = func_eval.eval_function_clauses(**dds);
1093 delete *dds; *dds = 0;
1096 (*dds)->mark_all(
false);
1098 promote_function_output_structures(*dds);
1101 eval.parse_constraint(get_ce(), **dds);
1103 (*dds)->tag_nested_sequences();
1105 if ((*dds)->get_response_limit() != 0 && (*dds)->get_request_size(
true) > (*dds)->get_response_limit()) {
1106 string msg =
"The Request for " + long_to_string((*dds)->get_request_size(
true) / 1024)
1107 +
"KB is too large; requests for this user are limited to " 1108 + long_to_string((*dds)->get_response_limit() / 1024) +
"KB.";
1112 if (with_mime_headers)
1113 set_mime_binary(data_stream, dods_data, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
1115 #if STORE_DAP2_RESULT_FEATURE 1117 if (!store_dap2_result(data_stream, **dds, eval)) {
1118 serialize_dap2_data_dds(data_stream, dds, eval,
true );
1121 serialize_dap2_data_dds(data_stream, dds, eval,
true );
1126 BESDEBUG(
"dap",
"BESDapResponseBuilder::send_dap2_data() - Simple constraint" << endl);
1128 eval.parse_constraint(get_ce(), **dds);
1130 (*dds)->tag_nested_sequences();
1132 if ((*dds)->get_response_limit() != 0 && (*dds)->get_request_size(
true) > (*dds)->get_response_limit()) {
1133 string msg =
"The Request for " + long_to_string((*dds)->get_request_size(
true) / 1024)
1134 +
"KB is too large; requests for this user are limited to " 1135 + long_to_string((*dds)->get_response_limit() / 1024) +
"KB.";
1139 if (with_mime_headers)
1140 set_mime_binary(data_stream, dods_data, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
1142 #if STORE_DAP2_RESULT_FEATURE 1144 if (!store_dap2_result(data_stream, **dds, eval)) {
1145 serialize_dap2_data_dds(data_stream, dds, eval);
1148 serialize_dap2_data_dds(data_stream, dds, eval);
1152 data_stream << flush;
1154 BESDEBUG(
"dap",
"BESDapResponseBuilder::send_dap2_data() - END"<< endl);
1174 if (d_dap2ce.empty()) {
1175 if (with_mime_headers)
1176 set_mime_text(out, dods_ddx, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
1178 (*dds)->print_xml_writer(out,
false ,
"");
1184 #if USE_LOCAL_TIMEOUT_SCHEME 1186 establish_timeout(out);
1187 dds.set_timeout(d_timeout);
1196 if (!d_btp_func_ce.empty()) {
1199 ConstraintEvaluator func_eval;
1201 if (response_cache && response_cache->can_be_cached(*dds, get_btp_func_ce())) {
1205 func_eval.parse_constraint(get_btp_func_ce(), **dds);
1206 fdds = func_eval.eval_function_clauses(**dds);
1209 delete *dds; *dds = 0;
1212 (*dds)->mark_all(
false);
1214 promote_function_output_structures(*dds);
1216 eval.parse_constraint(d_dap2ce, **dds);
1218 if (with_mime_headers)
1219 set_mime_text(out, dods_ddx, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
1221 conditional_timeout_cancel();
1223 (*dds)->print_xml_writer(out,
true,
"");
1226 eval.parse_constraint(d_dap2ce, **dds);
1228 if (with_mime_headers)
1229 set_mime_text(out, dods_ddx, x_plain, last_modified_time(d_dataset), (*dds)->get_dap_version());
1231 conditional_timeout_cancel();
1235 (*dds)->print_xml_writer(out,
true,
"");
1241 void BESDapResponseBuilder::send_dmr(ostream &out, DMR &dmr,
bool with_mime_headers)
1246 if (!d_dap4ce.empty()) {
1248 BESDEBUG(
"dap",
"BESDapResponseBuilder::send_dmr() - Parsing DAP4 constraint: '"<< d_dap4ce <<
"'"<< endl);
1250 D4ConstraintEvaluator parser(&dmr);
1251 bool parse_ok = parser.parse(d_dap4ce);
1252 if (!parse_ok)
throw Error(malformed_expr,
"Constraint Expression (" + d_dap4ce +
") failed to parse.");
1258 dmr.root()->set_send_p(
true);
1261 if (with_mime_headers) set_mime_text(out, dap4_dmr, x_plain, last_modified_time(d_dataset), dmr.dap_version());
1263 conditional_timeout_cancel();
1267 dmr.print_dap4(xml, !d_dap4ce.empty() );
1268 out << xml.get_doc() << flush;
1271 void BESDapResponseBuilder::send_dap4_data_using_ce(ostream &out, DMR &dmr,
bool with_mime_headers)
1273 if (!d_dap4ce.empty()) {
1274 D4ConstraintEvaluator parser(&dmr);
1275 bool parse_ok = parser.parse(d_dap4ce);
1276 if (!parse_ok)
throw Error(malformed_expr,
"Constraint Expression (" + d_dap4ce +
") failed to parse.");
1282 dmr.root()->set_send_p(
true);
1285 if (dmr.response_limit() != 0 && dmr.request_size(
true) > dmr.response_limit()) {
1286 string msg =
"The Request for " + long_to_string(dmr.request_size(
true) / 1024)
1287 +
"MB is too large; requests for this user are limited to " + long_to_string(dmr.response_limit() / 1024)
1292 if (!store_dap4_result(out, dmr)) {
1293 serialize_dap4_data(out, dmr, with_mime_headers);
1297 void BESDapResponseBuilder::send_dap4_data(ostream &out, DMR &dmr,
bool with_mime_headers)
1302 if (!d_dap4function.empty()) {
1303 D4BaseTypeFactory d4_factory;
1304 DMR function_result(&d4_factory,
"function_results");
1308 if (!ServerFunctionsList::TheList())
1310 "The function expression could not be evaluated because there are no server functions defined on this server");
1312 D4FunctionEvaluator parser(&dmr, ServerFunctionsList::TheList());
1313 bool parse_ok = parser.parse(d_dap4function);
1314 if (!parse_ok)
throw Error(
"Function Expression (" + d_dap4function +
") failed to parse.");
1316 parser.eval(&function_result);
1320 send_dap4_data_using_ce(out, function_result, with_mime_headers);
1323 send_dap4_data_using_ce(out, dmr, with_mime_headers);
1332 BESDEBUG(
"dap",
"BESDapResponseBuilder::serialize_dap4_data() - BEGIN" << endl);
1334 if (with_mime_headers) set_mime_binary(out, dap4_data, x_plain, last_modified_time(d_dataset), dmr.dap_version());
1338 dmr.print_dap4(xml, !d_dap4ce.empty());
1343 chunked_ostream cos(out, max((
unsigned int) CHUNK_SIZE, xml.get_doc_size() + 2));
1345 conditional_timeout_cancel();
1348 cos << xml.get_doc() << CRLF << flush;
1351 D4StreamMarshaller m(cos);
1352 dmr.root()->serialize(m, dmr, !d_dap4ce.empty());
1353 #ifdef CLEAR_LOCAL_DATA 1354 dmr.root()->clear_local_data();
1358 BESDEBUG(
"dap",
"BESDapResponseBuilder::serialize_dap4_data() - END" << endl);
1377 if (get_store_result().length() != 0) {
1378 string serviceUrl = get_store_result();
1385 string *stylesheet_ref = 0, ss_ref_value;
1387 if (found && ss_ref_value.length() > 0) {
1388 stylesheet_ref = &ss_ref_value;
1392 if (resultCache == NULL) {
1399 string msg =
"The Stored Result request cannot be serviced. ";
1400 msg +=
"Unable to acquire StoredResultCache instance. ";
1401 msg +=
"This is most likely because the StoredResultCache is not (correctly) configured.";
1403 BESDEBUG(
"dap",
"[WARNING] " << msg << endl);
1404 d4au.writeD4AsyncResponseRejected(xmlWrtr, UNAVAILABLE, msg, stylesheet_ref);
1405 out << xmlWrtr.get_doc();
1407 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap4_result() - Sent AsyncRequestRejected" << endl);
1412 if (get_async_accepted().length() != 0) {
1417 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap4_result() - serviceUrl="<< serviceUrl << endl);
1419 string storedResultId =
"";
1423 "BESDapResponseBuilder::store_dap4_result() - storedResultId='"<< storedResultId <<
"'" << endl);
1426 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap4_result() - targetURL='"<< targetURL <<
"'" << endl);
1428 d4au.writeD4AsyncAccepted(xmlWrtr, 0, 0, targetURL, stylesheet_ref);
1429 out << xmlWrtr.get_doc();
1431 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap4_result() - sent AsyncAccepted" << endl);
1439 d4au.writeD4AsyncRequired(xmlWrtr, 0, 0, stylesheet_ref);
1440 out << xmlWrtr.get_doc();
1442 BESDEBUG(
"dap",
"BESDapResponseBuilder::store_dap4_result() - sent AsyncAccepted" << endl);
void set_dds(libdap::DDS *ddsIn)
virtual libdap::DDS * intern_dap2_data(BESResponseObject *obj, BESDataHandlerInterface &dhi)
void register_timeout() const
exception thrown if an internal error is found and is fatal to the BES
Holds a DDS object within the BES.
void set_dds(libdap::DDS *ddsIn)
virtual void send_dds(std::ostream &out, libdap::DDS **dds, libdap::ConstraintEvaluator &eval, bool constrained=false, bool with_mime_headers=true)
Transmit a DDS.
virtual string store_dap4_result(libdap::DMR &dmr, const string &constraint, BESDapResponseBuilder *rb)
virtual bool start(string name)
virtual void serialize_dap2_data_dds(std::ostream &out, libdap::DDS **dds, libdap::ConstraintEvaluator &eval, bool ce_eval=true)
virtual std::string get_dataset_name() const
Get the dataset name.
static string assemblePath(const string &firstPart, const string &secondPart, bool addLeadingSlash=false)
Assemble path fragments making sure that they are separated by a single '/' character.
virtual void remove_timeout() const
Transmit data.
static BESStoredDapResultCache * get_instance()
virtual libdap::DDS * get_or_cache_dataset(libdap::DDS *dds, const std::string &constraint)
Return a DDS loaded with data that can be serialized back to a client.
libdap::ConstraintEvaluator & get_ce()
virtual void split_ce(libdap::ConstraintEvaluator &eval, const std::string &expr="")
virtual void establish_timeout(std::ostream &stream) const
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
void set_timeout(int timeout=0)
virtual void set_dataset_name(const std::string _dataset)
Set the dataset pathname.
virtual void set_dap4function(std::string _func)
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.
map< string, string > data
the map of string data that will be required for the current request.
virtual std::string get_ce() const
Get the constraint expression.
virtual void send_dap2_data(std::ostream &data_stream, libdap::DDS **dds, libdap::ConstraintEvaluator &eval, bool with_mime_headers=true)
virtual std::string get_dap4function() const
Get the DAP4 server side function expression.
void first_container()
set the container pointer to the first container in the containers list
virtual void set_ce(std::string _ce)
void conditional_timeout_cancel()
static BESKeys * TheKeys()
Cache the results from server functions.
Abstract base class representing a specific set of information in response to a request to the BES...
virtual void send_ddx(std::ostream &out, libdap::DDS **dds, libdap::ConstraintEvaluator &eval, bool with_mime_headers=true)
virtual bool store_dap4_result(ostream &out, libdap::DMR &dmr)
virtual std::string get_dap4ce() const
Get the DAP4 constraint expression.
virtual void set_dap4ce(std::string _ce)
virtual void serialize_dap4_data(std::ostream &out, libdap::DMR &dmr, bool with_mime_headers=true)
virtual libdap::DDS * process_dap2_dds(BESResponseObject *obj, BESDataHandlerInterface &dhi)
Process a DDS (i.e., apply a constraint) for a non-DAP transmitter.