FileDocCategorySizeDatePackage
ClusterConfigFactory.javaAPI DocGlassfish v2 API5463Fri May 04 22:23:16 BST 2007com.sun.enterprise.management.config

ClusterConfigFactory

public final class ClusterConfigFactory extends ConfigFactory

Fields Summary
private final com.sun.enterprise.management.support.oldconfig.OldClustersMBean
mOldClustersMBean
private static final String
REFERENCED_CONFIG_NAME
Constructors Summary
public ClusterConfigFactory(ConfigFactoryCallback callbacks)

		super( callbacks );
		
		mOldClustersMBean	= getOldConfigProxies().getOldClustersMBean();
	
Methods Summary
private voidcheckConfigExists(java.lang.String configName)

		final Map<String,ConfigConfig>	configs	= getDomainConfig().getConfigConfigMap();
		
		if( ! configs.keySet().contains( configName ) )
		{
			throw new IllegalArgumentException( "No ConfigConfig exists with the name: " + configName );
		}
	
private booleanclusterExists(java.lang.String name)

		return getDomainConfig().getClusterConfigMap().keySet().contains( name );
	
public javax.management.ObjectNamecreate(java.lang.String name, java.lang.String configName, java.util.Map optional)

		if ( configName != null )
		{
			checkNonEmptyString( configName, "configName" );
			checkConfigExists( configName );
			
			// This is explicitly disallowed
			if ( configName.equals( "server-config" ) || configName.equals( "default-config" ) )
			{
				throw new IllegalArgumentException( configName );
			}
		}
		
		if ( clusterExists( name )  )
		{
			throw new IllegalArgumentException( "Cluster already exists: " + quote( name ) );
		}

		
        final String[] requiredParams =
		{
			"ReferencedConfigName",		configName,
		};
		
		final Map<String,String> params	= initParams( name, requiredParams, optional );
		
		return createNamedChild( name, params );
	
public javax.management.ObjectNamecreate(java.lang.String name, java.util.Map optional)

		return create( name, null, optional );
	
protected javax.management.ObjectNamecreateOldChildConfig(javax.management.AttributeList translatedAttrs, java.util.Properties props)

		// YUCK--createCluster( AttributeList ) cannot be called;
		// it won't work correctly; we must make the call explicity.
		final Map<String,String>	m	= JMXUtil.attributeListToStringMap( translatedAttrs );
		
		final String	config	= (String)m.get( "config-ref" );
		final String	name	= (String)m.get( "name" );
		
		return mOldClustersMBean.createCluster( name, config, props );
	
protected java.util.MapgetParamNameOverrides()

	
		 
	
	
		return( MapUtil.newMap( REFERENCED_CONFIG_NAME, "config-ref" ) );
	
protected voidinternalRemove(javax.management.ObjectName objectName)

        final String name = Util.getName(objectName);
        if ( ! clusterExists( name ) )
		{
			throw new IllegalArgumentException( "No such cluster: " + quote( name ) );
		}
        mOldClustersMBean.deleteCluster(name);