DeleteManagementRuleCommandpublic class DeleteManagementRuleCommand extends GenericCommand
Fields Summary |
---|
private static final String | TARGET_OPTION |
Methods Summary |
---|
private java.lang.String | resolveTargetToConfig(javax.management.MBeanServerConnection mbsc, java.lang.String target)resolves the target to config name
String objectName = "com.sun.appserv:type=configs,category=config";
final Object[] params = new Object[] {target};
final String operationName = "getConfigNameForTarget";
final String[] types = new String[] {"java.lang.String"};
try
{
String returnValue = (String) mbsc.invoke(
new ObjectName(objectName),
operationName, params, types);
return (returnValue);
}
catch(Exception e)
{
throw new CommandException(e.getLocalizedMessage());
}
| public void | runCommand()An abstract method that Executes the command
validateOptions();
MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(),
getUser(), getPassword());
String config = resolveTargetToConfig(mbsc, getOption(TARGET_OPTION));
String objectName = "com.sun.appserv:type=management-rules,config=" +
config + ",category=config";
CLILogger.getInstance().printDebugMessage("ObjectName = " + objectName);
//use http connector
final Object[] params = getParamsInfo();
final String operationName = getOperationName();
final String[] types = getTypesInfo();
try
{
if (params[0] != null)
{
Object returnValue = mbsc.invoke(new ObjectName(objectName),
operationName, params, types);
handleReturnValue(returnValue);
}
CLILogger.getInstance().printDetailMessage(getLocalizedString(
"CommandSuccessful",
new Object[] {name}));
}
catch(Exception e)
{
displayExceptionMessage(e);
}
|
|