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:
invoke
in interfaceMBeanServer
- Specified by:
invoke
in interfaceMBeanServerConnection
- Throws:
ReflectionException
InstanceNotFoundException
MBeanException
-
getAttribute
public final Object getAttribute(ObjectName objectName, String attributeName) throws InstanceNotFoundException, AttributeNotFoundException, MBeanException, ReflectionException
- Specified by:
getAttribute
in interfaceMBeanServer
- Specified by:
getAttribute
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
AttributeNotFoundException
MBeanException
ReflectionException
-
setAttribute
public void setAttribute(ObjectName objectName, Attribute attribute) throws InstanceNotFoundException, AttributeNotFoundException, MBeanException, ReflectionException, InvalidAttributeValueException
- Specified by:
setAttribute
in interfaceMBeanServer
- Specified by:
setAttribute
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
AttributeNotFoundException
MBeanException
ReflectionException
InvalidAttributeValueException
-
getAttributes
public final AttributeList getAttributes(ObjectName objectName, String[] attrNames) throws InstanceNotFoundException, ReflectionException
- Specified by:
getAttributes
in interfaceMBeanServer
- Specified by:
getAttributes
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ReflectionException
-
setAttributes
public AttributeList setAttributes(ObjectName objectName, AttributeList attributeList) throws InstanceNotFoundException, ReflectionException
- Specified by:
setAttributes
in interfaceMBeanServer
- Specified by:
setAttributes
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ReflectionException
-
registerMBean
public final ObjectInstance registerMBean(Object obj, ObjectName objectName) throws NotCompliantMBeanException, MBeanRegistrationException, InstanceAlreadyExistsException
- Specified by:
registerMBean
in interfaceMBeanServer
- Throws:
NotCompliantMBeanException
MBeanRegistrationException
InstanceAlreadyExistsException
-
unregisterMBean
public final void unregisterMBean(ObjectName objectName) throws InstanceNotFoundException, MBeanRegistrationException
- Specified by:
unregisterMBean
in interfaceMBeanServer
- Specified by:
unregisterMBean
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
MBeanRegistrationException
-
getMBeanCount
public final Integer getMBeanCount()
- Specified by:
getMBeanCount
in interfaceMBeanServer
- Specified by:
getMBeanCount
in interfaceMBeanServerConnection
-
queryMBeans
public final Set queryMBeans(ObjectName objectName, QueryExp expr)
- Specified by:
queryMBeans
in interfaceMBeanServer
- Specified by:
queryMBeans
in interfaceMBeanServerConnection
-
getMBeanInfo
public final MBeanInfo getMBeanInfo(ObjectName objectName) throws InstanceNotFoundException, IntrospectionException, ReflectionException
- Specified by:
getMBeanInfo
in interfaceMBeanServer
- Specified by:
getMBeanInfo
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
IntrospectionException
ReflectionException
-
isRegistered
public final boolean isRegistered(ObjectName objectName)
- Specified by:
isRegistered
in interfaceMBeanServer
- Specified by:
isRegistered
in interfaceMBeanServerConnection
-
addNotificationListener
public final void addNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException
- Specified by:
addNotificationListener
in interfaceMBeanServer
- Specified by:
addNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
-
addNotificationListener
public final void addNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException
- Specified by:
addNotificationListener
in interfaceMBeanServer
- Specified by:
addNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
- Specified by:
createMBean
in interfaceMBeanServer
- Specified by:
createMBean
in interfaceMBeanServerConnection
- Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
- Specified by:
createMBean
in interfaceMBeanServer
- Specified by:
createMBean
in interfaceMBeanServerConnection
- Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, Object[] obj, String[] str3) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
- Specified by:
createMBean
in interfaceMBeanServer
- Specified by:
createMBean
in interfaceMBeanServerConnection
- Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
-
createMBean
public final ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2, Object[] obj, String[] str4) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
- Specified by:
createMBean
in interfaceMBeanServer
- Specified by:
createMBean
in interfaceMBeanServerConnection
- Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException
-
deserialize
public final ObjectInputStream deserialize(String str, byte[] values) throws OperationsException, ReflectionException
- Specified by:
deserialize
in interfaceMBeanServer
- Throws:
OperationsException
ReflectionException
-
deserialize
public final ObjectInputStream deserialize(ObjectName objectName, byte[] values) throws InstanceNotFoundException, OperationsException
- Specified by:
deserialize
in interfaceMBeanServer
- Throws:
InstanceNotFoundException
OperationsException
-
deserialize
public final ObjectInputStream deserialize(String str, ObjectName objectName, byte[] values) throws InstanceNotFoundException, OperationsException, ReflectionException
- Specified by:
deserialize
in interfaceMBeanServer
- Throws:
InstanceNotFoundException
OperationsException
ReflectionException
-
getDefaultDomain
public final String getDefaultDomain()
- Specified by:
getDefaultDomain
in interfaceMBeanServer
- Specified by:
getDefaultDomain
in interfaceMBeanServerConnection
-
getObjectInstance
public final ObjectInstance getObjectInstance(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getObjectInstance
in interfaceMBeanServer
- Specified by:
getObjectInstance
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
-
instantiate
public final Object instantiate(String str) throws ReflectionException, MBeanException
- Specified by:
instantiate
in interfaceMBeanServer
- Throws:
ReflectionException
MBeanException
-
instantiate
public final Object instantiate(String str, ObjectName objectName) throws ReflectionException, MBeanException, InstanceNotFoundException
- Specified by:
instantiate
in interfaceMBeanServer
- Throws:
ReflectionException
MBeanException
InstanceNotFoundException
-
instantiate
public final Object instantiate(String str, Object[] obj, String[] str2) throws ReflectionException, MBeanException
- Specified by:
instantiate
in interfaceMBeanServer
- Throws:
ReflectionException
MBeanException
-
instantiate
public final Object instantiate(String str, ObjectName objectName, Object[] obj, String[] str3) throws ReflectionException, MBeanException, InstanceNotFoundException
- Specified by:
instantiate
in interfaceMBeanServer
- Throws:
ReflectionException
MBeanException
InstanceNotFoundException
-
isInstanceOf
public final boolean isInstanceOf(ObjectName objectName, String str) throws InstanceNotFoundException
- Specified by:
isInstanceOf
in interfaceMBeanServer
- Specified by:
isInstanceOf
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
-
queryNames
public final Set queryNames(ObjectName objectName, QueryExp queryExp)
- Specified by:
queryNames
in interfaceMBeanServer
- Specified by:
queryNames
in interfaceMBeanServerConnection
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, ObjectName objectName1) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListener
in interfaceMBeanServer
- Specified by:
removeNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListener
in interfaceMBeanServer
- Specified by:
removeNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListener
in interfaceMBeanServer
- Specified by:
removeNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ListenerNotFoundException
-
removeNotificationListener
public final void removeNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj) throws InstanceNotFoundException, ListenerNotFoundException
- Specified by:
removeNotificationListener
in interfaceMBeanServer
- Specified by:
removeNotificationListener
in interfaceMBeanServerConnection
- Throws:
InstanceNotFoundException
ListenerNotFoundException
-
getClassLoader
public final ClassLoader getClassLoader(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getClassLoader
in interfaceMBeanServer
- Throws:
InstanceNotFoundException
-
getClassLoaderFor
public final ClassLoader getClassLoaderFor(ObjectName objectName) throws InstanceNotFoundException
- Specified by:
getClassLoaderFor
in interfaceMBeanServer
- Throws:
InstanceNotFoundException
-
getClassLoaderRepository
public final ClassLoaderRepository getClassLoaderRepository()
- Specified by:
getClassLoaderRepository
in interfaceMBeanServer
-
getDomains
public final String[] getDomains()
- Specified by:
getDomains
in interfaceMBeanServer
- Specified by:
getDomains
in interfaceMBeanServerConnection
-
-