bes  Updated for version 3.20.6
BESXDResponseHandler.cc
1 // BESXDResponseHandler.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) 2004,2005 University Corporation for Atmospheric Research
7 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.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 University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // Authors:
27 // pwest Patrick West <pwest@ucar.edu>
28 // jgarcia Jose Garcia <jgarcia@ucar.edu>
29 
30 #include <DataDDS.h>
31 
32 #include <BESRequestHandlerList.h>
33 #include <BESDapNames.h>
34 #include <BESDataDDSResponse.h>
35 
36 #include "BESXDNames.h"
37 #include "BESXDTransmit.h"
38 #include "BESXDResponseHandler.h"
39 
40 using namespace libdap;
41 
42 BESXDResponseHandler::BESXDResponseHandler(const string &name) :
43  BESResponseHandler(name)
44 {
45 }
46 
47 BESXDResponseHandler::~BESXDResponseHandler()
48 {
49 }
50 
65 {
66  dhi.action_name = XD_RESPONSE_STR;
67  // Create the DDS.
68  // NOTE: It is the responsibility of the specific request handler to set
69  // the BaseTypeFactory. It is set to NULL here
70  DDS *dds = new DDS(NULL, "virtual");
71  BESDataDDSResponse *bdds = new BESDataDDSResponse(dds);
72  d_response_object = bdds;
73  d_response_name = DATA_RESPONSE;
74  dhi.action = DATA_RESPONSE;
75  BESRequestHandlerList::TheList()->execute_each(dhi);
76 
77  dhi.action = XD_RESPONSE;
78  d_response_object = bdds;
79 }
80 
94 {
95  if (d_response_object) {
96  transmitter->send_response(XD_TRANSMITTER, d_response_object, dhi);
97  }
98 }
99 
101 BESXDResponseHandler::XDResponseBuilder(const string &handler_name)
102 {
103  return new BESXDResponseHandler(handler_name);
104 }
105 
BESXDResponseHandler::execute
virtual void execute(BESDataHandlerInterface &dhi)
executes the command 'get ascii for <def_name>' by executing the request for each container in the sp...
Definition: BESXDResponseHandler.cc:64
BESXDResponseHandler
response handler that builds an OPeNDAP ASCII response object
Definition: BESXDResponseHandler.h:46
BESXDResponseHandler::transmit
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object
Definition: BESXDResponseHandler.cc:93
BESDataHandlerInterface::action
std::string action
the response object requested, e.g. das, dds
Definition: BESDataHandlerInterface.h:79
BESRequestHandlerList::execute_each
virtual void execute_each(BESDataHandlerInterface &dhi)
for each container in the given data handler interface, execute the given request
Definition: BESRequestHandlerList.cc:167
libdap
Definition: BESDapFunctionResponseCache.h:35
BESResponseHandler
handler object that knows how to create a specific response object
Definition: BESResponseHandler.h:77
BESTransmitter
Definition: BESTransmitter.h:47
BESDataDDSResponse
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
Definition: BESDataDDSResponse.h:46
BESDataHandlerInterface
Structure storing information used by the BES to handle the request.
Definition: BESDataHandlerInterface.h:56