bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
FFModule.cc
1// FFModule.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
34using std::endl;
35using std::ostream;
36using std::string;
37
38#include <BESRequestHandlerList.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
46#include "FFModule.h"
47#include "FFRequestHandler.h"
48
49#define FF_CATALOG "catalog"
50
51void FFModule::initialize(const string &modname)
52{
53 BESDEBUG("ff", "Initializing FF module " << modname << endl);
54
55 BESRequestHandler *handler = new FFRequestHandler(modname);
56 BESRequestHandlerList::TheList()->add_handler(modname, handler);
57
59
60 if (!BESCatalogList::TheCatalogList()->ref_catalog(FF_CATALOG)) {
61 BESCatalogList::TheCatalogList()->add_catalog(new BESCatalogDirectory(FF_CATALOG));
62 }
63 else {
64 BESDEBUG("ff", " catalog already exists, skipping" << endl);
65 }
66
67 if (!BESContainerStorageList::TheList()->ref_persistence(FF_CATALOG)) {
68 BESContainerStorageList::TheList()->add_persistence(new BESFileContainerStorage(FF_CATALOG));
69 }
70 else {
71 BESDEBUG("ff", " storage already exists, skipping" << endl);
72 }
73
75
76 BESDEBUG("ff", "Done Initializing FF module " << modname << endl);
77}
78
79void FFModule::terminate(const string &modname)
80{
81 BESDEBUG("ff", "Cleaning FF module " << modname << endl);
82
83 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
84 if (rh) delete rh;
85
86 BESContainerStorageList::TheList()->deref_persistence( FF_CATALOG);
87
88 BESCatalogList::TheCatalogList()->deref_catalog( FF_CATALOG);
89
90 BESDEBUG("ff", "Done Cleaning FF module " << modname << endl);
91}
92
99void FFModule::dump(ostream &strm) const
100{
101 strm << BESIndent::LMarg << "FFModule::dump - (" << (void *) this << ")" << endl;
102}
103
104extern "C" {
105BESAbstractModule *maker()
106{
107 return new FFModule;
108}
109}
110
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
virtual void dump(std::ostream &strm) const
dumps information about this object
Definition FFModule.cc:99