JBossMX Parent POM 6.0.0.GA

org.jboss.jmx.mbeanserver
Class JBossMBeanRegistry

java.lang.Object
  extended by org.jboss.jmx.mbeanserver.JBossMBeanRegistry

public class JBossMBeanRegistry
extends Object

JBossMBeanRegistry.

Version:
$Revision: 1.1 $
Author:
Adrian Brock

Constructor Summary
JBossMBeanRegistry(MBeanServer server)
          Create a new JBossMBeanRegistry.
 
Method Summary
protected  void add(org.jboss.jmx.mbeanserver.RegistryEntry entry)
          Adds an MBean entry
 boolean contains(ObjectName name)
          Test whether an object name is registered.
 org.jboss.jmx.mbeanserver.RegistryEntry get(ObjectName name)
          Retrieve the registration for an object name.
 org.jboss.jmx.mbeanserver.RegistryEntry get(ObjectName name, boolean errorIfNotFound)
          Retrieve the registration for an object name.
 String getDefaultDomain()
          Retrieve the default domain for this registry.
 String[] getDomains()
          Retrieve the domains for this registry.
 ObjectInstance getObjectInstance(ObjectName name)
           
 int getSize()
          Retrieve the number of mbeans registered.
 Object getValue(ObjectName name, String key)
          Retrieve the object instance for an object name.
protected  ObjectName qualifyName(ObjectName name)
          Qualify an object name with the default domain
 ObjectInstance registerMBean(Object object, ObjectName name, Map<String,Object> valueMap)
          Register an mbean.
protected  void remove(ObjectName name)
          Removes an MBean entry
 void unregisterMBean(ObjectName name)
          Unregister an mbean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossMBeanRegistry

public JBossMBeanRegistry(MBeanServer server)
Create a new JBossMBeanRegistry.

Parameters:
server - the server
Method Detail

registerMBean

public ObjectInstance registerMBean(Object object,
                                    ObjectName name,
                                    Map<String,Object> valueMap)
                             throws InstanceAlreadyExistsException,
                                    MBeanRegistrationException,
                                    NotCompliantMBeanException
Register an mbean.

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 org.jboss.mx.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 - when the object name is already registered.
MBeanRegistrationException - when an exception is raised during preRegister for the mbean.
NotCompliantMBeanException - when the passed object is a valid mbean.

unregisterMBean

public void unregisterMBean(ObjectName name)
                     throws InstanceNotFoundException,
                            MBeanRegistrationException
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 - when the object name is not registered.
MBeanRegistrationException - when an exception is raised during preDeregister for the mbean.

get

public org.jboss.jmx.mbeanserver.RegistryEntry get(ObjectName name)
                                            throws InstanceNotFoundException
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 - when the object name is not registered.

get

public org.jboss.jmx.mbeanserver.RegistryEntry get(ObjectName name,
                                                   boolean errorIfNotFound)
                                            throws InstanceNotFoundException
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
errorIfNotFound - whether to throw an error if not found
Returns:
the mbean's registration
Throws:
InstanceNotFoundException - when the object name is not registered.

getDefaultDomain

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

Returns:
the default domain

getDomains

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

Returns:
the domains

getObjectInstance

public ObjectInstance getObjectInstance(ObjectName name)
                                 throws InstanceNotFoundException
Throws:
InstanceNotFoundException

getValue

public Object getValue(ObjectName name,
                       String key)
                throws InstanceNotFoundException
Retrieve the object instance for an object name.

Parameters:
name - the object name of the mbean
key - the key to retrieve
Returns:
the object instance
Throws:
InstanceNotFoundException - when the object name is not registered

contains

public boolean contains(ObjectName 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

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.

add

protected void add(org.jboss.jmx.mbeanserver.RegistryEntry entry)
            throws InstanceAlreadyExistsException
Adds an MBean entry

WARNING: The object name should be fully qualified.

Parameters:
entry - the MBean entry to add
Throws:
InstanceAlreadyExistsException - when the MBean's object name is already registered

remove

protected void remove(ObjectName name)
               throws InstanceNotFoundException
Removes an MBean entry

Parameters:
name - the object name of the entry to remove
Throws:
InstanceNotFoundException - when the object name is not registered

qualifyName

protected ObjectName qualifyName(ObjectName name)
Qualify an object name with the default domain

Adds the default domain if no domain is specified.

Parameters:
name - the name to qualify
Returns:
the original name or the name prepended with the default domain if no domain is specified.
Throws:
RuntimeOperationsException - containing an IllegalArgumentException when there is a problem

JBossMX Parent POM 6.0.0.GA

Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.