FileDocCategorySizeDatePackage
ConfigBeanHelperFactory.javaAPI DocGlassfish v2 API5681Fri May 04 22:23:40 BST 2007com.sun.enterprise.management.offline

ConfigBeanHelperFactory

public final class ConfigBeanHelperFactory extends Object
Factory for creating ConfigBeanHelpers. Although they can be instantiated directly, failure to use the factory means that certain special cases won't be dealt with.

Fields Summary
private final com.sun.enterprise.config.ConfigContext
mConfigContext
private final Map
mHelperCache
private static ConfigBeanHelperFactory
INSTANCE
private static Map
mFactories
Constructors Summary
private ConfigBeanHelperFactory(com.sun.enterprise.config.ConfigContext configContext)

    
        
       
    
        mConfigContext  = configContext;
        mHelperCache    = new HashMap<String,ConfigBeanHelper>();
    
Methods Summary
private ConfigBeanHelpercreateHelper(java.lang.String xPath)

        ConfigBeanHelper    helper  = null;
        final String        type = ConfigBeanHelper._getType( xPath );
        
        final ConfigBean    configBean  = mConfigContext.exactLookup( xPath );
        if ( configBean == null )
        {
            throw new IllegalArgumentException( 
                "Null configBean returned for type: " + type );
        }
        
        if ( "auth-realm".equals( type ) )
        {
            helper  = new AuthRealmConfigBeanHelper( mConfigContext, configBean );
        }
        else if ( "security-map".equals( type ) )
        {
            helper  = new SecurityMapConfigBeanHelper( mConfigContext, configBean );
        }
        else if ( "java-config".equals( type ) )
        {
            helper  = new JavaConfigConfigBeanHelper( mConfigContext, configBean );
        }
        else
        {
            helper  = new StdConfigBeanHelper( mConfigContext, configBean );
        }
        
        debug( "CREATED: " + xPath );
        
        return helper;
    
private voiddebug(java.lang.Object o)

        AMXDebug.getInstance().getOutput( "ConfigBeanHelperFactory" ).println( o );
    
public ConfigBeanHelpergetHelper(java.lang.String xPath)

        if ( xPath == null )
        {
            throw new IllegalArgumentException( "null xPath" );
        }
        
        ConfigBeanHelper    helper  = mHelperCache.get( xPath );
        
        if ( helper == null )
        {
            helper  = createHelper( xPath );
            
            mHelperCache.put( xPath, helper );
        }
        
        return helper;
    
public ConfigBeanHelpergetHelper(com.sun.enterprise.config.ConfigBean configBean)

        try
        {
            return getHelper( configBean.getXPath() );
        }
        catch( Exception e )
        {
            throw new RuntimeException( e );
        }
    
public static synchronized com.sun.enterprise.management.offline.ConfigBeanHelperFactorygetInstance(com.sun.enterprise.config.ConfigContext configContext)

        if ( mFactories == null )
        {
            mFactories  = new HashMap<ConfigContext,ConfigBeanHelperFactory>();
        }

        ConfigBeanHelperFactory   instance    = mFactories.get( configContext );
	    if ( instance == null )
	    {
	        instance    = new ConfigBeanHelperFactory( configContext );
	        mFactories.put( configContext, instance );
	    }

	    return instance;
	
protected voidsdebug(java.lang.Object o)

	    debug( o );
	    System.out.println( "" + o );