mx4j.server
Class MX4JMBeanServer

java.lang.Object
  extended bymx4j.server.MX4JMBeanServer
All Implemented Interfaces:
javax.management.MBeanServer, javax.management.MBeanServerConnection

public class MX4JMBeanServer
extends java.lang.Object
implements javax.management.MBeanServer

The MX4J 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 MX4JSystemKeys.MX4J_MBEANSERVER_REPOSITORY 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.31 $

Constructor Summary
MX4JMBeanServer(java.lang.String defaultDomain, javax.management.MBeanServer outer, javax.management.MBeanServerDelegate delegate)
          Create a new MBeanServer implementation with the specified default domain.
 
Method Summary
 void addNotificationListener(javax.management.ObjectName observed, javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void addNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName)
           
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, java.lang.Object[] args, java.lang.String[] parameters)
           
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, javax.management.ObjectName loaderName)
           
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, javax.management.ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
           
 java.io.ObjectInputStream deserialize(javax.management.ObjectName objectName, byte[] bytes)
           
 java.io.ObjectInputStream deserialize(java.lang.String className, byte[] bytes)
           
 java.io.ObjectInputStream deserialize(java.lang.String className, javax.management.ObjectName loaderName, byte[] bytes)
           
 java.lang.Object getAttribute(javax.management.ObjectName objectName, java.lang.String attribute)
           
 javax.management.AttributeList getAttributes(javax.management.ObjectName objectName, java.lang.String[] attributes)
           
 java.lang.ClassLoader getClassLoader(javax.management.ObjectName name)
           
 java.lang.ClassLoader getClassLoaderFor(javax.management.ObjectName name)
           
 javax.management.loading.ClassLoaderRepository getClassLoaderRepository()
          Returns the ClassLoaderRepository for this MBeanServer.
 java.lang.String getDefaultDomain()
           
 java.lang.String[] getDomains()
           
 java.lang.Integer getMBeanCount()
           
 javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName objectName)
           
 javax.management.ObjectInstance getObjectInstance(javax.management.ObjectName objectName)
           
 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, javax.management.ObjectName loaderName)
           
 java.lang.Object instantiate(java.lang.String className, javax.management.ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
           
 java.lang.Object invoke(javax.management.ObjectName objectName, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] parameters)
           
 boolean isInstanceOf(javax.management.ObjectName objectName, java.lang.String className)
           
 boolean isRegistered(javax.management.ObjectName objectName)
           
 java.util.Set queryMBeans(javax.management.ObjectName patternName, javax.management.QueryExp filter)
           
 java.util.Set queryNames(javax.management.ObjectName patternName, javax.management.QueryExp filter)
           
 javax.management.ObjectInstance registerMBean(java.lang.Object mbean, javax.management.ObjectName objectName)
           
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.NotificationListener listener)
           
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener)
           
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)
           
 void setAttribute(javax.management.ObjectName objectName, javax.management.Attribute attribute)
           
 javax.management.AttributeList setAttributes(javax.management.ObjectName objectName, javax.management.AttributeList attributes)
           
 void unregisterMBean(javax.management.ObjectName objectName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MX4JMBeanServer

public MX4JMBeanServer(java.lang.String defaultDomain,
                       javax.management.MBeanServer outer,
                       javax.management.MBeanServerDelegate delegate)
Create a new MBeanServer implementation with the specified default domain. If the default domain is null, then the empty string is assumed.

Parameters:
defaultDomain - The default domain to be used
Throws:
java.lang.SecurityException - if access is not granted to create an MBeanServer instance
Method Detail

getClassLoaderRepository

public javax.management.loading.ClassLoaderRepository getClassLoaderRepository()
Returns the ClassLoaderRepository for this MBeanServer. When first the ClassLoaderRepository is created in the constructor, the system property MX4JSystemKeys.MX4J_MBEANSERVER_CLASSLOADER_REPOSITORY is tested; if it is non-null and defines a subclass of ModifiableClassLoaderRepository, then that class is used instead of the default one.

Specified by:
getClassLoaderRepository in interface javax.management.MBeanServer

getClassLoader

public java.lang.ClassLoader getClassLoader(javax.management.ObjectName name)
                                     throws javax.management.InstanceNotFoundException
Specified by:
getClassLoader in interface javax.management.MBeanServer
Throws:
javax.management.InstanceNotFoundException

getClassLoaderFor

public java.lang.ClassLoader getClassLoaderFor(javax.management.ObjectName name)
                                        throws javax.management.InstanceNotFoundException
Specified by:
getClassLoaderFor in interface javax.management.MBeanServer
Throws:
javax.management.InstanceNotFoundException

deserialize

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

deserialize

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

deserialize

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

addNotificationListener

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

addNotificationListener

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

removeNotificationListener

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

removeNotificationListener

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

removeNotificationListener

public void removeNotificationListener(javax.management.ObjectName observed,
                                       javax.management.ObjectName listener,
                                       javax.management.NotificationFilter filter,
                                       java.lang.Object handback)
                                throws javax.management.InstanceNotFoundException,
                                       javax.management.ListenerNotFoundException
Specified by:
removeNotificationListener in interface javax.management.MBeanServer
Throws:
javax.management.InstanceNotFoundException
javax.management.ListenerNotFoundException

removeNotificationListener

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

instantiate

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

instantiate

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

instantiate

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

instantiate

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

createMBean

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

createMBean

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

createMBean

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

createMBean

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

registerMBean

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

unregisterMBean

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

getAttribute

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

setAttribute

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

getAttributes

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

setAttributes

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

invoke

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

getDefaultDomain

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

getDomains

public java.lang.String[] getDomains()
Specified by:
getDomains in interface javax.management.MBeanServer

getMBeanCount

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

isRegistered

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

getMBeanInfo

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

getObjectInstance

public javax.management.ObjectInstance getObjectInstance(javax.management.ObjectName objectName)
                                                  throws javax.management.InstanceNotFoundException
Specified by:
getObjectInstance in interface javax.management.MBeanServer
Throws:
javax.management.InstanceNotFoundException

isInstanceOf

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

queryMBeans

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

queryNames

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


Copyright © 2001-2005 The MX4J Contributors. All Rights Reserved.