FileDocCategorySizeDatePackage
J2EEClusterImpl.javaAPI DocGlassfish v2 API5624Fri May 04 22:23:30 BST 2007com.sun.enterprise.management.j2ee

J2EEClusterImpl

public final class J2EEClusterImpl extends J2EELogicalServerImplBase
JSR 77 extension representing an Appserver Cluster

Fields Summary
Constructors Summary
public J2EEClusterImpl(com.sun.enterprise.management.support.Delegate delegate)

		super( J2EETypes.J2EE_CLUSTER, delegate );
	
Methods Summary
private com.sun.enterprise.management.support.oldconfig.OldClusterMBeangetOldClusterMBean()

		return( getOldConfigProxies().getOldClusterMBean( getSelfName() ) );
	
private com.sun.enterprise.admin.servermgmt.RuntimeStatusListgetRuntimeStatus()

		/**
			Should have called OldClusterMBean.getRuntimeStatus() instead. 
			But was getting back AttributeNotFoundException. Maybe bacause
			RuntimeStatus is not exposed as an attribute of the ClusterConfigMBean.
		 */
		final OldClustersMBean oldMBean = 
			getOldConfigProxies().getOldClustersMBean();
		return( ( RuntimeStatusList )oldMBean.getRuntimeStatus( getSelfName() ) );
	
public java.lang.String[]getServerNames()

		/*
			J2EEServer is not a subtype of J2EECluster in the containment hierarchy. 
			So the following doesnot work.			
			return getContaineeNamesOfType( J2EETypes.J2EE_SERVER );
		 */
		return getOldClusterMBean().listServerInstancesAsString( false );
    
public java.util.MapgetServerObjectNameMap()

		/*
			J2EEServer is not a subtype of J2EECluster in the containment hierarchy. 
			So the following does not work.
            return getContaineeObjectNameMap( J2EETypes.J2EE_SERVER );
         */
		final Set<String> serverNamesInCluster	= GSetUtil.newStringSet( getServerNames() );
		if ( serverNamesInCluster.size() == 0 )
		{
			return Collections.emptyMap();
		}
		final Set<ObjectName> allJ2EEServerObjectNames = 
			getQueryMgr().queryJ2EETypeObjectNameSet( J2EETypes.J2EE_SERVER );
		final Map<String,ObjectName> objectNameMap = Util.createObjectNameMap( allJ2EEServerObjectNames );

		final Map<String,ObjectName> serverObjectNameMap =
		    new HashMap<String,ObjectName>( serverNamesInCluster.size() );

		for( final String nameKey : serverNamesInCluster )
		{
			serverObjectNameMap.put( nameKey, objectNameMap.get( nameKey ) );
		}
		return serverObjectNameMap;
	
public intgetstate()

		final RuntimeStatusList rsl = getRuntimeStatus();
		int state = rsl.anyRunning() ? 
			StateManageable.STATE_RUNNING : StateManageable.STATE_STOPPED;
		return state;
	
public booleanisstateManageable()

		return true;
	
public voidstart()

		trace( "J2EEClusterImpl.start" );
		getOldClusterMBean().start();
		setstartTime( System.currentTimeMillis() );
	
public voidstartRecursive()

		start();
	
public voidstop()

		trace( "J2EEClusterImpl.start" );
		getOldClusterMBean().stop();
		setstartTime( 0 );