bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HDF5Module.cc
Go to the documentation of this file.
1// HDF5Module.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,2005 University Corporation for Atmospheric Research
7// Author: Patrick West <pwest@ucar.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 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//
33
34#include <iostream>
35#include <memory>
36#include "HDF5Module.h"
37#include <BESRequestHandlerList.h>
38#include "HDF5RequestHandler.h"
39#include <BESDapService.h>
40#include <BESContainerStorageList.h>
41#include <BESFileContainerStorage.h>
42#include <BESCatalogDirectory.h>
43#include <BESCatalogList.h>
44#include <BESDebug.h>
45#define HDF5_CATALOG "catalog"
46#define prolog std::string("HDF5RequestHandler::").append(__func__).append("() - ")
47#define HDF5_NAME "h5"
48using std::endl;
49
50void HDF5Module::initialize(const string & modname)
51{
52 BESDEBUG(HDF5_NAME, prolog << "Initializing HDF5 module " << modname << endl);
53
54 auto handler_unique = make_unique<HDF5RequestHandler>(modname);
55 auto handler = handler_unique.release();
56 BESRequestHandlerList::TheList()->add_handler(modname, handler);
57
59
60 if (!BESCatalogList::TheCatalogList()->ref_catalog(HDF5_CATALOG)) {
61 auto BESCatalogDirectory_unique = make_unique<BESCatalogDirectory>(HDF5_CATALOG);
62 BESCatalogList::TheCatalogList()->add_catalog(BESCatalogDirectory_unique.release());
63 }
64
65 if (!BESContainerStorageList::TheList()->ref_persistence(HDF5_CATALOG)) {
66 auto csc_unique = make_unique<BESFileContainerStorage>(HDF5_CATALOG);
67 auto csc = csc_unique.release();
68 BESContainerStorageList::TheList()->add_persistence(csc);
69 }
70
72
73 BESDEBUG(HDF5_NAME, prolog << "Done Initializing HDF5 " << modname << endl);
74}
75
76void HDF5Module::terminate(const string & modname)
77{
78 BESDEBUG(HDF5_NAME, prolog << "Cleaning HDF5 module " << modname << endl);
79
80 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
81 if (rh) delete rh;
82
83 BESContainerStorageList::TheList()->deref_persistence(HDF5_CATALOG);
84
85 BESCatalogList::TheCatalogList()->deref_catalog(HDF5_CATALOG);
86
87 BESDEBUG(HDF5_NAME, prolog << "Done Cleaning HDF5 module " << modname << endl);
88}
89
96void HDF5Module::dump(ostream & strm) const
97{
98 strm << BESIndent::LMarg << "HDF5Module::dump - (" << (void *) this << ")" << endl;
99}
100
101extern "C" {
102BESAbstractModule *maker()
103{
104 return new HDF5Module;
105}
106}
The starting and ending fuctions for the HDF5 OPeNDAP handler via BES.
include the entry functions to execute the handlers
static void handle_dap_service(const std::string &handler)
static function to register a handler to handle the dap services
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
void dump(std::ostream &strm) const override
dumps information about this object
Definition HDF5Module.cc:96
STL class.