FileDocCategorySizeDatePackage
MBeanServerConnection_Hook.javaAPI DocGlassfish v2 API22936Fri May 18 09:30:22 BST 2007com.sun.appserv.management.util.jmx

MBeanServerConnection_Hook

public class MBeanServerConnection_Hook extends Object implements MBeanServerConnection
This class wraps an MBeanServerConnection and provides hooks on each method call via its Hook interface. Typical used would be for a subclass to

Fields Summary
private final MBeanServerConnection
mConn
public static final String
CREATE_MBEAN
public static final String
UNREGISTER_MBEAN
public static final String
REGISTER_MBEAN
public static final String
GET_OBJECT_INSTANCE
public static final String
QUERY_MBEANS
public static final String
QUERY_NAMES
public static final String
GET_DOMAINS
public static final String
IS_REGISTERED
public static final String
GET_MBEAN_COUNT
public static final String
GET_ATTRIBUTE
public static final String
GET_ATTRIBUTES
public static final String
SET_ATTRIBUTE
public static final String
SET_ATTRIBUTES
public static final String
INVOKE
public static final String
GET_DEFAULT_DOMAIN
public static final String
ADD_NOTIFICATION_LISTENER
public static final String
REMOVE_NOTIFICATION_LISTENER
public static final String
GET_MBEAN_INFO
public static final String
IS_INSTANCE_OF
Constructors Summary
public MBeanServerConnection_Hook(MBeanServerConnection conn)

		mConn	= conn;
		
		assert( getConn() != null );
		
	
Methods Summary
public voidaddNotificationListener(javax.management.ObjectName name, javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)

		final Object []	args	= new Object [] { name, listener, filter, handback  };
		final long id = callPreHook( ADD_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().addNotificationListener( callNameHook( id, name ), listener, filter, handback );
			
			callPostHook( id, ADD_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, ADD_NOTIFICATION_LISTENER, name, args );
		}
	
public voidaddNotificationListener(javax.management.ObjectName name, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)

		final Object []	args	= new Object [] { name, listener, filter, handback  };
		final long id = callPreHook( ADD_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().addNotificationListener( callNameHook( id, name ), listener, filter, handback );
			
			callPostHook( id, ADD_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, ADD_NOTIFICATION_LISTENER, name, args );
		}
	
voidcallIOExceptionHook(long id, java.io.IOException e, java.lang.String operationName, javax.management.ObjectName objectName, java.lang.Object[] allArgs)

		getHook().IOExceptionHook( id, e, operationName, objectName, allArgs );
	
javax.management.ObjectNamecallNameHook(long id, javax.management.ObjectName objectName)

		return( getHook().nameHook( id, objectName ) );
	
voidcallPostHook(long id, java.lang.String name, java.lang.Object[] args, java.lang.Object result)

		getHook().postHook( id, name, args, result );
	
voidcallPostHook(long id, java.lang.String name, java.lang.Object[] args)

		getHook().postHook( id, name, args );
	
voidcallPostHook(long id, java.lang.String name)

		getHook().postHook( id, name );
	
longcallPreHook(java.lang.String name, java.lang.Object[] args)

		return( getHook().preHook( name, args ) );
	
longcallPreHook(java.lang.String name)

		return( getHook().preHook( name ) );
	
public javax.management.ObjectInstancecreateMBean(java.lang.String className, javax.management.ObjectName name)


	
	
	     
		  
		    
		    
	
		final Object []	args	= new Object [] { className, name };
		
		final long id = callPreHook( CREATE_MBEAN, args );
		
		ObjectInstance	result	= null;
		try
		{
			result	= getConn().createMBean( className, name );
			callPostHook( id, CREATE_MBEAN, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, CREATE_MBEAN, name, args );
		}
		
		return( result );
	
public javax.management.ObjectInstancecreateMBean(java.lang.String className, javax.management.ObjectName name, javax.management.ObjectName loaderName)

		final Object []	args	= new Object [] { className, name, loaderName };
		final long id = callPreHook( CREATE_MBEAN, args );
		
		ObjectInstance	result	= null;
		try
		{
			result	= getConn().createMBean( className, name, loaderName );
			callPostHook( id, CREATE_MBEAN, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, CREATE_MBEAN, name, args );
		}
		catch( InstanceNotFoundException e )
		{
			getHook().InstanceNotFoundExceptionHook( CREATE_MBEAN, id, e );
		}
		
		return( result );
	
public javax.management.ObjectInstancecreateMBean(java.lang.String className, javax.management.ObjectName name, java.lang.Object[] params, java.lang.String[] signature)

		final Object []	args	= new Object [] { className, name, params, signature };
		final long id = callPreHook( CREATE_MBEAN, args );
		
		ObjectInstance	result	= null;
		try
		{
			result	= getConn().createMBean( className, name, params, signature );
			callPostHook( id, CREATE_MBEAN, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, CREATE_MBEAN, name, args );
		}
		
		return( result );
	
