mx4j.server
Class MX4JMBeanServer

java.lang.Object
  extended by mx4j.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)
          Adds a NotificationListener to a registered MBean.
 void addNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)
          Adds a NotificationListener to a registered MBean.
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName)
          A facility method for createMBean(className, objectName, null, null).
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, java.lang.Object[] args, java.lang.String[] parameters)
          Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer.
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, javax.management.ObjectName loaderName)
          A facility method for createMBean(className, objectName, loaderName, null, null).
 javax.management.ObjectInstance createMBean(java.lang.String className, javax.management.ObjectName objectName, javax.management.ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
          Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer.
 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)
          Gets the value of the specified attribute of the named MBean.
 javax.management.AttributeList getAttributes(javax.management.ObjectName objectName, java.lang.String[] attributes)
          Gets the values of several attributes of the named MBean.
 java.lang.ClassLoader getClassLoader(javax.management.ObjectName name)
          Returns the named classloader MBean.
 java.lang.ClassLoader getClassLoaderFor(javax.management.ObjectName name)
          Returns the ClassLoader that was used for loading the named MBean.
 javax.management.loading.ClassLoaderRepository getClassLoaderRepository()
          Returns the ClassLoaderRepository for this MBeanServer.
 java.lang.String getDefaultDomain()
          Returns the default domain for this MBeanServer used in case ObjectName domain are not specified.
 java.lang.String[] getDomains()
          Returns the list of different ObjectName domains under which the MBeans in this MBeanServer are registered.
 java.lang.Integer getMBeanCount()
          Returns the number of MBeans registered in this MBeanServer.
 javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName objectName)
          Returns the metadata information exposed for management about the named MBean.
 javax.management.ObjectInstance getObjectInstance(javax.management.ObjectName objectName)
          Gets the ObjectInstance for the named MBean registered with the MBeanServer.
 java.lang.Object instantiate(java.lang.String className)
          Instantiates an object of the given class using the MBeanServer's ClassLoaderRepository.
 java.lang.Object instantiate(java.lang.String className, java.lang.Object[] args, java.lang.String[] parameters)
          Instantiates an object of the given class using the MBeanServer's ClassLoaderRepository.
 java.lang.Object instantiate(java.lang.String className, javax.management.ObjectName loaderName)
          Instantiates an object of the given class using the specified ClassLoader MBean.
 java.lang.Object instantiate(java.lang.String className, javax.management.ObjectName loaderName, java.lang.Object[] args, java.lang.String[] parameters)
          Instantiates an object of the given class using the specified ClassLoader MBean.
 java.lang.Object invoke(javax.management.ObjectName objectName, java.lang.String methodName, java.lang.Object[] args, java.lang.String[] parameters)
          Invokes the specified operation on the named MBean.
 boolean isInstanceOf(javax.management.ObjectName objectName, java.lang.String className)
          Returns whether the MBean specified is an instance of the specified class.
 boolean isRegistered(javax.management.ObjectName objectName)
          Checks whether the given ObjectName identifies an MBean registered in this MBeanServer.
 java.util.Set queryMBeans(javax.management.ObjectName patternName, javax.management.QueryExp filter)
          Gets a subset of the ObjectInstances belonging to MBeans registered in this MBeanServer.
 java.util.Set queryNames(javax.management.ObjectName patternName, javax.management.QueryExp filter)
          Gets a subset of the ObjectNames belonging to MBeans registered in this MBeanServer.
 javax.management.ObjectInstance registerMBean(java.lang.Object mbean, javax.management.ObjectName objectName)
          Registers the given MBean with the given ObjectName.
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.NotificationListener listener)
          Removes the specified listener from the named source MBean.
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback)
          Removes the specified listener from the named source MBean.
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener)
          Removes the specified listener MBean from the named source MBean.
 void removeNotificationListener(javax.management.ObjectName observed, javax.management.ObjectName listener, javax.management.NotificationFilter filter, java.lang.Object handback)
          Removes the specified listener MBean from the named source MBean.
 void setAttribute(javax.management.ObjectName objectName, javax.management.Attribute attribute)
          Sets the value of the specified attribute of the named MBean.
 javax.management.AttributeList setAttributes(javax.management.ObjectName objectName, javax.management.AttributeList attributes)
          Sets the values of several attributes of the named MBean.
 void unregisterMBean(javax.management.ObjectName objectName)
          Unregisters the MBean with the specified ObjectName from this MBeanServer.
 
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
Description copied from interface: javax.management.MBeanServer
Returns the named classloader MBean. If the given loaderName is null, the classloader of the MBeanServer will be used.

Specified by:
getClassLoader in interface javax.management.MBeanServer
Parameters:
name - The ObjectName of the classloader MBean, or null.
Returns:
The named classloader MBean.
Throws:
javax.management.InstanceNotFoundException - If the named classloader MBean is not found.

getClassLoaderFor

public java.lang.ClassLoader getClassLoaderFor(javax.management.ObjectName name)
                                        throws javax.management.InstanceNotFoundException
Description copied from interface: javax.management.MBeanServer
Returns the ClassLoader that was used for loading the named MBean.

Specified by:
getClassLoaderFor in interface javax.management.MBeanServer
Parameters:
name - The ObjectName of the MBean.
Returns:
The ClassLoader used to load the names MBean.
Throws:
javax.management.InstanceNotFoundException - If the named MBean is not found.

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
Description copied from interface: javax.management.MBeanServerConnection
Adds a NotificationListener to a registered MBean. A notification emitted by the specified source MBean will be forwarded by the MBeanServer to the given listener MBean, if the given NotificationFilter allows so. If the filter is null, every notification will be sent to the listener. The handback object is transparently passed to the listener by the MBeanServer. The source of the notification is the source MBean ObjectName. If the listener MBean is unregistered, it will continue to receive notifications.

Specified by:
addNotificationListener in interface javax.management.MBeanServer
Specified by:
addNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be added.
listener - The ObjectName of the listener MBean which will handle the notifications emitted by the source MBean.
filter - The filter which will allow the notification to be forwarded to the listener.
handback - The context to be sent to the listener when a notification is emitted.
Throws:
javax.management.InstanceNotFoundException - If the source or listener MBean are not registered in the MBeanServer.
See Also:
MBeanServerConnection.removeNotificationListener(ObjectName, ObjectName, NotificationFilter, Object)

addNotificationListener

public void addNotificationListener(javax.management.ObjectName observed,
                                    javax.management.NotificationListener listener,
                                    javax.management.NotificationFilter filter,
                                    java.lang.Object handback)
                             throws javax.management.InstanceNotFoundException
Description copied from interface: javax.management.MBeanServerConnection
Adds a NotificationListener to a registered MBean. A notification emitted by the specified source MBean will be forwarded by the MBeanServer to the given listener, if the given NotificationFilter allows so. If the filter is null, every notification will be sent to the listener. The handback object is transparently passed to the listener by the MBeanServer. The source of the notification is the source MBean ObjectName.

Specified by:
addNotificationListener in interface javax.management.MBeanServer
Specified by:
addNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be added.
listener - The listener which will handle the notifications emitted by the source MBean.
filter - The filter which will allow the notification to be forwarded to the listener.
handback - The context to be sent to the listener when a notification is emitted.
Throws:
javax.management.InstanceNotFoundException - If the source MBean is not registered in the MBeanServer.
See Also:
MBeanServerConnection.removeNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)

removeNotificationListener

public void removeNotificationListener(javax.management.ObjectName observed,
                                       javax.management.ObjectName listener)
                                throws javax.management.InstanceNotFoundException,
                                       javax.management.ListenerNotFoundException
Description copied from interface: javax.management.MBeanServerConnection
Removes the specified listener MBean from the named source MBean. If the listener is registered more than once, for example with different filters or handbacks, this method will remove all those registrations.

