-
Notifications
You must be signed in to change notification settings - Fork 2
/
NCModule.cc
106 lines (83 loc) · 3.25 KB
/
NCModule.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// NCModule.cc
// This file is part of bes, A C++ back-end server implementation framework
// for the OPeNDAP Data Access Protocol.
// Copyright (c) 2004,2005 University Corporation for Atmospheric Research
// Author: Patrick West <pwest@ucar.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// You can contact University Corporation for Atmospheric Research at
// 3080 Center Green Drive, Boulder, CO 80301
// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
// Please read the full copyright statement in the file COPYRIGHT_UCAR.
//
// Authors:
// pwest Patrick West <pwest@ucar.edu>
#include <iostream>
#include <BESRequestHandlerList.h>
#include <BESDapService.h>
#include <BESContainerStorageList.h>
#include <BESContainerStorageCatalog.h>
#include <BESCatalogDirectory.h>
#include <BESCatalogList.h>
#include <BESDebug.h>
#include "NCModule.h"
#include "NCRequestHandler.h"
using std::endl;
#define NC_CATALOG "catalog"
void NCModule::initialize(const string & modname)
{
BESDEBUG("nc", "Initializing NC module " << modname << endl);
BESRequestHandler *handler = new NCRequestHandler(modname);
BESRequestHandlerList::TheList()->add_handler(modname, handler);
BESDapService::handle_dap_service(modname);
if (!BESCatalogList::TheCatalogList()->ref_catalog( NC_CATALOG)) {
BESCatalogList::TheCatalogList()->add_catalog(new BESCatalogDirectory( NC_CATALOG));
}
else {
BESDEBUG("nc", " catalog already exists, skipping" << endl);
}
if (!BESContainerStorageList::TheList()->ref_persistence( NC_CATALOG)) {
BESContainerStorageList::TheList()->add_persistence(new BESContainerStorageCatalog( NC_CATALOG));
}
else {
BESDEBUG("nc", " storage already exists, skipping" << endl);
}
BESDebug::Register("nc");
BESDEBUG("nc", "Done Initializing NC module " << modname << endl);
}
void NCModule::terminate(const string & modname)
{
BESDEBUG("nc", "Cleaning NC module " << modname << endl);
BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
if (rh) delete rh;
BESContainerStorageList::TheList()->deref_persistence( NC_CATALOG);
BESCatalogList::TheCatalogList()->deref_catalog( NC_CATALOG);
BESDEBUG("nc", "Done Cleaning NC module " << modname << endl);
}
/** @brief dumps information about this object
*
* Displays the pointer value of this instance
*
* @param strm C++ i/o stream to dump the information to
*/
void NCModule::dump(ostream & strm) const
{
strm << BESIndent::LMarg << "NCModule::dump - (" << (void *) this << ")" << endl;
}
extern "C" BESAbstractModule * maker()
{
return new NCModule;
}