OPeNDAP Hyrax Back End Server (BES)
Updated for version 3.8.3
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BESDapModule.cc
Go to the documentation of this file.
1
// BESDapModule.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-2009 University Corporation for Atmospheric Research
7
// Author: Patrick West <pwest@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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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
34
using
std::endl ;
35
36
#include "
BESDapModule.h
"
37
38
#include "
BESDapRequestHandler.h
"
39
#include "
BESRequestHandlerList.h
"
40
41
#include "
BESDapNames.h
"
42
#include "
BESResponseHandlerList.h
"
43
44
#include "
BESDASResponseHandler.h
"
45
#include "
BESDDSResponseHandler.h
"
46
#include "
BESDataResponseHandler.h
"
47
#include "
BESDDXResponseHandler.h
"
48
#include "
BESDataDDXResponseHandler.h
"
49
50
#include "
BESCatalogResponseHandler.h
"
51
52
#include "
BESServiceRegistry.h
"
53
54
#include "
BESDapTransmit.h
"
55
#include "
BESTransmitter.h
"
56
#include "
BESReturnManager.h
"
57
#include "
BESTransmitterNames.h
"
58
59
#include "
BESDebug.h
"
60
#include "
BESInternalFatalError.h
"
61
#include "
BESExceptionManager.h
"
62
#include "
BESDapError.h
"
63
64
void
65
BESDapModule::initialize
(
const
string
&modname )
66
{
67
BESDEBUG
(
"dap"
,
"Initializing DAP Modules:"
<< endl ) ;
68
69
BESDEBUG
(
"dap"
,
" adding "
<< modname <<
" request handler"
<< endl ) ;
70
BESRequestHandlerList::TheList
()->
add_handler
( modname,
new
BESDapRequestHandler
( modname ) ) ;
71
72
BESDEBUG
(
"dap"
,
" adding "
<<
DAS_RESPONSE
<<
" response handler"
<< endl ) ;
73
BESResponseHandlerList::TheList
()->
add_handler
(
DAS_RESPONSE
,
BESDASResponseHandler::DASResponseBuilder
) ;
74
75
BESDEBUG
(
"dap"
,
" adding "
<<
DDS_RESPONSE
<<
" response handler"
<< endl ) ;
76
BESResponseHandlerList::TheList
()->
add_handler
(
DDS_RESPONSE
,
BESDDSResponseHandler::DDSResponseBuilder
) ;
77
78
BESDEBUG
(
"dap"
,
" adding "
<<
DDX_RESPONSE
<<
" response handler"
<< endl ) ;
79
BESResponseHandlerList::TheList
()->
add_handler
(
DDX_RESPONSE
,
BESDDXResponseHandler::DDXResponseBuilder
) ;
80
81
BESDEBUG
(
"dap"
,
" adding "
<<
DATA_RESPONSE
<<
" response handler"
<< endl ) ;
82
BESResponseHandlerList::TheList
()->
add_handler
(
DATA_RESPONSE
,
BESDataResponseHandler::DataResponseBuilder
) ;
83
84
BESDEBUG
(
"dap"
,
" adding "
<<
DATADDX_RESPONSE
<<
" response handler"
<< endl ) ;
85
BESResponseHandlerList::TheList
()->
add_handler
(
DATADDX_RESPONSE
,
BESDataDDXResponseHandler::DataDDXResponseBuilder
) ;
86
87
BESDEBUG
(
"dap"
,
" adding "
<<
CATALOG_RESPONSE
<<
" response handler"
<< endl ) ;
88
BESResponseHandlerList::TheList
()->
add_handler
(
CATALOG_RESPONSE
,
BESCatalogResponseHandler::CatalogResponseBuilder
) ;
89
90
BESDEBUG
(
"dap"
,
"Adding "
<<
OPENDAP_SERVICE
<<
" services:"
<< endl ) ;
91
BESServiceRegistry
*registry =
BESServiceRegistry::TheRegistry
() ;
92
registry->
add_service
(
OPENDAP_SERVICE
) ;
93
registry->
add_to_service
(
OPENDAP_SERVICE
,
DAS_SERVICE
,
94
DAS_DESCRIPT
,
DAP2_FORMAT
) ;
95
registry->
add_to_service
(
OPENDAP_SERVICE
,
DDS_SERVICE
,
96
DDS_DESCRIPT
,
DAP2_FORMAT
) ;
97
registry->
add_to_service
(
OPENDAP_SERVICE
,
DDX_SERVICE
,
98
DDX_DESCRIPT
,
DAP2_FORMAT
) ;
99
registry->
add_to_service
(
OPENDAP_SERVICE
,
DATA_SERVICE
,
100
DATA_DESCRIPT
,
DAP2_FORMAT
) ;
101
registry->
add_to_service
(
OPENDAP_SERVICE
,
DATADDX_SERVICE
,
102
DATADDX_DESCRIPT
,
DAP2_FORMAT
) ;
103
104
BESDEBUG
(
"dap"
,
"Initializing DAP Basic Transmitters:"
<< endl ) ;
105
BESReturnManager::TheManager
()->
add_transmitter
(
DAP2_FORMAT
,
106
new
BESDapTransmit
( ) ) ;
107
108
BESDEBUG
(
"dap"
,
" adding dap exception handler"
<< endl ) ;
109
BESExceptionManager::TheEHM
()->
add_ehm_callback
(
BESDapError::handleException
) ;
110
111
BESDEBUG
(
"dap"
,
" adding dap debug context"
<< endl ) ;
112
BESDebug::Register
(
"dap"
) ;
113
114
BESDEBUG
(
"dap"
,
"Done Initializing DAP Modules:"
<< endl ) ;
115
}
116
117
void
118
BESDapModule::terminate
(
const
string
&modname )
119
{
120
BESDEBUG
(
"dap"
,
"Removing DAP Modules:"
<< endl ) ;
121
122
BESDEBUG
(
"dap"
,
" removing dap Response handlers "
<< modname << endl ) ;
123
BESResponseHandlerList::TheList
()->
remove_handler
(
DAS_RESPONSE
) ;
124
BESResponseHandlerList::TheList
()->
remove_handler
(
DDS_RESPONSE
) ;
125
BESResponseHandlerList::TheList
()->
remove_handler
(
DDX_RESPONSE
) ;
126
BESResponseHandlerList::TheList
()->
remove_handler
(
DATA_RESPONSE
) ;
127
BESResponseHandlerList::TheList
()->
remove_handler
(
DATADDX_RESPONSE
) ;
128
BESResponseHandlerList::TheList
()->
remove_handler
(
CATALOG_RESPONSE
) ;
129
130
BESDEBUG
(
"dap"
,
" removing "
<<
OPENDAP_SERVICE
<<
" services"
<< endl ) ;
131
BESServiceRegistry::TheRegistry
()->
remove_service
(
OPENDAP_SERVICE
) ;
132
133
BESDEBUG
(
"dap"
,
" removing dap Request Handler "
<< modname << endl ) ;
134
BESRequestHandler
*rh =
BESRequestHandlerList::TheList
()->
remove_handler
( modname ) ;
135
if
( rh )
delete
rh ;
136
137
BESDEBUG
(
"dap"
,
"Done Removing DAP Modules:"
<< endl ) ;
138
}
139
146
void
147
BESDapModule::dump
( ostream &strm )
const
148
{
149
strm <<
BESIndent::LMarg
<<
"BESDapModule::dump - ("
150
<< (
void
*)
this
<<
")"
<< endl ;
151
}
152
153
extern
"C"
154
{
155
BESAbstractModule
*
maker
()
156
{
157
return
new
BESDapModule
;
158
}
159
}
160
dispatch
BESDapModule.cc
Generated by
1.8.4