BESDefaultCommands.cc
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
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 #ifdef BES_DEVELOPER
00077 BESDEBUG( "bes", " adding " << PROCESS_RESPONSE << " command" << endl )
00078 BESCommand::add_command( PROCESS_RESPONSE, BESCommand::TermCommand ) ;
00079
00080 BESDEBUG( "bes", " adding " << CONFIG_RESPONSE << " command" << endl )
00081 BESCommand::add_command( CONFIG_RESPONSE, BESCommand::TermCommand ) ;
00082 #endif
00083
00084 BESDEBUG( "bes", " adding " << VERS_RESPONSE << " command" << endl )
00085 BESCommand::add_command( VERS_RESPONSE, BESCommand::TermCommand ) ;
00086
00087 BESDEBUG( "bes", " adding " << STATUS_RESPONSE << " command" << endl )
00088 BESCommand::add_command( STATUS_RESPONSE, BESCommand::TermCommand ) ;
00089
00090 BESDEBUG( "bes", " adding " << SET_RESPONSE << " command" << endl )
00091 cmd = new BESSetCommand( SET_RESPONSE ) ;
00092 BESCommand::add_command( SET_RESPONSE, cmd ) ;
00093
00094 BESDEBUG( "bes", " adding " << DELETE_RESPONSE << " command" << endl )
00095 cmd = new BESDeleteCommand( DELETE_RESPONSE ) ;
00096 BESCommand::add_command( DELETE_RESPONSE, cmd ) ;
00097
00098 BESDEBUG( "bes", " adding " << SETCONTAINER << " command" << endl )
00099 cmd = new BESSetContainerCommand( SETCONTAINER ) ;
00100 BESCommand::add_command( SETCONTAINER, cmd ) ;
00101
00102 BESDEBUG( "bes", " adding " << SHOWCONTAINERS_RESPONSE << " command" << endl)
00103 BESCommand::add_command( SHOWCONTAINERS_RESPONSE, BESCommand::TermCommand ) ;
00104
00105 BESDEBUG( "bes", " adding " << DELETE_CONTAINER << " command" << endl )
00106 cmd = new BESDelContainerCommand( DELETE_CONTAINER ) ;
00107 BESCommand::add_command( DELETE_CONTAINER, cmd ) ;
00108
00109 BESDEBUG( "bes", " adding " << DELETE_CONTAINERS << " command" << endl )
00110 cmd = new BESDelContainersCommand( DELETE_CONTAINERS ) ;
00111 BESCommand::add_command( DELETE_CONTAINERS, cmd ) ;
00112
00113 BESDEBUG( "bes", " adding " << DEFINE_RESPONSE << " command" << endl )
00114 cmd = new BESDefineCommand( DEFINE_RESPONSE ) ;
00115 BESCommand::add_command( DEFINE_RESPONSE, cmd ) ;
00116
00117 BESDEBUG( "bes", " adding " << SHOWDEFS_RESPONSE << " command" << endl )
00118 BESCommand::add_command( SHOWDEFS_RESPONSE, BESCommand::TermCommand ) ;
00119
00120 BESDEBUG( "bes", " adding " << DELETE_DEFINITION << " command" << endl )
00121 cmd = new BESDelDefCommand( DELETE_DEFINITION ) ;
00122 BESCommand::add_command( DELETE_DEFINITION, cmd ) ;
00123
00124 BESDEBUG( "bes", " adding " << DELETE_DEFINITIONS << " command" << endl )
00125 cmd = new BESDelDefsCommand( DELETE_DEFINITIONS ) ;
00126 BESCommand::add_command( DELETE_DEFINITIONS, cmd ) ;
00127
00128 BESDEBUG( "bes", " adding " << SET_CONTEXT << " command" << endl )
00129 cmd = new BESSetContextCommand( SET_CONTEXT ) ;
00130 BESCommand::add_command( SET_CONTEXT, cmd ) ;
00131
00132 BESDEBUG( "bes", " adding " << SHOW_CONTEXT << " command" << endl )
00133 BESCommand::add_command( SHOW_CONTEXT, BESCommand::TermCommand ) ;
00134
00135 BESDEBUG( "bes", "Done Initializing default commands:" << endl )
00136
00137 return 0;
00138 }
00139
00140 int
00141 BESDefaultCommands::terminate( void )
00142 {
00143 BESDEBUG( "bes", "Removing default commands:" << endl )
00144
00145 BESCommand::del_command( GET_RESPONSE ) ;
00146 BESCommand::del_command( SHOW_RESPONSE ) ;
00147 BESCommand::del_command( HELP_RESPONSE ) ;
00148 #ifdef BES_DEVELOPER
00149 BESCommand::del_command( PROCESS_RESPONSE ) ;
00150 BESCommand::del_command( CONFIG_RESPONSE ) ;
00151 #endif
00152 BESCommand::del_command( VERS_RESPONSE ) ;
00153 BESCommand::del_command( STATUS_RESPONSE ) ;
00154 BESCommand::del_command( SET_RESPONSE ) ;
00155 BESCommand::del_command( DELETE_RESPONSE ) ;
00156 BESCommand::del_command( SETCONTAINER ) ;
00157 BESCommand::del_command( SHOWCONTAINERS_RESPONSE ) ;
00158 BESCommand::del_command( DELETE_CONTAINER ) ;
00159 BESCommand::del_command( DELETE_CONTAINERS ) ;
00160 BESCommand::del_command( DEFINE_RESPONSE ) ;
00161 BESCommand::del_command( SHOWDEFS_RESPONSE ) ;
00162 BESCommand::del_command( DELETE_DEFINITION ) ;
00163 BESCommand::del_command( DELETE_DEFINITIONS ) ;
00164 BESCommand::del_command( SET_CONTEXT ) ;
00165 BESCommand::del_command( SHOW_CONTEXT ) ;
00166
00167 BESDEBUG( "bes", "Done Removing default commands:" << endl )
00168
00169 return true;
00170 }
00171