Package org.exoplatform.container
Class DefaultInterceptorChainFactory
java.lang.Object
org.exoplatform.container.DefaultInterceptorChainFactory
- All Implemented Interfaces:
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected List<Interceptor> getDynamicInterceptors(ExoContainer holder, ExoContainer parent) Gives the dynamicInterceptorfrom the last to the headgetInterceptorChain(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)
-
Constructor Details
-
DefaultInterceptorChainFactory
public DefaultInterceptorChainFactory()
-
-
Method Details
-
getInterceptorChain
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
Gives the staticInterceptorfrom the last to the head -
getDynamicInterceptors
Gives the dynamicInterceptorfrom the last to the head -
resolve
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
-