org.jboss.mx.interceptor
public class: DynamicInterceptor [javadoc |
source]
java.lang.Object
org.jboss.mx.interceptor.AbstractInterceptor
org.jboss.mx.interceptor.DynamicInterceptor
All Implemented Interfaces:
Interceptor
Interceptor that provides access to the org.jboss.mx.server.Interceptable hooks
for dynamically adding and removing interceptors to an MBean.
- author:
< - a href="mailto:dimitris@jboss.org">Dimitris Andreadis.
- version:
$ - Revision: 39975 $
| Field Summary |
|---|
| public static final String | ADD_INTERCEPTOR | methods implemented from org.jboss.mx.server.Interceptable |
| public static final String | REMOVE_INTERCEPTOR | |
| MBeanInvoker | invoker | the invoker implementing Interceptable |
| Method from org.jboss.mx.interceptor.DynamicInterceptor Summary: |
|---|
|
invoke |
| Method from org.jboss.mx.interceptor.DynamicInterceptor Detail: |
public Object invoke(Invocation invocation) throws Throwable {
String type = invocation.getType();
// implement Interceptable by delegating to MBeanInvoker
if (type.equals(Invocation.OP_INVOKE))
{
String name = invocation.getName();
if (name.equals(ADD_INTERCEPTOR))
{
Object args[] = invocation.getArgs();
Object retn = invocation.getReturnTypeClass();
if ((args.length == 1) && (args[0] instanceof Interceptor) && (retn == null))
{
invoker.addOperationInterceptor((Interceptor)args[0]);
return null;
}
}
else if (name.equals(REMOVE_INTERCEPTOR))
{
Object args[] = invocation.getArgs();
Object retn = invocation.getReturnTypeClass();
if ((args.length == 1) && (args[0] instanceof Interceptor) && (retn == null))
{
invoker.removeOperationInterceptor((Interceptor)args[0]);
return null;
}
}
}
// call the next in the interceptor chain,
// if nobody follows dispatch the call
Interceptor next = invocation.nextInterceptor();
if (next != null)
{
return next.invoke(invocation);
}
else
{
return invocation.dispatch();
}
}
|