OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESDataDDXResponseHandler.cc
Go to the documentation of this file.
1 // BESDataDDXResponseHandler.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-2009 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 //
23 // You can contact University Corporation for Atmospheric Research at
24 // 3080 Center Green Drive, Boulder, CO 80301
25 
26 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
28 //
29 // Authors:
30 // pwest Patrick West <pwest@ucar.edu>
31 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
34 #include "BESDataDDSResponse.h"
35 #include "BESRequestHandlerList.h"
36 #include "BESDapNames.h"
37 #include "BESDapTransmit.h"
38 
39 #include "BESDebug.h"
40 
42  : BESResponseHandler( name )
43 {
44 }
45 
47 {
48 }
49 
64 void
66 {
67  BESDEBUG( "dap", "Entering BESDataDDXResponseHandler::execute" << endl ) ;
68 
70  // Create the DDS.
71  // NOTE: It is the responsibility of the specific request handler to set
72  // the BaseTypeFactory. It is set to NULL here
73  DataDDS *dds = new DataDDS( NULL, "virtual" ) ;
74  BESDataDDSResponse *bdds = new BESDataDDSResponse( dds ) ;
75  _response = bdds ;
76 
77  // we're actually going to get the data response, it just gets
78  // displayed as a DataDDX
80  dhi.action = DATA_RESPONSE ;
81 
82  // I added these two lines from BESDDXResponse. jhrg 8/21/09
83  dds->set_dap_version( bdds->get_dap_client_protocol() ) ;
84  dds->set_request_xml_base( bdds->get_request_xml_base() );
85 
87 
88  // we've got what we want, now set the action back to data ddx
89  dhi.action = DATADDX_RESPONSE ;
90  _response = bdds ;
91 
92  BESDEBUG( "dap", "Leaving BESDataDDXResponseHandler::execute" << endl ) ;
93 }
94 
107 void
110 {
111  if( _response )
112  {
113  transmitter->send_response( DATADDX_SERVICE, _response, dhi ) ;
114  }
115 }
116 
123 void
124 BESDataDDXResponseHandler::dump( ostream &strm ) const
125 {
126  strm << BESIndent::LMarg << "BESDataDDXResponseHandler::dump - ("
127  << (void *)this << ")" << endl ;
129  BESResponseHandler::dump( strm ) ;
131 }
132 
135 {
136  return new BESDataDDXResponseHandler( name ) ;
137 }
138 
static BESResponseHandler * DataDDXResponseBuilder(const string &name)
#define DATADDX_RESPONSE_STR
Definition: BESDapNames.h:73
virtual void execute(BESDataHandlerInterface &dhi)
executes the command &#39;get ddx for def_name;&#39;
static void Indent()
Definition: BESIndent.cc:38
BESResponseObject * _response
#define DATADDX_RESPONSE
Definition: BESDapNames.h:70
handler object that knows how to create a specific response object
BESDataDDXResponseHandler(const string &name)
#define DATA_RESPONSE
Definition: BESDapNames.h:66
virtual void send_response(const string &method, BESResponseObject *obj, BESDataHandlerInterface &dhi)
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
virtual void execute_each(BESDataHandlerInterface &dhi)
for each container in the given data handler interface, execute the given request ...
#define DATADDX_SERVICE
Definition: BESDapNames.h:71
Represents an OPeNDAP DataDDS DAP2 data object within the BES.
static BESRequestHandlerList * TheList()
Structure storing information used by the BES to handle the request.
string get_dap_client_protocol() const
Return the dap version string sent by the client (e.g., the OLFS)
virtual void dump(ostream &strm) const
dumps information about this object
string get_request_xml_base() const
Return the xml:base URL for this request.
virtual void dump(ostream &strm) const
dumps information about this object
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
static void UnIndent()
Definition: BESIndent.cc:44
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command
string action
the response object requested, e.g.