bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESUsageResponseHandler.cc
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
33#include "../usage/BESUsageResponseHandler.h"
34
35#include <libdap/DDS.h>
36#include "../usage/BESUsage.h"
37#include "../usage/BESUsageNames.h"
38#include "../usage/BESUsageTransmit.h"
39#include "BESRequestHandlerList.h"
40#include "BESDapNames.h"
41#include "BESDASResponse.h"
42#include "BESDDSResponse.h"
43#include "BESTransmitter.h"
44
45using namespace libdap;
46
47BESUsageResponseHandler::BESUsageResponseHandler( const string &name )
48 : BESResponseHandler( name )
49{
50}
51
52BESUsageResponseHandler::~BESUsageResponseHandler( )
53{
54}
55
72void
74{
75 dhi.action_name = Usage_RESPONSE_STR ;
76
77 // Create the DDS.
78 // NOTE: It is the responsibility of the specific request handler to set
79 // the BaseTypeFactory. It is set to NULL here
80 DDS *dds = new DDS( NULL, "virtual" ) ;
81 BESDDSResponse *bdds = new BESDDSResponse( dds ) ;
82 d_response_object = bdds ;
83 d_response_name = DDS_RESPONSE ;
84 dhi.action = DDS_RESPONSE ;
85 BESRequestHandlerList::TheList()->execute_each( dhi ) ;
86
87 // Fill the DAS
88 DAS *das = new DAS ;
89 BESDASResponse *bdas = new BESDASResponse( das ) ;
90 d_response_object = bdas ;
91 d_response_name = DAS_RESPONSE ;
92 dhi.action = DAS_RESPONSE ;
93 BESRequestHandlerList::TheList()->execute_each( dhi ) ;
94
95 BESUsage *usage = new BESUsage( bdas, bdds ) ;
96 d_response_object = usage ;
97 dhi.action = Usage_RESPONSE ;
98}
99
112void
115{
116 if( d_response_object )
117 {
118 transmitter->send_response( Usage_TRANSMITTER, d_response_object, dhi ) ;
119 }
120}
121
123BESUsageResponseHandler::UsageResponseBuilder( const string &handler_name )
124{
125 return new BESUsageResponseHandler( handler_name ) ;
126}
127
Represents an OPeNDAP DAS DAP2 data object within the BES.
Holds a DDS object within the BES.
Structure storing information used by the BES to handle the request.
std::string action
the response object requested, e.g. das, dds
handler object that knows how to create a specific response object
response handler that builds an OPeNDAP Usage response object
virtual void execute(BESDataHandlerInterface &dhi)
executes the command 'get Usage for <def_name>;' by executing the request for each container in the s...
virtual void transmit(BESTransmitter *transmitter, BESDataHandlerInterface &dhi)
transmit the response object built by the execute command using the specified transmitter object
container for a DAS and DDS needed to write out the usage information for a dataset.
Definition BESUsage.h:52