OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESDataHandlerInterface.cc
Go to the documentation of this file.
1 // BESDataHandlerInterface.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> 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., 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 // jgarcia Jose Garcia <jgarcia@ucar.edu>
32 
34 #include "BESContainer.h"
35 #include "BESResponseHandler.h"
36 #include "BESInfo.h"
37 #include "BESIndent.h"
38 
49 {
50  this->data = copy_from.data;
51  this->output_stream = copy_from.output_stream;
52  this->transmit_protocol = copy_from.transmit_protocol;
53 }
54 
63 {
64  if (response_handler) {
65  delete response_handler;
66  }
67  response_handler = 0;
68 }
69 
79 {
80  BESResponseObject *response = 0;
81 
82  if (response_handler) {
84  }
85  return response;
86 }
87 
95 void BESDataHandlerInterface::dump(ostream &strm) const
96 {
97  strm << BESIndent::LMarg << "BESDataHandlerInterface::dump" << endl;
99  if (response_handler) {
100  strm << BESIndent::LMarg << "response handler:" << endl;
102  response_handler->dump(strm);
104  }
105  else {
106  strm << BESIndent::LMarg << "response handler: not set" << endl;
107  }
108 
109  if (container) {
110  strm << BESIndent::LMarg << "current container:" << endl;
112  container->dump(strm);
114  }
115  else {
116  strm << BESIndent::LMarg << "current container: not set" << endl;
117  }
118 
119  if (containers.size()) {
120  strm << BESIndent::LMarg << "container list:" << endl;
122  list<BESContainer *>::const_iterator i = containers.begin();
123  list<BESContainer *>::const_iterator ie = containers.end();
124  for (; i != ie; i++) {
125  (*i)->dump(strm);
126  }
128  }
129  else {
130  strm << BESIndent::LMarg << "container list: empty" << endl;
131  }
132 
133  strm << BESIndent::LMarg << "action: " << action << endl;
134  strm << BESIndent::LMarg << "action name: " << action_name << endl;
135  strm << BESIndent::LMarg << "transmit protocol: " << transmit_protocol << endl;
136  if (data.size()) {
137  strm << BESIndent::LMarg << "data:" << endl;
139  data_citer i = data.begin();
140  data_citer ie = data.end();
141  for (; i != ie; i++) {
142  strm << BESIndent::LMarg << (*i).first << ": " << (*i).second << endl;
143  }
145  }
146  else {
147  strm << BESIndent::LMarg << "data: none" << endl;
148  }
149 
150  if (error_info) {
151  strm << BESIndent::LMarg << "error info:" << endl;
153  error_info->dump(strm);
155  }
156  else {
157  strm << BESIndent::LMarg << "error info: null" << endl;
158  }
160 }
161 
void clean()
clean up any information created within this data handler interface
void dump(ostream &strm) const
dumps information about this object
map< string, string >::const_iterator data_citer
list< BESContainer * > containers
virtual void dump(ostream &strm) const
Displays debug information about this object.
Definition: BESInfo.cc:299
static void Indent()
Definition: BESIndent.cc:38
void make_copy(const BESDataHandlerInterface &copy_from)
make a copy of only some data from specified object
virtual BESResponseObject * get_response_object()
return the current response object
BESResponseHandler * response_handler
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
BESResponseObject * get_response_object()
returns the response object using the response handler
string transmit_protocol
request protocol, such as HTTP
virtual void dump(ostream &strm) const
dumps information about this object
Structure storing information used by the BES to handle the request.
map< string, string > data
the map of string data that will be required for the current request.
virtual void dump(ostream &strm) const
dumps information about this object
Definition: BESContainer.cc:65
BESInfo * error_info
error information object
static void UnIndent()
Definition: BESIndent.cc:44
Abstract base class representing a specific set of information in response to a request to the BES...
string action
the response object requested, e.g.
BESContainer * container
pointer to current container in this interface