com.sun.enterprise.v3.admin
Class DynamicInterceptor

java.lang.Object
  extended by 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
DynamicInterceptor()
           
 
Method Summary
 void addNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj)
           
 void addNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj)
           
 ObjectInstance createMBean(String str, ObjectName objectName)
           
 ObjectInstance createMBean(String str, ObjectName objectName, Object[] obj, String[] str3)
           
 ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2)
           
 ObjectInstance createMBean(String str, ObjectName objectName, ObjectName objectName2, Object[] obj, String[] str4)
           
 ObjectInputStream deserialize(ObjectName objectName, byte[] values)
           
 ObjectInputStream deserialize(String str, byte[] values)
           
 ObjectInputStream deserialize(String str, ObjectName objectName, byte[] values)
           
 Object getAttribute(ObjectName objectName, String attributeName)
           
 AttributeList getAttributes(ObjectName objectName, String[] attrNames)
           
 ClassLoader getClassLoader(ObjectName objectName)
           
 ClassLoader getClassLoaderFor(ObjectName objectName)
           
 ClassLoaderRepository getClassLoaderRepository()
           
 String getDefaultDomain()
           
 MBeanServer getDelegateMBeanServer()
          Get the MBeanServer to which the request can be delegated.
 String[] getDomains()
           
 Integer getMBeanCount()
           
 MBeanInfo getMBeanInfo(ObjectName objectName)
           
 ObjectInstance getObjectInstance(ObjectName objectName)
           
 Object instantiate(String str)
           
 Object instantiate(String str, Object[] obj, String[] str2)
           
 Object instantiate(String str, ObjectName objectName)
           
 Object instantiate(String str, ObjectName objectName, Object[] obj, String[] str3)
           
 Object invoke(ObjectName objectName, String operationName, Object[] params, String[] signature)
           
 boolean isInstanceOf(ObjectName objectName, String str)
           
 boolean isRegistered(ObjectName objectName)
           
 Set queryMBeans(ObjectName objectName, QueryExp expr)
           
 Set queryNames(ObjectName objectName, QueryExp queryExp)
           
 ObjectInstance registerMBean(Object obj, ObjectName objectName)
           
 void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener)
           
 void removeNotificationListener(ObjectName objectName, NotificationListener notificationListener, NotificationFilter notificationFilter, Object obj)
           
 void removeNotificationListener(ObjectName objectName, ObjectName objectName1)
           
 void removeNotificationListener(ObjectName objectName, ObjectName objectName1, NotificationFilter notificationFilter, Object obj)
           
 void setAttribute(ObjectName objectName, Attribute attribute)
           
 AttributeList setAttributes(ObjectName objectName, AttributeList attributeList)
           
 void setDelegateMBeanServer(MBeanServer server)
           
 void unregisterMBean(ObjectName objectName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicInterceptor

public DynamicInterceptor()
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 interface MBeanServer
Specified by:
invoke in interface MBeanServerConnection
Throws:
ReflectionException
InstanceNotFoundException
MBeanException

getAttribute

public final Object getAttribute(ObjectName objectName,
                                 String attributeName)
                          throws InstanceNotFoundException,
                                 AttributeNotFoundException,
                                 MBeanException,
                                 ReflectionException
Specified by:
getAttribute in interface MBeanServer
Specified by:
getAttribute in interface MBeanServerConnection
Throws:
InstanceNotFoundException
AttributeNotFoundException
MBeanException
ReflectionException

setAttribute

public void setAttribute(ObjectName objectName,
                         Attribute attribute)
                  throws InstanceNotFoundException,
                         AttributeNotFoundException,
                         MBeanException,
                         ReflectionException,
                         InvalidAttributeValueException
Specified by:
setAttribute in interface MBeanServer
Specified by:
setAttribute in interface MBeanServerConnection
Throws:
InstanceNotFoundException
AttributeNotFoundException
MBeanException
ReflectionException
InvalidAttributeValueException

getAttributes

public final AttributeList getAttributes(ObjectName objectName,
                                         String[] attrNames)
                                  throws InstanceNotFoundException,
                                         ReflectionException
Specified by:
getAttributes in interface MBeanServer
Specified by:
getAttributes in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ReflectionException

setAttributes

public AttributeList setAttributes(ObjectName objectName,
                                   AttributeList attributeList)
                            throws InstanceNotFoundException,
                                   ReflectionException
Specified by:
setAttributes in interface MBeanServer
Specified by:
setAttributes in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ReflectionException

registerMBean

public final ObjectInstance registerMBean(Object obj,
                                          ObjectName objectName)
                                   throws NotCompliantMBeanException,
                                          MBeanRegistrationException,
                                          InstanceAlreadyExistsException
Specified by:
registerMBean in interface MBeanServer
Throws:
NotCompliantMBeanException
MBeanRegistrationException
InstanceAlreadyExistsException

unregisterMBean

public final void unregisterMBean(ObjectName objectName)
                           throws InstanceNotFoundException,
                                  MBeanRegistrationException
Specified by:
unregisterMBean in interface MBeanServer
Specified by:
unregisterMBean in interface MBeanServerConnection
Throws:
InstanceNotFoundException
MBeanRegistrationException

getMBeanCount

public final Integer getMBeanCount()
Specified by:
getMBeanCount in interface MBeanServer
Specified by:
getMBeanCount in interface MBeanServerConnection

queryMBeans

public final Set queryMBeans(ObjectName objectName,
                             QueryExp expr)
Specified by:
queryMBeans in interface MBeanServer
Specified by:
queryMBeans in interface MBeanServerConnection

getMBeanInfo

public final MBeanInfo getMBeanInfo(ObjectName objectName)
                             throws InstanceNotFoundException,
                                    IntrospectionException,
                                    ReflectionException
Specified by:
getMBeanInfo in interface MBeanServer
Specified by:
getMBeanInfo in interface MBeanServerConnection
Throws:
InstanceNotFoundException
IntrospectionException
ReflectionException

isRegistered

public final boolean isRegistered(ObjectName objectName)
Specified by:
isRegistered in interface MBeanServer
Specified by:
isRegistered in interface MBeanServerConnection

addNotificationListener

public final void addNotificationListener(ObjectName objectName,
                                          NotificationListener notificationListener,
                                          NotificationFilter notificationFilter,
                                          Object obj)
                                   throws InstanceNotFoundException
Specified by:
addNotificationListener in interface MBeanServer
Specified by:
addNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException

addNotificationListener

public final void addNotificationListener(ObjectName objectName,
                                          ObjectName objectName1,
                                          NotificationFilter notificationFilter,
                                          Object obj)
                                   throws InstanceNotFoundException
Specified by:
addNotificationListener in interface MBeanServer
Specified by:
addNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException

createMBean

public final ObjectInstance createMBean(String str,
                                        ObjectName objectName)
                                 throws ReflectionException,
                                        InstanceAlreadyExistsException,
                                        MBeanRegistrationException,
                                        MBeanException,
                                        NotCompliantMBeanException
Specified by:
createMBean in interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
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 interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
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 interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
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 interface MBeanServer
Specified by:
createMBean in interface MBeanServerConnection
Throws:
ReflectionException
InstanceAlreadyExistsException
MBeanRegistrationException
MBeanException
NotCompliantMBeanException
InstanceNotFoundException

deserialize

public final ObjectInputStream deserialize(String str,
                                           byte[] values)
                                    throws OperationsException,
                                           ReflectionException
Specified by:
deserialize in interface MBeanServer
Throws:
OperationsException
ReflectionException

deserialize

public final ObjectInputStream deserialize(ObjectName objectName,
                                           byte[] values)
                                    throws InstanceNotFoundException,
                                           OperationsException
Specified by:
deserialize in interface MBeanServer
Throws:
InstanceNotFoundException
OperationsException

deserialize

public final ObjectInputStream deserialize(String str,
                                           ObjectName objectName,
                                           byte[] values)
                                    throws InstanceNotFoundException,
                                           OperationsException,
                                           ReflectionException
Specified by:
deserialize in interface MBeanServer
Throws:
InstanceNotFoundException
OperationsException
ReflectionException

getDefaultDomain

public final String getDefaultDomain()
Specified by:
getDefaultDomain in interface MBeanServer
Specified by:
getDefaultDomain in interface MBeanServerConnection

getObjectInstance

public final ObjectInstance getObjectInstance(ObjectName objectName)
                                       throws InstanceNotFoundException
Specified by:
getObjectInstance in interface MBeanServer
Specified by:
getObjectInstance in interface MBeanServerConnection
Throws:
InstanceNotFoundException

instantiate

public final Object instantiate(String str)
                         throws ReflectionException,
                                MBeanException
Specified by:
instantiate in interface MBeanServer
Throws:
ReflectionException
MBeanException

instantiate

public final Object instantiate(String str,
                                ObjectName objectName)
                         throws ReflectionException,
                                MBeanException,
                                InstanceNotFoundException
Specified by:
instantiate in interface MBeanServer
Throws:
ReflectionException
MBeanException
InstanceNotFoundException

instantiate

public final Object instantiate(String str,
                                Object[] obj,
                                String[] str2)
                         throws ReflectionException,
                                MBeanException
Specified by:
instantiate in interface MBeanServer
Throws:
ReflectionException
MBeanException

instantiate

public final Object instantiate(String str,
                                ObjectName objectName,
                                Object[] obj,
                                String[] str3)
                         throws ReflectionException,
                                MBeanException,
                                InstanceNotFoundException
Specified by:
instantiate in interface MBeanServer
Throws:
ReflectionException
MBeanException
InstanceNotFoundException

isInstanceOf

public final boolean isInstanceOf(ObjectName objectName,
                                  String str)
                           throws InstanceNotFoundException
Specified by:
isInstanceOf in interface MBeanServer
Specified by:
isInstanceOf in interface MBeanServerConnection
Throws:
InstanceNotFoundException

queryNames

public final Set queryNames(ObjectName objectName,
                            QueryExp queryExp)
Specified by:
queryNames in interface MBeanServer
Specified by:
queryNames in interface MBeanServerConnection

removeNotificationListener

public final void removeNotificationListener(ObjectName objectName,
                                             ObjectName objectName1)
                                      throws InstanceNotFoundException,
                                             ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public final void removeNotificationListener(ObjectName objectName,
                                             NotificationListener notificationListener)
                                      throws InstanceNotFoundException,
                                             ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public final void removeNotificationListener(ObjectName objectName,
                                             NotificationListener notificationListener,
                                             NotificationFilter notificationFilter,
                                             Object obj)
                                      throws InstanceNotFoundException,
                                             ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ListenerNotFoundException

removeNotificationListener

public final void removeNotificationListener(ObjectName objectName,
                                             ObjectName objectName1,
                                             NotificationFilter notificationFilter,
                                             Object obj)
                                      throws InstanceNotFoundException,
                                             ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer
Specified by:
removeNotificationListener in interface MBeanServerConnection
Throws:
InstanceNotFoundException
ListenerNotFoundException

getClassLoader

public final ClassLoader getClassLoader(ObjectName objectName)
                                 throws InstanceNotFoundException
Specified by:
getClassLoader in interface MBeanServer
Throws:
InstanceNotFoundException

getClassLoaderFor

public final ClassLoader getClassLoaderFor(ObjectName objectName)
                                    throws InstanceNotFoundException
Specified by:
getClassLoaderFor in interface MBeanServer
Throws:
InstanceNotFoundException

getClassLoaderRepository

public final ClassLoaderRepository getClassLoaderRepository()
Specified by:
getClassLoaderRepository in interface MBeanServer

getDomains

public final String[] getDomains()
Specified by:
getDomains in interface MBeanServer
Specified by:
getDomains in interface MBeanServerConnection


Copyright © 2012. All Rights Reserved.