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

BulkAccessImpl

public class BulkAccessImpl extends AMXImplBase implements com.sun.appserv.management.base.BulkAccess

Fields Summary
Constructors Summary
public BulkAccessImpl()

	
Methods Summary
public java.lang.Object[]bulkGetAttribute(javax.management.ObjectName[] objectNames, java.lang.String attributeName)

		final Object[]	results	= new Object[ objectNames.length ];
		
		for( int i = 0; i < objectNames.length; ++i )
		{
			try
			{
				results[ i ]	= getMBeanServer().getAttribute( objectNames[ i ], attributeName );
			}
			catch( Throwable t )
			{
				results[ i ]	= t;
			}
		}
		return( results );
	
public java.lang.Object[]bulkGetAttributeNames(javax.management.ObjectName[] objectNames)

		final Object[]	results		= new Object[ objectNames.length ];
		final Object[]	mbeanInfos	= bulkGetMBeanInfo( objectNames );
		
		for( int i = 0; i < results.length; ++i )
		{
			if ( mbeanInfos[ i ] instanceof MBeanInfo )
			{
				final MBeanInfo	info	= (MBeanInfo)mbeanInfos[ i ];
				
				results[ i ]	= JMXUtil.getAttributeNames( info.getAttributes() );
			}
			else
			{
				results[ i ]	= mbeanInfos[ i ];
			}
		}
		return( results );
	
public java.lang.Object[]bulkGetAttributes(javax.management.ObjectName[] objectNames, java.lang.String[] attributeNames)

		final Object[]	results	= new Object[ objectNames.length ];
		
		// check for empty list; this occurs occassionally and not all MBeans
		// are well-behaved if one asks for an empty list
		if ( attributeNames.length != 0 )
		{
			for( int i = 0; i < objectNames.length; ++i )
			{
				// copy names, in case an MBean messes with the array
				final String[]	attributesCopy	= (String[])attributeNames.clone();
				
				try
				{
					results[ i ]	= getMBeanServer().getAttributes( objectNames[ i ], attributesCopy );
				}
				catch( Throwable t )
				{
					results[ i ]	= t;
				}
			}
		}
		return( results );
	
public java.lang.Object[]bulkGetMBeanAttributeInfo(javax.management.ObjectName[] objectNames)

		final Object[]	results		= new Object[objectNames.length];
		final Object[]	mbeanInfos	= bulkGetMBeanInfo( objectNames );
		
		for( int i = 0; i < results.length; ++i )
		{
			if ( mbeanInfos[ i ] instanceof MBeanInfo )
			{
				results[ i ]	= ((MBeanInfo)mbeanInfos[ i ]).getAttributes();
			}
			else
			{
				results[ i ]	= mbeanInfos[ i ];
			}
		}
		return( results );
	
public java.lang.Object[]bulkGetMBeanInfo(javax.management.ObjectName[] objectNames)

		final Object[]	infos	= new Object[ objectNames.length ];
		
		for( int i = 0; i < infos.length; ++i )
		{
			try
			{
				infos[ i ]	= getMBeanServer().getMBeanInfo( objectNames[ i ] );
			}
			catch( Throwable t )
			{
				infos[ i ]	= t;
			}
		}
		return( infos );
	
public java.lang.Object[]bulkGetMBeanOperationInfo(javax.management.ObjectName[] objectNames)

		final Object[]	results	= new Object[ objectNames.length ];
		final Object[]	mbeanInfos	= bulkGetMBeanInfo( objectNames );
		
		for( int i = 0; i < results.length; ++i )
		{
			if ( mbeanInfos[ i ] instanceof MBeanInfo )
			{
				final MBeanInfo	info	= (MBeanInfo)mbeanInfos[ i ];
				
				results[ i ]	= info.getOperations();
			}
			else
			{
				results[ i ]	= mbeanInfos[ i ];
			}
		}
		return( results );
	
public java.lang.Object[]bulkInvoke(javax.management.ObjectName[] objectNames, java.lang.String operationName, java.lang.Object[] args, java.lang.String[] types)

		final Object[]	results	= new Object[ objectNames.length ];
		
		for( int i = 0; i < objectNames.length; ++i )
		{
			try
			{
				// hopefully the MBean won't alter the args or types
				results[ i ]	= getMBeanServer().invoke( objectNames[ i ],
									operationName, args, types );
			}
			catch( Throwable t )
			{
				results[ i ]	= t;
			}
		}
		return( results );
	
public java.lang.Object[]bulkSetAttribute(javax.management.ObjectName[] objectNames, javax.management.Attribute attr)

		final Object[]	results	= new Object[ objectNames.length ];
		
		for( int i = 0; i < objectNames.length; ++i )
		{
			try
			{
				results[ i ]	= null;
				getMBeanServer().setAttribute( objectNames[ i ], attr );
			}
			catch( Throwable t )
			{
				results[ i ]	= t;
			}
		}
		return( results );
	
public java.lang.Object[]bulkSetAttributes(javax.management.ObjectName[] objectNames, javax.management.AttributeList attrs)

		final Object[]	results	= new Object[ objectNames.length ];
		
		for( int i = 0; i < objectNames.length; ++i )
		{
			try
			{
				// avoid alterations to original copy
				final AttributeList	attrsCopy	= (AttributeList)attrs.clone();
				
				results[ i ]	= getMBeanServer().setAttributes( objectNames[ i ], attrsCopy );
			}
			catch( Throwable t )
			{
				results[ i ]	= t;
			}
		}
		return( results );
	
public java.lang.StringgetGroup()

		return( AMX.GROUP_UTILITY );