bes  Updated for version 3.20.8
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 "HDF5Module.h"
36 #include <BESRequestHandlerList.h>
37 #include "HDF5RequestHandler.h"
38 #include <BESDapService.h>
39 #include <BESContainerStorageList.h>
40 #include <BESFileContainerStorage.h>
41 #include <BESCatalogDirectory.h>
42 #include <BESCatalogList.h>
43 #include <BESDebug.h>
44 #define HDF5_CATALOG "catalog"
45 #define prolog std::string("HDF5RequestHandler::").append(__func__).append("() - ")
46 #define HDF5_NAME "h5"
47 using std::endl;
48 
49 void HDF5Module::initialize(const string & modname)
50 {
51  BESDEBUG(HDF5_NAME, prolog << "Initializing HDF5 module " << modname << endl);
52 
53  BESRequestHandler *handler = new HDF5RequestHandler(modname);
54  BESRequestHandlerList::TheList()->add_handler(modname, handler);
55 
57 
58  if (!BESCatalogList::TheCatalogList()->ref_catalog(HDF5_CATALOG)) {
60  }
61 
62  if (!BESContainerStorageList::TheList()->ref_persistence(HDF5_CATALOG)) {
63  BESContainerStorage *csc = new BESFileContainerStorage(HDF5_CATALOG);
64  BESContainerStorageList::TheList()->add_persistence(csc);
65  }
66 
67  BESDebug::Register("h5");
68 
69  BESDEBUG(HDF5_NAME, prolog << "Done Initializing HDF5 " << modname << endl);
70 }
71 
72 void HDF5Module::terminate(const string & modname)
73 {
74  BESDEBUG(HDF5_NAME, prolog << "Cleaning HDF5 module " << modname << endl);
75 
76  BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
77  if (rh) delete rh;
78 
79  BESContainerStorageList::TheList()->deref_persistence(HDF5_CATALOG);
80 
81  BESCatalogList::TheCatalogList()->deref_catalog(HDF5_CATALOG);
82 
83  BESDEBUG(HDF5_NAME, prolog << "Done Cleaning HDF5 module " << modname << endl);
84 }
85 
92 void HDF5Module::dump(ostream & strm) const
93 {
94  strm << BESIndent::LMarg << "HDF5Module::dump - (" << (void *) this << ")" << endl;
95 }
96 
97 extern "C" {
98 BESAbstractModule *maker()
99 {
100  return new HDF5Module;
101 }
102 }
The starting and ending fuctions for the HDF5 OPeNDAP handler via BES.
include the entry functions to execute the handlers
Catalogs from a directory structure.
virtual bool add_catalog(BESCatalog *catalog)
adds the specified catalog to the list
static BESCatalogList * TheCatalogList()
Get the singleton BESCatalogList instance.
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
virtual bool deref_persistence(const std::string &persist_name)
dereference a persistent store in the list.
provides persistent storage for data storage information represented by a container.
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:141
implementation of BESContainerStorage that represents a data within a catalog repository
virtual bool add_handler(const std::string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual BESRequestHandler * remove_handler(const std::string &handler_name)
remove and return the specified request handler
Represents a specific data type request handler.
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition: HDF5Module.cc:92