An abstract method that Executes the command
if (!validateOptions())
throw new CommandValidationException("Validation failed");
String objectName = getObjectName();
Object[] params = getParamsInfo();
String operationName = getOperationName();
String[] types = getTypesInfo();
String[] map = null;
String[] principals = null;
String[] usergroups = null;
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
getUser(), getPassword());
try {
ArrayList list =(ArrayList)mbsc.invoke(new ObjectName(objectName),
operationName, params, types);
Iterator iterator= list.iterator();
while (iterator.hasNext()){
map = (String[]) iterator.next();
CLILogger.getInstance().printMessage(" ====================================");
CLILogger.getInstance().printMessage(" Security Map Name is :" +map[0]);
CLILogger.getInstance().printMessage(" =====================================");
if(map[1] != null)
principals = getOptionsList(map[1]);
if(map[2] != null)
usergroups = getOptionsList(map[2]);
if(principals != null){
CLILogger.getInstance().printMessage("Principals for Security Map :"+ map[0] +" are :");
for(int i = 0;i<principals.length;i++)
CLILogger.getInstance().printMessage("<principal> " +principals[i]);
}
CLILogger.getInstance().printMessage("\n");
if(usergroups != null ){
CLILogger.getInstance().printMessage("UserGroups for Security Map :"+ map[0] +" are :");
for(int i = 0;i<usergroups.length;i++)
CLILogger.getInstance().printMessage("<user-group> "+usergroups[i]);
}
CLILogger.getInstance().printMessage("\n");
if(map[3] != null){
String username = map[3];
CLILogger.getInstance().printMessage("Backend Principal User Name for :"+map[0] +" is :"+username);
CLILogger.getInstance().printMessage(" \n");
}
if(map[4] != null){
String password = map[4];
CLILogger.getInstance().printMessage("Backend Principal Password for :"+map[0] +" is :"+password);
CLILogger.getInstance().printMessage("\n");
}
}
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
}catch(Exception e){
if (e.getLocalizedMessage() != null)
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
throw new CommandException(getLocalizedString("CommandUnSuccessful",
new Object[] {name} ), e);
}