mx4j.server
Class MBeanServerImpl

java.lang.Object
  |
  +--mx4j.server.MBeanServerImpl
All Implemented Interfaces:
MBeanServer

public class MBeanServerImpl
extends java.lang.Object
implements MBeanServer

MBeanServer implementation.

The MBeanServer accomplishes these roles:


The repository function is delegated to instances of MBeanRepository classes. This class acts as a factory for MBeanRepository instances, that can be controlled via the system property mx4j.mbeanserver.repository set to the qualified name of the implementation class.

This class also acts as an invoker on MBeans. The architecture is interceptor-based, that is whenever you call from a client an MBeanServer method that will end up to call the MBean instance, the call is dispatched to the interceptor chain and eventually to the MBean.
The interceptors are configurable via the MBean MBeanServerInterceptorConfigurator. When the call is about to arrive to the MBean instance, the last interceptor dispatches the call depending on the MBean type: if the MBean is a dynamic MBean, the call is dispatched directly; if the MBean is a standard MBean an MBeanInvoker is delegated to invoke on the MBean instance.

Version:
$Revision: 1.11 $
Author:
Simone Bordet

Constructor Summary
MBeanServerImpl(java.lang.String defaultDomain)
           
 
Method Summary
 void addNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, java.lang.Object handback)
           
 void addNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, java.lang.Object handback)
           
 ObjectInstance createMBean(java.lang.String className, ObjectName objectName)
           
 ObjectInstance createMBean(java.lang.String className, ObjectName objectName, java.lang.Object[] args, java.lang.String[] parameters)
           
 ObjectInstance createMBean(java.lang.String className, ObjectName objectName, ObjectName loaderName)
           
 ObjectInstance createMBean(java.lang.String className, ObjectName objectName, ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
           
 java.io.ObjectInputStream deserialize(ObjectName objectName, byte[] bytes)
           
 java.io.ObjectInputStream deserialize(java.lang.String className, byte[] bytes)
           
 java.io.ObjectInputStream deserialize(java.lang.String className, ObjectName loaderName, byte[] bytes)
           
 java.lang.Object getAttribute(ObjectName objectName, java.lang.String attribute)
           
 AttributeList getAttributes(ObjectName objectName, java.lang.String[] attributes)
           
 BaseClassLoaderRepository getClassLoaderRepository()
           
 java.lang.String getDefaultDomain()
           
 java.lang.Integer getMBeanCount()
           
 MBeanInfo getMBeanInfo(ObjectName objectName)
           
 ObjectInstance getObjectInstance(ObjectName objectName)
           
static BaseClassLoaderRepository getStaticClassLoaderRepository()
           
 java.lang.Object instantiate(java.lang.String className)
           
 java.lang.Object instantiate(java.lang.String className, java.lang.Object[] args, java.lang.String[] parameters)
           
 java.lang.Object instantiate(java.lang.String className, ObjectName loaderName)
           
 java.lang.Object instantiate(java.lang.String className, ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
           
 java.lang.Object invoke(ObjectName objectName, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] parameters)
           
 boolean isInstanceOf(ObjectName objectName, java.lang.String className)
           
 boolean isRegistered(ObjectName objectName)
           
 java.util.Set queryMBeans(ObjectName patternName, QueryExp filter)
           
 java.util.Set queryNames(ObjectName patternName, QueryExp filter)
           
 ObjectInstance registerMBean(java.lang.Object mbean, ObjectName objectName)
           
 void removeNotificationListener(ObjectName observed, NotificationListener listener)
           
 void removeNotificationListener(ObjectName observed, NotificationListener listener, NotificationFilter filter, java.lang.Object handback)
           
 void removeNotificationListener(ObjectName observed, ObjectName listener)
           
 void removeNotificationListener(ObjectName observed, ObjectName listener, NotificationFilter filter, java.lang.Object handback)
           
 void setAttribute(ObjectName objectName, Attribute attribute)
           
 AttributeList setAttributes(ObjectName objectName, AttributeList attributes)
           
 void unregisterMBean(ObjectName objectName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MBeanServerImpl

public MBeanServerImpl(java.lang.String defaultDomain)
Method Detail

getStaticClassLoaderRepository

public static BaseClassLoaderRepository getStaticClassLoaderRepository()

getClassLoaderRepository

public BaseClassLoaderRepository getClassLoaderRepository()

addNotificationListener

public void addNotificationListener(ObjectName observed,
                                    ObjectName listener,
                                    NotificationFilter filter,
                                    java.lang.Object handback)
                             throws InstanceNotFoundException
Specified by:
addNotificationListener in interface MBeanServer

addNotificationListener

public void addNotificationListener(ObjectName observed,
                                    NotificationListener listener,
                                    NotificationFilter filter,
                                    java.lang.Object handback)
                             throws InstanceNotFoundException
Specified by:
addNotificationListener in interface MBeanServer

removeNotificationListener

public void removeNotificationListener(ObjectName observed,
                                       ObjectName listener)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer

removeNotificationListener

public void removeNotificationListener(ObjectName observed,
                                       NotificationListener listener)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException
Specified by:
removeNotificationListener in interface MBeanServer

removeNotificationListener

public void removeNotificationListener(ObjectName observed,
                                       ObjectName listener,
                                       NotificationFilter filter,
                                       java.lang.Object handback)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException

removeNotificationListener

public void removeNotificationListener(ObjectName observed,
                                       NotificationListener listener,
                                       NotificationFilter filter,
                                       java.lang.Object handback)
                                throws InstanceNotFoundException,
                                       ListenerNotFoundException

instantiate

public java.lang.Object instantiate(java.lang.String className)
                             throws ReflectionException,
                                    MBeanException
Specified by:
instantiate in interface MBeanServer

instantiate

public java.lang.Object instantiate(java.lang.String className,
                                    java.lang.Object[] args,
                                    java.lang.String[] parameters)
                             throws ReflectionException,
                                    MBeanException
Specified by:
instantiate in interface MBeanServer

instantiate

public java.lang.Object instantiate(java.lang.String className,
                                    ObjectName loaderName)
                             throws ReflectionException,
                                    MBeanException,
                                    InstanceNotFoundException
Specified by:
instantiate in interface MBeanServer

instantiate

public java.lang.Object instantiate(java.lang.String className,
                                    ObjectName loaderName,
                                    java.lang.Object[] args,
                                    java.lang.String[] parameters)
                             throws ReflectionException,
                                    MBeanException,
                                    InstanceNotFoundException
Specified by:
instantiate in interface MBeanServer

createMBean

public ObjectInstance createMBean(java.lang.String className,
                                  ObjectName objectName)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException
Specified by:
createMBean in interface MBeanServer

createMBean

public ObjectInstance createMBean(java.lang.String className,
                                  ObjectName objectName,
                                  java.lang.Object[] args,
                                  java.lang.String[] parameters)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException
Specified by:
createMBean in interface MBeanServer

createMBean

public ObjectInstance createMBean(java.lang.String className,
                                  ObjectName objectName,
                                  ObjectName loaderName)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException,
                                  InstanceNotFoundException
Specified by:
createMBean in interface MBeanServer

createMBean

public ObjectInstance createMBean(java.lang.String className,
                                  ObjectName objectName,
                                  ObjectName loaderName,
                                  java.lang.Object[] args,
                                  java.lang.String[] parameters)
                           throws ReflectionException,
                                  InstanceAlreadyExistsException,
                                  MBeanRegistrationException,
                                  MBeanException,
                                  NotCompliantMBeanException,
                                  InstanceNotFoundException
Specified by:
createMBean in interface MBeanServer

registerMBean

public ObjectInstance registerMBean(java.lang.Object mbean,
                                    ObjectName objectName)
                             throws InstanceAlreadyExistsException,
                                    MBeanRegistrationException,
                                    NotCompliantMBeanException
Specified by:
registerMBean in interface MBeanServer

unregisterMBean

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

deserialize

public java.io.ObjectInputStream deserialize(java.lang.String className,
                                             ObjectName loaderName,
                                             byte[] bytes)
                                      throws InstanceNotFoundException,
                                             OperationsException,
                                             ReflectionException
Specified by:
deserialize in interface MBeanServer

deserialize

public java.io.ObjectInputStream deserialize(java.lang.String className,
                                             byte[] bytes)
                                      throws OperationsException,
                                             ReflectionException
Specified by:
deserialize in interface MBeanServer

deserialize

public java.io.ObjectInputStream deserialize(ObjectName objectName,
                                             byte[] bytes)
                                      throws InstanceNotFoundException,
                                             OperationsException
Specified by:
deserialize in interface MBeanServer

getAttribute

public java.lang.Object getAttribute(ObjectName objectName,
                                     java.lang.String attribute)
                              throws InstanceNotFoundException,
                                     MBeanException,
                                     AttributeNotFoundException,
                                     ReflectionException
Specified by:
getAttribute in interface MBeanServer

setAttribute

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

getAttributes

public AttributeList getAttributes(ObjectName objectName,
                                   java.lang.String[] attributes)
                            throws InstanceNotFoundException,
                                   ReflectionException
Specified by:
getAttributes in interface MBeanServer

setAttributes

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

invoke

public java.lang.Object invoke(ObjectName objectName,
                               java.lang.String methodName,
                               java.lang.Object[] args,
                               java.lang.String[] parameters)
                        throws InstanceNotFoundException,
                               MBeanException,
                               ReflectionException
Specified by:
invoke in interface MBeanServer

getDefaultDomain

public java.lang.String getDefaultDomain()
Specified by:
getDefaultDomain in interface MBeanServer

getMBeanCount

public java.lang.Integer getMBeanCount()
Specified by:
getMBeanCount in interface MBeanServer

isRegistered

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

getMBeanInfo

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

getObjectInstance

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

isInstanceOf

public boolean isInstanceOf(ObjectName objectName,
                            java.lang.String className)
                     throws InstanceNotFoundException
Specified by:
isInstanceOf in interface MBeanServer

queryMBeans

public java.util.Set queryMBeans(ObjectName patternName,
                                 QueryExp filter)
Specified by:
queryMBeans in interface MBeanServer

queryNames

public java.util.Set queryNames(ObjectName patternName,
                                QueryExp filter)
Specified by:
queryNames in interface MBeanServer