30#include <libdap/DMR.h>
31#include <libdap/D4Group.h>
32#include <libdap/D4Attributes.h>
33#include <libdap/D4BaseTypeFactory.h>
35#include "BESDMRResponseHandler.h"
36#include "BESDMRResponse.h"
37#include "BESRequestHandlerList.h"
38#include "BESDapNames.h"
39#include "BESDapTransmit.h"
40#include "BESContextManager.h"
41#include "GlobalMetadataStore.h"
50#define prolog std::string("BESDMRResponseHandler::").append(__func__).append("() - ")
52BESDMRResponseHandler::BESDMRResponseHandler(
const string &name) :
57BESDMRResponseHandler::~BESDMRResponseHandler()
80 dhi.action_name = DMR_RESPONSE_STR;
96 d_response_object = 0;
105 BESDEBUG(MODULE, prolog <<
"dmr->request_xml_base(): '"<< dmr->request_xml_base() <<
106 "' (dmr: "<< (
void *) dmr <<
")" << endl);
113 d_response_object = bdmr;
114 BESDEBUG(MODULE, prolog <<
"d_response_object: "<< (
void *) d_response_object << endl);
121 BESDEBUG(MODULE, prolog <<
"dmr->request_xml_base(): '"<< dmr->request_xml_base()
122 <<
"' (dmr: "<< (
void *)dmr <<
")" << endl);
124 d_response_object = bdmr;
126 BESDEBUG(MODULE, prolog <<
"d_response_object: "<< (
void *) d_response_object << endl);
129 BESRequestHandlerList::TheList()->execute_each(dhi);
135 if (!d_annotation_service_url.empty()) {
136 unique_ptr<D4Attribute> annotation_url(
new D4Attribute(DODS_EXTRA_ANNOTATION_ATTR, attr_str_c));
137 annotation_url->add_value(d_annotation_service_url);
140 if (dmr->root() && dmr->root()->attributes()->get(DODS_EXTRA_ATTR_TABLE)) {
141 dmr->root()->attributes()->get(DODS_EXTRA_ATTR_TABLE)->attributes()->add_attribute_nocopy(annotation_url.release());
145 unique_ptr<D4Attribute> dods_extra(
new D4Attribute(DODS_EXTRA_ATTR_TABLE, attr_container_c));
146 dods_extra->attributes()->add_attribute_nocopy(annotation_url.release());
150 unique_ptr<D4BaseTypeFactory> factory(
new D4BaseTypeFactory);
151 dmr->set_factory(factory.get());
152 dmr->root()->attributes()->add_attribute_nocopy(dods_extra.release());
156 dmr->root()->attributes()->add_attribute_nocopy(dods_extra.release());
184 if (d_response_object) {
185 transmitter->send_response(DMR_SERVICE, d_response_object, dhi);
197 strm << BESIndent::LMarg <<
"BESDMRResponseHandler::dump - (" << (
void *)
this <<
")" << endl;
200 BESIndent::UnIndent();
204BESDMRResponseHandler::DMRResponseBuilder(
const string &name)
std::string get_relative_name() const
Get the relative name of the object in this container.
std::string get_dap4_constraint() const
retrieve the constraint expression for this container
std::string get_dap4_function() const
retrieve the constraint expression for this container
response handler that builds an OPeNDAP DMR response object
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void execute(BESDataHandlerInterface &dhi)
executes the command <get type-"dmr" definition="..">
Represents an OPeNDAP DMR DAP4 data object within the BES.
virtual void clear_container()
clear the container in the DAP response object
virtual void set_dap4_constraint(BESDataHandlerInterface &dhi)
set the constraint depending on the context
Structure storing information used by the BES to handle the request.
void first_container()
set the container pointer to the first container in the containers list
BESContainer * container
pointer to current container in this interface
handler object that knows how to create a specific response object
void dump(std::ostream &strm) const override
dumps information about this object