public class InterceptorChain extends Object
Constructor and Description |
---|
InterceptorChain(CommandInterceptor first)
Constructs an interceptor chain having the supplied interceptor as first.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addAfterInterceptor(CommandInterceptor toAdd,
Class<? extends CommandInterceptor> afterInterceptor)
Adds a new interceptor in list after an interceptor of a given type.
|
boolean |
addBeforeInterceptor(CommandInterceptor toAdd,
Class<? extends CommandInterceptor> beforeInterceptor)
Adds a new interceptor in list after an interceptor of a given type.
|
void |
addInterceptor(CommandInterceptor interceptor,
int position)
Inserts the given interceptor at the specified position in the chain (o based indexing).
|
void |
appendIntereceptor(CommandInterceptor ci)
Appends at the end.
|
List<CommandInterceptor> |
asList()
Returns an unmofiable list with all the interceptors in sequence.
|
boolean |
containsInstance(CommandInterceptor interceptor)
Checks whether the chain contains the supplied interceptor instance.
|
CommandInterceptor |
getFirstInChain() |
String |
getInterceptorDetails() |
String |
getInterceptorDetailsAsHtml() |
List<CommandInterceptor> |
getInterceptorsWhichExtend(Class<? extends CommandInterceptor> interceptorClass)
Returns all interceptors which extend the given command interceptor.
|
List<CommandInterceptor> |
getInterceptorsWithClassName(String fqName)
Returns all the interceptors that have the fully qualified name of their class equal with the supplied class name.
|
InvocationContext |
getInvocationContext() |
void |
initialize(InvocationContextContainer invocationContextContainer) |
Object |
invoke(InvocationContext ctx,
VisitableCommand command)
Walks the command through the interceptor chain.
|
Object |
invoke(VisitableCommand cacheCommand)
Similar to
invoke(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand) , but
constructs a invocation context on the fly, using ThreadLocal.get() and setting the origin local flag to its default value. |
Object |
invokeRemote(VisitableCommand cacheCommand)
Similar to
invoke(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand) , but
constructs a invocation context on the fly, using ThreadLocal.get() |
void |
removeInterceptor(Class<? extends CommandInterceptor> clazz)
Removes all the occurences of supplied interceptor type from the chain.
|
void |
removeInterceptor(int position)
Removes the interceptor at the given postion.
|
void |
setFirstInChain(CommandInterceptor interceptor)
Mainly used by unit tests to replace the interceptor chain with the starting point passed in.
|
int |
size()
Returns the number of interceptors in the chain.
|
String |
toString() |
public InterceptorChain(CommandInterceptor first)
public void initialize(InvocationContextContainer invocationContextContainer)
public void addInterceptor(CommandInterceptor interceptor, int position)
IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)public void removeInterceptor(int position)
IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)public int size()
public String getInterceptorDetails()
public String getInterceptorDetailsAsHtml()
public List<CommandInterceptor> asList()
public void removeInterceptor(Class<? extends CommandInterceptor> clazz)
public boolean addAfterInterceptor(CommandInterceptor toAdd, Class<? extends CommandInterceptor> afterInterceptor)
public boolean addBeforeInterceptor(CommandInterceptor toAdd, Class<? extends CommandInterceptor> beforeInterceptor)
public void appendIntereceptor(CommandInterceptor ci)
public Object invoke(InvocationContext ctx, VisitableCommand command)
public Object invokeRemote(VisitableCommand cacheCommand) throws Throwable
invoke(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand)
, but
constructs a invocation context on the fly, using ThreadLocal.get()
Throwable
public Object invoke(VisitableCommand cacheCommand) throws Throwable
invoke(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand)
, but
constructs a invocation context on the fly, using ThreadLocal.get()
and setting the origin local flag to its default value.Throwable
public CommandInterceptor getFirstInChain()
public void setFirstInChain(CommandInterceptor interceptor)
interceptor
- interceptor to be used as the first interceptor in the chain.public InvocationContext getInvocationContext()
public List<CommandInterceptor> getInterceptorsWhichExtend(Class<? extends CommandInterceptor> interceptorClass)
public List<CommandInterceptor> getInterceptorsWithClassName(String fqName)
public boolean containsInstance(CommandInterceptor interceptor)
Copyright © 2012 JBoss, a division of Red Hat. All Rights Reserved.