Specified by:
removeNotificationListener in interface javax.management.MBeanServer
Specified by:
removeNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be removed.
listener - The ObjectName of the listener MBean to be removed.
Throws:
javax.management.InstanceNotFoundException - If the source or listener MBean are not registered in the MBeanServer.
javax.management.ListenerNotFoundException - The listener is not registered in the MBean.
See Also:
MBeanServerConnection.addNotificationListener(ObjectName, ObjectName, NotificationFilter, Object)

removeNotificationListener

public void removeNotificationListener(javax.management.ObjectName observed,
                                       javax.management.NotificationListener listener)
                                throws javax.management.InstanceNotFoundException,
                                       javax.management.ListenerNotFoundException
Description copied from interface: javax.management.MBeanServerConnection
Removes the specified listener from the named source MBean. If the listener is registered more than once, for example with different filters or handbacks, this method will remove all those registrations.

Specified by:
removeNotificationListener in interface javax.management.MBeanServer
Specified by:
removeNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be removed.
listener - The listener to be removed.
Throws:
javax.management.InstanceNotFoundException - If the source MBean is not registered in the MBeanServer.
javax.management.ListenerNotFoundException - If the listener is not registered in the MBean.
See Also:
MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)

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
Description copied from interface: javax.management.MBeanServerConnection
Removes the specified listener MBean from the named source MBean. The MBean must have a listener that exactly matches the given listener, filter, and handback parameters.

Specified by:
removeNotificationListener in interface javax.management.MBeanServer
Specified by:
removeNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be removed.
listener - The ObjectName of the listener MBean to be removed.
filter - The filter that was specified when the listener was added.
handback - The handback that was specified when the listener was added.
Throws:
javax.management.InstanceNotFoundException - If the source MBean is not registered in the MBeanServer.
javax.management.ListenerNotFoundException - If the listener (along with filter and handback) is not registered in the MBean.
See Also:
MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)

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
Description copied from interface: javax.management.MBeanServerConnection
Removes the specified listener from the named source MBean. The MBean must have a listener that exactly matches the given listener, filter, and handback parameters.

Specified by:
removeNotificationListener in interface javax.management.MBeanServer
Specified by:
removeNotificationListener in interface javax.management.MBeanServerConnection
Parameters:
observed - The ObjectName of the source MBean on which the listener should be removed.
listener - The listener to be removed.
filter - The filter that was specified when the listener was added.
handback - The handback that was specified when the listener was added.
Throws:
javax.management.InstanceNotFoundException - If the source MBean is not registered in the MBeanServer.
javax.management.ListenerNotFoundException - If the listener (along with filter and handback) is not registered in the MBean.
See Also:
MBeanServerConnection.addNotificationListener(ObjectName, NotificationListener, NotificationFilter, Object)

instantiate

public java.lang.Object instantiate(java.lang.String className)
                             throws javax.management.ReflectionException,
                                    javax.management.MBeanException
Description copied from interface: javax.management.MBeanServer
Instantiates an object of the given class using the MBeanServer's ClassLoaderRepository. The given class should have a public parameterless constructor.

Specified by:
instantiate in interface javax.management.MBeanServer
Parameters:
className - The class name of the object to be instantiated.
Returns:
The newly instantiated object.
Throws:
javax.management.ReflectionException - Wraps a Java reflection exception thrown while trying to create the instance
javax.management.MBeanException - Thrown if the constructor of the object throws an exception

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
Description copied from interface: javax.management.MBeanServer
Instantiates an object of the given class using the MBeanServer's ClassLoaderRepository. The given class should have a public constructor matching the given signature, and will be called passing the given arguments.

Specified by:
instantiate in interface javax.management.MBeanServer
Parameters:
className - The class name of the object to be instantiated.
args - The arguments passed to the constructor.
parameters - The signature of the constructor.
Returns:
The newly instantiated object.
Throws:
javax.management.ReflectionException - Wraps a Java reflection exception thrown while trying to create the instance
javax.management.MBeanException - Thrown if the constructor of the object throws an exception

instantiate

