| GNU Classpath (0.95) | |
| Prev Class | Next Class | Frames | No Frames |
| Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
public interface MBeanServerextends MBeanServerConnectionMBeanServerFactory.
Registering a bean with the server makes its attributes and
operations accessible via the server. Only JMX compliant
beans may be registered with the server. When a bean
is registered or unregistered, an MBeanServerNotification
is emitted by the server's MBeanServerDelegate.
Listeners may be registered with this bean in order to
obtain such notifications. It has the ObjectName
JMImplementation:type=MBeanServerDelegate.
Security checks are applied on the methods of the server,
as detailed below, if it is obtained using the
MBeanServerFactory.createMBeanServer() or
MBeanServerFactory.newMBeanServer() methods and
System.getSecurityManager() returns a non-null
value. If a check fails, a SecurityException
is thrown. Note than the class name used in the exception
is that of the bean, and thus, as a result, an
InstanceNotFoundException
precludes these security checks, due to the class name
that would be used in the exception being unavailable.
Method Summary | |
void |
|
void |
|
ObjectInstance |
|
ObjectInstance |
|
ObjectInstance |
|
ObjectInstance |
|
ObjectInputStream |
|
ObjectInputStream |
|
ObjectInputStream |
|
Object |
|
AttributeList |
|
ClassLoader |
|
ClassLoader |
|
ClassLoaderRepository |
|
String |
|
String[] |
|
Integer |
|
MBeanInfo |
|
ObjectInstance |
|
Object |
|
Object |
|
Object |
|
Object |
|
Object |
|
boolean |
|
boolean |
|
Set |
|
Set |
|
ObjectInstance |
|
void |
|
void |
|
void |
|
void |
|
void |
|
AttributeList |
|
void |
|
public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException
Registers the supplied listener with the specified management bean. Notifications emitted by the management bean are forwarded to the listener via the server, which will convert any MBean references in the source to portableObjectNameinstances. The notification is otherwise unchanged.
- Specified by:
- addNotificationListener in interface MBeanServerConnection
- Parameters:
name- the name of the management bean with which the listener should be registered.listener- the listener which will handle notifications from the bean.filter- the filter to apply to incoming notifications, ornullif no filtering should be applied.passback- an object to be passed to the listener when a notification is emitted.
- Throws:
InstanceNotFoundException- if the name of the management bean could not be resolved.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, name, "addNotificationListener")
public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object passback) throws InstanceNotFoundException
Registers the supplied listener with the specified management bean. Notifications emitted by the management bean are forwarded to the listener via the server, which will convert any MBean references in the source to portableObjectNameinstances. The notification is otherwise unchanged. The listener that receives notifications will be the one that is registered with the given name at the time this method is called. Even if it later unregisters and ceases to use that name, it will still receive notifications.
- Specified by:
- addNotificationListener in interface MBeanServerConnection
- Parameters:
name- the name of the management bean with which the listener should be registered.listener- the name of the listener which will handle notifications from the bean.filter- the filter to apply to incoming notifications, ornullif no filtering should be applied.passback- an object to be passed to the listener when a notification is emitted.
- Throws:
InstanceNotFoundException- if the name of the management bean could not be resolved.RuntimeOperationsException- if the bean associated with the given object name is not aNotificationListener. This exception wraps anIllegalArgumentException.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, name, "addNotificationListener")
public ObjectInstance createMBean(String className, ObjectName name) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
Instantiates a new instance of the specified management bean using the default constructor and registers it with the server under the supplied name. The class is loaded using thedefault loader repositoryof the server. If the name supplied isnull, then the bean is expected to implement theMBeanRegistrationinterface. ThepreRegistermethod of this interface will be used to obtain the name in this case. This method is equivalent to callingwithcreateMBean(className, name, (Object[]) null, (String[]) null)nullparameters and signature.
- Specified by:
- createMBean in interface MBeanServerConnection
- Parameters:
className- the class of the management bean, of which an instance should be created.name- the name to register the new bean with.
- Returns:
- an
ObjectInstancecontaining theObjectNameand Java class name of the created instance.
- Throws:
ReflectionException- if an exception occurs in creating an instance of the bean.InstanceAlreadyExistsException- if a matching instance already exists.MBeanRegistrationException- if an exception occurs in calling the preRegister method.MBeanException- if the bean's constructor throws an exception.NotCompliantMBeanException- if the created bean is not compliant with the JMX specification.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullclass name or object name or if the object name is a pattern.SecurityException- if a security manager exists and the caller's permissions don't imply the use of theinstantiateandregisterMBeanmethods.
public ObjectInstance createMBean(String className, ObjectName name, Object[] params, String[] sig) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException
Instantiates a new instance of the specified management bean using the given constructor and registers it with the server under the supplied name. The class is loaded using thedefault loader repositoryof the server. If the name supplied isnull, then the bean is expected to implement theMBeanRegistrationinterface. ThepreRegistermethod of this interface will be used to obtain the name in this case.
- Specified by:
- createMBean in interface MBeanServerConnection
- Parameters:
className- the class of the management bean, of which an instance should be created.name- the name to register the new bean with.params- the parameters for the bean's constructor.sig- the signature of the constructor to use.
- Returns:
- an
ObjectInstancecontaining theObjectNameand Java class name of the created instance.
- Throws:
ReflectionException- if an exception occurs in creating an instance of the bean.InstanceAlreadyExistsException- if a matching instance already exists.MBeanRegistrationException- if an exception occurs in calling the preRegister method.MBeanException- if the bean's constructor throws an exception.NotCompliantMBeanException- if the created bean is not compliant with the JMX specification.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullclass name or object name or if the object name is a pattern.SecurityException- if a security manager exists and the caller's permissions don't imply the use of theinstantiateandregisterMBeanmethods.
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
Instantiates a new instance of the specified management bean using the default constructor and registers it with the server under the supplied name. The class is loaded using the given class loader. If this argument isnull, then the same class loader as was used to load the server is used. If the name supplied isnull, then the bean is expected to implement theMBeanRegistrationinterface. ThepreRegistermethod of this interface will be used to obtain the name in this case. This method is equivalent to callingwithcreateMBean(className, name, loaderName, (Object[]) null, (String) null)nullparameters and signature.
- Specified by:
- createMBean in interface MBeanServerConnection
- Parameters:
className- the class of the management bean, of which an instance should be created.name- the name to register the new bean with.loaderName- the name of the class loader.
- Returns:
- an
ObjectInstancecontaining theObjectNameand Java class name of the created instance.
- Throws:
ReflectionException- if an exception occurs in creating an instance of the bean.InstanceAlreadyExistsException- if a matching instance already exists.MBeanRegistrationException- if an exception occurs in calling the preRegister method.MBeanException- if the bean's constructor throws an exception.NotCompliantMBeanException- if the created bean is not compliant with the JMX specification.InstanceNotFoundException- if the specified class loader is not registered with the server.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullclass name or object name or if the object name is a pattern.SecurityException- if a security manager exists and the caller's permissions don't imply the use of theinstantiateandregisterMBeanmethods.
public ObjectInstance createMBean(String className, ObjectName name, ObjectName loaderName, Object[] params, String[] sig) throws ReflectionException, InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException, NotCompliantMBeanException, InstanceNotFoundException
Instantiates a new instance of the specified management bean using the given constructor and registers it with the server under the supplied name. The class is loaded using the given class loader. If this argument isnull, then the same class loader as was used to load the server is used. If the name supplied isnull, then the bean is expected to implement theMBeanRegistrationinterface. ThepreRegistermethod of this interface will be used to obtain the name in this case.
- Specified by:
- createMBean in interface MBeanServerConnection
- Parameters:
className- the class of the management bean, of which an instance should be created.name- the name to register the new bean with.loaderName- the name of the class loader.params- the parameters for the bean's constructor.sig- the signature of the constructor to use.
- Returns:
- an
ObjectInstancecontaining theObjectNameand Java class name of the created instance.
- Throws:
ReflectionException- if an exception occurs in creating an instance of the bean.InstanceAlreadyExistsException- if a matching instance already exists.MBeanRegistrationException- if an exception occurs in calling the preRegister method.MBeanException- if the bean's constructor throws an exception.NotCompliantMBeanException- if the created bean is not compliant with the JMX specification.InstanceNotFoundException- if the specified class loader is not registered with the server.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullclass name or object name or if the object name is a pattern.SecurityException- if a security manager exists and the caller's permissions don't imply the use of theinstantiateandregisterMBeanmethods.
public ObjectInputStream deserialize(String name, byte[] data) throws OperationsException, ReflectionException
Deprecated.
getClassLoaderRepository()should be used to obtain the class loading repository, which can then be used to obtain theClassinstance and deserialize the array using its class loader.Deserializes a byte array using the same class loader for its context as was used to load the given class. This class loader is obtained by loading the specified class using theClass Loader Repositoryand then using the class loader of the resultingClassinstance.
- Parameters:
name- the name of the class which should be loaded to obtain the class loader.data- the byte array to be deserialized.
- Returns:
- the deserialized object stream.
- Throws:
OperationsException- if any I/O error is thrown by the deserialization process.ReflectionException- if an error occurs in obtaining theClassinstance.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(null, null, null, "getClassLoaderRepository")
public ObjectInputStream deserialize(String name, ObjectName loader, byte[] data) throws InstanceNotFoundException, ReflectionException, OperationsException
Deprecated.
getClassLoader(ObjectNamecan be used to obtain the named class loader and deserialize the array.Deserializes a byte array using the same class loader for its context as was used to load the given class. The name of the class loader to be used is supplied, and may benullif the server's class loader should be used instead.
- Parameters:
name- the name of the class which should be loaded to obtain the class loader.loader- the name of the class loader to use, ornullif the class loader of the server should be used.data- the byte array to be deserialized.
- Returns:
- the deserialized object stream.
- Throws:
InstanceNotFoundException- if the specified class loader is not registered with the server.OperationsException- if any I/O error is thrown by the deserialization process.ReflectionException- if an error occurs in obtaining theClassinstance.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(className, null, loader, "getClassLoader")
public ObjectInputStream deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException, OperationsException
Deprecated.
getClassLoaderFor(ObjectName)should be used to obtain the class loader of the bean, which can then be used to perform deserialization in the user's code.Deserializes a byte array using the class loader of the specified management bean as its context.
- Parameters:
name- the name of the bean whose class loader should be used.data- the byte array to be deserialized.
- Returns:
- the deserialized object stream.
- Throws:
InstanceNotFoundException- if the specified bean is not registered with the server.OperationsException- if any I/O error is thrown by the deserialization process.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(className, null, name, "getClassLoaderFor")
public Object getAttribute(ObjectName bean, String name) throws MBeanException, AttributeNotFoundException, InstanceNotFoundException, ReflectionException
Returns the value of the supplied attribute from the specified management bean.
- Specified by:
- getAttribute in interface MBeanServerConnection
- Parameters:
bean- the bean to retrieve the value from.name- the name of the attribute to retrieve.
- Returns:
- the value of the attribute.
- Throws:
AttributeNotFoundException- if the attribute could not be accessed from the bean.MBeanException- if the management bean's accessor throws an exception.InstanceNotFoundException- if the bean can not be found.ReflectionException- if an exception was thrown in trying to invoke the bean's accessor.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullbean or attribute name.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, name, bean, "getAttribute")
- See Also:
DynamicMBean.getAttribute(String)
public AttributeList getAttributes(ObjectName bean, String[] names) throws InstanceNotFoundException, ReflectionException
Returns the values of the named attributes from the specified management bean.
- Specified by:
- getAttributes in interface MBeanServerConnection
- Parameters:
bean- the bean to retrieve the value from.names- the names of the attributes to retrieve.
- Returns:
- the values of the attributes.
- Throws:
InstanceNotFoundException- if the bean can not be found.ReflectionException- if an exception was thrown in trying to invoke the bean's accessor.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullbean or attribute name.SecurityException- if a security manager exists and the caller's permissions don't imply. Additionally, for an attribute name,MBeanPermission(className, null, bean, "getAttribute")n, the caller's permission must implyor that attribute will not be included.MBeanPermission(className, n, bean, "getAttribute")
- See Also:
DynamicMBean.getAttributes(String[])
public ClassLoader getClassLoader(ObjectName name) throws InstanceNotFoundException
Returns the specified class loader. If the specified value isnull, then the class loader of the server will be returned. Iflis the requested class loader, andris the actual class loader returned, then eitherlandrwill be identical, or they will at least return the same class fromClassLoader.loadClass(String)for any given string. They may not be identical due to one or the other being wrapped in another class loader (e.g. for security).
- Parameters:
name- the name of the class loader to return.
- Returns:
- the class loader.
- Throws:
InstanceNotFoundException- if the class loader can not be found.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(className, null, name, "getClassLoader")
public ClassLoader getClassLoaderFor(ObjectName name) throws InstanceNotFoundException
Returns the class loader of the specified management bean. Iflis the requested class loader, andris the actual class loader returned, then eitherlandrwill be identical, or they will at least return the same class fromClassLoader.loadClass(String)for any given string. They may not be identical due to one or the other being wrapped in another class loader (e.g. for security).
- Parameters:
name- the name of the bean whose class loader should be returned.
- Returns:
- the class loader.
- Throws:
InstanceNotFoundException- if the bean is not registered with the server.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(className, null, name, "getClassLoaderFor")
public ClassLoaderRepository getClassLoaderRepository()
Returns the class loader repository used by this server.
- Returns:
- the class loader repository.
- Throws:
SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(null, null, null, "getClassLoaderRepository")
public String getDefaultDomain()
Returns the default domain this server applies to beans that have no specified domain.
- Specified by:
- getDefaultDomain in interface MBeanServerConnection
- Returns:
- the default domain.
public String[] getDomains()
Returns an array containing all the domains used by beans registered with this server. The ordering of the array is undefined.
- Specified by:
- getDomains in interface MBeanServerConnection
- Returns:
- the list of domains.
- Throws:
SecurityException- if a security manager exists and the caller's permissions don't imply. Additionally, for an domain,MBeanPermission(null, null, name, "getDomains")d, the caller's permission must implyor that domain will not be included. Note that "x=x" is an arbitrary key-value pair provided to satisfy the constructor.MBeanPermission(null, null, new ObjectName("d:x=x"), "getDomains")
- See Also:
ObjectName.getDomain()
public Integer getMBeanCount()
Returns the number of management beans registered with this server. This may be less than the real number if the caller's access is restricted.
- Specified by:
- getMBeanCount in interface MBeanServerConnection
- Returns:
- the number of registered beans.
public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException, IntrospectionException, ReflectionException
Returns information on the given management bean.
- Specified by:
- getMBeanInfo in interface MBeanServerConnection
- Parameters:
name- the name of the management bean.
- Returns:
- an instance of
MBeanInfofor the bean.
- Throws:
IntrospectionException- if an exception occurs in examining the bean.InstanceNotFoundException- if the bean can not be found.ReflectionException- if an exception occurs when trying to invokeDynamicMBean.getMBeanInfo()on the bean.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, name, "getMBeanInfo")
- See Also:
DynamicMBean.getMBeanInfo()
public ObjectInstance getObjectInstance(ObjectName name) throws InstanceNotFoundException
Returns theObjectInstancecreated for the specified management bean on registration.
- Specified by:
- getObjectInstance in interface MBeanServerConnection
- Parameters:
name- the name of the bean.
- Returns:
- the corresponding
ObjectInstanceinstance.
- Throws:
InstanceNotFoundException- if the bean can not be found.SecurityException- if a security manager exists and the caller's permissions don't implyMBeanPermission(className, null, name, "getObjectInstance")
- See Also:
createMBean(String,ObjectName)
public Object instantiate(String name) throws ReflectionException, MBeanException
Creates an instance of the specified class using the list of class loaders from theClass Loader Repository. The class should have a public constructor with no arguments. A reference to the new instance is returned, but the instance is not yet registered with the server. This method is equivalent to callingwithinstantiate(name, (Object[]) null, (String[]) null)nullparameters and signature.
- Parameters:
name- the name of the class of bean to be instantiated.
- Returns:
- an instance of the given class.
- Throws:
ReflectionException- if an exception is thrown during loading the class or calling the constructor.MBeanException- if the constructor throws an exception.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullname.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, null, "instantiate")
public Object instantiate(String name, Object[] params, String[] sig) throws ReflectionException, MBeanException
Creates an instance of the specified class using the list of class loaders from theClass Loader Repository. The class should have a public constructor matching the supplied signature. A reference to the new instance is returned, but the instance is not yet registered with the server.
- Parameters:
name- the name of the class of bean to be instantiated.params- the parameters for the constructor.sig- the signature of the constructor.
- Returns:
- an instance of the given class.
- Throws:
ReflectionException- if an exception is thrown during loading the class or calling the constructor.MBeanException- if the constructor throws an exception.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullname.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, null, "instantiate")
public Object instantiate(String name, ObjectName loaderName) throws InstanceNotFoundException, ReflectionException, MBeanException
Creates an instance of the specified class using the supplied class loader. If the class loader given isnull, then the class loader of the server will be used. The class should have a public constructor with no arguments. A reference to the new instance is returned, but the instance is not yet registered with the server. This method is equivalent to callingwithinstantiate(name, loaderName, (Object[]) null, (String[]) null)nullparameters and signature.
- Parameters:
name- the name of the class of bean to be instantiated.loaderName- the name of the class loader to use.
- Returns:
- an instance of the given class.
- Throws:
InstanceNotFoundException- if the class loader is not registered with the server.ReflectionException- if an exception is thrown during loading the class or calling the constructor.MBeanException- if the constructor throws an exception.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullname.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, null, "instantiate")
public Object instantiate(String name, ObjectName loaderName, Object[] params, String[] sig) throws InstanceNotFoundException, ReflectionException, MBeanException
Creates an instance of the specified class using the supplied class loader. If the class loader given isnull, then the class loader of the server will be used. The class should have a public constructor matching the supplied signature. A reference to the new instance is returned, but the instance is not yet registered with the server.
- Parameters:
name- the name of the class of bean to be instantiated.loaderName- the name of the class loader to use.params- the parameters for the constructor.sig- the signature of the constructor.
- Returns:
- an instance of the given class.
- Throws:
InstanceNotFoundException- if the class loader is not registered with the server.ReflectionException- if an exception is thrown during loading the class or calling the constructor.MBeanException- if the constructor throws an exception.RuntimeOperationsException- if anIllegalArgumentExceptionis thrown by the server due to anullname.SecurityException- if a security manager exists and the caller's permissions don't imply.MBeanPermission(className, null, null, "instantiate")
public Object invoke(ObjectName bean, String name, Object[] params, String[] sig) throws InstanceNotFoundException, MBeanException, ReflectionException
Invokes the supplied operation on the specified management bean. The class objects specified in the signature are loaded using the same class loader as was used for the management bean.
- Specified by:
- invoke in interface MBeanServerConnection
- Parameters: