OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
BESXMLShowErrorCommand.cc
Go to the documentation of this file.
1 // BESXMLShowErrorCommand.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 
33 #include "BESXMLShowErrorCommand.h"
34 #include "BESXMLUtils.h"
35 #include "BESUtil.h"
36 #include "BESResponseNames.h"
37 #include "BESDataNames.h"
38 #include "BESSyntaxUserError.h"
39 #include "BESDebug.h"
40 
42  : BESXMLCommand( base_dhi )
43 {
44 }
45 
59 void
61 {
62  string etype ;
63  string value ;
64  string action ;
65  map<string, string> props ;
66  BESXMLUtils::GetNodeInfo( node, action, value, props ) ;
67  if( action != SHOW_ERROR_STR )
68  {
69  string err = "The specified command " + action
70  + " is not a show error command" ;
71  throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
72  }
73 
75 
76  etype = props["type"] ;
77  if( etype.empty() )
78  {
79  string err = action + " command: error type property missing" ;
80  throw BESSyntaxUserError( err, __FILE__, __LINE__ ) ;
81  }
82  // test the error type number in the response handler
83  _dhi.data[SHOW_ERROR_TYPE] = etype ;
84  _str_cmd = (string)"show error " + etype + ";" ;
85 
86  // now that we've set the action, go get the response handler for the
87  // action
89 }
90 
97 void
98 BESXMLShowErrorCommand::dump( ostream &strm ) const
99 {
100  strm << BESIndent::LMarg << "BESXMLShowErrorCommand::dump - ("
101  << (void *)this << ")" << endl ;
103  BESXMLCommand::dump( strm ) ;
105 }
106 
109 {
110  return new BESXMLShowErrorCommand( base_dhi ) ;
111 }
112 
virtual void dump(ostream &strm) const
dumps information about this object
static void GetNodeInfo(xmlNode *node, string &name, string &value, map< string, string > &props)
get the name, value if any, and any properties for the specified node
Definition: BESXMLUtils.cc:105
BESDataHandlerInterface _dhi
Definition: BESXMLCommand.h:57
#define SHOW_ERROR
static void Indent()
Definition: BESIndent.cc:38
error thrown if there is a user syntax error in the request or any other user error ...
virtual void dump(ostream &strm) const
dumps information about this object
virtual void set_response()
The request has been parsed, use the command action name to set the response handler.
static ostream & LMarg(ostream &strm)
Definition: BESIndent.cc:73
#define SHOW_ERROR_STR
BESXMLShowErrorCommand(const BESDataHandlerInterface &base_dhi)
virtual void parse_request(xmlNode *node)
parse a set context command.
static BESXMLCommand * CommandBuilder(const BESDataHandlerInterface &base_dhi)
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.
static void UnIndent()
Definition: BESIndent.cc:44
string action
the response object requested, e.g.
#define SHOW_ERROR_TYPE
Definition: BESDataNames.h:74