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

DeployedItemRefConfigFactory

public class DeployedItemRefConfigFactory extends ConfigFactory
Base impl class for <application-ref>

Fields Summary
private final com.sun.enterprise.management.support.oldconfig.OldApplicationsConfigMBean
mOldApplicationsConfigMBean
private final Set
LEGAL_OPTIONAL_KEYS
Constructors Summary
public DeployedItemRefConfigFactory(ConfigFactoryCallback callbacks)

		super( callbacks );
		
		mOldApplicationsConfigMBean	= getOldConfigProxies().getOldApplicationsConfigMBean();
	
Methods Summary
private voidcheckDeploymentStatusForExceptions(java.util.Map m)

		DeploymentStatus status = DeploymentSupport.mapToDeploymentStatus( m );
		Throwable t = status.getStageThrowable();
		final Iterator<DeploymentStatus> it = status.getSubStagesList().iterator();
		while ( ( t == null ) && ( it.hasNext() ) )
		{
			status = it.next();
			t = status.getThrowable();
		}
		if ( null != t )
		{
			throw new RuntimeException( status.getStageStatusMessage() );
		}
    
public javax.management.ObjectNamecreate(java.lang.String referencedApplicationName, java.util.Map optional)

		trace( "DeployedItemRefConfigFactory.create: creating using: ");

		final Map<String,String> params	= initParams( referencedApplicationName, null, optional );
		
		trace( "params as processed: " + stringify( params ) );

		final ObjectName	amxName	= createNamedChild( referencedApplicationName, params );

		return( amxName );
	
public javax.management.ObjectNamecreate(java.lang.String referencedApplicationName, boolean enabled, java.lang.String virtualServers, boolean lbEnabled, int disableTimeoutInMinutes)

		final Map<String,String> optionalParams = new java.util.HashMap<String,String>();
		putNonNull( optionalParams, DeployedItemRefConfigCR.ENABLED_KEY,Boolean.toString(enabled));
		putNonNull( optionalParams, DeployedItemRefConfigCR.VIRTUAL_SERVERS_KEY,virtualServers);
		putNonNull( optionalParams, DeployedItemRefConfigCR.LB_ENABLED_KEY,Boolean.toString(lbEnabled));
		putNonNull( optionalParams, DeployedItemRefConfigCR.DISABLE_TIMEOUT_IN_MINUTES_KEY,Integer.toString(disableTimeoutInMinutes));

		final ObjectName amxName =  create(referencedApplicationName, optionalParams);
		return( amxName );
	
public javax.management.ObjectNamecreate(java.lang.String referencedApplicationName)

		return create(referencedApplicationName, null);
	
private javax.management.ObjectNamecreateApplicationRef(java.lang.String ref, java.lang.String target, java.util.Map optional)

		Map<String,Serializable> m = TypeCast.checkMap(
		    mOldApplicationsConfigMBean.
		        createApplicationReferenceAndReturnStatusAsMap( target, ref, optional ),
		        String.class,
		        Serializable.class );
		checkDeploymentStatusForExceptions( m );

		final String targetJ2EEType	= getFactoryContainer().getJ2EEType();

		ObjectName on = null;
		if ( XTypes.STANDALONE_SERVER_CONFIG.equals( targetJ2EEType ) )
		{
			on = getOldConfigProxies().getOldServerMBean( target ).
				getApplicationRefByRef( ref );
		}
		else if ( XTypes.CLUSTER_CONFIG.equals( targetJ2EEType ) )
		{
			on = getOldConfigProxies().getOldClusterMBean( target ).
				getApplicationRefByRef( ref );
		}
		else
		{
			throw new RuntimeException(
			"Application refs can be created only on clusters and standalone servers" );
		}

		return on;
	
protected javax.management.ObjectNamecreateOldChildConfig(javax.management.AttributeList translatedAttrs)

		trace( "createOldChildConfig: attrs: " + stringify( translatedAttrs ) );

		final String REF_KEY	= "ref";

		final Map<String,String> attributeMap = JMXUtil.attributeListToStringMap( translatedAttrs );

		String appRef	= null;
		try
		{
			appRef = attributeMap.remove( REF_KEY );
		}
		catch ( UnsupportedOperationException uoe )
		{
			assert false;
		}
		assert appRef != null;

		final String target		= getFactoryContainer().getName();
		assert target != null;

		final ObjectName on = createApplicationRef( appRef, target, attributeMap );

		return on;
	
protected java.util.SetgetLegalOptionalCreateKeys()

	
	     
	
	
		return( LEGAL_OPTIONAL_KEYS );
	
protected java.util.MapgetParamNameOverrides()

		return( MapUtil.newMap( CONFIG_NAME_KEY, "ref" ) );
	
public voidinternalRemove(javax.management.ObjectName objectName)

		final String containerName = getFactoryContainer().getName();

		mOldApplicationsConfigMBean.deleteApplicationReferenceAndReturnStatusAsMap( 
				containerName, Util.getName( objectName ), null );