Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.mx.server.registry
Class BasicMBeanRegistry

    java.lang.Object
      org.jboss.mx.server.registry.BasicMBeanRegistry

All Implemented Interfaces:
  MBeanRegistry, ServerConstants

public class BasicMBeanRegistry
extends Object
implements MBeanRegistry

The registry for object name - object reference mapping in the MBean server.

The implementation of this class affects the invocation speed directly, please check any changes for performance.

Version:
  $Revision: 1.60 $
Author:
  Juha Lindfors., Trevor Squires., Adrian Brock., Jeff Haynie., Thomas Diesler.
See Also:
  `MBeanRegistry`

Field Summary
`protected MBeanServerDelegate` | `delegate` Direct reference to the mandatory MBean server delegate MBean.
`protected Vector` | `fMbInfosToStore`
`protected static org.jboss.logging.Logger` | `log` The logger
`protected EDU.oswego.cs.dl.util.concurrent.SynchronizedLong` | `registrationNotificationSequence` Sequence number for the MBean server registration notifications.
`protected EDU.oswego.cs.dl.util.concurrent.SynchronizedLong` | `unregistrationNotificationSequence` Sequence number for the MBean server unregistration notifications.

Fields inherited from interface org.jboss.mx.server.ServerConstants
`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`

Constructor Summary
`BasicMBeanRegistry(MBeanServer server, String defaultDomain, ClassLoaderRepository clr)` Constructs a new BasicMBeanRegistry.

