mx4j.adaptor.interceptor
Class AdaptorInterceptor

java.lang.Object
  extended bymx4j.adaptor.interceptor.AdaptorInterceptor
All Implemented Interfaces:
AdaptorInterceptorMBean, Interceptor, Invocable
Direct Known Subclasses:
ContextClassLoaderAdaptorInterceptor, InvokerAdaptorInterceptor, LoggerAdaptorInterceptor, TimingAdaptorInterceptor

public class AdaptorInterceptor
extends java.lang.Object
implements Interceptor, AdaptorInterceptorMBean

The base adaptor interceptor implementation

Version:
$Revision: 1.6 $
Author:
Simone Bordet

Constructor Summary
AdaptorInterceptor()
           
 
Method Summary
protected  InvocationResult doInvoke(Invocation invocation)
          The real invocation on the interceptor chain.
protected  Logger getLogger()
           
 MBeanServer getMBeanServer()
           
protected  Interceptor getNext()
           
 ObjectName getObjectName()
          Returns the object name explicitely set by setObjectName(javax.management.ObjectName)
 java.lang.String getType()
          Returns the type of this interceptor
 InvocationResult invoke(Invocation invocation)
          Invocation method
 boolean isEnabled()
          Returns whether this interceptor is enabled
protected  void postInvoke(Invocation invocation)
          Called after the real invocation in the interceptor chain.
protected  void preInvoke(Invocation invocation)
          Called before the real invocation on the interceptor chain.
 void setEnabled(boolean value)
          Enables or disables this interceptor
 void setMBeanServer(MBeanServer server)
           
 void setNext(Interceptor interceptor)
          Sets the next interceptor in the chain
 void setObjectName(ObjectName name)
          Explicitely sets the object name of this interceptor in case it is registered with an MBeanServer.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AdaptorInterceptor

public AdaptorInterceptor()
Method Detail

getMBeanServer

public MBeanServer getMBeanServer()

setMBeanServer

public void setMBeanServer(MBeanServer server)

setNext

public void setNext(Interceptor interceptor)
Description copied from interface: Interceptor
Sets the next interceptor in the chain

Specified by:
setNext in interface Interceptor

getNext

protected Interceptor getNext()

setObjectName

public void setObjectName(ObjectName name)
Explicitely sets the object name of this interceptor in case it is registered with an MBeanServer.
If not set, the object name will be deducted from the adaptor's object name and from this interceptor's name.

See Also:
getObjectName(), getType()

getObjectName

public ObjectName getObjectName()
Returns the object name explicitely set by setObjectName(javax.management.ObjectName)


preInvoke

protected void preInvoke(Invocation invocation)
                  throws java.lang.Exception
Called before the real invocation on the interceptor chain.
By default does nothing; exception thrown by this method will result in doInvoke(mx4j.adaptor.interceptor.Invocation) not being called. Subclasses normally override this method to perform some operation before the real invocation on the interceptor chain.

Throws:
java.lang.Exception
See Also:
postInvoke(mx4j.adaptor.interceptor.Invocation)

invoke

public InvocationResult invoke(Invocation invocation)
                        throws java.lang.Exception
Description copied from interface: Invocable
Invocation method

Specified by:
invoke in interface Invocable
Throws:
java.lang.Exception

doInvoke

protected InvocationResult doInvoke(Invocation invocation)
                             throws java.lang.Exception
The real invocation on the interceptor chain.
By default calls the next interceptor in the chain.

Throws:
java.lang.Exception
See Also:
setNext(mx4j.adaptor.interceptor.Interceptor), preInvoke(mx4j.adaptor.interceptor.Invocation), postInvoke(mx4j.adaptor.interceptor.Invocation)

postInvoke

protected void postInvoke(Invocation invocation)
                   throws java.lang.Exception
Called after the real invocation in the interceptor chain.
By default does nothing; exception thrown by this method will be just logged. This method is always called, even in case of exception thrown by preInvoke(mx4j.adaptor.interceptor.Invocation) or by doInvoke(mx4j.adaptor.interceptor.Invocation) Subclasses normally override this method to perform some operation after the real invocation on the interceptor chain.

Throws:
java.lang.Exception
See Also:
preInvoke(mx4j.adaptor.interceptor.Invocation)

getType

public java.lang.String getType()
Description copied from interface: Interceptor
Returns the type of this interceptor

Specified by:
getType in interface Interceptor

setEnabled

public void setEnabled(boolean value)
Description copied from interface: AdaptorInterceptorMBean
Enables or disables this interceptor

Specified by:
setEnabled in interface AdaptorInterceptorMBean

isEnabled

public boolean isEnabled()
Description copied from interface: AdaptorInterceptorMBean
Returns whether this interceptor is enabled

Specified by:
isEnabled in interface AdaptorInterceptorMBean

getLogger

protected Logger getLogger()

toString

public java.lang.String toString()


Copyright © 2001-2002 MX4J Team. All Rights Reserved.