public java.lang.Object instantiate(java.lang.String className,
                                    javax.management.ObjectName loaderName)
                             throws javax.management.ReflectionException,
                                    javax.management.MBeanException,
                                    javax.management.InstanceNotFoundException
Description copied from interface: javax.management.MBeanServer
Instantiates an object of the given class using the specified ClassLoader MBean. If loaderName is null, the classloader of the MBeanServer will be used. The given class should have a public parameterless constructor.

Specified by:
instantiate in interface javax.management.MBeanServer
Parameters:
className - The class name of the MBean to be instantiated.
loaderName - The object name of the class loader to be used.
Returns:
The newly instantiated object.
Throws:
javax.management.ReflectionException - Wraps a Java reflection exception thrown while trying to create the instance
javax.management.MBeanException - Thrown if the constructor of the object throws an exception
javax.management.InstanceNotFoundException - The specified classloader MBean is not registered in the MBeanServer.

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
Description copied from interface: javax.management.MBeanServer
Instantiates an object of the given class using the specified ClassLoader MBean. If loaderName is null, the classloader of the MBeanServer will be used. The given class should have a public constructor matching the given signature, and will be called passing the given arguments.

Specified by:
instantiate in interface javax.management.MBeanServer
Parameters:
className - The class name of the MBean to be instantiated.
loaderName - The object name of the class loader to be used.
args - The arguments passed to the constructor.
parameters - The signature of the constructor.
Returns:
The newly instantiated object.
Throws:
javax.management.ReflectionException - Wraps a Java reflection exception thrown while trying to create the instance
javax.management.MBeanException - Thrown if the constructor of the object throws an exception
javax.management.InstanceNotFoundException - The specified classloader MBean is not registered in the MBeanServer.

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
Description copied from interface: javax.management.MBeanServerConnection
A facility method for createMBean(className, objectName, null, null).

Specified by:
createMBean in interface javax.management.MBeanServer
Specified by:
createMBean in interface javax.management.MBeanServerConnection
Throws:
javax.management.ReflectionException
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.MBeanException
javax.management.NotCompliantMBeanException
See Also:
MBeanServerConnection.createMBean(String, ObjectName, Object[], String[])

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
Description copied from interface: javax.management.MBeanServerConnection
Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer. The MBeanServer will use its ClassLoaderRepository to load the class of the MBean and the specified constructor's parameter classes, and creates the instance passing the specified arguments. The ObjectName may be null if the MBean implements MBeanRegistration

Specified by:
createMBean in interface javax.management.MBeanServer
Specified by:
createMBean in interface javax.management.MBeanServerConnection
Parameters:
className - The class name of the MBean to be instantiated.
objectName - The ObjectName of the MBean, may be null.
args - An array containing the arguments to pass to the constructor.
parameters - An array containing the signature of the constructor.
Returns:
An ObjectInstance, containing the ObjectName and the Java class name of the newly instantiated MBean.
Throws:
javax.management.ReflectionException - If a reflection exception is thrown.
javax.management.InstanceAlreadyExistsException - If another MBean with the same ObjectName is already registered in the MBeanServer.
javax.management.MBeanRegistrationException - If an exception is thrown during MBean's registration.
javax.management.MBeanException - If the constructor of the MBean has thrown an exception
javax.management.NotCompliantMBeanException - If the MBean is not a JMX compliant MBean

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
Description copied from interface: javax.management.MBeanServerConnection
A facility method for createMBean(className, objectName, loaderName, null, null).

Specified by:
createMBean in interface javax.management.MBeanServer
Specified by:
createMBean in interface javax.management.MBeanServerConnection
Throws:
javax.management.ReflectionException
javax.management.InstanceAlreadyExistsException
javax.management.MBeanRegistrationException
javax.management.MBeanException
javax.management.NotCompliantMBeanException
javax.management.InstanceNotFoundException
See Also:
MBeanServerConnection.createMBean(String, ObjectName, ObjectName, Object[], String[])

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
Description copied from interface: javax.management.MBeanServerConnection
Instantiates and registers an MBean of the specified class with the given ObjectName in the MBeanServer. The MBeanServer will use the specified classloader MBean to load the class of the MBean and the specified constructor's parameter classes, and creates the instance passing the specified arguments, or the classloader of the MBeanServer if the classloader ObjectName is null. The ObjectName may be null if the MBean implements MBeanRegistration