Method Summary
`protected void` | `add(MBeanEntry entry)` Adds an MBean entry
`boolean` | `contains(ObjectName name)` Test whether an object name is registered.
`List` | `findEntries(ObjectName pattern)` Return a List of MBeanEntry objects with ObjectNames that match the specified pattern.
`MBeanEntry` | `get(ObjectName name)` 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)` Retrieve the object instance for an object name.
`int` | `getSize()` Retrieve the number of mbeans registered.
`Object` | `getValue(ObjectName name, String key)` Retrieve a value from the registration.
`protected void` | `handlePreDeregister(MBeanRegistration registrationInterface)` subclasses can override to provide any custom preDeregister logic and must call preDregister on the MBeanRegistration instance
`protected ObjectName` | `handlePreRegistration(MBeanRegistration registrationInterface, ObjectName regName)` subclasses can override to provide their own pre-registration pre- and post- logic for `preRegister` and must call preRegister on the MBeanRegistration instance
`protected ObjectName` | `invokePreRegister(MBeanInvoker invoker, ObjectName regName, String magicToken)`
`protected Vector` | `mbInfosToStore()` ObjectName objects bound to MBean Info objects that are waiting to be stored in the persistence store.
`protected void` | `persistIfRequired(MBeanInfo info, ObjectName name)` Adds the given MBean Info object to the persistence queue if it explicity denotes (via metadata) that it should be stored.
`protected ObjectName` | `qualifyName(ObjectName name)` Qualify an object name with the default domain
`protected void` | `registerClassLoader(ClassLoader cl)` Subclasses can override if they wish to control the classloader registration to loader repository.
`ObjectInstance` | `registerMBean(Object object, ObjectName name, Map valueMap)` Register an mbean.
`void` | `releaseRegistry()` Cleans up the registry before the MBean server is released.
`protected void` | `remove(ObjectName name)` Removes an MBean entry WARNING: The object name should be fully qualified.
`protected void` | `sendRegistrationNotification(ObjectName regName)` send a MBeanServerNotification.REGISTRATION_NOTIFICATION notification to regName
`protected void` | `sendUnRegistrationNotification(ObjectName name)` send MBeanServerNotification.UNREGISTRATION_NOTIFICATION notification to name
`void` | `unregisterMBean(ObjectName name)` Unregister an mbean.
`protected ObjectName` | `validateAndQualifyName(ObjectName name, String magicToken)` Validates and qualifies an MBean

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### registrationNotificationSequence

    protected final EDU.oswego.cs.dl.util.concurrent.SynchronizedLong registrationNotificationSequence

  Sequence number for the MBean server registration notifications.

### unregistrationNotificationSequence

    protected final EDU.oswego.cs.dl.util.concurrent.SynchronizedLong unregistrationNotificationSequence

  Sequence number for the MBean server unregistration notifications.

### delegate

    protected MBeanServerDelegate delegate

  Direct reference to the mandatory MBean server delegate MBean.

### fMbInfosToStore

    protected Vector fMbInfosToStore

### log

    protected static org.jboss.logging.Logger log

  The logger

Constructor Detail

### BasicMBeanRegistry

    public BasicMBeanRegistry(MBeanServer server,
                              String defaultDomain,
                              ClassLoaderRepository clr)

  Constructs a new BasicMBeanRegistry.

Method Detail

### registerMBean

    public ObjectInstance registerMBean(Object object,
                                        ObjectName name,
                                        Map valueMap)
                                 throws InstanceAlreadyExistsException,
                                        MBeanRegistrationException,
                                        NotCompliantMBeanException

  Description copied from interface: `MBeanRegistry`
  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.

  Specified by:
    `registerMBean` in interface `MBeanRegistry`
  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:
    `NotCompliantMBeanException` - when the passed object is a valid mbean.
    `InstanceAlreadyExistsException` - when the object name is already registered.
    `MBeanRegistrationException` - when an exception is raised during preRegister for the mbean.

### sendRegistrationNotification

    protected void sendRegistrationNotification(ObjectName regName)

  send a MBeanServerNotification.REGISTRATION_NOTIFICATION notification to regName

  Parameters:
    `regName` -

### handlePreRegistration

    protected ObjectName handlePreRegistration(MBeanRegistration registrationInterface,
                                               ObjectName regName)
                                        throws Exception

  subclasses can override to provide their own pre-registration pre- and post- logic for `preRegister` and must call preRegister on the MBeanRegistration instance

  Parameters:
    `registrationInterface` -
    `regName` -
  Returns:
    object name
  Throws:
    `Exception`

### handlePreDeregister

    protected void handlePreDeregister(MBeanRegistration registrationInterface)
                                throws Exception

  subclasses can override to provide any custom preDeregister logic and must call preDregister on the MBeanRegistration instance

  Parameters:
    `registrationInterface` -
  Throws:
    `Exception`

### registerClassLoader

    protected void registerClassLoader(ClassLoader cl)

  Subclasses can override if they wish to control the classloader registration to loader repository.

  Parameters:
    `cl` - classloader

### unregisterMBean

    public void unregisterMBean(ObjectName name)
                         throws InstanceNotFoundException,
                                MBeanRegistrationException

  Description copied from interface: `MBeanRegistry`
  Unregister an mbean.

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

  The object name passed maybe unqualified.

  MBeans in JMImplementation cannot be unregistered

  Specified by:
    `unregisterMBean` in interface `MBeanRegistry`
  Parameters:
    `name` - the mbean to unregister.
  Throws:
    `MBeanRegistrationException` - when an exception is raised during preDeregister for the mbean.
    `InstanceNotFoundException` - when the object name is not registered.

### sendUnRegistrationNotification

    protected void sendUnRegistrationNotification(ObjectName name)

  send MBeanServerNotification.UNREGISTRATION_NOTIFICATION notification to name

  Parameters:
    `name` -

### get

    public MBeanEntry get(ObjectName name)
                   throws InstanceNotFoundException

  Description copied from interface: `MBeanRegistry`
  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.

  Specified by:
    `get` in interface `MBeanRegistry`
  Parameters:
    `name` - the object name to retrieve
  Returns:
    the mbean's registration
  Throws:
    `InstanceNotFoundException` - when the object name is not registered.

### getDefaultDomain

    public String getDefaultDomain()

  Description copied from interface: `MBeanRegistry`
  Retrieve the default domain for this registry.

  Specified by:
    `getDefaultDomain` in interface `MBeanRegistry`
  Returns:
    the default domain

### getDomains

    public String[] getDomains()

  Description copied from interface: `MBeanRegistry`
  Retrieve the domains for this registry.

  Specified by:
    `getDomains` in interface `MBeanRegistry`
  Returns:
    the domains

### getObjectInstance

    public ObjectInstance getObjectInstance(ObjectName name)
                                     throws InstanceNotFoundException

  Description copied from interface: `MBeanRegistry`
  Retrieve the object instance for an object name.

  Specified by:
    `getObjectInstance` in interface `MBeanRegistry`
  Parameters:
    `name` - the object name of the mbean
  Returns:
    the object instance
  Throws:
    `InstanceNotFoundException` - when the object name is not registered

### getValue

    public Object getValue(ObjectName name,
                           String key)
                    throws InstanceNotFoundException

  Description copied from interface: `MBeanRegistry`
  Retrieve a value from the registration.

  Specified by:
    `getValue` in interface `MBeanRegistry`
  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` - when the object name is not registered

