net.sf.infrared.agent.integration
Class ComponentRegistry

java.lang.Object
  extended bynet.sf.infrared.agent.integration.ComponentRegistry

public class ComponentRegistry
extends Object

The registry where components register/unregister their monitors. Components integrated with InfraRED should ensure that their respective ComponentMonitor implementations are registered before any of their aspects are executed.


Constructor Summary
ComponentRegistry()
           
 
Method Summary
protected static void clear()
          Clears all registrations
static ContextApiTime[] getAllComponentStatistics()
           
static Collection getAllRegisteredComponents()
          Gets a Collection of all monitors registered.
static ComponentMonitor getComponentMonitor(String name)
          Gets the component monitor registered by the given name; returns null if none is registered
static boolean isRegistered(String name)
          Checks if any component montior is registered by the given name.
static boolean register(String name, ComponentMonitor compMonitor)
          Registers a monitor in a given name.
static boolean reregister(String name, ComponentMonitor compMonitor)
          Registers a monitor in a given name.
static void resetAllRegisteredComponents()
           
static boolean unregister(String name)
          Unregisters the monitor by the given name, if any has been already registered.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentRegistry

public ComponentRegistry()
Method Detail

register

public static boolean register(String name,
                               ComponentMonitor compMonitor)
Registers a monitor in a given name. Throws an IllegalStateException if some other monitor is already registerd by this name

Parameters:
name - of the component whose monitor this is
compMonitor - the ComponentMonitor implementation
Returns:
true if this monitor has not already been registered, and if this registeration is successful; false if this monitor has already been registered by the same name, and hence this registration is ignored.

reregister

public static boolean reregister(String name,
                                 ComponentMonitor compMonitor)
Registers a monitor in a given name. Overwrites the prevoius monitor registered by this name, if one exists.

Parameters:
name -
compMonitor -
Returns:
true if this resgistration had overwritten an earlier one for this name; else false.
Throws:
IllegalArgumentException - if name of compMonitor parameters are null

unregister

public static boolean unregister(String name)
Unregisters the monitor by the given name, if any has been already registered. If no component has already been registered by this name, this request is ignored.

Parameters:
name -
Returns:
true if a component was registered by this name and was unregistered by this call; else false.

getComponentMonitor

public static ComponentMonitor getComponentMonitor(String name)
Gets the component monitor registered by the given name; returns null if none is registered

Parameters:
name -
Returns:
ComponentMonitor implementation

isRegistered

public static boolean isRegistered(String name)
Checks if any component montior is registered by the given name.

Parameters:
name -
Returns:
true if there is ComponentMonitor registered by this name, else false.

getAllRegisteredComponents

public static Collection getAllRegisteredComponents()
Gets a Collection of all monitors registered.

Returns:
collection of monitors registered.

resetAllRegisteredComponents

public static void resetAllRegisteredComponents()

getAllComponentStatistics

public static ContextApiTime[] getAllComponentStatistics()

clear

protected static void clear()
Clears all registrations