OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESUsageResponseHandler.cc
Go to the documentation of this file.
1 // BESUsageResponseHandler.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 // (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 "BESRequestHandlerList.h"
35 #include "BESDapNames.h"
36 #include "BESUsageNames.h"
37 #include "BESUsage.h"
38 #include "BESDASResponse.h"
39 #include "BESDDSResponse.h"
40 #include "BESUsageTransmit.h"
41 
43  : BESResponseHandler( name )
44 {
45 }
46 
48 {
49 }
50 
67 void
69 {
71 
72  // Create the DDS.
73  // NOTE: It is the responsbility of the specific request handler to set
74  // the BaseTypeFactory. It is set to NULL here
75  DDS *dds = new DDS( NULL, "virtual" ) ;
76  BESDDSResponse *bdds = new BESDDSResponse( dds ) ;
77  _response = bdds ;
79  dhi.action = DDS_RESPONSE ;
81 
82  // Fill the DAS
83  DAS *das = new DAS ;
84  BESDASResponse *bdas = new BESDASResponse( das ) ;
85  _response = bdas ;
87  dhi.action = DAS_RESPONSE ;
89 
90  BESUsage *usage = new BESUsage( bdas, bdds ) ;
91  _response = usage ;
92  dhi.action = Usage_RESPONSE ;
93 }
94 
107 void
110 {
111  if( _response )
112  {
113  transmitter->send_response( Usage_TRANSMITTER, _response, dhi ) ;
114  }
115 }
116 
119 {
120  return new BESUsageResponseHandler( handler_name ) ;
121 }
122 
#define Usage_RESPONSE_STR
Definition: BESUsageNames.h:47
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object ...
Represents an OPeNDAP DDS DAP2 data object within the BES.
virtual void execute(BESDataHandlerInterface &dhi)
executes the command 'get Usage for ;' by executing the request for each container in the s...
#define Usage_RESPONSE
macros representing the Usage response objects handled
Definition: BESUsageNames.h:45
BESResponseObject * _response
handler object that knows how to create a specific response object
BESUsageResponseHandler(const string &name)
static BESResponseHandler * UsageResponseBuilder(const string &name)
virtual void send_response(const string &method, BESResponseObject *obj, BESDataHandlerInterface &dhi)
#define NULL
Definition: wcsUtil.h:65
virtual void execute_each(BESDataHandlerInterface &dhi)
for each container in the given data handler interface, execute the given request ...
#define Usage_TRANSMITTER
static BESRequestHandlerList * TheList()
Structure storing information used by the BES to handle the request.
container for a DAS and DDS needed to write out the usage information for a dataset.
Definition: BESUsage.h:51
Represents an OPeNDAP DAS DAP2 data object within the BES.
string action
the response object requested, e.g.
#define DDS_RESPONSE
Definition: BESDapNames.h:60
#define DAS_RESPONSE
Definition: BESDapNames.h:55