org.jboss.mx.server.registry
Interface MBeanRegistry

All Superinterfaces:
ServerConstants (src)
All Known Implementing Classes:
BasicMBeanRegistry (src)

public interface MBeanRegistry
extends ServerConstants (src)

Implementations of this interface can be plugged into the MBeanServer, to control the registration and deregistration of MBeans.

The registry can expose itself for management under the object name defined the name defined in ServerConstants (src) When this is the case, the MBeanServer will perform the register/unregister operations dynamically.

See Also:

Revisions:

20030806 Juha Lindfors:

  • Added releaseRegistry() method to the interface as per the patch submitted by Rod Burgett (Bug Tracker: #763378)
(src)

Field Summary
 
Fields inherited from interface org.jboss.mx.server.ServerConstants (src)
CLASS_REMOVED, CLASSLOADER, CLASSLOADER_ADDED, CLASSLOADER_REMOVED, DEFAULT_DOMAIN, DEFAULT_LOADER_NAME, DEFAULT_LOADER_REPOSITORY_CLASS, DEFAULT_MBEAN_REGISTRY_CLASS, DEFAULT_MBEAN_SERVER_BUILDER_CLASS, DEFAULT_REQUIRED_MODELMBEAN_CLASS, DEFAULT_SCOPED_REPOSITORY_CLASS, DEFAULT_SCOPED_REPOSITORY_PARSER_CLASS, IMPLEMENTATION_NAME, IMPLEMENTATION_VENDOR, IMPLEMENTATION_VERSION, JMI_DOMAIN, LOADER_REPOSITORY_CLASS_PROPERTY, MBEAN_REGISTRY, MBEAN_REGISTRY_CLASS_PROPERTY, MBEAN_SERVER_BUILDER_CLASS_PROPERTY, MBEAN_SERVER_CONFIGURATION, MBEAN_SERVER_DELEGATE, OPTIMIZE_REFLECTED_DISPATCHER, REQUIRED_MODELMBEAN_CLASS_PROPERTY, SPECIFICATION_NAME, SPECIFICATION_VENDOR, SPECIFICATION_VERSION, UNIFIED_LOADER_REPOSITORY_CLASS
 
Method Summary
 boolean contains(ObjectName (src)  name)
          Test whether an object name is registered.
 java.util.List findEntries(ObjectName (src)  pattern)
          Return a List of MBeanEntry objects with ObjectNames that match the specified pattern.
 MBeanEntry (src) get(ObjectName (src)  name)
          Retrieve the registration for an object name.
 java.lang.String getDefaultDomain()
          Retrieve the default domain for this registry.
 java.lang.String[] getDomains()
          Retrieve the domains for this registry.
 ObjectInstance (src) getObjectInstance(ObjectName (src)  name)
          Retrieve the object instance for an object name.
 int getSize()
          Retrieve the number of mbeans registered.
 java.lang.Object getValue(ObjectName (src)  name, java.lang.String key)
          Retrieve a value from the registration.
 ObjectInstance (src) registerMBean(java.lang.Object object, ObjectName (src)  name, java.util.Map valueMap)
          Register an mbean.
 void releaseRegistry()
          Invoked before the MBean server instance is released.
 void unregisterMBean(ObjectName (src)  name)
          Unregister an mbean.
 

Method Detail

registerMBean

public ObjectInstance (src)  registerMBean(java.lang.Object object,
                                    ObjectName (src)  name,
                                    java.util.Map valueMap)
                             throws InstanceAlreadyExistsException (src) ,
                                    MBeanRegistrationException (src) ,
                                    NotCompliantMBeanException (src) 
Register an mbean.

This method is invoked by the MBeanServer for createMBean() and registerMBean().

The object name passed maybe unqualified.

The map is a user definable string to value object map for holding information against a registered object. This map may contain metadata related to the registration, such as registration date/time, classloader references, etc.

Pass JMI_DOMAIN in both the key and values of the values map to get access to the reserved domain. It is removed from the map during registration to save memory.

Pass CLASSLOADER in the values map to set the context classloader

Other values are user definable and can be retrieved using the getValue(ObjectName,String) method.

Parameters:
object - the mbean to register.
name - the object name to assign to the mbean.
valueMap - a map of other information to include in the registry
Returns:
an object instance for the registered mbean
Throws:
InstanceAlreadyExistsException (src) - when the object name is already registered.
MBeanRegistrationException (src) - when an exception is raised during preRegister for the mbean.
NotCompliantMBeanException (src) - when the passed object is a valid mbean.

unregisterMBean

public void unregisterMBean(ObjectName (src)  name)
                     throws InstanceNotFoundException (src) ,
                            MBeanRegistrationException (src) 
Unregister an mbean.

This method is invoked by the MBeanServer for unregisterMBean().

The object name passed maybe unqualified.

MBeans in JMImplementation cannot be unregistered

Parameters:
name - the mbean to unregister.
Throws:
InstanceNotFoundException (src) - when the object name is not registered.
MBeanRegistrationException (src) - when an exception is raised during preDeregister for the mbean.

get

public MBeanEntry (src)  get(ObjectName (src)  name)
               throws InstanceNotFoundException (src) 
Retrieve the registration for an object name.

This method is invoked by the MBeanServer for methods passing an ObjectName that are not covered in other methods.

The object name passed maybe unqualified.

Parameters:
name - the object name to retrieve
Returns:
the mbean's registration
Throws:
InstanceNotFoundException (src) - when the object name is not registered.

getDefaultDomain

public java.lang.String getDefaultDomain()
Retrieve the default domain for this registry.

Returns:
the default domain

getDomains

public java.lang.String[] getDomains()
Retrieve the domains for this registry.

Returns:
the domains

getObjectInstance

public ObjectInstance (src)  getObjectInstance(ObjectName (src)  name)
                                 throws InstanceNotFoundException (src) 
Retrieve the object instance for an object name.

Parameters:
name - the object name of the mbean
Returns:
the object instance
Throws:
InstanceNotFoundException (src) - when the object name is not registered

getValue

public java.lang.Object getValue(ObjectName (src)  name,
                                 java.lang.String key)
                          throws InstanceNotFoundException (src) 
Retrieve a value from the registration.

Parameters:
name - the object name of the mbean
key - the key to the value
Returns:
the value or null if there is no such value
Throws:
InstanceNotFoundException (src) - when the object name is not registered

contains

public boolean contains(ObjectName (src)  name)
Test whether an object name is registered.

This method is invoked by the MBeanServer for isRegistered().

The object name passed maybe unqualified.

Parameters:
name - the object name
Returns:
true when the object name is registered, false otherwise

findEntries

public java.util.List findEntries(ObjectName (src)  pattern)
Return a List of MBeanEntry objects with ObjectNames that match the specified pattern.

This method is invoked by the MBeanServer for queryMBeans() and queryNames().

Parameters:
pattern - the pattern to match
Returns:
a List of entries matching the pattern

getSize

public int getSize()
Retrieve the number of mbeans registered.

This method is invoked by the MBeanServer for getMBeanCount().

Returns:
the number of mbeans registered.

releaseRegistry

public void releaseRegistry()
Invoked before the MBean server instance is released. Implementing this method lets the registry to process any clean up before the MBean server is shut down.