bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
S3Module.cc
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of S3_module, A C++ module that can be loaded in to
4// the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
5
6// Copyright (c) 2020 OPeNDAP, Inc.
7// Author: Nathan Potter <ndp@opendap.org>
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 OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25#include "config.h"
26
27#include <iostream>
28#include <vector>
29#include <string>
30
31#include <BESRequestHandlerList.h>
32#include <BESDebug.h>
33#include <BESContainerStorageList.h>
34
35#include "S3Module.h"
36#include "S3RequestHandler.h"
37#include "S3ContainerStorage.h"
38
39using namespace std;
40using namespace s3;
41
42void S3Module::initialize(const string &modname)
43{
44 BESDEBUG(modname, "Initializing s3 Module " << modname << endl);
45
46 BESRequestHandlerList::TheList()->add_handler(modname, new S3RequestHandler(modname));
47
48 BESContainerStorageList::TheList()->add_persistence(new S3ContainerStorage(modname));
49
50 BESDebug::Register(modname);
51
52 BESDEBUG(modname, "Done Initializing s3 Module " << modname << endl);
53}
54
55void S3Module::terminate(const string &modname)
56{
57 BESDEBUG(modname, "Cleaning s3 module " << modname << endl);
58
59 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
60 delete rh;
61
62 BESContainerStorageList::TheList()->deref_persistence(modname);
63
64 BESDEBUG(modname, "Done Cleaning s3 module " << modname << endl);
65}
66
67void S3Module::dump(ostream &strm) const
68{
69 strm << BESIndent::LMarg << "S3Module::dump - (" << (void *) this << ")" << endl;
70}
71
72extern "C"
73BESAbstractModule *maker()
74{
75 return new S3Module;
76}
77
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
void dump(std::ostream &strm) const override
dump the contents of this object to the specified ostream
Definition S3Module.cc:67