FileDocCategorySizeDatePackage
LoaderOfOldConfig.javaAPI DocGlassfish v2 API13565Fri May 04 22:23:42 BST 2007com.sun.enterprise.management.support

LoaderOfOldConfig

public class LoaderOfOldConfig extends LoaderOfOld
Loads MBeans.

Fields Summary
private final boolean
mSupportsClusters
private final ServerRefListener
mServerRefListener
private static final Set
NEEDS_SUPPORT
These types need to be supported.
private static final String
OLD_SERVER_TYPE
Constructors Summary
LoaderOfOldConfig(Loader loader)

		super( loader );
		
		final SystemInfo	systemInfo	= getDomainRoot().getSystemInfo();
		mSupportsClusters	= systemInfo.supportsFeature( systemInfo.CLUSTERS_FEATURE );
		
		if ( NEEDS_SUPPORT.size() != 0 )
		{
			getLogger().warning(
				"Support for the following old config mbean types is not yet implemented: {" +
				SmartStringifier.toString( NEEDS_SUPPORT ) + "}" );
		}
		
		try
		{
		    mServerRefListener  = new ServerRefListener( "LoaderOfOldConfig" );
            mServerRefListener.startListening();
		}
		catch( Exception e )
		{
		    debug( "" + e );
		    throw new Error( e );
		}
	
Methods Summary
protected java.util.SetfindAllOldCandidates()

		ObjectName	pattern		= null;
		Set<ObjectName>			oldNames	= null;
		
		pattern		= Util.newObjectNamePattern( "com.sun.appserv", "category=config" );
		oldNames	= JMXUtil.queryNames( getMBeanServer(), pattern, null );
		
		oldNames.addAll( getOldServerConfigObjectNames() );
		
		debug( "LoaderOfOldConfig: found the following:" );
		debug( CollectionUtil.toString( oldNames, "\n" ) );
		return( oldNames );
	
protected java.util.SetgetIgnoreTypes()

		return( OldConfigTypes.getIgnoreTypes() );
	
private javax.management.ObjectNamegetListenToServerRefConfigPattern()

	    final String jmxDomain = Util.getObjectName( getDomainRoot() ).getDomain();
        final String props  = Util.makeJ2EETypeProp( XTypes.SERVER_REF_CONFIG );
        return Util.newObjectNamePattern( jmxDomain, props );
    
protected java.util.SetgetNeedsSupport()

	
		 
	
	
		return( NEEDS_SUPPORT );
	
private java.util.SetgetOldServerConfigObjectNames()

		// 8.0 put the type=server MBeans into ias:
		// see if they are present under com.sun.appserv
		//
		ObjectName	pattern		=
			Util.newObjectNamePattern( "com.sun.appserv", "type=server" );
		Set<ObjectName>	objectNames	= JMXUtil.queryNames( getMBeanServer(), pattern, null );
		
		if ( objectNames.size() == 0 )
		{
			pattern		= Util.newObjectNamePattern( "ias", "type=server" );
			
			objectNames	= JMXUtil.queryNames( getMBeanServer(), pattern, null );
		}
		return( objectNames );
	
private booleanisOldConfigMBean(javax.management.ObjectName objectName)

		boolean	isOldConfigMBean	= false;
		
		if ( objectName.getDomain().equals( "com.sun.appserv" ) &&
					"config".equals( objectName.getKeyProperty( "category" ) ) )
		{
			final String	type	= objectName.getKeyProperty( "type" );
			
			isOldConfigMBean	= ! OldConfigTypes.getIgnoreTypes().contains( type );
		}
		return( isOldConfigMBean );
	
protected booleanisOldMBean(javax.management.ObjectName objectName)

		return( isOldConfigMBean( objectName ) );
	
protected javax.management.ObjectNameoldToNewObjectName(javax.management.ObjectName oldObjectName)

		trace( "oldToNewObjectName: " + oldObjectName );
		final OldTypeToJ2EETypeMapper	mapper	= new MyOldTypes( );
		final OldProps	oldProps	= new OldProps( oldObjectName, mapper );
		final String	domainName	= mLoader.getAMXJMXDomainName();

		String	props	= oldProps.getNewProps();
		
		// may be modified down below
		final ObjectName	newObjectName	= Util.newObjectName( domainName, props );
		
		return( newObjectName );