bes  Updated for version 3.17.4
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,
67  BESXMLShowCommand::CommandBuilder );
68  BESXMLCommand::add_command( CONFIG_RESPONSE_STR,
69  BESXMLShowCommand::CommandBuilder );
70 #endif
71  BESXMLCommand::add_command( VERS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
72  BESXMLCommand::add_command( STATUS_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
73  BESXMLCommand::add_command( SERVICE_RESPONSE_STR, BESXMLShowCommand::CommandBuilder);
74  BESXMLCommand::add_command( SET_CONTEXT_STR, BESXMLSetContextCommand::CommandBuilder);
75  BESXMLCommand::add_command( SETCONTAINER_STR, BESXMLSetContainerCommand::CommandBuilder);
76  BESXMLCommand::add_command( DEFINE_RESPONSE_STR, BESXMLDefineCommand::CommandBuilder);
77  BESXMLCommand::add_command( GET_RESPONSE, BESXMLGetCommand::CommandBuilder);
78  BESXMLCommand::add_command( DELETE_CONTAINER_STR, BESXMLDeleteContainerCommand::CommandBuilder);
79  BESXMLCommand::add_command( DELETE_CONTAINERS_STR, BESXMLDeleteContainersCommand::CommandBuilder);
80  BESXMLCommand::add_command( DELETE_DEFINITION_STR, BESXMLDeleteDefinitionCommand::CommandBuilder);
81  BESXMLCommand::add_command( DELETE_DEFINITIONS_STR, BESXMLDeleteDefinitionsCommand::CommandBuilder);
82 
83  BESDEBUG("besxml", "Done Initializing default commands:" << endl);
84 
85  return 0;
86 }
87 
92 {
93  BESDEBUG("besxml", "Removing default commands:" << endl);
94 
95  BESXMLCommand::del_command( GET_RESPONSE);
96  BESXMLCommand::del_command( SHOW_CONTEXT_STR);
97  BESXMLCommand::del_command( SHOWDEFS_RESPONSE_STR);
98  BESXMLCommand::del_command( SHOWCONTAINERS_RESPONSE_STR);
99  BESXMLCommand::del_command( HELP_RESPONSE_STR);
100 #ifdef BES_DEVELOPER
101  BESXMLCommand::del_command( PROCESS_RESPONSE_STR );
102  BESXMLCommand::del_command( CONFIG_RESPONSE_STR );
103 #endif
104  BESXMLCommand::del_command( VERS_RESPONSE_STR);
105  BESXMLCommand::del_command( STATUS_RESPONSE_STR);
106  BESXMLCommand::del_command( SET_CONTEXT_STR);
107  BESXMLCommand::del_command( SETCONTAINER_STR);
108  BESXMLCommand::del_command( DEFINE_RESPONSE_STR);
109  BESXMLCommand::del_command( DELETE_CONTAINER_STR);
110  BESXMLCommand::del_command( DELETE_CONTAINERS_STR);
111  BESXMLCommand::del_command( DELETE_DEFINITION_STR);
112 
113  BESDEBUG("besxml", "Done Removing default commands:" << endl);
114 
115  return true;
116 }
117 
static bool del_command(const string &cmd_str)
Deletes the command called cmd_str from the list of possible commands.
static void add_command(const string &cmd_str, p_xmlcmd_builder cmd)
Add a command to the possible commands allowed by this BES.
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.