Specified by:
createMBean in interface javax.management.MBeanServer
Specified by:
createMBean in interface javax.management.MBeanServerConnection
Parameters:
className - The class name of the MBean to be instantiated.
objectName - The ObjectName of the MBean, may be null.
loaderName - The ObjectName of the classloader MBean to be used.
args - An array containing the arguments to pass to the constructor.
parameters - An array containing the signature of the constructor.
Returns:
An ObjectInstance, containing the ObjectName and the Java class name of the newly instantiated MBean.
Throws:
javax.management.ReflectionException - If a reflection exception is thrown.
javax.management.InstanceAlreadyExistsException - If another MBean with the same ObjectName is already registered in the MBeanServer.
javax.management.MBeanRegistrationException - If an exception is thrown during MBean's registration.
javax.management.MBeanException - If the constructor of the MBean has thrown an exception
javax.management.NotCompliantMBeanException - If the MBean is not a JMX compliant MBean
javax.management.InstanceNotFoundException - If the specified classloader MBean is not registered in the MBeanServer.

registerMBean

public javax.management.ObjectInstance registerMBean(java.lang.Object mbean,
                                                     javax.management.ObjectName objectName)
                                              throws javax.management.InstanceAlreadyExistsException,
                                                     javax.management.MBeanRegistrationException,
                                                     javax.management.NotCompliantMBeanException
Description copied from interface: javax.management.MBeanServer
Registers the given MBean with the given ObjectName. The ObjectName may be null, but the MBean should then implement MBeanRegistration.

Specified by:
registerMBean in interface javax.management.MBeanServer
Parameters:
mbean - The MBean to be registered.
objectName - The ObjectName of the MBean, may be null.
Returns:
An ObjectInstance, containing the ObjectName and the Java class name of the newly registered MBean.
Throws:
javax.management.InstanceAlreadyExistsException - An MBean with the same ObjectName is already registered in the MBeanServer.
javax.management.MBeanRegistrationException - Thrown if a problem is encountered during registration.
javax.management.NotCompliantMBeanException - The given MBean is not a JMX compliant MBean

unregisterMBean

public void unregisterMBean(javax.management.ObjectName objectName)
                     throws javax.management.InstanceNotFoundException,
                            javax.management.MBeanRegistrationException
Description copied from interface: javax.management.MBeanServerConnection
Unregisters the MBean with the specified ObjectName from this MBeanServer.

Specified by:
unregisterMBean in interface javax.management.MBeanServer
Specified by:
unregisterMBean in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean to be unregistered.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.MBeanRegistrationException - If an exception is thrown during MBean's unregistration.

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
Description copied from interface: javax.management.MBeanServerConnection
Gets the value of the specified attribute of the named MBean.

Specified by:
getAttribute in interface javax.management.MBeanServer
Specified by:
getAttribute in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean from which the attribute is to be retrieved.
attribute - The attribute name.
Returns:
The value of the specified attribute.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.MBeanException - If the MBean's getter method throws an exception.
javax.management.AttributeNotFoundException - If the specified attribute does not belong to the management interface of the MBean.
javax.management.ReflectionException - If a reflection exception is thrown.
See Also:
MBeanServerConnection.setAttribute(javax.management.ObjectName, javax.management.Attribute)

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
Description copied from interface: javax.management.MBeanServerConnection
Sets the value of the specified attribute of the named MBean.

Specified by:
setAttribute in interface javax.management.MBeanServer
Specified by:
setAttribute in interface javax.management.MBeanServerConnection
Parameters:
objectName - The name of the MBean within which the attribute is to be set.
attribute - The Attribute to be set.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.AttributeNotFoundException - If the specified attribute does not belong to the management interface of the MBean.
javax.management.InvalidAttributeValueException - If the value specified for the attribute does not match the attribute's type
javax.management.MBeanException - If the MBean's setter method throws an exception.
javax.management.ReflectionException - If a reflection exception is thrown.
See Also:
MBeanServerConnection.getAttribute(javax.management.ObjectName, java.lang.String)

