bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
HDF4Module.cc
1// HDF4Module.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//
29// Authors:
30// pwest Patrick West <pwest@ucar.edu>
31
32#include <iostream>
33#include "HDF4Module.h"
34#include <BESRequestHandlerList.h>
35#include "HDF4RequestHandler.h"
36#include <BESDapService.h>
37#include <BESContainerStorageList.h>
38#include <BESFileContainerStorage.h>
39#include <BESCatalogDirectory.h>
40#include <BESCatalogList.h>
41#include <BESDebug.h>
42
43using namespace std;
44const string HDF4_CATALOG="catalog";
45
46void HDF4Module::initialize(const string & modname)
47{
48 BESDEBUG("h4", "Initializing HDF4 module " << modname << endl);
49
50 auto handler = new HDF4RequestHandler(modname);
51 BESRequestHandlerList::TheList()->add_handler(modname, handler);
52
54
55 if( !BESCatalogList::TheCatalogList()->ref_catalog( HDF4_CATALOG ) ) {
56 BESCatalogList::TheCatalogList()->
57 add_catalog(new BESCatalogDirectory(HDF4_CATALOG));
58 }
59
60 if( !BESContainerStorageList::TheList()->ref_persistence( HDF4_CATALOG ) ) {
61 auto csc = new BESFileContainerStorage(HDF4_CATALOG);
62 BESContainerStorageList::TheList()->add_persistence(csc);
63 }
64
66 BESDEBUG("h4", "Done Initializing HDF4 module " << modname << endl);
67 }
68
69void HDF4Module::terminate(const string & modname)
70{
71 BESDEBUG("h4", "Cleaning HDF4 module " << modname << endl);
72
73 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
74 if (rh) delete rh;
75
76 BESContainerStorageList::TheList()->deref_persistence(HDF4_CATALOG);
77
78 BESCatalogList::TheCatalogList()->deref_catalog(HDF4_CATALOG);
79
80 BESDEBUG("h4", "Done Cleaning HDF4 module " << modname << endl);
81}
82
89void HDF4Module::dump(ostream & strm) const
90{
91 strm << BESIndent::LMarg << "HDF4Module::dump - ("
92 << (void *) this << ")" << endl;
93}
94
95extern "C" {
96 BESAbstractModule *maker() {
97 return new HDF4Module;
98}
99
100}
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 HDF4Module.cc:89