OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
GatewayRequestHandler.cc
Go to the documentation of this file.
1 // GatewayRequestHandler.cc
2 
3 #include "config.h"
4 
6 #include <BESResponseHandler.h>
7 #include <BESResponseNames.h>
8 #include "GatewayResponseNames.h"
9 #include <BESVersionInfo.h>
10 #include <BESTextInfo.h>
11 #include "BESDapNames.h"
12 #include "BESDataDDSResponse.h"
13 #include "BESDDSResponse.h"
14 #include "BESDASResponse.h"
15 #include <BESConstraintFuncs.h>
16 #include <BESServiceRegistry.h>
17 #include <BESUtil.h>
18 
20  BESRequestHandler(name)
21 {
24 }
25 
27 {
28 }
29 
31 {
32  bool ret = true;
33  BESVersionInfo *info = dynamic_cast<BESVersionInfo *>(dhi.response_handler->get_response_object());
34  if (!info)
35  throw InternalErr(__FILE__, __LINE__, "Expected a BESVersionInfo instance");
36 #if 0
38 #endif
39  info->add_module(MODULE_NAME, MODULE_VERSION);
40  return ret;
41 }
42 
44 {
45  bool ret = true;
46  BESInfo *info = dynamic_cast<BESInfo *>(dhi.response_handler->get_response_object());
47  if (!info)
48  throw InternalErr(__FILE__, __LINE__, "Expected a BESInfo instance");
49 
50  // This is an example. If you had a help file you could load it like
51  // this and if your handler handled the following responses.
52  map < string, string > attrs;
53  attrs["name"] = MODULE_NAME ;
54  attrs["version"] = MODULE_VERSION ;
55 #if 0
56  attrs["name"] = PACKAGE_NAME;
57  attrs["version"] = PACKAGE_VERSION;
58 #endif
59  list < string > services;
61  if (services.size() > 0) {
62  string handles = BESUtil::implode(services, ',');
63  attrs["handles"] = handles;
64  }
65  info->begin_tag("module", &attrs);
66  //info->add_data_from_file( "Gateway.Help", "Gateway Help" ) ;
67  info->end_tag("module");
68 
69  return ret;
70 }
71 
72 void GatewayRequestHandler::dump(ostream &strm) const
73 {
74  strm << BESIndent::LMarg << "GatewayRequestHandler::dump - (" << (void *) this << ")" << endl;
78 }
79 
brief represents simple text information in a response object, such as version and help inforamtion...
static bool gateway_build_help(BESDataHandlerInterface &dhi)
virtual void dump(ostream &strm) const
dumps information about this object
#define Gateway_NAME
static void Indent()
Definition: BESIndent.cc:38
#define HELP_RESPONSE
informational response object
Definition: BESInfo.h:68
static string implode(const list< string > &values, char delim)
implode a list of values into a single string delimited by delim
Definition: BESUtil.cc:602
virtual BESResponseObject * get_response_object()
return the current response object
#define PACKAGE_NAME
Definition: config.h:244
static BESServiceRegistry * TheRegistry()
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
GatewayRequestHandler(const string &name)
virtual ~GatewayRequestHandler(void)
Represents a specific data type request handler.
Structure storing information used by the BES to handle the request.
#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 bool gateway_build_vers(BESDataHandlerInterface &dhi)
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)
virtual void end_tag(const string &tag_name)
Definition: BESInfo.cc:132
virtual void services_handled(const string &handler, list< string > &services)
returns the list of servies provided by the handler in question