An abstract method that Executes the command
if (!validateOptions())
throw new CommandValidationException("Validation is false");
//use http connector
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
getUser(), getPassword());
final String targetName = (String)getOption(TARGET_NAME);
//if targetName is not null, then try to get the Config ObjectName of the
//target before creating the resource because we don't want to create
//the resource if the target does not exist.
ObjectName scON = (targetName!=null && !targetName.equals(DOMAIN))?
getTargetConfigObjectName(mbsc, targetName):null;
final Object[] params = getParamsInfo();
final String operationName = getOperationName();
final String[] types = getTypesInfo();
try {
Object returnValue = mbsc.invoke(Util.newObjectName(DOMAIN_CONFIG_OBJECT_NAME),
operationName,
params, types);
if (scON!=null)
{
//create reference to the target
mbsc.invoke(scON, "createResourceRefConfig",
new Object[]{new String((String)getOperands().get(0))},
new String[]{"java.lang.String"} );
}
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
}
catch (Exception e) {
displayExceptionMessage(e);
}