FileDocCategorySizeDatePackage
ListManagementRulesCommand.javaAPI DocGlassfish v2 API4566Fri May 04 22:25:12 BST 2007com.sun.enterprise.cli.commands

ListManagementRulesCommand

public class ListManagementRulesCommand extends GenericCommand

Fields Summary
private static final String
DEFAULT_TARGET
Constructors Summary
Methods Summary
private java.lang.StringresolveTargetToConfig(javax.management.MBeanServerConnection mbsc)
resolves the target to config name

throws
CommandException

        String objectName = "com.sun.appserv:type=configs,category=config";
        String target = (getOperands().size() == 1) ? 
                    (String) getOperands().get(0) : DEFAULT_TARGET;
        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 voidrunCommand()
An abstract method that Executes the command

throws
CommandException

   
                    
         
    
        validateOptions();
        MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(), 
                                                              getUser(), getPassword());
        String config = resolveTargetToConfig(mbsc);
        String objectName = "com.sun.appserv:type=management-rules,config=" +
                            config + ",category=config";
        CLILogger.getInstance().printDebugMessage("ObjectName = " + objectName);
        //use http connector
        final String operationName = getOperationName();

        try
        { 
            Object returnValue = mbsc.invoke(new ObjectName(objectName), 
                                            operationName, null, null);
            handleReturnValue(returnValue);
	    CLILogger.getInstance().printDetailMessage(getLocalizedString(
						       "CommandSuccessful",
						       new Object[] {name}));
        }
        catch(Exception e)
        {
            displayExceptionMessage(e);
        }