FileDocCategorySizeDatePackage
AppServConfigProvider.javaAPI DocGlassfish v2 API8015Fri May 04 22:24:42 BST 2007com.sun.enterprise.admin.wsmgmt.config.impl

AppServConfigProvider

public class AppServConfigProvider extends Object implements com.sun.enterprise.admin.wsmgmt.config.spi.ConfigProvider
This is the mechanism to access web service management configuration.

Fields Summary
Constructors Summary
Methods Summary
public java.util.ListgetManagedWebserviceApplicationIds()
Returns a list of application or stand alone module ids currently configured for web service management.

return
managed web service application ids


        List aList = new ArrayList();
        try {
            ConfigContext ctx = ApplicationServer.getServerContext().
                                                getConfigContext();

            String serverName =
            ApplicationServer.getServerContext().getInstanceName();

            ApplicationRef[] appRefs =ServerHelper.getApplicationReferences(ctx,
            serverName);
            for ( int appIdx =0; appIdx < appRefs.length; appIdx++) {
                String appName = appRefs[appIdx].getRef();
                ConfigBean cb = ApplicationHelper.findApplication(ctx, appName);
                // check if web service endpoint is configured for this
                // application/module, then ruturn this app

                int wsSize = 0;

                if ( cb instanceof WebModule) {
                    wsSize = ( (WebModule) cb).sizeWebServiceEndpoint();
                } else if ( cb instanceof EjbModule) {
                    wsSize = ( (EjbModule) cb).sizeWebServiceEndpoint();
                } else if (cb instanceof J2eeApplication) {
                    wsSize = ( (J2eeApplication) cb).sizeWebServiceEndpoint();
                }

                if (wsSize > 0)  { aList.add(appName); }
            }
        } catch (ConfigException ce) {
            // XX throw exception
        } finally {
            return aList;
        }
    
public java.lang.StringgetProviderID()
Returns the unique identifier for this RepositoryProvider object.

return
fully qualified class name of this RepositoryProvider

        return ConfigFactory.CONFIG_DEFAULT_PROVIDER;
    
public com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfiggetWebServiceConfig(java.lang.String appId, java.lang.String modId, boolean isStandalone, java.lang.String name)
Returns the list of Web Service Endpoint config in this application

param
appName Name of the application
return
the array of WebServiceConfig


        WebServiceEndpoint[] wsps = getWebServiceEndpoints(appId);
        if (wsps != null) {
            for (int idx =0; idx < wsps.length; idx++) {
               String sName = null;
               if ( isStandalone ) {
                    sName = name;
               } else {
                    sName = modId + "#" + name;
               }
               if ( wsps[idx].getName().equals(sName) ) {
                return new WebServiceConfigImpl(wsps[idx]); 
               }
            }
        }
        return null;
    
public com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfiggetWebServiceConfig(java.lang.String fqn)
Returns the Web Service Endpoint config in this endpoint

param
fqn Fully Qualified Name of the endpoint
return
the WebServiceConfig


	if (fqn==null) return null;
	String appId = null;
	int sepIdx = fqn.indexOf("#");
	appId = fqn.substring(0, sepIdx);
	String partialName = fqn.substring(sepIdx +1);

        WebServiceEndpoint[] wsps = getWebServiceEndpoints(appId);

        for (int idx =0; idx < wsps.length; idx++) {
           if ( wsps[idx].getName().equals(partialName) ) {
            return new WebServiceConfigImpl(wsps[idx]); 
           }
        }
        return null;
    
com.sun.enterprise.config.serverbeans.WebServiceEndpoint[]getWebServiceEndpoints(java.lang.String appId)

        WebServiceEndpoint[] wsps = null;
        try {
            ConfigContext ctx = ApplicationServer.getServerContext().
                                                getConfigContext();

            ConfigBean cb = ApplicationHelper.findApplication(ctx, appId);

            // check if web service endpoint is configured for this
            // application/module, then ruturn this app

            if ( cb instanceof WebModule) {
                wsps = ( (WebModule) cb).getWebServiceEndpoint();
            } else if ( cb instanceof EjbModule) {
                wsps = ( (EjbModule) cb).getWebServiceEndpoint();
            } else if (cb instanceof J2eeApplication) {
                wsps = ( (J2eeApplication) cb).getWebServiceEndpoint();
            }

        } catch (ConfigException ce) {
            // XX throw exception
        } finally {
            return wsps;
        }
    
public com.sun.enterprise.admin.wsmgmt.config.spi.WebServiceConfig[]getWebserviceConfigs(java.lang.String appId)
Returns the list of Web Service Endpoint config in this application

param
appName Name of the application
return
the array of WebServiceConfig

        WebServiceEndpoint[] wsps = getWebServiceEndpoints(appId);

        WebServiceConfig[] wsCfgs = new WebServiceConfig[wsps.length];
        for (int idx =0; idx < wsps.length; idx++) {
           wsCfgs[idx] = new WebServiceConfigImpl(wsps[idx]); 
        }
        return wsCfgs;