org.sape.carbon.core.component.proxy
Class AbstractInterceptor

java.lang.Object
  |
  +--org.sape.carbon.core.component.proxy.AbstractInterceptor
All Implemented Interfaces:
Decorator, Interceptor
Direct Known Subclasses:
DefaultLifecycleInterceptor

public abstract class AbstractInterceptor
extends Object
implements Interceptor

This is the abstract interceptor that can provide basic tracking and next interceptor calling for subclassed interceptors. This implementation will also shortcut calls to DynamicProxy classes acting as interceptors by skipping their proxy classes and directly calling the Copyright 2003 Sapient

Since:
carbon 2.1
Version:
$Revision: 1.1 $($Author: ghinkl $ / $Date: 2003/10/15 01:03:26 $)
Author:
Greg Hinkle, October 2003

Field Summary
private  Method interceptorMethod
          The interceptor method object for the "invoke" method.
protected  Interceptor nextInterceptor
          The next interceptor in the chain after this one.
protected  boolean nextInterceptorIsProxy
          True if the next interceptor is a dynamic proxy.
protected  InvocationHandler nextInvocationHandler
          If the next interceptor is a dynamic proxy, this will hold a reference to its invocation handler.
 
Constructor Summary
AbstractInterceptor()
           
 
Method Summary
protected  Object callNextInterceptor(Invocation invocation)
          Will forward on an interceptor call to the next interceptor in the chain.
 void setNextInterceptor(Interceptor interceptor)
          Prepares the interceptor chain by setting the next interceptor that this one will forward to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sape.carbon.core.component.proxy.Interceptor
invoke
 
Methods inherited from interface org.sape.carbon.core.component.proxy.Decorator
getExposedInterfaces, setComponentReference
 

Field Detail

nextInterceptor

protected Interceptor nextInterceptor
The next interceptor in the chain after this one.


nextInterceptorIsProxy

protected boolean nextInterceptorIsProxy
True if the next interceptor is a dynamic proxy.


nextInvocationHandler

protected InvocationHandler nextInvocationHandler
If the next interceptor is a dynamic proxy, this will hold a reference to its invocation handler.


interceptorMethod

private Method interceptorMethod
The interceptor method object for the "invoke" method.

Constructor Detail

AbstractInterceptor

public AbstractInterceptor()
Method Detail

setNextInterceptor

public void setNextInterceptor(Interceptor interceptor)
Prepares the interceptor chain by setting the next interceptor that this one will forward to. It will also prepare for calls to DynamicProxies.

Specified by:
setNextInterceptor in interface Interceptor
Parameters:
interceptor - the next interceptor in the chain

callNextInterceptor

protected Object callNextInterceptor(Invocation invocation)
                              throws Throwable
Will forward on an interceptor call to the next interceptor in the chain.

Parameters:
invocation - the invocation in progress
Returns:
the return value of the component invocation
Throws:
Throwable - the exception caused by the invocation


Copyright 1999-2003 Sapient Corporation. All Rights Reserved.