FileDocCategorySizeDatePackage
ConfigFactory.javaAPI DocGlassfish v2 API4861Fri May 04 22:24:42 BST 2007com.sun.enterprise.admin.wsmgmt.config.spi

ConfigFactory

public class ConfigFactory extends Object
This SPI mechanism allows getting web services Management configuration. Thi provider can be implemented using any configuration storage mechanism underneath.

Fields Summary
public static final String
CONFIG_PROVIDER_NAME
Environment property name to customize Repository Provider
public static final String
CONFIG_DEFAULT_PROVIDER
Constructors Summary
private ConfigFactory()
Make ConfigFactory private, only one sigleton object is available.

    
Methods Summary
public static com.sun.enterprise.admin.wsmgmt.config.spi.ConfigFactorygetConfigFactory()
Returns the ConfigFactory singleton.

return
the ConfigFactory instance

        return new ConfigFactory();
    
public ConfigProvidergetConfigProvider()
Returns the ConfigProvider instance. If -Dconfig.provider.classname is defined, that class is loaded and returned as the repository provider. If there is an error finding or loading the class, the default provider class is returned.

return
RepositoryProvider implementation
throws
IllegalAccessException - if the class or its nullary constructor is not accessible. InstantiationException - if this Class represents an abstract class,an interface, an array class, a primitive type, or void; or if the class * has no nullary constructor; or if the instantiation fails for some other reason. ClassCastException - if the provider implementation specified by -D does not implement the com.sun. enterprise.admin.wsmgmt.repository.spi. RepositoryProvider interface. ClassNotFoundException - if the provider implementation specified * by -D does could not be found by the class loader.

       String implName = System.getProperty(CONFIG_PROVIDER_NAME);
       if ( implName == null ) {
            Class repClass = Class.forName(CONFIG_DEFAULT_PROVIDER);
            Object o = repClass.newInstance();
            return (ConfigProvider)o;
       } else {
            Class repClass = Class.forName(implName);
            Object o = repClass.newInstance();
            return (ConfigProvider)o;
       }