FileDocCategorySizeDatePackage
DottedNameGetSetMBeanImpl.javaAPI DocGlassfish v2 API8679Fri May 04 22:24:10 BST 2007com.sun.enterprise.admin.mbeans

DottedNameGetSetMBeanImpl

public class DottedNameGetSetMBeanImpl extends StandardMBean implements DottedNameGetSetMBean

Fields Summary
final DottedNameGetSetForConfig
mConfigImpl
final DottedNameGetSetForMonitoring
mMonitoringImpl
final DottedNameServerInfoCache
mServerInfo
long
mTimeOfLastCall
private static final long
CLEAR_CACHE_INTERVAL_MILLIS
Constructors Summary
public DottedNameGetSetMBeanImpl(MBeanServerConnection conn, DottedNameRegistry registry, DottedNameRegistry monitoringRegistry)



		super( DottedNameGetSet.class );
	
		mServerInfo	= new DottedNameServerInfoCache( createServerInfo( conn ) );
		
		mConfigImpl		= new DottedNameGetSetForConfig( conn, registry, mServerInfo );
		mMonitoringImpl	= new DottedNameGetSetForMonitoring( conn, monitoringRegistry, mServerInfo );
	
Methods Summary
protected booleancheckGetResults(java.lang.Object[] results)

		boolean 	good	= true;
		
		for( int i = 0; i < results.length; ++i )
		{
			final Object	o	= results[ i ];
			
			if ( ! (o instanceof Attribute ||
					o instanceof Attribute[] ||
					o instanceof Exception ) )
			{
				//System.out.println( "checkGetResults: object has class: " + o.getClass().getName() );
				good	= false;
				break;
			}
		}
		return( good );
	
protected booleancheckSetResults(java.lang.Object[] results)

		boolean 	good	= true;
		
		for( int i = 0; i < results.length; ++i )
		{
			final Object	o	= results[ i ];
			
			if ( ! (o instanceof Attribute ||
					o instanceof Exception ) )
			{
				good	= false;
				break;
			}
		}
		return( good );
	
protected java.lang.Object[]convertArrayType(java.lang.Object[] input)

		Object []	result	= input;
		
		if ( hasIdenticalElementClasses( input ) && input.length != 0 )
		{
			result	= (Object [])Array.newInstance( input[ 0 ].getClass(), input.length );
			
			for( int i = 0; i < input.length; ++i )
			{
				result[ i ]	= input[ i ];
			}
		}
		
		return( result );
	
protected DottedNameServerInfocreateServerInfo(javax.management.MBeanServerConnection conn)

		return( new DottedNameServerInfoImpl( conn ) );
	
protected java.lang.Object[]dottedNameAnyGet(DottedNameGetSetMBeanBase impl, java.lang.String[] names)

		pre();
		
		final Object []	results	= impl.dottedNameGet( names );
		
		assert( checkGetResults( results ) );
		
		assert( results.length == names.length );
		return( convertArrayType( results ) );
	
protected java.lang.ObjectdottedNameAnyGet(DottedNameGetSetMBeanBase impl, java.lang.String name)

		final Object []	results	= dottedNameAnyGet( impl, new String [] { name } );
		
		return( results[ 0 ] );
	
public java.lang.Object[]dottedNameGet(java.lang.String[] names)

		return( dottedNameAnyGet( mConfigImpl, names ) );
	
public java.lang.ObjectdottedNameGet(java.lang.String name)

		final Object	result	= dottedNameAnyGet( mConfigImpl, name );
		return( result );
	
public java.lang.String[]dottedNameList(java.lang.String[] namePrefixes)

		pre();
		
		return( mConfigImpl.dottedNameList( namePrefixes ) );
	
public java.lang.Object[]dottedNameMonitoringGet(java.lang.String[] names)

		return( dottedNameAnyGet( mMonitoringImpl, names ) );
	
public java.lang.ObjectdottedNameMonitoringGet(java.lang.String name)

		return( dottedNameAnyGet( mMonitoringImpl, name ) );
	
public java.lang.String[]dottedNameMonitoringList(java.lang.String[] namePrefixes)

		pre();
		
		return( mMonitoringImpl.dottedNameList( namePrefixes  ) );
	
public java.lang.Object[]dottedNameSet(java.lang.String[] nameValuePairs)

		pre();
		
		Object [] results	= mConfigImpl.dottedNameSet( nameValuePairs );
		
		assert( checkSetResults( results ) );
		assert( results.length == nameValuePairs.length );
		
		return( convertArrayType( results ) );
	
public java.lang.ObjectdottedNameSet(java.lang.String nameValuePair)

		final Object [] results	= dottedNameSet( new String [] { nameValuePair } );
		
		return( results[ 0 ] );
	
private booleanhasIdenticalElementClasses(java.lang.Object[] a)

		boolean	isUniform	= true;
		
		if ( a.length > 0 )
		{
			final Class		matchType	= a[ 0 ].getClass();
			
			for( int i = 1; i < a.length; ++i )
			{
				if ( a[ i ].getClass() != matchType )
				{
					isUniform	= false;
					break;
				}
			}
		}
		
		return( isUniform );
	
protected voidpre()

	
		 
	
	
		mServerInfo.refresh();
		
		final long	now	= System.currentTimeMillis();
		if ( (now - mTimeOfLastCall) > CLEAR_CACHE_INTERVAL_MILLIS )
		{
			DottedNameFactory.getInstance().clear();
		}
		
		mTimeOfLastCall	= now;