FileDocCategorySizeDatePackage
DeleteTransformationRuleCommand.javaAPI DocGlassfish v2 API5236Fri May 04 22:25:08 BST 2007com.sun.enterprise.cli.commands

DeleteTransformationRuleCommand

public class DeleteTransformationRuleCommand extends BaseTransformationRuleCommand

Fields Summary
private static final String
WEB_SERVICE_OPTION
Constructors Summary
Methods Summary
private com.sun.appserv.management.config.WebServiceEndpointConfiggetWebServiceEndpointConfig(java.util.Set s)
parse the operand to get the web service name Also validate if the operand is well formed.

throws
CommandValidationException

        // this webserviceName is fully qualified name
        String fqWebServiceName = getOption(WEB_SERVICE_OPTION);
        // extract the partially qualified web service endpoing config name
        int firstHashIdx = fqWebServiceName.indexOf("#");
        String wsName= null;
        if ( firstHashIdx != -1 ) {
            if ( firstHashIdx+1 == fqWebServiceName.length()) {
                // msg XXX
                throw new CommandException(getLocalizedString("InvalidFormatForWebservice"));
            }
            wsName =  fqWebServiceName.substring(firstHashIdx +1);
        }
        else
        {
            throw new CommandException(getLocalizedString("InvalidFormatForWebservice"));
        }
        final Iterator iter = s.iterator();
        while (iter.hasNext() )
        {
            final WebServiceEndpointConfig wsc = (WebServiceEndpointConfig)iter.next();
            CLILogger.getInstance().printDebugMessage(wsc.getName());
            if (wsc.getName().equals(wsName))
            {
                return wsc;
            }
        }
        return null;
    
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, true);
            WebServiceEndpointConfig wsc = 
                    getWebServiceEndpointConfig(mbsc, webServiceName, false);
            if (wsc == null)
                throw new CommandException(getLocalizedString("CannotFindWebservice"));
            String ruleName = (String) getOperands().get(0);
           
            wsc.removeTransformationRuleConfig(ruleName);

	    CLILogger.getInstance().printDetailMessage(getLocalizedString(
						       "CommandSuccessful",
						       new Object[] {name}));
        }
        catch(Exception e)
        {
            displayExceptionMessage(e);
        }