bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HttpdCatalogModule.cc
1
2// -*- mode: c++; c-basic-offset:4 -*-
3//
4// This file is part of bes, A C++ back-end server implementation framework
5// for the OPeNDAP Data Access Protocol.
6//
7// Copyright (c) 2018 OPeNDAP, Inc.
8// Author: Nathan Potter <ndp@opendap.org>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24
25#include "config.h"
26
27#include <iostream>
28#include <string>
29
30#include <BESRequestHandlerList.h>
31#include <BESResponseHandlerList.h>
32#include <BESResponseNames.h>
33
34#include <BESContainerStorageList.h>
35#include <BESFileContainerStorage.h>
36#include <BESCatalogDirectory.h>
37#include <BESCatalogList.h>
38#include <BESDapService.h>
39
40#include <BESLog.h>
41#include <BESDebug.h>
42
43#include "HttpdCatalogNames.h"
44#include "HttpdCatalogModule.h"
45#include "HttpdCatalogContainerStorage.h"
46#include "HttpdCatalog.h"
47
48using namespace std;
49
50#define prolog string("HttpdCatalogModule::").append(__func__).append("() - ")
51
52namespace httpd_catalog {
53
54void HttpdCatalogModule::initialize(const string &modname)
55{
56 BESDebug::Register(MODULE);
57
58 BESDEBUG(MODULE, prolog << "Initializing Module: " << modname << endl);
59
60 if (!BESCatalogList::TheCatalogList()->ref_catalog(HTTPD_CATALOG_NAME)) {
61 BESCatalogList::TheCatalogList()->add_catalog(new HttpdCatalog(HTTPD_CATALOG_NAME));
62 }
63
64 if (!BESContainerStorageList::TheList()->ref_persistence(HTTPD_CATALOG_NAME)) {
65 BESContainerStorageList::TheList()->add_persistence(new HttpdCatalogContainerStorage(HTTPD_CATALOG_NAME));
66 }
67
68 BESDEBUG(MODULE, "Done Initializing Handler: " << modname << endl);
69}
70
71void HttpdCatalogModule::terminate(const string &modname)
72{
73 BESDEBUG(MODULE, prolog << "Cleaning Module: " << modname << endl);
74
75 BESContainerStorageList::TheList()->deref_persistence(HTTPD_CATALOG_NAME);
76
77 BESCatalogList::TheCatalogList()->deref_catalog(HTTPD_CATALOG_NAME);
78
79 BESDEBUG(MODULE, prolog << "Done Cleaning Module: " << modname << endl);
80}
81
82extern "C" {
83BESAbstractModule *maker()
84{
85 return new HttpdCatalogModule;
86}
87}
88
89void HttpdCatalogModule::dump(ostream &strm) const
90{
91 strm << BESIndent::LMarg << prolog<< "(" << (void *) this << ")" << endl;
92}
93
94} // namespace httpd_catalog
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
virtual void dump(std::ostream &strm) const
dump the contents of this object to the specified ostream