FileDocCategorySizeDatePackage
DottedNameServerInfoCache.javaAPI DocGlassfish v2 API4758Fri May 04 22:24:08 BST 2007com.sun.enterprise.admin.dottedname

DottedNameServerInfoCache

public class DottedNameServerInfoCache extends Object implements DottedNameServerInfo

Fields Summary
final DottedNameServerInfo
mSrc
Set
mConfigNames
Set
mServerNames
HashMap
mServerToConfig
HashMap
mConfigToServers
Constructors Summary
public DottedNameServerInfoCache(DottedNameServerInfo src)

		mSrc	= src;
		
		// underlying source may or may not be ready yet, so it's up
		// to the caller to call refresh() before first use.
		mConfigNames	= Collections.EMPTY_SET;
		mServerNames	= Collections.EMPTY_SET;
		mServerToConfig	= mConfigToServers	= new HashMap();
	
Methods Summary
void_refresh()

		mConfigNames	= mSrc.getConfigNames();
		mServerNames	= mSrc.getServerNames();
		
		// create mapping from server to config
		Iterator	iter	= mServerNames.iterator();
		while ( iter.hasNext() )
		{
			final String	serverName	= (String)iter.next();
			
			final String	configName	= mSrc.getConfigNameForServer( serverName );
			
			if ( configName != null )
			{
				mServerToConfig.put( serverName, configName );
			}
		}
		
		// create mapping from config to servers
		iter	= mConfigNames.iterator();
		while ( iter.hasNext() )
		{
			final String	configName	= (String)iter.next();
			
			final String [] serverNames	= mSrc.getServerNamesForConfig( configName );
			
			if ( serverNames != null )
			{
				mConfigToServers.put( configName, serverNames );
			}
		}
	
public synchronized java.lang.StringgetConfigNameForServer(java.lang.String serverName)

		return( (String)mServerToConfig.get( serverName ) );
	
public synchronized java.util.SetgetConfigNames()

		return( mConfigNames );
	
public synchronized java.util.SetgetServerNames()

		return( mServerNames );
	
public synchronized java.lang.String[]getServerNamesForConfig(java.lang.String configName)

		return( (String [])mConfigToServers.get( configName ) );
	
public synchronized voidrefresh()

		try
		{
			_refresh();
		}
		catch( DottedNameServerInfo.UnavailableException e )
		{
			DottedNameLogger.logException( e );
		}