|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.cache.interceptors.InterceptorChain
public class InterceptorChain
Knows how to build and manage an chain of interceptors. Also in charge with invoking methods on the chain.
Constructor Summary | |
---|---|
InterceptorChain(CommandInterceptor first)
Constructs an interceptor chain having the supplied interceptor as first. |
Method Summary | |
---|---|
boolean |
addAfterInterceptor(CommandInterceptor toAdd,
java.lang.Class<? extends CommandInterceptor> afterInterceptor)
Adds a new interceptor in list after an interceptor of a given type. |
boolean |
addBeforeInterceptor(CommandInterceptor toAdd,
java.lang.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. |
java.util.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()
|
java.lang.String |
getInterceptorDetails()
|
java.lang.String |
getInterceptorDetailsAsHtml()
|
java.util.List<CommandInterceptor> |
getInterceptorsWhichExtend(java.lang.Class<? extends CommandInterceptor> interceptorClass)
Returns all interceptors which extend the given command interceptor. |
java.util.List<CommandInterceptor> |
getInterceptorsWithClassName(java.lang.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)
|
java.lang.Object |
invoke(InvocationContext ctx,
VisitableCommand command)
Walks the command through the interceptor chain. |
java.lang.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. |
java.lang.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(java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InterceptorChain(CommandInterceptor first)
Method Detail |
---|
public void initialize(InvocationContextContainer invocationContextContainer)
public void addInterceptor(CommandInterceptor interceptor, int position)
java.lang.IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)public void removeInterceptor(int position)
java.lang.IllegalArgumentException
- if the position is invalid (e.g. 5 and there are only 2 interceptors in the chain)public int size()
public java.lang.String getInterceptorDetails()
public java.lang.String getInterceptorDetailsAsHtml()
public java.util.List<CommandInterceptor> asList()
public void removeInterceptor(java.lang.Class<? extends CommandInterceptor> clazz)
public boolean addAfterInterceptor(CommandInterceptor toAdd, java.lang.Class<? extends CommandInterceptor> afterInterceptor)
public boolean addBeforeInterceptor(CommandInterceptor toAdd, java.lang.Class<? extends CommandInterceptor> beforeInterceptor)
public void appendIntereceptor(CommandInterceptor ci)
public java.lang.Object invoke(InvocationContext ctx, VisitableCommand command)
public java.lang.Object invokeRemote(VisitableCommand cacheCommand) throws java.lang.Throwable
invoke(org.jboss.cache.InvocationContext , org.jboss.cache.commands.VisitableCommand)
, but
constructs a invocation context on the fly, using ThreadLocal.get()
java.lang.Throwable
public java.lang.Object invoke(VisitableCommand cacheCommand) throws java.lang.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.
java.lang.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 java.util.List<CommandInterceptor> getInterceptorsWhichExtend(java.lang.Class<? extends CommandInterceptor> interceptorClass)
public java.util.List<CommandInterceptor> getInterceptorsWithClassName(java.lang.String fqName)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean containsInstance(CommandInterceptor interceptor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |