Executes the command
if (!validateOptions())
throw new CommandValidationException("Validation is false");
String objectName = getObjectName();
Object[] params = getParamsInfo();
String operationName = getOperationName();
String[] types = getTypesInfo();
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(),
getPort(),
getUser(),
getPassword());
try
{
Boolean returnValue = (Boolean)mbsc.invoke(new ObjectName(objectName),
operationName, params, types);
if (returnValue.booleanValue()) {
// Ping was successful
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
}
else {
// Ping was not successful
CLILogger.getInstance().printMessage(getLocalizedString(
"UnableToPing", new Object[]
{(String)getOperands().get(0)}));
}
}
catch(Exception e)
{
if (e.getLocalizedMessage() != null)
CLILogger.getInstance().printDetailMessage(e.getLocalizedMessage());
throw new CommandException(getLocalizedString("CommandUnSuccessful",
new Object[] {name} ), e);
}