bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESXMLDeleteContainerCommand.cc
1// BESXMLDeleteContainerCommand.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., 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#include "config.h"
34
35#include "BESXMLDeleteContainerCommand.h"
36#include "BESContainerStorageList.h"
37#include "BESDataNames.h"
38#include "BESResponseNames.h"
39#include "BESXMLUtils.h"
40#include "BESUtil.h"
41#include "BESSyntaxUserError.h"
42#include "BESDebug.h"
43
44using std::endl;
45using std::ostream;
46using std::string;
47using std::map;
48
49BESXMLDeleteContainerCommand::BESXMLDeleteContainerCommand(const BESDataHandlerInterface &base_dhi) :
50 BESXMLCommand(base_dhi)
51{
52}
53
61{
62 string name;
63 string value;
64 map<string, string> props;
65 BESXMLUtils::GetNodeInfo(node, name, value, props);
66 if (name != DELETE_CONTAINER_STR) {
67 string err = "The specified command " + name + " is not a delete container command";
68 throw BESSyntaxUserError(err, __FILE__, __LINE__);
69 }
70
71 string container_name = props["name"];
72 if (container_name.empty()) {
73 string err = name + " command: Must specify the container to delete";
74 throw BESSyntaxUserError(err, __FILE__, __LINE__);
75 }
76 d_xmlcmd_dhi.data[CONTAINER_NAME] = container_name;
77
78 // optional property
79 string storage = props["space"];
80 d_xmlcmd_dhi.data[STORE_NAME] = storage;
81 if (d_xmlcmd_dhi.data[STORE_NAME].empty()) {
82 d_xmlcmd_dhi.data[STORE_NAME] = CATALOG /* DEFAULT jhrg 12/27/18 */;
83 storage = CATALOG /* DEFAULT */;
84 }
85
86 d_xmlcmd_dhi.action = DELETE_CONTAINER;
87
88 d_cmd_log_info = (string) "delete container " + container_name + " from " + storage + ";";
89
90 // now that we've set the action, go get the response handler for the
91 // action
93}
94
101void BESXMLDeleteContainerCommand::dump(ostream &strm) const
102{
103 strm << BESIndent::LMarg << "BESXMLDeleteContainerCommand::dump - (" << (void *) this << ")" << endl;
104 BESIndent::Indent();
106 BESIndent::UnIndent();
107}
108
110BESXMLDeleteContainerCommand::CommandBuilder(const BESDataHandlerInterface &base_dhi)
111{
112 return new BESXMLDeleteContainerCommand(base_dhi);
113}
114
Structure storing information used by the BES to handle the request.
error thrown if there is a user syntax error in the request or any other user error
Base class for the BES's commands.
virtual void dump(std::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.
std::string d_cmd_log_info
Used only for the log.
virtual void dump(std::ostream &strm) const
dumps information about this object
virtual void parse_request(xmlNode *node)
parse a show command. No properties or children elements
static void GetNodeInfo(xmlNode *node, std::string &name, std::string &value, std::map< std::string, std::string > &props)
get the name, value if any, and any properties for the specified node