org.apache.beehive.netui.pageflow.interceptor
Class InterceptorChain

Object
  extended by InterceptorChain

public abstract class InterceptorChain
extends Object

Abstract base class that represents an interceptor chain.


Constructor Summary
protected InterceptorChain(InterceptorContext context, List interceptors)
          Create an interceptor chain with the InterceptorContext and a List of interceptors.
 
Method Summary
 Object continueChain()
          Execute the next interceptor in the chain of interceptors.
 InterceptorContext getContext()
          Get the InterceptorContext
protected abstract  Object invoke(Interceptor interceptor)
          Invoke an interceptor.
 boolean isEmpty()
          Check to see if the interception chain is empty.
protected  Interceptor removeFirst()
          Remove the first Interceptor that is currently the first interceptor in the chain.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptorChain

protected InterceptorChain(InterceptorContext context,
                           List interceptors)
Create an interceptor chain with the InterceptorContext and a List of interceptors.

Parameters:
context - the context
interceptors - the interceptors
Method Detail

continueChain

public Object continueChain()
                     throws InterceptorException
Execute the next interceptor in the chain of interceptors.

Returns:
the object returned when the interceptor is invoked
Throws:
InterceptorException - the exception thrown if an error occurs while invoking the interceptor

invoke

protected abstract Object invoke(Interceptor interceptor)
                          throws InterceptorException
Invoke an interceptor.

Parameters:
interceptor - the interceptor to invoke
Returns:
the interceptor's return value
Throws:
InterceptorException - the exception thrown if an error occurs while invoking the interceptor

getContext

public InterceptorContext getContext()
Get the InterceptorContext

Returns:
the context

isEmpty

public boolean isEmpty()
Check to see if the interception chain is empty.

Returns:
true if the chain is empty; false otherwise.

removeFirst

protected Interceptor removeFirst()
Remove the first Interceptor that is currently the first interceptor in the chain. This method can be used to advance to the "next" interceptor in the chain when executing a chain of interceptors.

Returns:
the first interceptor if one exists