bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
NgapModule.cc
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of ngap_module, A C++ module that can be loaded in to
4// the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
5
6// Copyright (c) 2020 OPeNDAP, Inc.
7// Author: Nathan Potter <ndp@opendap.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 OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25
26#include "config.h"
27
28#include <iostream>
29#include <vector>
30#include <string>
31
32#include <BESRequestHandlerList.h>
33#include <BESDebug.h>
34#include <BESContainerStorageList.h>
35
36#include "NgapModule.h"
37#include "NgapRequestHandler.h"
38#include "NgapOwnedContainerStorage.h"
39
40using namespace std;
41using namespace ngap;
42
43void NgapModule::initialize(const string &modname)
44{
45 BESDEBUG(modname, "Initializing NGAP Module " << modname << endl);
46
47 BESDEBUG(modname, " adding " << modname << " request handler" << endl);
48 BESRequestHandlerList::TheList()->add_handler(modname, new NgapRequestHandler(modname));
49
50 BESDEBUG(modname, " adding OWNED " << modname << " container storage" << endl);
51 // FIXME Do NOT merge this code as is since it breaks the handler needed for NGAP.
52 // This is a POC modification to test access to data using DMR++ documents that
53 // OPeNDAP 'owns.' jhrg 5/17/24
54 BESContainerStorageList::TheList()->add_persistence(new NgapOwnedContainerStorage(modname));
55
56 BESDEBUG(modname, " adding NGAP debug context" << endl);
57 BESDebug::Register(modname);
58
59 BESDEBUG(modname, "Done Initializing NGAP Module " << modname << endl);
60}
61
62void NgapModule::terminate(const string &modname)
63{
64 BESDEBUG(modname, "Cleaning NGAP module " << modname << endl);
65
66 BESDEBUG(modname, " removing " << modname << " request handler" << endl);
67 BESRequestHandler *rh = BESRequestHandlerList::TheList()->remove_handler(modname);
68 delete rh;
69
70 BESContainerStorageList::TheList()->deref_persistence(modname);
71
72 BESDEBUG(modname, "Done Cleaning NGAP module " << modname << endl);
73}
74
75void NgapModule::dump(ostream &strm) const
76{
77 strm << BESIndent::LMarg << "NgapModule::dump - (" << (void *) this << ")" << endl;
78}
79
80extern "C"
81BESAbstractModule *maker()
82{
83 return new NgapModule;
84}
85
static void Register(const std::string &flagName)
register the specified debug flag
Definition BESDebug.h:126
void dump(std::ostream &strm) const override
dump the contents of this object to the specified ostream
Definition NgapModule.cc:75