bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
SampleModule.cc
1// SampleModule.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-2009 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 "config.h"
34
35#include <iostream>
36
37using std::endl;
38using std::ostream;
39using std::string;
40
41#include "BESRequestHandlerList.h"
42
43#include "BESDebug.h"
44#include "BESResponseHandlerList.h"
45#include "BESResponseNames.h"
46#include "BESXMLCommand.h"
47
48#include "SampleModule.h"
49#include "SampleRequestHandler.h"
50#include "SampleResponseNames.h"
51#include "SampleSayResponseHandler.h"
52#include "SampleSayXMLCommand.h"
53
54void SampleModule::initialize(const string &modname)
55{
56 BESDEBUG(modname, "Initializing Sample Module " << modname << endl);
57
58 BESRequestHandlerList::TheList()->add_handler(modname, new SampleRequestHandler(modname));
59
60 BESResponseHandlerList::TheList()->add_handler(SAY_RESPONSE, SampleSayResponseHandler::SampleSayResponseBuilder);
61
62 BESXMLCommand::add_command(SAY_RESPONSE, SampleSayXMLCommand::CommandBuilder);
63
64 BESDebug::Register(modname);
65
66 BESDEBUG(modname, "Done Initializing Sample Module " << modname << endl);
67}
68
69void SampleModule::terminate(const string &modname)
70{
71 BESDEBUG(modname, "Cleaning Sample module " << modname << endl);
72
73 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
74 if (rh) delete rh;
75
76 BESResponseHandlerList::TheList()->remove_handler( SAY_RESPONSE);
77
78 BESXMLCommand::del_command( SAY_RESPONSE);
79
80 BESDEBUG(modname, "Done Cleaning Sample module " << modname << endl);
81}
82
83extern "C" {
84BESAbstractModule *maker()
85{
86 return new SampleModule;
87}
88}
89
90void SampleModule::dump(ostream &strm) const
91{
92 strm << BESIndent::LMarg << "SampleModule::dump - (" << (void *) this << ")" << endl;
93}
94
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
static void del_command(const std::string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const std::string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.
virtual void dump(std::ostream &strm) const
dump the contents of this object to the specified ostream