javax.management
Interface MBeanServerConnection

All Known Subinterfaces:
AdaptorMBean (src) , MBeanServer (src) , RMIAdaptor (src) , RMIAdaptorExt (src)
All Known Implementing Classes:
Adaptor (src) , MBeanServerImpl (src)

public interface MBeanServerConnection

An interface used to talk to an MBeanServer that is either remote or local. The local interface MBeanServer extends this one.

See Also:
MBeanServer (src)

Method Summary
 void addNotificationListener(ObjectName (src)  name, NotificationListener (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Add a notification listener to an MBean.
 void addNotificationListener(ObjectName (src)  name, ObjectName (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Add a notification listener to an MBean.
 ObjectInstance (src) createMBean(java.lang.String className, ObjectName (src)  name)
          Create an MBean registered using the given object name.
 ObjectInstance (src) createMBean(java.lang.String className, ObjectName (src)  name, java.lang.Object[] params, java.lang.String[] signature)
          Create an MBean registered using the given object name.
 ObjectInstance (src) createMBean(java.lang.String className, ObjectName (src)  name, ObjectName (src)  loaderName)
          Create an MBean registered using the given object name.
 ObjectInstance (src) createMBean(java.lang.String className, ObjectName (src)  name, ObjectName (src)  loaderName, java.lang.Object[] params, java.lang.String[] signature)
          Create an MBean registered using the given object name.
 java.lang.Object getAttribute(ObjectName (src)  name, java.lang.String attribute)
          Retrieve a value from an MBean.
 AttributeList (src) getAttributes(ObjectName (src)  name, java.lang.String[] attributes)
          Retrieve a list of values from an MBean.
 java.lang.String getDefaultDomain()
          Retrieve the default domain of the mbeanserver.
 java.lang.String[] getDomains()
          Retrieve the domains of the mbeanserver.
 java.lang.Integer getMBeanCount()
          Retrieve the number of mbeans registered in the server.
 MBeanInfo (src) getMBeanInfo(ObjectName (src)  name)
          Retrieves the jmx metadata for an mbean
 ObjectInstance (src) getObjectInstance(ObjectName (src)  name)
          Retrieve an MBean's registration information.
 java.lang.Object invoke(ObjectName (src)  name, java.lang.String operationName, java.lang.Object[] params, java.lang.String[] signature)
          Invokes an operation on an mbean.
 boolean isInstanceOf(ObjectName (src)  name, java.lang.String className)
          Tests whether an mbean can be cast to the given type
 boolean isRegistered(ObjectName (src)  name)
          Test whether an mbean is registered.
 java.util.Set queryMBeans(ObjectName (src)  name, QueryExp (src)  query)
          Retrieve a set of Object instances
 java.util.Set queryNames(ObjectName (src)  name, QueryExp (src)  query)
          Retrieve a set of Object names
 void removeNotificationListener(ObjectName (src)  name, NotificationListener (src)  listener)
          Removes a listener from an mbean.
 void removeNotificationListener(ObjectName (src)  name, NotificationListener (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Removes a listener from an mbean.
 void removeNotificationListener(ObjectName (src)  name, ObjectName (src)  listener)
          Removes a listener from an mbean.
 void removeNotificationListener(ObjectName (src)  name, ObjectName (src)  listener, NotificationFilter (src)  filter, java.lang.Object handback)
          Removes a listener from an mbean.
 void setAttribute(ObjectName (src)  name, Attribute (src)  attribute)
          Set a value for an MBean.
 AttributeList (src) setAttributes(ObjectName (src)  name, AttributeList (src)  attributes)
          Set a list of values for an MBean.
 void unregisterMBean(ObjectName (src)  name)
          Unregisters an mbean.
 

Method Detail

createMBean

public ObjectInstance (src)  createMBean(java.lang.String className,
                                  ObjectName (src)  name)
                           throws ReflectionException (src) ,
                                  InstanceAlreadyExistsException (src) ,
                                  MBeanRegistrationException (src) ,
                                  MBeanException (src) ,
                                  NotCompliantMBeanException (src) ,
                                  java.io.IOException
Create an MBean registered using the given object name.

Uses the default contructor.

Parameters:
className - the class name of the mbean
name - the object name for registration, can be null
Returns:
an ObjectInstance describing the registration
Throws:
ReflectionException (src) - for class not found or an exception invoking the contructor
InstanceAlreadyExistsException (src) - for an MBean already registered with the passed or generated ObjectName
MBeanRegistrationException (src) - for any exception thrown by the MBean's preRegister
MBeanException (src) - for any exception thrown by the MBean's constructor
NotCompliantMBeanException (src) - if the class name does not correspond to a valid MBean
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null class name, the ObjectName could not be determined or it is a pattern
java.io.IOException - for a communication problem during this operation

createMBean

public ObjectInstance (src)  createMBean(java.lang.String className,
                                  ObjectName (src)  name,
                                  ObjectName (src)  loaderName)
                           throws ReflectionException (src) ,
                                  InstanceAlreadyExistsException (src) ,
                                  MBeanRegistrationException (src) ,
                                  MBeanException (src) ,
                                  NotCompliantMBeanException (src) ,
                                  InstanceNotFoundException (src) ,
                                  java.io.IOException
Create an MBean registered using the given object name.

The MBean is loaded using the passed classloader. Uses the default contructor.

Parameters:
className - the class name of the mbean
loaderName - an MBean that implements a classloader
name - the object name for registration, can be null
Returns:
an ObjectInstance describing the registration
Throws:
ReflectionException (src) - for class not found or an exception invoking the contructor
InstanceAlreadyExistsException (src) - for an MBean already registered with the passed or generated ObjectName
MBeanRegistrationException (src) - for any exception thrown by the MBean's preRegister
MBeanException (src) - for any exception thrown by the MBean's constructor
InstanceNotFoundException (src) - if the loaderName is not a classloader registered in the MBeanServer
NotCompliantMBeanException (src) - if the class name does not correspond to a valid MBean
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null class name, the ObjectName could not be determined or it is a pattern
java.io.IOException - for a communication problem during this operation

createMBean

public ObjectInstance (src)  createMBean(java.lang.String className,
                                  ObjectName (src)  name,
                                  java.lang.Object[] params,
                                  java.lang.String[] signature)
                           throws ReflectionException (src) ,
                                  InstanceAlreadyExistsException (src) ,
                                  MBeanRegistrationException (src) ,
                                  MBeanException (src) ,
                                  NotCompliantMBeanException (src) ,
                                  java.io.IOException
Create an MBean registered using the given object name.

Uses the specified constructor.

Parameters:
className - the class name of the mbean
name - the object name for registration, can be null
params - the parameters for the constructor
signature - the signature of the constructor
Returns:
an ObjectInstance describing the registration
Throws:
ReflectionException (src) - for class not found or an exception invoking the contructor
InstanceAlreadyExistsException (src) - for an MBean already registered with the passed or generated ObjectName
MBeanRegistrationException (src) - for any exception thrown by the MBean's preRegister
MBeanException (src) - for any exception thrown by the MBean's constructor
NotCompliantMBeanException (src) - if the class name does not correspond to a valid MBean
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null class name, the ObjectName could not be determined or it is a pattern
java.io.IOException - for a communication problem during this operation

createMBean

public ObjectInstance (src)  createMBean(java.lang.String className,
                                  ObjectName (src)  name,
                                  ObjectName (src)  loaderName,
                                  java.lang.Object[] params,
                                  java.lang.String[] signature)
                           throws ReflectionException (src) ,
                                  InstanceAlreadyExistsException (src) ,
                                  MBeanRegistrationException (src) ,
                                  MBeanException (src) ,
                                  NotCompliantMBeanException (src) ,
                                  InstanceNotFoundException (src) ,
                                  java.io.IOException
Create an MBean registered using the given object name.

The MBean is loaded using the passed classloader. Uses the specified constructor.

Parameters:
className - the class name of the mbean
loaderName - an MBean that implements a classloader
name - the object name for registration, can be null
params - the parameters for the constructor
signature - the signature of the constructor
Returns:
an ObjectInstance describing the registration
Throws:
ReflectionException (src) - for class not found or an exception invoking the contructor
InstanceAlreadyExistsException (src) - for an MBean already registered with the passed or generated ObjectName
MBeanRegistrationException (src) - for any exception thrown by the MBean's preRegister
MBeanException (src) - for any exception thrown by the MBean's constructor
InstanceNotFoundException (src) - if the loaderName is not a classloader registered in the MBeanServer
NotCompliantMBeanException (src) - if the class name does not correspond to a valid MBean
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null class name, the ObjectName could not be determined or it is a pattern
java.io.IOException - for a communication problem during this operation

unregisterMBean

public void unregisterMBean(ObjectName (src)  name)
                     throws InstanceNotFoundException (src) ,
                            MBeanRegistrationException (src) ,
                            java.io.IOException
Unregisters an mbean.

Parameters:
name - the object name of the mbean to unregister
Throws:
InstanceNotFoundException (src) - if the mbean is not registered in the MBeanServer
MBeanRegistrationException (src) - for any exception thrown by the MBean's preDeregister
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name, or trying to unregister a JMX implementation MBean
java.io.IOException - for a communication problem during this operation

getObjectInstance

public ObjectInstance (src)  getObjectInstance(ObjectName (src)  name)
                                 throws InstanceNotFoundException (src) ,
                                        java.io.IOException
Retrieve an MBean's registration information.

Parameters:
name - the object name of the mbean
Throws:
InstanceNotFoundException (src) - if the mbean is not registered in the MBeanServer
java.io.IOException - for a communication problem during this operation

queryMBeans

public java.util.Set queryMBeans(ObjectName (src)  name,
                                 QueryExp (src)  query)
                          throws java.io.IOException
Retrieve a set of Object instances

Parameters:
name - an ObjectName pattern, can be null for all mbeans
query - a query expression to further filter the mbeans, can be null for no query
Throws:
java.io.IOException - for a communication problem during this operation

queryNames

public java.util.Set queryNames(ObjectName (src)  name,
                                QueryExp (src)  query)
                         throws java.io.IOException
Retrieve a set of Object names

Parameters:
name - an ObjectName pattern, can be null for all mbeans
query - a query expression to further filter the mbeans, can be null for no query
Throws:
java.io.IOException - for a communication problem during this operation

isRegistered

public boolean isRegistered(ObjectName (src)  name)
                     throws java.io.IOException
Test whether an mbean is registered.

Parameters:
name - the object name of the mbean
Returns:
true when the mbean is registered, false otherwise
Throws:
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name
java.io.IOException - for a communication problem during this operation

getMBeanCount

public java.lang.Integer getMBeanCount()
                                throws java.io.IOException
Retrieve the number of mbeans registered in the server.

Returns:
true the number of registered mbeans
Throws:
java.io.IOException - for a communication problem during this operation

getAttribute

public java.lang.Object getAttribute(ObjectName (src)  name,
                                     java.lang.String attribute)
                              throws MBeanException (src) ,
                                     AttributeNotFoundException (src) ,
                                     InstanceNotFoundException (src) ,
                                     ReflectionException (src) ,
                                     java.io.IOException
Retrieve a value from an MBean.

Parameters:
name - the object name of the mbean
attribute - the attribute name of the value to retrieve
Returns:
the value
Throws:
ReflectionException (src) - for an exception invoking the mbean
MBeanException (src) - for any exception thrown by the mbean
InstanceNotFoundException (src) - if the mbean is not registered
AttributeNotFoundException (src) - if the mbean has no such attribute
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name or attribute
java.io.IOException - for a communication problem during this operation

getAttributes

public AttributeList (src)  getAttributes(ObjectName (src)  name,
                                   java.lang.String[] attributes)
                            throws InstanceNotFoundException (src) ,
                                   ReflectionException (src) ,
                                   java.io.IOException
Retrieve a list of values from an MBean.

Parameters:
name - the object name of the mbean
attributes - the attribute names of the values to retrieve
Returns:
the list of values, attributes with errors are ignored
Throws:
ReflectionException (src) - for an exception invoking the mbean
InstanceNotFoundException (src) - if the mbean is not registered
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name or attributes
java.io.IOException - for a communication problem during this operation

setAttribute

public void setAttribute(ObjectName (src)  name,
                         Attribute (src)  attribute)
                  throws InstanceNotFoundException (src) ,
                         AttributeNotFoundException (src) ,
                         InvalidAttributeValueException (src) ,
                         MBeanException (src) ,
                         ReflectionException (src) ,
                         java.io.IOException
Set a value for an MBean.

Parameters:
name - the object name of the mbean
attribute - the attribute name and value to set
Throws:
ReflectionException (src) - for an exception invoking the mbean
MBeanException (src) - for any exception thrown by the mbean
InstanceNotFoundException (src) - if the mbean is not registered
AttributeNotFoundException (src) - if the mbean has no such attribute
InvalidAttributeValueException (src) - if the new value has an incorrect type
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name or attribute
java.io.IOException - for a communication problem during this operation

setAttributes

public AttributeList (src)  setAttributes(ObjectName (src)  name,
                                   AttributeList (src)  attributes)
                            throws InstanceNotFoundException (src) ,
                                   ReflectionException (src) ,
                                   java.io.IOException
Set a list of values for an MBean.

Parameters:
name - the object name of the mbean
attributes - the attribute names and values to set
Returns:
the list of values, attributes with errors are ignored
Throws:
ReflectionException (src) - for an exception invoking the mbean
InstanceNotFoundException (src) - if the mbean is not registered
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null name or attributes
java.io.IOException - for a communication problem during this operation

invoke

public java.lang.Object invoke(ObjectName (src)  name,
                               java.lang.String operationName,
                               java.lang.Object[] params,
                               java.lang.String[] signature)
                        throws InstanceNotFoundException (src) ,
                               MBeanException (src) ,
                               ReflectionException (src) ,
                               java.io.IOException
Invokes an operation on an mbean.

Parameters:
name - the object name of the mbean
operationName - the operation to perform
params - the parameters
signature - the signature of the operation
Returns:
any result of the operation
Throws:
ReflectionException (src) - for an exception invoking the mbean
MBeanException (src) - for any exception thrown by the mbean
InstanceNotFoundException (src) - if the mbean is not registered
java.io.IOException - for a communication problem during this operation

getDefaultDomain

public java.lang.String getDefaultDomain()
                                  throws java.io.IOException
Retrieve the default domain of the mbeanserver.

Returns:
the default domain
Throws:
java.io.IOException - for a communication problem during this operation

getDomains

public java.lang.String[] getDomains()
                              throws java.io.IOException
Retrieve the domains of the mbeanserver.

Returns:
the domains
Throws:
java.io.IOException - for a communication problem during this operation

addNotificationListener

public void addNotificationListener(ObjectName (src)  name,
                                    NotificationListener (src)  listener,
                                    NotificationFilter (src)  filter,
                                    java.lang.Object handback)
                             throws InstanceNotFoundException (src) ,
                                    java.io.IOException
Add a notification listener to an MBean.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the listener to add
filter - a filter to preprocess notifications
handback - a object to add to any notifications
Throws:
InstanceNotFoundException (src) - if the broadcaster is not registered
java.io.IOException - for a communication problem during this operation

addNotificationListener

public void addNotificationListener(ObjectName (src)  name,
                                    ObjectName (src)  listener,
                                    NotificationFilter (src)  filter,
                                    java.lang.Object handback)
                             throws InstanceNotFoundException (src) ,
                                    java.io.IOException
Add a notification listener to an MBean.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the object name listener to add
filter - a filter to preprocess notifications
handback - a object to add to any notifications
Throws:
InstanceNotFoundException (src) - if the broadcaster or listener is not registered
RuntimeOperationsException (src) - wrapping an IllegalArgumentException for a null listener or the listener does not implement the Notification Listener interface
java.io.IOException - for a communication problem during this operation

removeNotificationListener

public void removeNotificationListener(ObjectName (src)  name,
                                       ObjectName (src)  listener)
                                throws InstanceNotFoundException (src) ,
                                       ListenerNotFoundException (src) ,
                                       java.io.IOException
Removes a listener from an mbean.

All registrations of the listener are removed.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the object name of the listener to remove
Throws:
InstanceNotFoundException (src) - if the broadcaster or listener is not registered
ListenerNotFoundException (src) - if the listener is not registered against the broadcaster
java.io.IOException - for a communication problem during this operation

removeNotificationListener

public void removeNotificationListener(ObjectName (src)  name,
                                       ObjectName (src)  listener,
                                       NotificationFilter (src)  filter,
                                       java.lang.Object handback)
                                throws InstanceNotFoundException (src) ,
                                       ListenerNotFoundException (src) ,
                                       java.io.IOException
Removes a listener from an mbean.

Only the listener that was registered with the same filter and handback is removed.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the object name of listener to remove
filter - the filter of the listener to remove
Throws:
InstanceNotFoundException (src) - if the broadcaster or listener is not registered
ListenerNotFoundException (src) - if the listener, filter, handback is not registered against the broadcaster
java.io.IOException - for a communication problem during this operation

removeNotificationListener

public void removeNotificationListener(ObjectName (src)  name,
                                       NotificationListener (src)  listener)
                                throws InstanceNotFoundException (src) ,
                                       ListenerNotFoundException (src) ,
                                       java.io.IOException
Removes a listener from an mbean.

All registrations of the listener are removed.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the listener to remove
Throws:
InstanceNotFoundException (src) - if the broadcaster is not registered
ListenerNotFoundException (src) - if the listener is not registered against the broadcaster
java.io.IOException - for a communication problem during this operation

removeNotificationListener

public void removeNotificationListener(ObjectName (src)  name,
                                       NotificationListener (src)  listener,
                                       NotificationFilter (src)  filter,
                                       java.lang.Object handback)
                                throws InstanceNotFoundException (src) ,
                                       ListenerNotFoundException (src) ,
                                       java.io.IOException
Removes a listener from an mbean.

Only the listener that was registered with the same filter and handback is removed.

Parameters:
name - the name of the MBean broadcasting notifications
listener - the listener to remove
filter - the filter of the listener to remove
Throws:
InstanceNotFoundException (src) - if the broadcaster is not registered
ListenerNotFoundException (src) - if the listener, filter, handback is not registered against the broadcaster
java.io.IOException - for a communication problem during this operation

getMBeanInfo

public MBeanInfo (src)  getMBeanInfo(ObjectName (src)  name)
                       throws InstanceNotFoundException (src) ,
                              IntrospectionException (src) ,
                              ReflectionException (src) ,
                              java.io.IOException
Retrieves the jmx metadata for an mbean

Parameters:
name - the name of the mbean
Returns:
the metadata
Throws:
IntrospectionException (src) - for any error during instrospection
InstanceNotFoundException (src) - if the mbean is not registered
ReflectionException (src) - for any error trying to invoke the operation on the mbean
java.io.IOException - for a communication problem during this operation

isInstanceOf

public boolean isInstanceOf(ObjectName (src)  name,
                            java.lang.String className)
                     throws InstanceNotFoundException (src) ,
                            java.io.IOException
Tests whether an mbean can be cast to the given type

Parameters:
name - the name of the mbean
className - the class name to check
Returns:
true when it is of that type, false otherwise
Throws:
InstanceNotFoundException (src) - if the mbean is not registered
java.io.IOException - for a communication problem during this operation