public javax.management.ObjectInstancecreateMBean(java.lang.String className, javax.management.ObjectName name, javax.management.ObjectName loaderName, java.lang.Object[] params, java.lang.String[] signature)

		final Object []	args	= new Object [] { className, name, loaderName, params, signature };
		final long id = callPreHook( CREATE_MBEAN, args );
		
		ObjectInstance	result	= null;
		try
		{
			result	= getConn().createMBean( className, name, loaderName, params, signature);
			
			callPostHook( id, CREATE_MBEAN, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, CREATE_MBEAN, name, args );
		}
		catch( InstanceNotFoundException e )
		{
			getHook().InstanceNotFoundExceptionHook( CREATE_MBEAN, id, e );
		}
		
		return( result );
	
public java.lang.ObjectgetAttribute(javax.management.ObjectName name, java.lang.String attribute)

		final Object []	args	= new Object [] { name, attribute };
		final long id = callPreHook( GET_ATTRIBUTE, args );
		
		Object result	= null;
		try
		{
			result	= getConn().getAttribute( callNameHook( id, name ), attribute );
			
			callPostHook( id, GET_ATTRIBUTE, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_ATTRIBUTE, name, args );
		}
		
		return( result );
	
public javax.management.AttributeListgetAttributes(javax.management.ObjectName name, java.lang.String[] attributes)

		final Object []	args	= new Object [] { name, attributes };
		final long id = callPreHook( GET_ATTRIBUTES, args );
		
		AttributeList result	= null;
		try
		{
			final ObjectName	actualName	= callNameHook( id, name );
			
			result	= getConn().getAttributes(actualName , attributes );
			
			callPostHook( id, GET_ATTRIBUTES, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_ATTRIBUTES, name, args );
		}
		
		return( result );
	
javax.management.MBeanServerConnectiongetConn()

		return( mConn );
	
public java.lang.StringgetDefaultDomain()

		final long id = callPreHook( GET_DEFAULT_DOMAIN );
		
		String	result	= null;
		try
		{
			result	= getConn().getDefaultDomain();
				
			callPostHook( id, GET_DEFAULT_DOMAIN );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_DEFAULT_DOMAIN, null, null );
		}
		
		return( result );
	
public java.lang.String[]getDomains()

		final long id = callPreHook( GET_DOMAINS );
		
		String[]	result	= null;
		try
		{
			result 	= getConn().getDomains( );
				
			callPostHook( id, GET_DOMAINS, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_DOMAINS, null, null );
		}
		
		return( result );
	
com.sun.appserv.management.util.jmx.MBeanServerConnection_Hook$HookgetHook()

		return( HookImpl.HOOK );
	
public java.lang.IntegergetMBeanCount()

		final long id = callPreHook( GET_MBEAN_COUNT, null );
		
		Integer	result	= null;
		try
		{
			result	= getConn().getMBeanCount( );
			
			callPostHook( id, GET_MBEAN_COUNT, null, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_MBEAN_COUNT, null, null );
		}
		
		return( result );
	
public javax.management.MBeanInfogetMBeanInfo(javax.management.ObjectName name)

		final Object []	args	= new Object [] { name };
		final long id = callPreHook( GET_MBEAN_INFO, args );
		
		MBeanInfo	result	= null;
		try
		{
			result	= getConn().getMBeanInfo( callNameHook( id, name ) );
			
			callPostHook( id, GET_MBEAN_INFO, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id,  e, GET_MBEAN_INFO, name, args );
		}
		
		return( result );
	
public javax.management.ObjectInstancegetObjectInstance(javax.management.ObjectName name)

		final Object []	args	= new Object [] { name };
		final long id = callPreHook( GET_OBJECT_INSTANCE, args );
		
		ObjectInstance	result	= null;
		try
		{
			result	= getConn().getObjectInstance( callNameHook( id, name ) );
			
			callPostHook( id, GET_OBJECT_INSTANCE, args, result );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, GET_OBJECT_INSTANCE, name, args );
		}
		catch( InstanceNotFoundException e )
		{
			getHook().InstanceNotFoundExceptionHook( GET_OBJECT_INSTANCE, id, e );
		}
		
		return( result );
	
public java.lang.Objectinvoke(javax.management.ObjectName name, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)

		final Object []	args	= new Object [] { name, operationName, params, signature };
		final long id = callPreHook( INVOKE, args );
		
		Object	result	= null;
		try
		{
			result	= getConn().invoke( callNameHook( id, name ), operationName, params, signature);
		
			callPostHook( id, INVOKE, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, INVOKE, name, args );
		}
		return( result );
	
public booleanisInstanceOf(javax.management.ObjectName name, java.lang.String className)

		final Object []	args	= new Object [] { name, className };
		final long id = callPreHook( IS_INSTANCE_OF, args );
		
		boolean	isInstance	= false;
		try
		{
			isInstance	= getConn().isInstanceOf( callNameHook( id, name ), className );
			
			callPostHook( id, IS_INSTANCE_OF, args, isInstance ? Boolean.TRUE : Boolean.FALSE );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, IS_INSTANCE_OF, name, args );
		}
		
		return( isInstance );
	
