FileDocCategorySizeDatePackage
JDBCResourceConfigFactory.javaAPI DocGlassfish v2 API4722Fri May 04 22:23:18 BST 2007com.sun.enterprise.management.config

JDBCResourceConfigFactory

public final class JDBCResourceConfigFactory extends ResourceFactoryImplBase
MBean managing all instances of JDBC resource.

Fields Summary
public static final String
POOL_NAME_KEY
Constructors Summary
public JDBCResourceConfigFactory(ConfigFactoryCallback callbacks)

		super( callbacks );
	
Methods Summary
public javax.management.ObjectNamecreate(java.lang.String jndiName, java.lang.String poolName, java.util.Map optional)
Create a new <jdbc-resource>

param
jndiName
param
poolName
param
optional


	    		   				 		 		          	 
	 	
		  
	      
	       
	
		final JDBCConnectionPoolConfig	pool	= (JDBCConnectionPoolConfig)
			getCallbacks().getProxyFactory().getDomainRoot().getDomainConfig().
				getContainee( XTypes.JDBC_CONNECTION_POOL_CONFIG, poolName );
		if ( pool == null )
		{
			throw new IllegalArgumentException( "JDBCConnectionPoolConfig does not exit: " + poolName );
		}
			
		final String[] requiredParams = new String[]
		{
			POOL_NAME_KEY,	poolName,
		};
		    
		final Map<String,String> params	= initParams( jndiName, requiredParams, optional );

		final ObjectName	amxName = createNamedChild( jndiName, params );
		return( amxName );
	
protected javax.management.ObjectNamecreateOldChildConfig(javax.management.AttributeList translatedAttrs)
The caller is responsible for dealing with any Properties.

		trace( "JDBCResourceConfigFactory.createOldChildConfig: creating using: " +
			stringify( translatedAttrs ) );
			
		final ObjectName	objectName	=
				getOldResourcesMBean().createJdbcResource( translatedAttrs );
		
		return( objectName );
	
protected java.util.MapgetParamNameOverrides()

		return( MapUtil.newMap( CONFIG_NAME_KEY, "jndi-name" ) );
	
protected voidremoveByName(java.lang.String name)

	    final Set<ResourceRefConfig> refs   =
	        findAllRefConfigs( XTypes.JDBC_RESOURCE_CONFIG, name );
	    
	    if ( refs.size() == 0 )
	    {
		    getOldResourcesMBean().removeJdbcResourceByJndiName( name );
	    }
	    else
	    {
    	    for( final ResourceRefConfig ref : refs )
    	    {
    	        final String target = ref.getContainer().getName();
		        getOldResourcesMBean().deleteJdbcResource( name, target );
    	    }
		}