OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FitsModule.cc
Go to the documentation of this file.
1 // FitsModule.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.edu> and Jose Garcia <jgarcia@ucar.edu>
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 Atmostpheric 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 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #include <iostream>
34 
35 using std::endl;
36 
37 #include "FitsModule.h"
38 #include <BESRequestHandlerList.h>
39 #include "FitsRequestHandler.h"
40 #include <BESDapService.h>
41 #include <BESDebug.h>
44 #include <BESCatalogDirectory.h>
45 #include <BESCatalogList.h>
46 //#include "FitsResponseNames.h"
47 
48 #define FITS_CATALOG "catalog"
49 
50 void FitsModule::initialize(const string &modname)
51 {
52  BESDEBUG("fits", "Initializing Fits module " << modname << endl);
53 
55 
57 
58  if (!BESCatalogList::TheCatalogList()->ref_catalog(FITS_CATALOG)) {
60  }
61  else {
62  BESDEBUG("fits", " catalog already exists, skipping" << endl);
63  }
64 
65  if (!BESContainerStorageList::TheList()->ref_persistence(FITS_CATALOG)) {
68  }
69  else {
70  BESDEBUG("fits", " storage already exists, skipping" << endl);
71  }
72 
73  BESDebug::Register("fits");
74 
75  BESDEBUG("fits", "Done Initializing Fits module " << modname << endl);
76 }
77 
78 void FitsModule::terminate(const string &modname)
79 {
80  BESDEBUG("fits", "Cleaning Fits module " << modname << endl);
81 
83  if (rh) delete rh;
84 
86 
88 
89  BESDEBUG("fits", "Done Cleaning Fits module " << modname << endl);
90 }
91 
98 void FitsModule::dump(ostream &strm) const
99 {
100  strm << BESIndent::LMarg << "FitsModule::dump - (" << (void *) this << ")" << endl;
101 }
102 
103 extern "C" {
105 {
106  return new FitsModule;
107 }
108 }
109 
virtual bool add_handler(const string &handler_name, BESRequestHandler *handler)
add a request handler to the list of registered handlers for this server
virtual bool add_catalog(BESCatalog *catalog)
adds the speciifed catalog to the list
virtual bool add_persistence(BESContainerStorage *p)
Add a persistent store to the list.
implementation of BESContainerStorage that represents a data within a catalog repository ...
virtual void terminate(const string &modname)
Definition: FitsModule.cc:78
BESAbstractModule * maker()
Definition: FitsModule.cc:104
virtual void dump(ostream &strm) const
dumps information about this object
Definition: FitsModule.cc:98
#define FITS_CATALOG
Definition: FitsModule.cc:48
virtual bool deref_catalog(const string &catalog_name)
de-reference the specified catalog and remove from list if no longer referenced
builds catalogs from a directory structure
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
virtual bool deref_persistence(const string &persist_name)
dereference a persistent store in the list.
Represents a specific data type request handler.
static BESRequestHandlerList * TheList()
static BESContainerStorageList * TheList()
virtual void initialize(const string &modname)
Definition: FitsModule.cc:50
#define BESDEBUG(x, y)
macro used to send debug information to the debug stream
Definition: BESDebug.h:64
static BESCatalogList * TheCatalogList()
returns the singleton BESCatalogList instance.
static void Register(const string &flagName)
register the specified debug flag
Definition: BESDebug.h:138
static void handle_dap_service(const string &handler)
static function to register a handler to handle the dap services
virtual BESRequestHandler * remove_handler(const string &handler_name)
remove and return the specified request handler