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 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