eXo Kernel :: Container 2.5.0-GA

org.exoplatform.container
Class DefaultInterceptorChainFactory

java.lang.Object
  extended by org.exoplatform.container.DefaultInterceptorChainFactory
All Implemented Interfaces:
InterceptorChainFactory

public class DefaultInterceptorChainFactory
extends Object
implements InterceptorChainFactory

The default implementation of a InterceptorChainFactory. This implementation uses 3 static Interceptor which are ConcurrentContainer, CachingContainer and ManageableContainer and uses a list of dynamic Interceptor that are retrieved thanks to the ServiceLoader. Then according to the annotations Before and After defined on the dynamic Interceptor, it will define an ordered list of Interceptor classes which will be used at each next calls of getInterceptorChain(ExoContainer, ExoContainer) to re-create the exact same chain of Interceptor.

Version:
$Id$
Author:
Nicolas Filotto

Constructor Summary
DefaultInterceptorChainFactory()
           
 
Method Summary
protected  List<Interceptor> getDynamicInterceptors(ExoContainer holder, ExoContainer parent)
          Gives the dynamic Interceptor from the last to the head
 Interceptor getInterceptorChain(ExoContainer holder, ExoContainer parent)
          Creates a new Interceptor chain with the provided ExoContainer instance as parent container and with the provided ExoContainer as holder of the container.
protected  List<Interceptor> getStaticInterceptors(ExoContainer holder, ExoContainer parent)
          Gives the static Interceptor from the last to the head
protected  List<Interceptor> resolve(List<Interceptor> staticInts, List<Interceptor> dynamicInts)
          Resolves all the dynamic Interceptor and inject them into a list of Interceptor according to the annotation Before and After
protected  void resolveNext(List<Interceptor> alreadyResolved, Iterator<Interceptor> iter, boolean resolveIfAbsent)
          Resolves the next dynamic Interceptor using the annotation Before and After
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultInterceptorChainFactory

public DefaultInterceptorChainFactory()
Method Detail

getInterceptorChain

public Interceptor getInterceptorChain(ExoContainer holder,
                                       ExoContainer parent)
Creates a new Interceptor chain with the provided ExoContainer instance as parent container and with the provided ExoContainer as holder of the container. The holder is mostly used when it is required to be able to go through the chain of Interceptor

Specified by:
getInterceptorChain in interface InterceptorChainFactory
Parameters:
holder - the holder of the container
parent - the parent container, if null the container will be considered as the root container.
Returns:
an Interceptor corresponding to the head of the Interceptor chain

getStaticInterceptors

protected List<Interceptor> getStaticInterceptors(ExoContainer holder,
                                                  ExoContainer parent)
Gives the static Interceptor from the last to the head


getDynamicInterceptors

protected List<Interceptor> getDynamicInterceptors(ExoContainer holder,
                                                   ExoContainer parent)
Gives the dynamic Interceptor from the last to the head


resolve

protected List<Interceptor> resolve(List<Interceptor> staticInts,
                                    List<Interceptor> dynamicInts)
Resolves all the dynamic Interceptor and inject them into a list of Interceptor according to the annotation Before and After

Returns:
the ordered list of interceptors

resolveNext

protected void resolveNext(List<Interceptor> alreadyResolved,
                           Iterator<Interceptor> iter,
                           boolean resolveIfAbsent)
Resolves the next dynamic Interceptor using the annotation Before and After

Parameters:
alreadyResolved - the list of Interceptor already resolved
iter - the Iterator containing the remaining dynamic Interceptor to resolve
resolveIfAbsent - indicates if the interceptor must be resolved if the referred interceptor could not be found

eXo Kernel :: Container 2.5.0-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.