BESDefaultCommands.cc

Go to the documentation of this file.
00001 // BESDefaultCommands.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,2005 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 "BESDefaultCommands.h"
00038 
00039 #include "BESResponseNames.h"
00040 
00041 #include "BESDebug.h"
00042 
00043 #include "BESGetCommand.h"
00044 #include "BESSetCommand.h"
00045 #include "BESDeleteCommand.h"
00046 #include "BESShowCommand.h"
00047 
00048 #include "BESSetContainerCommand.h"
00049 #include "BESDelContainerCommand.h"
00050 #include "BESDelContainersCommand.h"
00051 
00052 #include "BESDefineCommand.h"
00053 #include "BESDelDefCommand.h"
00054 #include "BESDelDefsCommand.h"
00055 
00056 #include "BESSetContextCommand.h"
00057 
00058 int
00059 BESDefaultCommands::initialize( int, char** )
00060 {
00061     BESDEBUG( "bes", "Initializing default commands:" << endl )
00062 
00063     BESCommand *cmd = NULL ;
00064 
00065     BESDEBUG( "bes", "    adding " << GET_RESPONSE << " command" << endl )
00066     cmd = new BESGetCommand( GET_RESPONSE ) ;
00067     BESCommand::add_command( GET_RESPONSE, cmd ) ;
00068 
00069     BESDEBUG( "bes", "    adding " << SHOW_RESPONSE << " command" << endl )
00070     cmd = new BESShowCommand( SHOW_RESPONSE ) ;
00071     BESCommand::add_command( SHOW_RESPONSE, cmd ) ;
00072 
00073     BESDEBUG( "bes", "    adding " << HELP_RESPONSE << " command" << endl )
00074     BESCommand::add_command( HELP_RESPONSE, BESCommand::TermCommand ) ;
00075 
00076     BESDEBUG( "bes", "    adding " << PROCESS_RESPONSE << " command" << endl )
00077     BESCommand::add_command( PROCESS_RESPONSE, BESCommand::TermCommand ) ;
00078 
00079     BESDEBUG( "bes", "    adding " << KEYS_RESPONSE << " command" << endl )
00080     BESCommand::add_command( KEYS_RESPONSE, BESCommand::TermCommand ) ;
00081 
00082     BESDEBUG( "bes", "    adding " << VERS_RESPONSE << " command" << endl )
00083     BESCommand::add_command( VERS_RESPONSE, BESCommand::TermCommand ) ;
00084 
00085     BESDEBUG( "bes", "    adding " << STATUS_RESPONSE << " command" << endl )
00086     BESCommand::add_command( STATUS_RESPONSE, BESCommand::TermCommand ) ;
00087 
00088     BESDEBUG( "bes", "    adding " << SET_RESPONSE << " command" << endl )
00089     cmd = new BESSetCommand( SET_RESPONSE ) ;
00090     BESCommand::add_command( SET_RESPONSE, cmd ) ;
00091 
00092     BESDEBUG( "bes", "    adding " << DELETE_RESPONSE << " command" << endl )
00093     cmd = new BESDeleteCommand( DELETE_RESPONSE ) ;
00094     BESCommand::add_command( DELETE_RESPONSE, cmd ) ;
00095 
00096     BESDEBUG( "bes", "    adding " << SETCONTAINER << " command" << endl )
00097     cmd = new BESSetContainerCommand( SETCONTAINER ) ;
00098     BESCommand::add_command( SETCONTAINER, cmd ) ;
00099 
00100     BESDEBUG( "bes", "    adding " << SHOWCONTAINERS_RESPONSE << " command" << endl)
00101     BESCommand::add_command( SHOWCONTAINERS_RESPONSE, BESCommand::TermCommand ) ;
00102 
00103     BESDEBUG( "bes", "    adding " << DELETE_CONTAINER << " command" << endl )
00104     cmd = new BESDelContainerCommand( DELETE_CONTAINER ) ;
00105     BESCommand::add_command( DELETE_CONTAINER, cmd ) ;
00106 
00107     BESDEBUG( "bes", "    adding " << DELETE_CONTAINERS << " command" << endl )
00108     cmd = new BESDelContainersCommand( DELETE_CONTAINERS ) ;
00109     BESCommand::add_command( DELETE_CONTAINERS, cmd ) ;
00110 
00111     BESDEBUG( "bes", "    adding " << DEFINE_RESPONSE << " command" << endl )
00112     cmd = new BESDefineCommand( DEFINE_RESPONSE ) ;
00113     BESCommand::add_command( DEFINE_RESPONSE, cmd ) ;
00114 
00115     BESDEBUG( "bes", "    adding " << SHOWDEFS_RESPONSE << " command" << endl )
00116     BESCommand::add_command( SHOWDEFS_RESPONSE, BESCommand::TermCommand ) ;
00117 
00118     BESDEBUG( "bes", "    adding " << DELETE_DEFINITION << " command" << endl )
00119     cmd = new BESDelDefCommand( DELETE_DEFINITION ) ;
00120     BESCommand::add_command( DELETE_DEFINITION, cmd ) ;
00121 
00122     BESDEBUG( "bes", "    adding " << DELETE_DEFINITIONS << " command" << endl )
00123     cmd = new BESDelDefsCommand( DELETE_DEFINITIONS ) ;
00124     BESCommand::add_command( DELETE_DEFINITIONS, cmd ) ;
00125 
00126     BESDEBUG( "bes", "    adding " << SET_CONTEXT << " command" << endl )
00127     cmd = new BESSetContextCommand( SET_CONTEXT ) ;
00128     BESCommand::add_command( SET_CONTEXT, cmd ) ;
00129 
00130     BESDEBUG( "bes", "    adding " << SHOW_CONTEXT << " command" << endl )
00131     BESCommand::add_command( SHOW_CONTEXT, BESCommand::TermCommand ) ;
00132 
00133     BESDEBUG( "bes", "Done Initializing default commands:" << endl )
00134 
00135     return 0;
00136 }
00137 
00138 int
00139 BESDefaultCommands::terminate( void )
00140 {
00141     BESDEBUG( "bes", "Removing default commands:" << endl )
00142 
00143     BESCommand::del_command( GET_RESPONSE ) ;
00144     BESCommand::del_command( SHOW_RESPONSE ) ;
00145     BESCommand::del_command( SET_RESPONSE ) ;
00146     BESCommand::del_command( DELETE_RESPONSE ) ;
00147 
00148     BESCommand::del_command( SETCONTAINER ) ;
00149     BESCommand::del_command( SHOWCONTAINERS_RESPONSE ) ;
00150     BESCommand::del_command( DELETE_CONTAINER ) ;
00151     BESCommand::del_command( DELETE_CONTAINERS ) ;
00152 
00153     BESCommand::del_command( DEFINE_RESPONSE ) ;
00154     BESCommand::del_command( SHOWDEFS_RESPONSE ) ;
00155     BESCommand::del_command( DELETE_DEFINITION ) ;
00156     BESCommand::del_command( DELETE_DEFINITIONS ) ;
00157 
00158     BESCommand::del_command( SET_CONTEXT ) ;
00159     BESCommand::del_command( SHOW_CONTEXT ) ;
00160 
00161     BESDEBUG( "bes", "Done Removing default commands:" << endl )
00162 
00163     return true;
00164 }
00165 

Generated on Wed Jan 2 06:00:39 2008 for OPeNDAP Back End Server (BES) by  doxygen 1.5.4