Class DynamicInterceptor
- java.lang.Object
-
- com.sun.enterprise.v3.admin.DynamicInterceptor
-
- All Implemented Interfaces:
MBeanServer,MBeanServerConnection
public class DynamicInterceptor extends Object implements MBeanServer
This Interceptor wraps the real MBeanServer so that additional interceptor code can be "turned on" at a later point. However, it must be possible to start the MBeanServer even before the JVM calls main(). Therefore, This class must not depend on anything that can't initialize before the JVM calls main(). This includes things like logging which is not happy being invoked that early.When instantiated at startup, the instance of this class that wraps the real MBeanServer is termed the "Primary Interceptor". There can only be one such Interceptor for each real* MBeanServer. MBeanServer #0 is the Platform MBeanServer, and this class must be used for GlassFish. Additional MBeanServers can be created if desired.
This class can also be used to implement an Interceptor which can be set for use by the Primary Interceptor. Such interceptors are used only for get/setAttribute(s) and invoke(), though the use of them could be expanded for other methods.
Note that many methods are declared 'final' for efficiency. If a subclass needs to override a method, remove 'final'. Until that time, we might as well remain efficient, since most methods won't be overridden.
-
-
Constructor Summary
Constructors Constructor Description DynamicInterceptor()
-
Method Summary
-
-
-
Method Detail
-
getDelegateMBeanServer
public MBeanServer getDelegateMBeanServer()
Get the MBeanServer to which the request can be delegated.
-
setDelegateMBeanServer
public void setDelegateMBeanServer(MBeanServer server)
-
invoke
public Object invoke(ObjectName objectName, String operationName, Object[] params, String[] signature) throws ReflectionException, InstanceNotFoundException, MBeanException
- Specified by:
invokein interfaceMBeanServer- Specified by:
invokein interfaceMBeanServerConnection- Throws:
ReflectionExceptionInstanceNotFoundExceptionMBeanException
-
getAttribute
public final Object getAttribute(ObjectName objectName, String attributeName) throws InstanceNotFoundException, AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttributein interfaceMBeanServer- Specified by:
getAttributein interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionAttributeNotFoundExceptionMBeanExceptionReflectionException
-
setAttribute
public void setAttribute(ObjectName objectName, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, MBeanException, ReflectionException, InvalidAttributeValueException
- Specified by:
setAttributein interfaceMBeanServer- Specified by:
setAttributein interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionAttributeNotFoundExceptionMBeanExceptionReflectionExceptionInvalidAttributeValueException
-
getAttributes
public final AttributeList getAttributes(ObjectName objectName, String[] attrNames) throws InstanceNotFoundException, ReflectionException
- Specified by:
getAttributesin interfaceMBeanServer- Specified by:
getAttributesin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionReflectionException
-
setAttributes
public AttributeList setAttributes(ObjectName objectName, AttributeList attributeList) throws InstanceNotFoundException, ReflectionException
- Specified by:
setAttributesin interfaceMBeanServer- Specified by:
setAttributesin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionReflectionException
-
registerMBean
public final ObjectInstance registerMBean(Object obj, ObjectName objectName) throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException
- Specified by:
registerMBeanin interfaceMBeanServer- Throws:
NotCompliantMBeanExceptionMBeanRegistrationExceptionInstanceAlreadyExistsException
-
unregisterMBean
public final void unregisterMBean(ObjectName objectName) throws InstanceNotFoundException, MBeanRegistrationException
- Specified by:
unregisterMBeanin interfaceMBeanServer- Specified by:
unregisterMBeanin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionMBeanRegistrationException
-
getMBeanCount
public final Integer getMBeanCount()
- Specified by:
getMBeanCountin interfaceMBeanServer- Specified by:
getMBeanCountin interfaceMBeanServerConnection
-
queryMBeans
public final Set queryMBeans(ObjectName objectName, QueryExp expr)
- Specified by:
queryMBeansin interfaceMBeanServer- Specified by:
queryMBeansin interfaceMBeanServerConnection
-
getMBeanInfo
public final MBeanInfo getMBeanInfo(ObjectName objectName) throws InstanceNotFoundException, IntrospectionException, ReflectionException
- Specified by:
getMBeanInfoin interfaceMBeanServer- Specified by:
getMBeanInfoin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionIntrospectionExceptionReflectionException
-
isRegistered
public final boolean isRegistered(ObjectName objectName)
- Specified by:
isRegisteredin interfaceMBeanServer- Specified by:
isRegisteredin interfaceMBeanServerConnection
-
addNotificationListener
public final void addNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException
- Specified by:
addNotificationListenerin interfaceMBeanServer- Specified by:
addNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundException
-
addNotificationListener
public final void addNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException
- Specified by:
addNotificationListenerin interfaceMBeanServer- Specified by:
addNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
- Specified by:
createMBeanin interfaceMBeanServer- Specified by:
createMBeanin interfaceMBeanServerConnection- Throws:
ReflectionExceptionInstanceAlreadyExistsExceptionMBeanRegistrationExceptionMBeanExceptionNotCompliantMBeanException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
- Specified by:
createMBeanin interfaceMBeanServer- Specified by:
createMBeanin interfaceMBeanServerConnection- Throws:
ReflectionExceptionInstanceAlreadyExistsExceptionMBeanRegistrationExceptionMBeanExceptionNotCompliantMBeanExceptionInstanceNotFoundException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, Object[] obj, String[] str3) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
- Specified by:
createMBeanin interfaceMBeanServer- Specified by:
createMBeanin interfaceMBeanServerConnection- Throws:
ReflectionExceptionInstanceAlreadyExistsExceptionMBeanRegistrationExceptionMBeanExceptionNotCompliantMBeanException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2, Object[] obj, String[] str4) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
- Specified by:
createMBeanin interfaceMBeanServer- Specified by:
createMBeanin interfaceMBeanServerConnection- Throws:
ReflectionExceptionInstanceAlreadyExistsExceptionMBeanRegistrationExceptionMBeanExceptionNotCompliantMBeanExceptionInstanceNotFoundException
-
deserialize
public final ObjectInputStream deserialize(String str, byte[] values) throws OperationsException, ReflectionException
- Specified by:
deserializein interfaceMBeanServer- Throws:
OperationsExceptionReflectionException
-
deserialize
public final ObjectInputStream deserialize(ObjectName objectName, byte[] values) throws InstanceNotFoundException, OperationsException
- Specified by:
deserializein interfaceMBeanServer- Throws:
InstanceNotFoundExceptionOperationsException
-
deserialize
public final ObjectInputStream deserialize(String str, ObjectName objectName, byte[] values) throws InstanceNotFoundException, OperationsException, ReflectionException
- Specified by:
deserializein interfaceMBeanServer- Throws:
InstanceNotFoundExceptionOperationsExceptionReflectionException
-
getDefaultDomain
public final String getDefaultDomain()
- Specified by:
getDefaultDomainin interfaceMBeanServer- Specified by:
getDefaultDomainin interfaceMBeanServerConnection
-
getObjectInstance
public final ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getObjectInstancein interfaceMBeanServer- Specified by:
getObjectInstancein interfaceMBeanServerConnection- Throws:
InstanceNotFoundException
-
instantiate
public final Object instantiate(String str) throws ReflectionException, MBeanException
- Specified by:
instantiatein interfaceMBeanServer- Throws:
ReflectionExceptionMBeanException
-
instantiate
public final Object instantiate(String str, ObjectName objectName) throws ReflectionException, MBeanException, InstanceNotFoundException
- Specified by:
instantiatein interfaceMBeanServer- Throws:
ReflectionExceptionMBeanExceptionInstanceNotFoundException
-
instantiate
public final Object instantiate(String str, Object[] obj, String[] str2) throws ReflectionException, MBeanException
- Specified by:
instantiatein interfaceMBeanServer- Throws:
ReflectionExceptionMBeanException
-
instantiate
public final Object instantiate(String str, ObjectName objectName, Object[] obj, String[] str3) throws ReflectionException, MBeanException, InstanceNotFoundException
- Specified by:
instantiatein interfaceMBeanServer- Throws:
ReflectionExceptionMBeanExceptionInstanceNotFoundException
-
isInstanceOf
public final boolean isInstanceOf(ObjectName objectName, String str) throws InstanceNotFoundException
- Specified by:
isInstanceOfin interfaceMBeanServer- Specified by:
isInstanceOfin interfaceMBeanServerConnection- Throws:
InstanceNotFoundException
-
queryNames
public final Set queryNames(ObjectName objectName, QueryExp queryExp)
- Specified by:
queryNamesin interfaceMBeanServer- Specified by:
queryNamesin interfaceMBeanServerConnection
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, ObjectName objectName1) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListenerin interfaceMBeanServer- Specified by:
removeNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListenerin interfaceMBeanServer- Specified by:
removeNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListenerin interfaceMBeanServer- Specified by:
removeNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListenerin interfaceMBeanServer- Specified by:
removeNotificationListenerin interfaceMBeanServerConnection- Throws:
InstanceNotFoundExceptionListenerNotFoundException
-
getClassLoader
public final ClassLoader getClassLoader(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getClassLoaderin interfaceMBeanServer- Throws:
InstanceNotFoundException
-
getClassLoaderFor
public final ClassLoader getClassLoaderFor(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getClassLoaderForin interfaceMBeanServer- Throws:
InstanceNotFoundException
-
getClassLoaderRepository
public final ClassLoaderRepository getClassLoaderRepository()
- Specified by:
getClassLoaderRepositoryin interfaceMBeanServer
-
getDomains
public final String[] getDomains()
- Specified by:
getDomainsin interfaceMBeanServer- Specified by:
getDomainsin interfaceMBeanServerConnection
-
-