public class DefaultInterceptorChainFactory extends Object implements InterceptorChainFactory
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.| Constructor and Description |
|---|
DefaultInterceptorChainFactory() |
| Modifier and Type | Method and Description |
|---|---|
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)
|
public Interceptor getInterceptorChain(ExoContainer holder, ExoContainer parent)
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 InterceptorgetInterceptorChain in interface InterceptorChainFactoryholder - the holder of the containerparent - the parent container, if null the container will be considered
as the root container.Interceptor corresponding to the head of the Interceptor chainprotected List<Interceptor> getStaticInterceptors(ExoContainer holder, ExoContainer parent)
Interceptor from the last to the headprotected List<Interceptor> getDynamicInterceptors(ExoContainer holder, ExoContainer parent)
Interceptor from the last to the headprotected List<Interceptor> resolve(List<Interceptor> staticInts, List<Interceptor> dynamicInts)
Interceptor and inject them into a list of Interceptor
according to the annotation Before and Afterprotected void resolveNext(List<Interceptor> alreadyResolved, Iterator<Interceptor> iter, boolean resolveIfAbsent)
alreadyResolved - the list of Interceptor already resolvediter - the Iterator containing the remaining dynamic Interceptor to resolveresolveIfAbsent - indicates if the interceptor must be resolved if the referred interceptor could not
be foundCopyright © 2018 eXo Platform SAS. All Rights Reserved.