OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESUsageRequestHandler.cc
Go to the documentation of this file.
1 // BESUsageRequestHandler.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 
34 #include "BESUsageRequestHandler.h"
35 #include "BESResponseHandler.h"
36 #include "BESResponseNames.h"
37 #include "BESVersionInfo.h"
38 #include "BESDataNames.h"
39 #include "config.h"
40 
42  : BESRequestHandler( name )
43 {
46 }
47 
49 {
50 }
51 
52 bool
54 {
56  BESInfo *info = dynamic_cast < BESInfo * >(response) ;
57  if( !info )
58  throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
59 
60  map<string,string> attrs ;
61  attrs["name"] = PACKAGE_NAME ;
62  attrs["version"] = PACKAGE_VERSION ;
63  info->begin_tag( "module", &attrs ) ;
64  info->add_data_from_file( "DAP-SERVER.Help", "Dap server Help" ) ;
65  info->end_tag( "module" ) ;
66 
67  return true ;
68 }
69 
70 bool
72 {
74  BESVersionInfo *info = dynamic_cast < BESVersionInfo * >(response) ;
75  if( !info )
76  throw BESInternalError( "cast error", __FILE__, __LINE__ ) ;
77 
78  info->add_module( MODULE_NAME, MODULE_VERSION ) ;
79 
80  return true ;
81 }
82 
89 void
90 BESUsageRequestHandler::dump( ostream &strm ) const
91 {
92  strm << BESIndent::LMarg << "BESUsageRequestHandler::dump - ("
93  << (void *)this << ")" << endl ;
95  BESRequestHandler::dump( strm ) ;
97 }
98 
brief represents simple text information in a response object, such as version and help inforamtion...
BESUsageRequestHandler(const string &name)
exception thrown if inernal error encountered
virtual void add_data_from_file(const string &key, const string &name)
add data from a file to the informational object.
Definition: BESInfo.cc:170
static bool dap_build_version(BESDataHandlerInterface &dhi)
static void Indent()
Definition: BESIndent.cc:38
#define HELP_RESPONSE
informational response object
Definition: BESInfo.h:68
virtual BESResponseObject * get_response_object()
return the current response object
#define PACKAGE_NAME
Definition: config.h:244
virtual void dump(ostream &strm) const
dumps information about this object
BESResponseHandler * response_handler
virtual void begin_tag(const string &tag_name, map< string, string > *attrs=0)
Definition: BESInfo.cc:127
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
Represents a specific data type request handler.
Structure storing information used by the BES to handle the request.
static bool dap_build_help(BESDataHandlerInterface &dhi)
#define VERS_RESPONSE
virtual bool add_handler(const string &handler_name, p_request_handler handler_method)
add a handler method to the request handler that knows how to fill in a specific response object ...
#define PACKAGE_VERSION
Definition: config.h:256
static void UnIndent()
Definition: BESIndent.cc:44
virtual void dump(ostream &strm) const
dumps information about this object
virtual void add_module(const string &n, const string &v)
Abstract base class representing a specific set of information in response to a request to the BES...
virtual void end_tag(const string &tag_name)
Definition: BESInfo.cc:132