org.apache.felix.scr.impl
Class ComponentRegistry

java.lang.Object
  extended by org.apache.felix.scr.impl.ComponentRegistry
All Implemented Interfaces:
ScrService
Direct Known Subclasses:
ConfigurationComponentRegistry

public class ComponentRegistry
extends Object
implements ScrService

The ComponentRegistry class acts as the global registry for components by name and by component ID. As such the component registry also registers itself as the ScrService to support access to the registered components.


Constructor Summary
protected ComponentRegistry(BundleContext context)
           
 
Method Summary
 ComponentHolder createComponentHolder(BundleComponentActivator activator, ComponentMetadata metadata)
          Factory method to issue ComponentHolder instances to manage components described by the given component metadata.
 void dispose()
           
 Component getComponent(long componentId)
          Returns the component whose component.id matches the given componentId or null if no component with the given id is currently managed.
 ComponentHolder getComponentHolder(String name)
          Returns the component registered under the given name or null if no component is registered yet.
 Component[] getComponents()
          Returns an array of all components managed by this SCR instance.
 Component[] getComponents(Bundle bundle)
          Reuturns an array of all components managed by this SCR instance on behalf of the given bundle.
 Component[] getComponents(String componentName)
          Returns the components whose component.name matches the given componentName or null if no component with the given name is currently managed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentRegistry

protected ComponentRegistry(BundleContext context)
Method Detail

dispose

public void dispose()

getComponents

public Component[] getComponents()
Description copied from interface: ScrService
Returns an array of all components managed by this SCR instance. The components are returned in ascending order of their component.id. If there are no components currently managed by the SCR, null is returned.

Specified by:
getComponents in interface ScrService
Returns:
The components or null if there are none.

getComponents

public Component[] getComponents(Bundle bundle)
Description copied from interface: ScrService
Reuturns an array of all components managed by this SCR instance on behalf of the given bundle. The components are returned in ascending order of their component.id. If there are no components managed by the SCR for the given bundle, null is returned.

Specified by:
getComponents in interface ScrService
Parameters:
bundle - The Bundle whose components are to be returned.
Returns:
The bundle's components or null if the bundle has none.

getComponent

public Component getComponent(long componentId)
Description copied from interface: ScrService
Returns the component whose component.id matches the given componentId or null if no component with the given id is currently managed.

Specified by:
getComponent in interface ScrService
Parameters:
componentId - The ID of the component to return
Returns:
The indicated component or null if no such component exists.

getComponents

public Component[] getComponents(String componentName)
Description copied from interface: ScrService
Returns the components whose component.name matches the given componentName or null if no component with the given name is currently managed.

If the component name refers to a component factory component or a component configured with multiple factory configurations this method returns multiple component instances.

Specified by:
getComponents in interface ScrService
Parameters:
componentName - The name of the component to return
Returns:
The indicated components or null if no such component exists.

getComponentHolder

public final ComponentHolder getComponentHolder(String name)
Returns the component registered under the given name or null if no component is registered yet.


createComponentHolder

public ComponentHolder createComponentHolder(BundleComponentActivator activator,
                                             ComponentMetadata metadata)
Factory method to issue ComponentHolder instances to manage components described by the given component metadata.



Copyright © 2011 Apache Software Foundation. All Rights Reserved.