org.apache.commons.modeler
Class Registry

java.lang.Object
  |
  +--org.apache.commons.modeler.Registry

public final class Registry
extends java.lang.Object

Registry for MBean descriptor information. This class implements the Singleton design pattern.

WARNING - It is expected that this registry will be initially populated at startup time, and then provide read-only access in a multithreaded environment. Therefore, no instance operations are synchronized.

Version:
$Revision: 1.1.1.1 $ $Date: 2002/04/30 20:58:52 $
Author:
Craig R. McClanahan

Field Summary
private  java.util.HashMap beans
          The set of ManagedBean instances for the beans this registry knows about, keyed by name.
private static org.apache.commons.logging.Log log
          The Log instance to which we will write our log messages.
private static Registry registry
          The registry instance created by our factory method the first time it is called.
private static javax.management.MBeanServer server
          The MBeanServer instance that we will use to register management beans.
 
Constructor Summary
private Registry()
          Private constructor to require use of the factory create method.
 
Method Summary
 void addManagedBean(ManagedBean bean)
          Add a new bean to the set of beans known to this registry.
 ManagedBean findManagedBean(java.lang.String name)
          Find and return the managed bean definition for the specified bean name, if any; otherwise return null.
 java.lang.String[] findManagedBeans()
          Return the set of bean names for all managed beans known to this registry.
 java.lang.String[] findManagedBeans(java.lang.String group)
          Return the set of bean names for all managed beans known to this registry that belong to the specified group.
static Registry getRegistry()
          Factory method to create (if necessary) and return our Registry instance.
static javax.management.MBeanServer getServer()
          Factory method to create (if necessary) and return our MBeanServer instance.
static void loadRegistry(java.io.InputStream stream)
          Load the registry from the XML input found in the specified input stream.
 void removeManagedBean(ManagedBean bean)
          Remove an existing bean from the set of beans known to this registry.
static void setServer(javax.management.MBeanServer mbeanServer)
          Set the MBeanServer to be utilized for our registered management beans.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

beans

private java.util.HashMap beans
The set of ManagedBean instances for the beans this registry knows about, keyed by name.

log

private static org.apache.commons.logging.Log log
The Log instance to which we will write our log messages.

registry

private static Registry registry
The registry instance created by our factory method the first time it is called.

server

private static javax.management.MBeanServer server
The MBeanServer instance that we will use to register management beans.
Constructor Detail

Registry

private Registry()
Private constructor to require use of the factory create method.
Method Detail

addManagedBean

public void addManagedBean(ManagedBean bean)
Add a new bean to the set of beans known to this registry.
Parameters:
bean - The managed bean to be added

findManagedBean

public ManagedBean findManagedBean(java.lang.String name)
Find and return the managed bean definition for the specified bean name, if any; otherwise return null.
Parameters:
name - Name of the managed bean to be returned

findManagedBeans

public java.lang.String[] findManagedBeans()
Return the set of bean names for all managed beans known to this registry.

findManagedBeans

public java.lang.String[] findManagedBeans(java.lang.String group)
Return the set of bean names for all managed beans known to this registry that belong to the specified group.
Parameters:
group - Name of the group of interest, or null to select beans that do not belong to a group

removeManagedBean

public void removeManagedBean(ManagedBean bean)
Remove an existing bean from the set of beans known to this registry.
Parameters:
bean - The managed bean to be removed

getRegistry

public static Registry getRegistry()
Factory method to create (if necessary) and return our Registry instance.

getServer

public static javax.management.MBeanServer getServer()
Factory method to create (if necessary) and return our MBeanServer instance.

loadRegistry

public static void loadRegistry(java.io.InputStream stream)
                         throws java.lang.Exception
Load the registry from the XML input found in the specified input stream.
Parameters:
stream - InputStream containing the registry configuration information
Throws:
java.lang.Exception - if any parsing or processing error occurs

setServer

public static void setServer(javax.management.MBeanServer mbeanServer)
Set the MBeanServer to be utilized for our registered management beans.
Parameters:
mbeanServer - The new MBeanServer instance


Copyright (c) 2001-2002 - Apache Software Foundation