getAttributes

public javax.management.AttributeList getAttributes(javax.management.ObjectName objectName,
                                                    java.lang.String[] attributes)
                                             throws javax.management.InstanceNotFoundException,
                                                    javax.management.ReflectionException
Description copied from interface: javax.management.MBeanServerConnection
Gets the values of several attributes of the named MBean.

Specified by:
getAttributes in interface javax.management.MBeanServer
Specified by:
getAttributes in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean from which the attributes are to be retrieved.
attributes - The attribute names.
Returns:
An AttributeList containing the values of the attributes that it has been possible to retrieve.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.ReflectionException - If a reflection exception is thrown.
See Also:
MBeanServerConnection.setAttributes(javax.management.ObjectName, javax.management.AttributeList)

setAttributes

public javax.management.AttributeList setAttributes(javax.management.ObjectName objectName,
                                                    javax.management.AttributeList attributes)
                                             throws javax.management.InstanceNotFoundException,
                                                    javax.management.ReflectionException
Description copied from interface: javax.management.MBeanServerConnection
Sets the values of several attributes of the named MBean.

Specified by:
setAttributes in interface javax.management.MBeanServer
Specified by:
setAttributes in interface javax.management.MBeanServerConnection
Parameters:
objectName - The name of the MBean within which the attribute is to be set.
attributes - The AttributeList containing the Attributes to be set.
Returns:
The AttributeList containing the attributes that it has been possible to set.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.ReflectionException - If a reflection exception is thrown.
See Also:
MBeanServerConnection.getAttributes(javax.management.ObjectName, java.lang.String[])

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
Description copied from interface: javax.management.MBeanServerConnection
Invokes the specified operation on the named MBean.

Specified by:
invoke in interface javax.management.MBeanServer
Specified by:
invoke in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean on which the method is to be invoked.
methodName - The name of the operation to be invoked.
args - An array containing the arguments to pass to the operation.
parameters - An array containing the signature of the operation.
Returns:
The return value of the operation, or null if the operation returns void.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.
javax.management.MBeanException - If the MBean's operation method throws an exception.
javax.management.ReflectionException - If a reflection exception is thrown.

getDefaultDomain

public java.lang.String getDefaultDomain()
Description copied from interface: javax.management.MBeanServerConnection
Returns the default domain for this MBeanServer used in case ObjectName domain are not specified.

Specified by:
getDefaultDomain in interface javax.management.MBeanServer
Specified by:
getDefaultDomain in interface javax.management.MBeanServerConnection
Returns:
The default domain of this MBeanServer.

getDomains

public java.lang.String[] getDomains()
Description copied from interface: javax.management.MBeanServerConnection
Returns the list of different ObjectName domains under which the MBeans in this MBeanServer are registered.

Specified by:
getDomains in interface javax.management.MBeanServer
Specified by:
getDomains in interface javax.management.MBeanServerConnection
Returns:
The array of different ObjectName domains present in this MBeanServer.

getMBeanCount

public java.lang.Integer getMBeanCount()
Description copied from interface: javax.management.MBeanServerConnection
Returns the number of MBeans registered in this MBeanServer.

Specified by:
getMBeanCount in interface javax.management.MBeanServer
Specified by:
getMBeanCount in interface javax.management.MBeanServerConnection

isRegistered

public boolean isRegistered(javax.management.ObjectName objectName)
Description copied from interface: javax.management.MBeanServerConnection
Checks whether the given ObjectName identifies an MBean registered in this MBeanServer.

Specified by:
isRegistered in interface javax.management.MBeanServer
Specified by:
isRegistered in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName to be checked.
Returns:
True if an MBean with the specified ObjectName is already registered in the MBeanServer.

getMBeanInfo

