bes  Updated for version 3.17.0
BESInterface.h
1 // BESInterface.h
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> 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 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 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
33 #ifndef BESInterface_h_
34 #define BESInterface_h_ 1
35 
36 #include <list>
37 
38 using std::list;
39 
40 #include "BESDataHandlerInterface.h"
41 
42 #include "BESObj.h"
43 
44 class BESError;
45 class BESTransmitter;
46 
47 typedef bool (*p_bes_init)(BESDataHandlerInterface &dhi);
48 typedef void (*p_bes_end)(BESDataHandlerInterface &dhi);
49 
123 class BESInterface: public BESObj {
124 private:
125  typedef list<p_bes_init>::const_iterator init_citer;
126  typedef list<p_bes_init>::iterator init_iter;
127  static list<p_bes_init> _init_list;
128 
129  typedef list<p_bes_end>::const_iterator end_citer;
130  typedef list<p_bes_end>::iterator end_iter;
131  static list<p_bes_end> _end_list;
132 
133  ostream *_strm;
134  int _timeout_from_keys;
135 
136 protected:
138  BESTransmitter *_transmitter;
139 
140  virtual int exception_manager(BESError &e);
141  virtual void initialize();
142  virtual void validate_data_request();
143 
152  virtual void build_data_request_plan() = 0;
153 
154  virtual void execute_data_request_plan();
155  virtual void invoke_aggregation();
156 
157  virtual int finish(int status);
158  virtual void transmit_data();
159  virtual void log_status();
160  virtual void report_request();
161  virtual void end_request();
162  virtual void clean();
163 
164  BESInterface(ostream *strm);
165  virtual ~BESInterface();
166 public:
167  virtual int execute_request(const string &from);
168  virtual int finish_with_error(int status);
169 
170  virtual void dump(ostream &strm) const;
171 
172  static void add_init_callback(p_bes_init init);
173  static void add_end_callback(p_bes_end end);
174 };
175 
176 #endif // BESInterface_h_
177 
virtual void initialize()
Initialize the BES object.
virtual int exception_manager(BESError &e)
Manage any exceptions thrown during the whole process.
virtual void transmit_data()
Transmit the resulting response object.
Base object for bes objects.
Definition: BESObj.h:52
Abstract exception class for the BES with basic string message.
Definition: BESError.h:56
virtual void report_request()
Report the request and status of the request to BESReporterList::TheList()
Entry point into BES, building responses to given requests.
Definition: BESInterface.h:123
virtual void validate_data_request()
Validate the incoming request information.
virtual void build_data_request_plan()=0
Build the data request plan.
virtual void clean()
Clean up after the request.
virtual void invoke_aggregation()
Aggregate the resulting response object.
Structure storing information used by the BES to handle the request.
virtual void end_request()
End the BES request.
virtual void dump(ostream &strm) const
dumps information about this object
virtual void log_status()
Log the status of the request.
virtual void execute_data_request_plan()
Execute the data request plan.