OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESDMRResponseHandler.cc
Go to the documentation of this file.
1 // BESDMRResponseHandler.cc
2 
3 // This file is part of bes, A C++ back-end server implementation framework
4 // for the OPeNDAP Data Access Protocol.
5 
6 // Copyright (c) 2013 OPeNDAP, Inc.
7 // Author: Patrick West <pwest@rpi.edu>
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU Lesser General Public
11 // License as published by the Free Software Foundation; either
12 // version 2.1 of the License, or (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // Lesser General Public License for more details.
18 //
19 // You should have received a copy of the GNU Lesser General Public
20 // License along with this library; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 //
23 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24 
25 #include <DMR.h>
26 
27 #include "BESDMRResponseHandler.h"
28 #include "BESDMRResponse.h"
29 #include "BESRequestHandlerList.h"
30 #include "BESDapNames.h"
31 #include "BESDapTransmit.h"
32 #include "BESContextManager.h"
33 
35  BESResponseHandler(name)
36 {
37 }
38 
40 {
41 }
42 
57 {
59  DMR *dmr = new DMR();
60 
61  // Here we might set the dap and dmr version if they should be different from
62  // 4.0 and 1.0. jhrg 11/6/13
63 
64  bool found = false;
65  string xml_base = BESContextManager::TheManager()->get_context("xml:base", found);
66  if (found && !xml_base.empty()) {
67  dmr->set_request_xml_base(xml_base);
68  }
69 
70  _response = new BESDMRResponse(dmr);
72 }
73 
87 {
88  if (_response) {
89  transmitter->send_response(DMR_SERVICE, _response, dhi);
90  }
91 }
92 
99 void BESDMRResponseHandler::dump(ostream &strm) const
100 {
101  strm << BESIndent::LMarg << "BESDMRResponseHandler::dump - (" << (void *) this << ")" << endl;
105 }
106 
109 {
110  return new BESDMRResponseHandler(name);
111 }
112 
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object ...
virtual void dump(ostream &strm) const
dumps information about this object
#define DMR_SERVICE
Definition: BESDapNames.h:82
BESDMRResponseHandler(const string &name)
virtual void execute(BESDataHandlerInterface &dhi)
executes the command 'get dmr for def_name;' by executing the request for each container in the speci...
virtual string get_context(const string &name, bool &found)
retrieve the value of the specified context from the BES
static void Indent()
Definition: BESIndent.cc:38
BESResponseObject * _response
handler object that knows how to create a specific response object
virtual void send_response(const string &method, BESResponseObject *obj, BESDataHandlerInterface &dhi)
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
Represents an OPeNDAP DMR DAP4 data object within the BES.
virtual void execute_each(BESDataHandlerInterface &dhi)
for each container in the given data handler interface, execute the given request ...
static BESResponseHandler * DMRResponseBuilder(const string &name)
virtual void dump(ostream &strm) const
dumps information about this object
static BESContextManager * TheManager()
static BESRequestHandlerList * TheList()
Structure storing information used by the BES to handle the request.
static void UnIndent()
Definition: BESIndent.cc:44
#define DMR_RESPONSE_STR
Definition: BESDapNames.h:84