org.jboss.mx.interceptor
abstract public class: AbstractInterceptor [javadoc |
source]
java.lang.Object
org.jboss.mx.interceptor.AbstractInterceptor
All Implemented Interfaces:
Interceptor
Direct Known Subclasses:
MBeanAttributeInterceptor, JNDISecurity, NullInterceptor, DynamicInterceptor, NullDispatcher, XMBeanInterceptor, AuthorizationInterceptor, JNDIPersistence, ReflectedDispatcher, StandardMBeanInterceptor, AttributeDispatcher, ModelMBeanInterceptor, ModelMBeanInfoInterceptor, AbstractSharedInterceptor, SubDeployerInterceptor, ProxyFactoryInterceptor, ModelMBeanOperationInterceptor, ProxyFactoryInterceptor, SecurityInterceptor, PersistenceInterceptor, PrincipalInterceptor, SerializableInterceptor, XMBeanInterceptor, LogInterceptor, AuthenticationInterceptor, ObjectReferenceInterceptor, SecurityInterceptor, PersistenceInterceptor2, SRPCacheInterceptor, ModelMBeanAttributeInterceptor, StandardMBeanInfoInterceptor
Base class for all interceptors. This class provides some default method
implementations for interceptors.
| Field Summary |
|---|
| protected String | name | Name for this interceptor. |
| protected boolean | isShared | Indicates whether this interceptor instance is shared or not. |
| protected Logger | log | Logger reference for interceptor implementations. This reference is
set by the invoker for non-shared interceptors after construction.
Shared interceptors will should create their own logger instance. |
| Method from org.jboss.mx.interceptor.AbstractInterceptor Detail: |
public void destroy() {
}
|
public String getName() {
return name;
}
|
public void init() throws Exception {
}
|
public Object invoke(Invocation invocation) throws Throwable {
Interceptor ic = invocation.nextInterceptor();
// if the invocation object does not provide us with more interceptors,
// invoke the dispatcher that lands the invocation to its final target
// in the resource object
if (ic == null)
return invocation.dispatch();
// see if the next interceptor in the chain is shared
if (ic.isShared())
{
// we require a common interface for all shared interceptors
SharedInterceptor shared = (SharedInterceptor)ic;
// we invoke shared interceptor it via the MBean server bus, get the
// interceptors view to its MBean server
MBeanServer server = shared.getMBeanServer();
// And the object name the interceptor is registered under
ObjectName name = shared.getObjectName();
return server.invoke(
name, "invoke",
new Object[] { invocation }, // args
new String[] { Invocation.class.getName() } // signature
);
}
// invoke non-shared interceptor directly via Java reference
else
{
return ic.invoke(invocation);
}
}
|
public boolean isShared() {
return isShared;
}
|
public void setLogger(Logger log) {
this.log = log;
}
|
public void setName(String name) {
this.name = name;
}
Sets a name for this interceptor. |
public void start() {
}
|
public void stop() throws Exception {
}
|
public String toString() {
String className = getClass().getName();
int index = className.lastIndexOf('.");
return className.substring((index < 0) ? 0 : index) + "[name=" + name + "]";
}
Returns a string representation of this interceptor instance. |