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

ConfigureWebServiceCommand

public class ConfigureWebServiceCommand extends BaseTransformationRuleCommand

Fields Summary
private static final String
MONITORING_OPTION
private static final String
MAX_HISTORY_SIZE_OPTION
Constructors Summary
Methods Summary
private java.util.MapgetOptionMap()
return the map containing the monitoring & maxhistorysize attrs.

throws
CommandValidationException

        HashMap map = new HashMap();
        String maxHistorySize = getOption(MAX_HISTORY_SIZE_OPTION);
        String monitoring = getOption(MONITORING_OPTION);
        map.put(WebServiceEndpointConfigKeys.MONITORING_LEVEL_KEY, monitoring);
        map.put(WebServiceEndpointConfigKeys.MAX_HISTORY_SIZE_KEY, maxHistorySize);
        return map;
    
private java.lang.StringgetWebServiceEndPoint()
parse the operand to get the webservice endpoint

throws
CommandValidationException

        String operand = (String) getOperands().get(0);
        int index = operand.indexOf("#");
        return operand.substring(index+1);
    
private java.lang.StringgetWebServiceName()
parse the operand to get the web service name Also validate if the operand is well formed.

throws
CommandValidationException

        String operand = (String) getOperands().get(0);
        StringTokenizer paramsTokenizer = new StringTokenizer(operand, "#");
        int size = paramsTokenizer.countTokens();
        if (size != 3)
            throw new CommandException(getLocalizedString("InvalidWebServiceEndpoint"));
        return paramsTokenizer.nextToken();
    
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 = (String) getOperands().get(0);
            validateWebServiceName(webServiceName, true);
            WebServiceEndpointConfig wsc = 
                    getWebServiceEndpointConfig(mbsc, webServiceName, true);
            if (wsc == null)
                throw new CommandException(getLocalizedString("CannotFindWebservice"));

            String maxHistorySize = getOption(MAX_HISTORY_SIZE_OPTION);
            String monitoring = getOption(MONITORING_OPTION);
            if (maxHistorySize != null)
            {
                wsc.setMaxHistorySize(maxHistorySize);
            }
            if (monitoring != null)
            {
                wsc.setMonitoringLevel(monitoring);
            }
	    CLILogger.getInstance().printDetailMessage(getLocalizedString(
						       "CommandSuccessful",
						       new Object[] {name}));
        }
        catch(Exception e)
        {
            displayExceptionMessage(e);
        }