bes  Updated for version 3.19.1
BESXMLDefaultCommands.cc
1 // BESXMLDefaultCommands.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 <iostream>
34 
35 using std::endl;
36 
37 #include "BESXMLDefaultCommands.h"
38 
39 #include "BESResponseNames.h"
40 
41 #include "BESDebug.h"
42 
43 #include "BESXMLShowCommand.h"
44 #include "BESXMLShowErrorCommand.h"
45 #include "BESXMLSetContextCommand.h"
46 #include "BESXMLSetContainerCommand.h"
47 #include "BESXMLDefineCommand.h"
48 #include "BESXMLGetCommand.h"
49 #include "BESXMLDeleteContainerCommand.h"
50 #include "BESXMLDeleteContainersCommand.h"
51 #include "BESXMLDeleteDefinitionCommand.h"
52 #include "BESXMLDeleteDefinitionsCommand.h"
53 
57 {
58  BESDEBUG("besxml", "Initializing default commands:" << endl);
59 
60  BESXMLCommand::add_command( SHOW_CONTEXT_STR, BESXMLShowCommand::CommandBuilder);
61  BESXMLCommand::add_command( SHOWDEFS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
62  BESXMLCommand::add_command( SHOWCONTAINERS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
63  BESXMLCommand::add_command( SHOW_ERROR_STR, BESXMLShowErrorCommand::CommandBuilder);
64  BESXMLCommand::add_command( HELP_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
65 #ifdef BES_DEVELOPER
66  BESXMLCommand::add_command( PROCESS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder );
67  BESXMLCommand::add_command( CONFIG_RESPONSE_STR, BESXMLShowCommand::CommandBuilder );
68 #endif
69  BESXMLCommand::add_command( VERS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
70  BESXMLCommand::add_command( STATUS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
71  BESXMLCommand::add_command( SERVICE_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
72 
73  BESXMLCommand::add_command( SET_CONTEXT_STR, BESXMLSetContextCommand::CommandBuilder);
74 
75  BESXMLCommand::add_command( SETCONTAINER_STR, BESXMLSetContainerCommand::CommandBuilder);
76 
77  BESXMLCommand::add_command( DEFINE_RESPONSE_STR, BESXMLDefineCommand::CommandBuilder);
78 
79  BESXMLCommand::add_command( GET_RESPONSE, BESXMLGetCommand::CommandBuilder);
80 
81  BESXMLCommand::add_command( DELETE_CONTAINER_STR, BESXMLDeleteContainerCommand::CommandBuilder);
82  BESXMLCommand::add_command( DELETE_CONTAINERS_STR, BESXMLDeleteContainersCommand::CommandBuilder);
83 
84  BESXMLCommand::add_command( DELETE_DEFINITION_STR, BESXMLDeleteDefinitionCommand::CommandBuilder);
85  BESXMLCommand::add_command( DELETE_DEFINITIONS_STR, BESXMLDeleteDefinitionsCommand::CommandBuilder);
86 
87  BESDEBUG("besxml", "Done Initializing default commands:" << endl);
88 
89  return 0;
90 }
91 
96 {
97  BESDEBUG("besxml", "Removing default commands:" << endl);
98 
99  BESXMLCommand::del_command( GET_RESPONSE);
100  BESXMLCommand::del_command( SHOW_CONTEXT_STR);
101  BESXMLCommand::del_command( SHOWDEFS_RESPONSE_STR);
102  BESXMLCommand::del_command( SHOWCONTAINERS_RESPONSE_STR);
103  BESXMLCommand::del_command( HELP_RESPONSE_STR);
104 #ifdef BES_DEVELOPER
105  BESXMLCommand::del_command( PROCESS_RESPONSE_STR );
106  BESXMLCommand::del_command( CONFIG_RESPONSE_STR );
107 #endif
108  BESXMLCommand::del_command( VERS_RESPONSE_STR);
109  BESXMLCommand::del_command( STATUS_RESPONSE_STR);
110  BESXMLCommand::del_command( SET_CONTEXT_STR);
111  BESXMLCommand::del_command( SETCONTAINER_STR);
112  BESXMLCommand::del_command( DEFINE_RESPONSE_STR);
113  BESXMLCommand::del_command( DELETE_CONTAINER_STR);
114  BESXMLCommand::del_command( DELETE_CONTAINERS_STR);
115  BESXMLCommand::del_command( DELETE_DEFINITION_STR);
116 
117  BESDEBUG("besxml", "Done Removing default commands:" << endl);
118 
119  return true;
120 }
121 
static int terminate(void)
Removes the default set of BES XML commands from the list of possible commands.
static int initialize(int argc, char **argv)
Loads the default set of BES XML commands.
static bool del_command(const std::string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const std::string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.