bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
CmrModule.cc
1// CSVModule.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: Stephan Zednik <zednik@ucar.edu> and Patrick West <pwest@ucar.edu>
8// and Jose Garcia <jgarcia@ucar.edu>
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// You can contact University Corporation for Atmospheric Research at
25// 3080 Center Green Drive, Boulder, CO 80301
26
27// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
28// Please read the full copyright statement in the file COPYRIGHT_UCAR.
29//
30// Authors:
31// zednik Stephan Zednik <zednik@ucar.edu>
32// pwest Patrick West <pwest@ucar.edu>
33// jgarcia Jose Garcia <jgarcia@ucar.edu>
34#include "config.h"
35
36#include <iostream>
37
38using std::endl;
39using std::ostream;
40using std::string;
41
42#include <BESRequestHandlerList.h>
43#include <BESResponseHandlerList.h>
44#include <BESResponseNames.h>
45
46#include <BESContainerStorageList.h>
47#include <BESFileContainerStorage.h>
48#include <BESCatalogDirectory.h>
49#include <BESCatalogList.h>
50#include <BESDapService.h>
51
52#include <BESLog.h>
53#include <BESDebug.h>
54#include <TheBESKeys.h>
55
56// #include "CmrRequestHandler.h"
57#include "CmrNames.h"
58#include "CmrModule.h"
59#include "CmrCatalog.h"
60#include "CmrContainerStorage.h"
61
62#define prolog std::string("CmrModule::").append(__func__).append("() - ")
63
64void CmrModule::initialize(const string &modname)
65{
66 BESDebug::Register(MODULE);
67 BESDEBUG(MODULE, prolog << "BEGIN (modname: " << modname << ")" << endl);
68 if (!BESCatalogList::TheCatalogList()->ref_catalog(CMR_CATALOG_NAME)) {
69 BESDEBUG(MODULE, prolog << "Enabling Cmr Catalog Module." << endl);
70 BESCatalogList::TheCatalogList()->add_catalog(new cmr::CmrCatalog(CMR_CATALOG_NAME));
71 }
72 else {
73 BESDEBUG(MODULE, prolog << "CMR Catalog Module is not enabled." << endl);
74 }
75
76 if (!BESContainerStorageList::TheList()->ref_persistence(CMR_CATALOG_NAME) &&
77 TheBESKeys::TheKeys()->read_bool_key("CMR.UseContainerAccess", false) ){
78 BESDEBUG(MODULE, prolog << "Enabling CmrContainerStorage for access." << endl);
79 BESContainerStorageList::TheList()->add_persistence(new cmr::CmrContainerStorage(CMR_CATALOG_NAME));
80 }
81 else {
82 BESDEBUG(MODULE, prolog << "CmrContainerStorage is not enabled." << endl);
83 }
84
85 BESDEBUG(MODULE, "Done Initializing CMR Handler: " << modname << endl);
86}
87
88void CmrModule::terminate(const string &modname)
89{
90 BESDEBUG(MODULE, prolog << "Cleaning CMR Module: " << modname << endl);
91
92 //BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
93 //if (rh) delete rh;
94
95 BESContainerStorageList::TheList()->deref_persistence(CMR_CATALOG_NAME);
96
97 BESCatalogList::TheCatalogList()->deref_catalog(CMR_CATALOG_NAME);
98
99 BESDEBUG(MODULE, prolog << "Done Cleaning CMR Module: " << modname << endl);
100}
101
102extern "C" {
103BESAbstractModule *maker()
104{
105 return new CmrModule;
106}
107}
108
109void CmrModule::dump(ostream &strm) const
110{
111 strm << BESIndent::LMarg << prolog << "(" << (void *) this << ")" << endl;
112}
113
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
Definition CmrModule.cc:109
static TheBESKeys * TheKeys()
Access to the singleton.
Definition TheBESKeys.cc:85