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

DottedNameServerInfoImpl

public class DottedNameServerInfoImpl extends Object implements DottedNameServerInfo

Fields Summary
final MBeanServerConnection
mConn
Constructors Summary
public DottedNameServerInfoImpl(MBeanServerConnection conn)

		mConn	= conn;
	
Methods Summary
java.util.Set_getConfigNames()

		// we can't use a proxy; it won't work when the method name starts with "get", apparently
		// thinking it's an Attribute
		final ObjectName []	configObjectNames	=
			(ObjectName [])mConn.invoke( getConfigsObjectName(), "getConfig", null, null );
		
		final HashSet	configNames	= new HashSet();
		for( int i = 0; i < configObjectNames.length; ++i )
		{
			final String	name	= (String)mConn.getAttribute( configObjectNames[ i ], "name" );
			
			configNames.add( name );
		}
		
		return( configNames );
	
protected java.util.Set_getServerNames()

		final MyController	controller	= (MyController)
			MBeanServerInvocationHandler.newProxyInstance( mConn, getControllerObjectName(), MyController.class, false );
		
		final String []	names	= controller.listServerInstances();
		
		return( ArrayConversion.toSet( names ) );
	
public java.lang.StringgetConfigNameForServer(java.lang.String serverName)

		final ObjectName	serverObjectName	= getServerObjectName( serverName );
		
		if ( serverObjectName == null )
		{
			throw new DottedNameServerInfo.UnavailableException( serverName );
		}
		
		String	configName	= null;
		try
		{
			configName	= (String)mConn.getAttribute( serverObjectName, "config_ref" );
		}
		catch( Exception e )
		{
			throw new DottedNameServerInfo.UnavailableException( e );
		}
		
		return( configName );
	
public java.util.SetgetConfigNames()

		Set	namesSet	= null;
		
		try
		{
			namesSet	= _getConfigNames();
		}
		catch( Exception e )
		{
			throw new DottedNameServerInfo.UnavailableException( e );
		}
		
		return( namesSet );
	
javax.management.ObjectNamegetConfigsObjectName()

		return( new ObjectName( "com.sun.appserv:type=configs,category=config" )  );
	
javax.management.ObjectNamegetControllerObjectName()

		return( ObjectNames.getControllerObjectName() );
	
public java.util.SetgetServerNames()

		Set	namesSet	= null;
		
		try
		{
			namesSet	= _getServerNames();
		}
		catch( Exception e )
		{
			throw new DottedNameServerInfo.UnavailableException( e );
		}
		
		return( namesSet );
	
public java.lang.String[]getServerNamesForConfig(java.lang.String configName)

		final java.util.Iterator iter			= getServerNames().iterator();
		final java.util.ArrayList	namesOut	= new java.util.ArrayList();
		
		while ( iter.hasNext() )
		{
			final String	serverName	= (String)iter.next();
			
			if ( configName.equals( getConfigNameForServer( serverName ) ) )
			{
				namesOut.add( serverName );
			}
		}
		
		final String []	namesOutArray	= new String [ namesOut.size() ];
		namesOut.toArray( namesOutArray );
		
		return( namesOutArray );
	
javax.management.ObjectNamegetServerObjectName(java.lang.String serverName)

		return( ObjectNames.getServerObjectName( serverName ) );