### contains

    public boolean contains(ObjectName name)

  Description copied from interface: `MBeanRegistry`
  Test whether an object name is registered.

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

  The object name passed maybe unqualified.

  Specified by:
    `contains` in interface `MBeanRegistry`
  Parameters:
    `name` - the object name
  Returns:
    true when the object name is registered, false otherwise

### getSize

    public int getSize()

  Description copied from interface: `MBeanRegistry`
  Retrieve the number of mbeans registered.

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

  Specified by:
    `getSize` in interface `MBeanRegistry`
  Returns:
    the number of mbeans registered.

### findEntries

    public List findEntries(ObjectName pattern)

  Description copied from interface: `MBeanRegistry`
  Return a List of MBeanEntry objects with ObjectNames that match the specified pattern.

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

  Specified by:
    `findEntries` in interface `MBeanRegistry`
  Parameters:
    `pattern` - the pattern to match
  Returns:
    a List of entries matching the pattern

### releaseRegistry

    public void releaseRegistry()

  Cleans up the registry before the MBean server is released.

  Specified by:
    `releaseRegistry` in interface `MBeanRegistry`

### invokePreRegister

    protected ObjectName invokePreRegister(MBeanInvoker invoker,
                                           ObjectName regName,
                                           String magicToken)
                                    throws MBeanRegistrationException,
                                           NotCompliantMBeanException

  Throws:
    `MBeanRegistrationException`
    `NotCompliantMBeanException`

### add

    protected void add(MBeanEntry 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 WARNING: The object name should be fully qualified.

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

### validateAndQualifyName

    protected ObjectName validateAndQualifyName(ObjectName name,
                                                String magicToken)

  Validates and qualifies an MBean

  Validates the name is not a pattern.

  Adds the default domain if no domain is specified.

  Checks the name is not in the reserved domain JMImplementation when the magicToken is not `JMI_DOMAIN`

  Parameters:
    `name` - the name to validate
    `magicToken` - used to get access to the reserved domain
  Returns:
    the original name or the name prepended with the default domain if no domain is specified.
  Throws:
    `RuntimeOperationsException` - containing an IllegalArgumentException for a problem with the name

### 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

### persistIfRequired

    protected void persistIfRequired(MBeanInfo info,
                                     ObjectName name)
                              throws MalformedObjectNameException,
                                     InstanceNotFoundException,
                                     MBeanException,
                                     ReflectionException

  Adds the given MBean Info object to the persistence queue if it explicity denotes (via metadata) that it should be stored.

  Throws:
    `MalformedObjectNameException`
    `InstanceNotFoundException`
    `MBeanException`
    `ReflectionException`

### mbInfosToStore

    protected Vector mbInfosToStore()

  ObjectName objects bound to MBean Info objects that are waiting to be stored in the persistence store.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.