org.ow2.util.component
Class ComponentRegistry

java.lang.Object
  extended by org.ow2.util.component.ComponentRegistry
All Implemented Interfaces:
org.ow2.util.component.api.IComponentRegistry

public class ComponentRegistry
extends Object
implements org.ow2.util.component.api.IComponentRegistry

Registry that manages components. It allows to get components.

Author:
Florent Benoit

Constructor Summary
ComponentRegistry()
          Constructor.
 
Method Summary
 org.ow2.util.component.api.Component getComponent(String componentName)
          Allow to get a reference on another component.
 String getComponentName(org.ow2.util.component.api.Component component)
           
<T extends org.ow2.util.component.api.Component>
List<T>
getComponents(Class<T> itf)
          Get the components that implements the given interface.
 void register(String componentName, org.ow2.util.component.api.Component component)
          Register a component.
 void unregister(org.ow2.util.component.api.Component component)
          Unregister a component.
 void unregister(String componentName)
          Unregister a component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentRegistry

public ComponentRegistry()
Constructor.

Method Detail

register

public void register(String componentName,
                     org.ow2.util.component.api.Component component)
              throws org.ow2.util.component.api.ComponentException
Register a component.

Specified by:
register in interface org.ow2.util.component.api.IComponentRegistry
Parameters:
componentName - the name of the component to register
component - the component to register.
Throws:
org.ow2.util.component.api.ComponentException - if registering fails.

unregister

public void unregister(String componentName)
                throws org.ow2.util.component.api.ComponentException
Unregister a component.

Specified by:
unregister in interface org.ow2.util.component.api.IComponentRegistry
Parameters:
componentName - the component name to unregister.
Throws:
org.ow2.util.component.api.ComponentException - if unregistering fails.

unregister

public void unregister(org.ow2.util.component.api.Component component)
                throws org.ow2.util.component.api.ComponentException
Unregister a component.

Specified by:
unregister in interface org.ow2.util.component.api.IComponentRegistry
Parameters:
component - the instance of the component to unregister.
Throws:
org.ow2.util.component.api.ComponentException - if unregistering fails.

getComponent

public org.ow2.util.component.api.Component getComponent(String componentName)
Allow to get a reference on another component.

Specified by:
getComponent in interface org.ow2.util.component.api.IComponentRegistry
Parameters:
componentName - the name of the component
Returns:
the component.

getComponentName

public String getComponentName(org.ow2.util.component.api.Component component)
Specified by:
getComponentName in interface org.ow2.util.component.api.IComponentRegistry
Parameters:
component - EZBComponent instance.
Returns:
Returns the component name from the EZBComponent instance.

getComponents

public <T extends org.ow2.util.component.api.Component> List<T> getComponents(Class<T> itf)
Get the components that implements the given interface.

Specified by:
getComponents in interface org.ow2.util.component.api.IComponentRegistry
Type Parameters:
T - an interface extending EZBComponent.
Parameters:
itf - the given interface
Returns:
an array of components implementing the given interface


Copyright © 2007-2011 OW2 Consortium. All Rights Reserved.