OPeNDAP Hyrax Back End Server (BES) Updated for version 3.8.3
BESXMLDefaultCommands.cc
Go to the documentation of this file.
00001 // BESXMLDefaultCommands.cc
00002 
00003 // This file is part of bes, A C++ back-end server implementation framework
00004 // for the OPeNDAP Data Access Protocol.
00005 
00006 // Copyright (c) 2004-2009 University Corporation for Atmospheric Research
00007 // Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
00008 //
00009 // This library is free software; you can redistribute it and/or
00010 // modify it under the terms of the GNU Lesser General Public
00011 // License as published by the Free Software Foundation; either
00012 // version 2.1 of the License, or (at your option) any later version.
00013 // 
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 // 
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // You can contact University Corporation for Atmospheric Research at
00024 // 3080 Center Green Drive, Boulder, CO 80301
00025  
00026 // (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
00027 // Please read the full copyright statement in the file COPYRIGHT_UCAR.
00028 //
00029 // Authors:
00030 //      pwest       Patrick West <pwest@ucar.edu>
00031 //      jgarcia     Jose Garcia <jgarcia@ucar.edu>
00032 
00033 #include <iostream>
00034 
00035 using std::endl ;
00036 
00037 #include "BESXMLDefaultCommands.h"
00038 
00039 #include "BESResponseNames.h"
00040 
00041 #include "BESDebug.h"
00042 
00043 #include "BESXMLShowCommand.h"
00044 #include "BESXMLShowErrorCommand.h"
00045 #include "BESXMLSetContextCommand.h"
00046 #include "BESXMLSetContainerCommand.h"
00047 #include "BESXMLDefineCommand.h"
00048 #include "BESXMLGetCommand.h"
00049 #include "BESXMLDeleteContainerCommand.h"
00050 #include "BESXMLDeleteContainersCommand.h"
00051 #include "BESXMLDeleteDefinitionCommand.h"
00052 #include "BESXMLDeleteDefinitionsCommand.h"
00053 
00056 int
00057 BESXMLDefaultCommands::initialize( int, char** )
00058 {
00059     BESDEBUG( "besxml", "Initializing default commands:" << endl ) ;
00060 
00061     BESXMLCommand *cmd = NULL ;
00062 
00063     BESDEBUG( "besxml", "    adding " << SHOW_CONTEXT_STR
00064                         << " command" << endl ) ;
00065     BESXMLCommand::add_command( SHOW_CONTEXT_STR,
00066                                 BESXMLShowCommand::CommandBuilder ) ;
00067 
00068     BESDEBUG( "besxml", "    adding " << SHOWDEFS_RESPONSE_STR
00069                         << " command" << endl ) ;
00070     BESXMLCommand::add_command( SHOWDEFS_RESPONSE_STR,
00071                                 BESXMLShowCommand::CommandBuilder ) ;
00072 
00073     BESDEBUG( "besxml", "    adding " << SHOWCONTAINERS_RESPONSE_STR
00074                         << " command" << endl) ;
00075     BESXMLCommand::add_command( SHOWCONTAINERS_RESPONSE_STR,
00076                                 BESXMLShowCommand::CommandBuilder ) ;
00077 
00078     BESDEBUG( "besxml", "    adding " << SHOW_ERROR_STR
00079                         << " command" << endl) ;
00080     BESXMLCommand::add_command( SHOW_ERROR_STR,
00081                                 BESXMLShowErrorCommand::CommandBuilder ) ;
00082 
00083     BESDEBUG( "besxml", "    adding " << HELP_RESPONSE_STR
00084                         << " command" << endl) ;
00085     BESXMLCommand::add_command( HELP_RESPONSE_STR,
00086                                 BESXMLShowCommand::CommandBuilder ) ;
00087 
00088 #ifdef BES_DEVELOPER
00089     BESDEBUG( "besxml", "    adding " << PROCESS_RESPONSE_STR
00090                         << " command" << endl) ;
00091     BESXMLCommand::add_command( PROCESS_RESPONSE_STR,
00092                                 BESXMLShowCommand::CommandBuilder ) ;
00093 
00094     BESDEBUG( "besxml", "    adding " << CONFIG_RESPONSE_STR
00095                         << " command" << endl) ;
00096     BESXMLCommand::add_command( CONFIG_RESPONSE_STR,
00097                                 BESXMLShowCommand::CommandBuilder ) ;
00098 #endif
00099 
00100     BESDEBUG( "besxml", "    adding " << VERS_RESPONSE_STR
00101                         << " command" << endl) ;
00102     BESXMLCommand::add_command( VERS_RESPONSE_STR,
00103                                 BESXMLShowCommand::CommandBuilder ) ;
00104 
00105     BESDEBUG( "besxml", "    adding " << STATUS_RESPONSE_STR
00106                         << " command" << endl) ;
00107     BESXMLCommand::add_command( STATUS_RESPONSE_STR,
00108                                 BESXMLShowCommand::CommandBuilder ) ;
00109 
00110     BESDEBUG( "besxml", "    adding " << SERVICE_RESPONSE_STR
00111                         << " command" << endl) ;
00112     BESXMLCommand::add_command( SERVICE_RESPONSE_STR,
00113                                 BESXMLShowCommand::CommandBuilder ) ;
00114 
00115     BESDEBUG( "besxml", "    adding " << SET_CONTEXT_STR
00116                         << " command" << endl ) ;
00117     BESXMLCommand::add_command( SET_CONTEXT_STR,
00118                                 BESXMLSetContextCommand::CommandBuilder ) ;
00119 
00120     BESDEBUG( "besxml", "    adding " << SETCONTAINER_STR
00121                         << " command" << endl ) ;
00122     BESXMLCommand::add_command( SETCONTAINER_STR,
00123                                 BESXMLSetContainerCommand::CommandBuilder);
00124 
00125     BESDEBUG( "besxml", "    adding " << DEFINE_RESPONSE_STR
00126                         << " command" << endl ) ;
00127     BESXMLCommand::add_command( DEFINE_RESPONSE_STR,
00128                                 BESXMLDefineCommand::CommandBuilder ) ;
00129 
00130     BESDEBUG( "besxml", "    adding " << GET_RESPONSE
00131                         << " command" << endl ) ;
00132     BESXMLCommand::add_command( GET_RESPONSE,
00133                                 BESXMLGetCommand::CommandBuilder ) ;
00134 
00135     BESDEBUG( "besxml", "    adding " << DELETE_CONTAINER_STR
00136                         << " command" << endl ) ;
00137     BESXMLCommand::add_command( DELETE_CONTAINER_STR,
00138                                 BESXMLDeleteContainerCommand::CommandBuilder ) ;
00139 
00140     BESDEBUG( "besxml", "    adding " << DELETE_CONTAINERS_STR
00141                         << " command" << endl ) ;
00142     BESXMLCommand::add_command( DELETE_CONTAINERS_STR,
00143                                 BESXMLDeleteContainersCommand::CommandBuilder );
00144 
00145     BESDEBUG( "besxml", "    adding " << DELETE_DEFINITION_STR
00146                         << " command" << endl ) ;
00147     BESXMLCommand::add_command( DELETE_DEFINITION_STR,
00148                                 BESXMLDeleteDefinitionCommand::CommandBuilder );
00149 
00150     BESDEBUG( "besxml", "    adding " << DELETE_DEFINITIONS_STR
00151                         << " command" << endl ) ;
00152     BESXMLCommand::add_command( DELETE_DEFINITIONS_STR,
00153                                 BESXMLDeleteDefinitionsCommand::CommandBuilder);
00154 
00155     BESDEBUG( "besxml", "Done Initializing default commands:" << endl ) ;
00156 
00157     return 0;
00158 }
00159 
00163 int
00164 BESXMLDefaultCommands::terminate( void )
00165 {
00166     BESDEBUG( "besxml", "Removing default commands:" << endl ) ;
00167 
00168     BESXMLCommand::del_command( GET_RESPONSE ) ;
00169     BESXMLCommand::del_command( SHOW_CONTEXT_STR ) ;
00170     BESXMLCommand::del_command( SHOWDEFS_RESPONSE_STR ) ;
00171     BESXMLCommand::del_command( SHOWCONTAINERS_RESPONSE_STR ) ;
00172     BESXMLCommand::del_command( HELP_RESPONSE_STR ) ;
00173 #ifdef BES_DEVELOPER
00174     BESXMLCommand::del_command( PROCESS_RESPONSE_STR ) ;
00175     BESXMLCommand::del_command( CONFIG_RESPONSE_STR ) ;
00176 #endif
00177     BESXMLCommand::del_command( VERS_RESPONSE_STR ) ;
00178     BESXMLCommand::del_command( STATUS_RESPONSE_STR ) ;
00179     BESXMLCommand::del_command( SET_CONTEXT_STR ) ;
00180     BESXMLCommand::del_command( SETCONTAINER_STR ) ;
00181     BESXMLCommand::del_command( DEFINE_RESPONSE_STR ) ;
00182     BESXMLCommand::del_command( DELETE_CONTAINER_STR ) ;
00183     BESXMLCommand::del_command( DELETE_CONTAINERS_STR ) ;
00184     BESXMLCommand::del_command( DELETE_DEFINITION_STR ) ;
00185 
00186     BESDEBUG( "besxml", "Done Removing default commands:" << endl ) ;
00187 
00188     return true;
00189 }
00190