29#include <libdap/InternalErr.h>
31#include <BESResponseHandler.h>
32#include <BESResponseNames.h>
33#include <BESVersionInfo.h>
34#include <BESConstraintFuncs.h>
35#include <BESServiceRegistry.h>
38#include "GatewayRequestHandler.h"
39#include "GatewayNames.h"
45using namespace gateway;
47GatewayRequestHandler::GatewayRequestHandler(
const string &name) :
50 add_method(VERS_RESPONSE, GatewayRequestHandler::gateway_build_vers);
51 add_method(HELP_RESPONSE, GatewayRequestHandler::gateway_build_help);
54GatewayRequestHandler::~GatewayRequestHandler()
58bool GatewayRequestHandler::gateway_build_vers(BESDataHandlerInterface &dhi)
61 BESVersionInfo *info =
dynamic_cast<BESVersionInfo *
>(dhi.response_handler->
get_response_object());
62 if (!info)
throw InternalErr(__FILE__, __LINE__,
"Expected a BESVersionInfo instance");
64 info->add_module(PACKAGE_NAME, PACKAGE_VERSION);
66 info->add_module(GATEWAY_MODULE, GATEWAY_MODULE_VERSION);
70bool GatewayRequestHandler::gateway_build_help(BESDataHandlerInterface &dhi)
74 if (!info)
throw InternalErr(__FILE__, __LINE__,
"Expected a BESInfo instance");
78 map<string, string, std::less<>> attrs;
79 attrs[
"name"] = GATEWAY_MODULE;
80 attrs[
"version"] = GATEWAY_MODULE_VERSION;
82 attrs[
"name"] = PACKAGE_NAME;
83 attrs[
"version"] = PACKAGE_VERSION;
85 list<string> services;
86 BESServiceRegistry::TheRegistry()->
services_handled(GATEWAY_MODULE, services);
87 if (services.size() > 0) {
89 attrs[
"handles"] = handles;
91 info->begin_tag(
"module", &attrs);
93 info->end_tag(
"module");
100 strm << BESIndent::LMarg <<
"GatewayRequestHandler::dump - (" << (
void *)
this <<
")" << endl;
103 BESIndent::UnIndent();
Represents a specific data type request handler.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual BESResponseObject * get_response_object()
return the current response object
virtual void services_handled(const std::string &handler, std::list< std::string > &services)
returns the list of servies provided by the handler in question
static std::string implode(const std::list< std::string > &values, char delim)
virtual void dump(std::ostream &strm) const
dumps information about this object