public booleanisRegistered(javax.management.ObjectName name)

		final Object []	args	= new Object [] { name };
		final long id = callPreHook( IS_REGISTERED, args );
		
		boolean	registered	= false;
		
		try
		{
			registered	= getConn().isRegistered( callNameHook( id, name) );
			
			callPostHook( id, IS_REGISTERED, args, registered ? Boolean.TRUE : Boolean.FALSE );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, IS_REGISTERED, name, args );
		}
		
		return( registered );
	
public java.util.SetqueryMBeans(javax.management.ObjectName name, javax.management.QueryExp query)

		final Object []	args	= new Object [] { name, query };
		final long id = callPreHook( QUERY_MBEANS, args );
		
		Set<ObjectInstance> result = null;
		try
		{
			result	= TypeCast.asSet( getConn().queryMBeans( name, query ) );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, QUERY_MBEANS, name, args );
		}
		
		callPostHook( id, QUERY_MBEANS, args, result );
		
		return( result );
	
public java.util.SetqueryNames(javax.management.ObjectName name, javax.management.QueryExp query)

		final Object []	args	= new Object [] { name, query };
		final long id = callPreHook( QUERY_NAMES, args );
		
		Set<ObjectName>	result	= null;
		try
		{
			result	= JMXUtil.queryNames( getConn(), name, query );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, QUERY_NAMES, name, args );
		}
		
		callPostHook( id, QUERY_NAMES, args, result );
		
		return( result );
	
public voidremoveNotificationListener(javax.management.ObjectName name, javax.management.ObjectName listener)

		final Object []	args	= new Object [] { listener };
		final long id = callPreHook( REMOVE_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().removeNotificationListener( callNameHook( id, name ), listener );
			
			callPostHook( id, REMOVE_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, REMOVE_NOTIFICATION_LISTENER, name, args );
		}
	
public voidremoveNotificationListener(javax.management.ObjectName name, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)

		final Object []	args	= new Object [] { name, listener, filter, handback };
		final long id = callPreHook( REMOVE_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().removeNotificationListener( callNameHook( id, name ), listener, filter, handback );
			
			callPostHook( id, REMOVE_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, REMOVE_NOTIFICATION_LISTENER, name, args );
		}
	
public voidremoveNotificationListener(javax.management.ObjectName name, javax.management.NotificationListener listener)

		final Object []	args	= new Object [] { name, listener };
		final long id = callPreHook( REMOVE_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().removeNotificationListener( callNameHook( id, name ), listener  );
			
			callPostHook( id, REMOVE_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, REMOVE_NOTIFICATION_LISTENER, name, args );
		}
	
public voidremoveNotificationListener(javax.management.ObjectName name, javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)

		final Object []	args	= new Object [] { name, listener, filter, handback };
		final long id = callPreHook( REMOVE_NOTIFICATION_LISTENER, args );
		
		try
		{
			getConn().removeNotificationListener( callNameHook( id, name ), listener, filter, handback );
			
			callPostHook( id, REMOVE_NOTIFICATION_LISTENER, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, REMOVE_NOTIFICATION_LISTENER, name, args );
		}
	
public voidsetAttribute(javax.management.ObjectName name, javax.management.Attribute attribute)

		final Object []	args	= new Object [] { name, attribute };
		final long id = callPreHook( SET_ATTRIBUTE, args );
		
		try
		{
			getConn().setAttribute( callNameHook( id, name ), attribute );
			
			callPostHook( id, SET_ATTRIBUTE, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, SET_ATTRIBUTE, name, args );
		}
	
public javax.management.AttributeListsetAttributes(javax.management.ObjectName name, javax.management.AttributeList attributes)

		final Object []	args	= new Object [] { name, attributes };
		final long id = callPreHook( SET_ATTRIBUTES, args );
		
		AttributeList result	= null;
		
		try
		{
			result	= getConn().setAttributes( callNameHook( id, name ), attributes );
		
			callPostHook( id, SET_ATTRIBUTES, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, SET_ATTRIBUTES, name, args );
		}
		
		return( result );
	
public voidunregisterMBean(javax.management.ObjectName name)

		final Object []	args	= new Object [] { name };
		final long id = callPreHook( UNREGISTER_MBEAN, args );
		
		try
		{
			getConn().unregisterMBean( callNameHook( id, name ) );
			
			callPostHook( id, UNREGISTER_MBEAN, args );
		}
		catch( IOException e )
		{
			callIOExceptionHook( id, e, UNREGISTER_MBEAN, name, args );
		}
		catch( InstanceNotFoundException e )
		{
			getHook().InstanceNotFoundExceptionHook( UNREGISTER_MBEAN, id, e );
		}