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

ListTransformationRulesCommand

public class ListTransformationRulesCommand extends BaseTransformationRuleCommand

Fields Summary
private static final String
WEB_SERVICE_OPTION
Constructors Summary
Methods Summary
private booleandisplayTransformationRules(com.sun.appserv.management.config.WebServiceEndpointConfig wsc)
Display the transformation rules.

throws
CommandException

        Map rules = wsc.getTransformationRuleConfigMap();
        for (Object key : rules.keySet())
        {
            CLILogger.getInstance().printMessage((String)key);
        }
        if (rules.size() > 0) 
            return false;
        else
            return true;
    
private booleanlistTransformationRules(javax.management.MBeanServerConnection mbsc)
Iterates throught WSEP config to find the transformation rules.

throws
CommandException

        String webServiceName = getOption(WEB_SERVICE_OPTION);
        if (webServiceName != null)
        {
            WebServiceEndpointConfig wsc = 
                    getWebServiceEndpointConfig(mbsc, webServiceName, false);
            if (wsc == null)
                throw new CommandException(getLocalizedString("CannotFindWebservice"));
            return displayTransformationRules(wsc);
        }
        DomainRoot domainRoot = ProxyFactory.getInstance(mbsc).getDomainRoot();
        final Set s = domainRoot.getQueryMgr().queryJ2EETypeSet(XTypes.WEB_SERVICE_ENDPOINT_CONFIG);
        final Iterator iter = s.iterator();
        boolean nothingToList = true;
        while (iter.hasNext() )
        {
            final WebServiceEndpointConfig wsc = (WebServiceEndpointConfig)iter.next();
            if (wsc.getTransformationRuleConfigMap().size() > 0)
            {
                CLILogger.getInstance().printMessage(wsc.getName());
                nothingToList = displayTransformationRules(wsc);
            }
        }
        return nothingToList;
    
public voidrunCommand()
An abstract method that Executes the command

throws
CommandException

   
                    
         
    
        validateOptions();
        try
        { 
            MBeanServerConnection mbsc = getMBeanServerConnection(getHost(), getPort(), 
                                                                  getUser(), getPassword());
            //DomainRoot domainRoot = ProxyFactory.getInstance(mbsc).getDomainRoot();
            //final Set s = domainRoot.getQueryMgr().queryJ2EETypeSet(XTypes.WEB_SERVICE_ENDPOINT_CONFIG);
            String webServiceName = getOption(WEB_SERVICE_OPTION);
            validateWebServiceName(webServiceName, false);
            boolean nothingToList = listTransformationRules(mbsc);
            if (nothingToList)
            {
                CLILogger.getInstance().printMessage(getLocalizedString("NoElementsToList"));
            }
	    CLILogger.getInstance().printDetailMessage(getLocalizedString(
						       "CommandSuccessful",
						       new Object[] {name}));
        }
        catch(Exception e)
        {
            displayExceptionMessage(e);
        }