public javax.management.MBeanInfo getMBeanInfo(javax.management.ObjectName objectName)
                                        throws javax.management.InstanceNotFoundException,
                                               javax.management.IntrospectionException,
                                               javax.management.ReflectionException
Description copied from interface: javax.management.MBeanServerConnection
Returns the metadata information exposed for management about the named MBean.

Specified by:
getMBeanInfo in interface javax.management.MBeanServer
Specified by:
getMBeanInfo in interface javax.management.MBeanServerConnection
Parameters:
objectName - The name of the MBean for which retrieve the metadata.
Returns:
An instance of MBeanInfo allowing the retrieval of constructors, attributes, operations and notifications of this MBean.
Throws:
javax.management.InstanceNotFoundException - If the named MBean is not registered in the MBeanServer.
javax.management.IntrospectionException - If an exception occured during introspection of the MBean.
javax.management.ReflectionException - If a reflection-type exception occurred

getObjectInstance

public javax.management.ObjectInstance getObjectInstance(javax.management.ObjectName objectName)
                                                  throws javax.management.InstanceNotFoundException
Description copied from interface: javax.management.MBeanServerConnection
Gets the ObjectInstance for the named MBean registered with the MBeanServer.

Specified by:
getObjectInstance in interface javax.management.MBeanServer
Specified by:
getObjectInstance in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean.
Returns:
The ObjectInstance associated with the named MBean.
Throws:
javax.management.InstanceNotFoundException - If the specified MBean is not registered in the MBeanServer.

isInstanceOf

public boolean isInstanceOf(javax.management.ObjectName objectName,
                            java.lang.String className)
                     throws javax.management.InstanceNotFoundException
Description copied from interface: javax.management.MBeanServerConnection
Returns whether the MBean specified is an instance of the specified class.

Specified by:
isInstanceOf in interface javax.management.MBeanServer
Specified by:
isInstanceOf in interface javax.management.MBeanServerConnection
Parameters:
objectName - The ObjectName of the MBean.
className - The name of the class.
Returns:
True if the MBean specified is an instance of the specified class.
Throws:
javax.management.InstanceNotFoundException - If the named MBean is not registered in the MBeanServer.

queryMBeans

public java.util.Set queryMBeans(javax.management.ObjectName patternName,
                                 javax.management.QueryExp filter)
Description copied from interface: javax.management.MBeanServerConnection
Gets a subset of the ObjectInstances belonging to MBeans registered in this MBeanServer. It is possible to filter the set of MBeans by specifying a pattern for MBean's ObjectNames, and a query expression to be evaluated to further filter the set of MBeans. The set can be further restricted if any exception is thrown during retrieval of MBean (for example for security reasons): the failing MBean will not be included.

Specified by:
queryMBeans in interface javax.management.MBeanServer
Specified by:
queryMBeans in interface javax.management.MBeanServerConnection
Parameters:
patternName - The ObjectName pattern identifying the MBeans to be retrieved, or null to retrieve all MBeans.
filter - The query expression to be evaluated for selecting MBeans, or null.
Returns:
A set containing the ObjectInstance objects for the selected MBeans.

queryNames

public java.util.Set queryNames(javax.management.ObjectName patternName,
                                javax.management.QueryExp filter)
Description copied from interface: javax.management.MBeanServerConnection
Gets a subset of the ObjectNames belonging to MBeans registered in this MBeanServer. It is possible to filter the set of MBeans by specifying a pattern for MBean's ObjectNames, and a query expression to be evaluated to further filter the set of MBeans. The set can be further restricted if any exception is thrown during retrieval of MBean (for example for security reasons): the failing MBean will not be included.

Specified by:
queryNames in interface javax.management.MBeanServer
Specified by:
queryNames in interface javax.management.MBeanServerConnection
Parameters:
patternName - The ObjectName pattern identifying the MBeans to be retrieved, or null to retrieve all MBeans.
filter - The query expression to be evaluated for selecting MBeans, or null.
Returns:
A set containing the ObjectNames for the selected MBeans.


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