org.apache.webbeans.intercept
Class InterceptorHandler

java.lang.Object
  extended by org.apache.webbeans.intercept.InterceptorHandler
All Implemented Interfaces:
Serializable, javassist.util.proxy.MethodHandler
Direct Known Subclasses:
DependentScopedBeanInterceptorHandler, NormalScopedBeanInterceptorHandler

public abstract class InterceptorHandler
extends Object
implements javassist.util.proxy.MethodHandler, Serializable

Logic for how interceptors & decorators work in OWB.

Version:
$Rev: 1182780 $ $Date: 2011-10-13 13:11:03 +0200 (Do, 13 Okt 2011) $
See Also:
WebBeansInterceptorConfig, WebBeansDecoratorConfig, WebBeansInterceptor, WebBeansDecorator, EJBInterceptorConfig, Serialized Form

Field Summary
protected  OwbBean<?> bean
          Proxied bean
protected  Map<Method,List<InterceptorData>> interceptedMethodMap
          Intercepted methods
protected  WebBeansContext webBeansContext
           
 
Constructor Summary
protected InterceptorHandler(OwbBean<?> bean)
          Creates a new handler.
 
Method Summary
protected abstract  Object callAroundInvokes(Method interceptedMethod, Object[] arguments, List<InterceptorData> stack)
          Call around invoke method of the given bean on calling interceptedMethod.
protected  BeanManagerImpl getBeanManager()
           
 Object invoke(Object instance, Method method, Method proceed, Object[] arguments, CreationalContextImpl<?> ownerCreationalContext)
          Calls decorators and interceptors and actual bean method.
protected  boolean isNotInterceptedOrDecoratedMethod(Method method)
          This method provides a way to implement a negative cache for methods which are known to become intercepted or decorated.
protected  void setNotInterceptedOrDecoratedMethod(Method method)
          This method will get called after the interceptorStack got evaluated and we found out that it isnt intercepted nor decorated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javassist.util.proxy.MethodHandler
invoke
 

Field Detail

bean

protected OwbBean<?> bean
Proxied bean


interceptedMethodMap

protected transient volatile Map<Method,List<InterceptorData>> interceptedMethodMap
Intercepted methods


webBeansContext

protected WebBeansContext webBeansContext
Constructor Detail

InterceptorHandler

protected InterceptorHandler(OwbBean<?> bean)
Creates a new handler.

Parameters:
bean - proxied bean
Method Detail

isNotInterceptedOrDecoratedMethod

protected boolean isNotInterceptedOrDecoratedMethod(Method method)
This method provides a way to implement a negative cache for methods which are known to become intercepted or decorated. This is useful since the calculation actually takes a lot of time.

Parameters:
method - which should get invoked
Returns:
true if the method is known to not get intercepted, false we dont know or it gets intercepted
See Also:
setNotInterceptedOrDecoratedMethod(java.lang.reflect.Method)

setNotInterceptedOrDecoratedMethod

protected void setNotInterceptedOrDecoratedMethod(Method method)
This method will get called after the interceptorStack got evaluated and we found out that it isnt intercepted nor decorated. The information might get cache to skip the evaluation in a later invocation.

Parameters:
method -
See Also:
isNotInterceptedOrDecoratedMethod(java.lang.reflect.Method)

invoke

public Object invoke(Object instance,
                     Method method,
                     Method proceed,
                     Object[] arguments,
                     CreationalContextImpl<?> ownerCreationalContext)
              throws Exception
Calls decorators and interceptors and actual bean method.

Parameters:
instance - actual bean instance
method - business method
proceed - proceed method
arguments - method arguments
ownerCreationalContext - bean creational context
Returns:
method result
Throws:
Exception - for exception

callAroundInvokes

protected abstract Object callAroundInvokes(Method interceptedMethod,
                                            Object[] arguments,
                                            List<InterceptorData> stack)
                                     throws Exception
Call around invoke method of the given bean on calling interceptedMethod.

Parameters:
interceptedMethod - intercepted bean method
arguments - method actual arguments
stack - interceptor stack
Returns:
return of method
Throws:
Exception - for any exception

getBeanManager

protected BeanManagerImpl getBeanManager()
Returns:
bean manager


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.