org.jboss.cache.factories
Class InterceptorChainFactory

java.lang.Object
  extended by org.jboss.cache.factories.InterceptorChainFactory

public class InterceptorChainFactory
extends java.lang.Object

Factory class that builds an interceptor chain based on CacheImpl config.

Author:
Manik Surtani (manik@jboss.org)

Method Summary
 java.util.List<Interceptor> asList(Interceptor interceptor)
           
 Interceptor buildInterceptorChain(CacheImpl cache)
           
 Interceptor correctInterceptorChaining(java.util.List<Interceptor> interceptors)
          "Fixes" the next() and last() pointers for each interceptor, based on the order presented in the list passed in
static InterceptorChainFactory getInstance()
           
 void initialiseInterceptors(Interceptor firstInterceptor, CacheSPI cache)
          Initialises the interceptors with a CacheSPI instance.
 java.lang.String printInterceptorChain(Interceptor i)
           
 Interceptor setLastInterceptorPointer(Interceptor first, Interceptor last)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static InterceptorChainFactory getInstance()

buildInterceptorChain

public Interceptor buildInterceptorChain(CacheImpl cache)
                                  throws java.lang.IllegalAccessException,
                                         java.lang.ClassNotFoundException,
                                         java.lang.InstantiationException
Throws:
java.lang.IllegalAccessException
java.lang.ClassNotFoundException
java.lang.InstantiationException

setLastInterceptorPointer

public Interceptor setLastInterceptorPointer(Interceptor first,
                                             Interceptor last)

printInterceptorChain

public java.lang.String printInterceptorChain(Interceptor i)

asList

public java.util.List<Interceptor> asList(Interceptor interceptor)

correctInterceptorChaining

public Interceptor correctInterceptorChaining(java.util.List<Interceptor> interceptors)
"Fixes" the next() and last() pointers for each interceptor, based on the order presented in the list passed in

Parameters:
interceptors -
Returns:
the first interceptor in the chain.

initialiseInterceptors

public void initialiseInterceptors(Interceptor firstInterceptor,
                                   CacheSPI cache)
Initialises the interceptors with a CacheSPI instance. Essentially calls setCache(). This is done AFTER the interceptor chain is created, and when Cache.start() is called, so the interceptors get a fully initialised cache.

Parameters:
firstInterceptor - interceptor chain
cache - cache instance