Package org.exoplatform.container
Class DefaultInterceptorChainFactory
- java.lang.Object
-
- org.exoplatform.container.DefaultInterceptorChainFactory
-
- All Implemented Interfaces:
InterceptorChainFactory
public class DefaultInterceptorChainFactory extends Object implements InterceptorChainFactory
The default implementation of aInterceptorChainFactory. This implementation uses 3 staticInterceptorwhich areConcurrentContainer,CachingContainerandManageableContainerand uses a list of dynamicInterceptorthat are retrieved thanks to theServiceLoader. Then according to the annotationsBeforeandAfterdefined on the dynamicInterceptor, it will define an ordered list ofInterceptorclasses which will be used at each next calls ofgetInterceptorChain(ExoContainer, ExoContainer)to re-create the exact same chain ofInterceptor.- Version:
- $Id$
- Author:
- Nicolas Filotto
-
-
Constructor Summary
Constructors Constructor Description DefaultInterceptorChainFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<Interceptor>getDynamicInterceptors(ExoContainer holder, ExoContainer parent)Gives the dynamicInterceptorfrom the last to the headInterceptorgetInterceptorChain(ExoContainer holder, ExoContainer parent)Creates a newInterceptorchain with the providedExoContainerinstance as parent container and with the providedExoContaineras holder of the container.protected List<Interceptor>getStaticInterceptors(ExoContainer holder, ExoContainer parent)Gives the staticInterceptorfrom the last to the headprotected List<Interceptor>resolve(List<Interceptor> staticInts, List<Interceptor> dynamicInts)Resolves all the dynamicInterceptorand inject them into a list ofInterceptoraccording to the annotationBeforeandAfterprotected voidresolveNext(List<Interceptor> alreadyResolved, Iterator<Interceptor> iter, boolean resolveIfAbsent)
-
-
-
Method Detail
-
getInterceptorChain
public Interceptor getInterceptorChain(ExoContainer holder, ExoContainer parent)
Creates a newInterceptorchain with the providedExoContainerinstance as parent container and with the providedExoContaineras holder of the container. The holder is mostly used when it is required to be able to go through the chain ofInterceptor- Specified by:
getInterceptorChainin interfaceInterceptorChainFactory- Parameters:
holder- the holder of the containerparent- the parent container, ifnullthe container will be considered as the root container.- Returns:
- an
Interceptorcorresponding to the head of theInterceptorchain
-
getStaticInterceptors
protected List<Interceptor> getStaticInterceptors(ExoContainer holder, ExoContainer parent)
Gives the staticInterceptorfrom the last to the head
-
getDynamicInterceptors
protected List<Interceptor> getDynamicInterceptors(ExoContainer holder, ExoContainer parent)
Gives the dynamicInterceptorfrom the last to the head
-
resolve
protected List<Interceptor> resolve(List<Interceptor> staticInts, List<Interceptor> dynamicInts)
Resolves all the dynamicInterceptorand inject them into a list ofInterceptoraccording to the annotationBeforeandAfter- Returns:
- the ordered list of interceptors
-
resolveNext
protected void resolveNext(List<Interceptor> alreadyResolved, Iterator<Interceptor> iter, boolean resolveIfAbsent)
- Parameters:
alreadyResolved- the list ofInterceptoralready resolvediter- the Iterator containing the remaining dynamicInterceptorto resolveresolveIfAbsent- indicates if the interceptor must be resolved if the referred interceptor could not be found
-
-