org.apache.aries.blueprint.namespace
Class ComponentDefinitionRegistryImpl

java.lang.Object
  extended by org.apache.aries.blueprint.namespace.ComponentDefinitionRegistryImpl
All Implemented Interfaces:
ComponentDefinitionRegistry

public class ComponentDefinitionRegistryImpl
extends java.lang.Object
implements ComponentDefinitionRegistry

ComponentDefinitionRegistry implementation. This implementation uses concurrent lists and maps to store components and converters metadata to allow its use by concurrent threads.

Version:
$Rev: 1002318 $, $Date: 2010-09-28 19:47:49 +0100 (Tue, 28 Sep 2010) $

Constructor Summary
ComponentDefinitionRegistryImpl()
           
 
Method Summary
 boolean containsComponentDefinition(java.lang.String name)
          Determine if the component registry contains a component definition for the given id
 ComponentMetadata getComponentDefinition(java.lang.String name)
          Retrieve a component's metadata by id
 java.util.Set<java.lang.String> getComponentDefinitionNames()
          Returns a set of the id of top-level blueprint components (both named and unnamed).
 java.util.List<Interceptor> getInterceptors(ComponentMetadata component)
          Retrieve all interceptors registered against a ComponentMetadata instance
 java.util.List<Target> getTypeConverters()
           
 void registerComponentDefinition(ComponentMetadata component)
          Register a new component The ComponentMetadata argument must have an id.
 void registerInterceptorWithComponent(ComponentMetadata component, Interceptor interceptor)
          Register an interceptor for a given component Since the interceptor is registered against a ComponentMetadata instance and not an id, interceptors can be registered for anonymous components as well as named and unnamed components.
 void registerTypeConverter(Target component)
           
 void removeComponentDefinition(java.lang.String name)
          Remove the component definition with a given id If no component is registered under the id, this method is a no-op.
 void reset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentDefinitionRegistryImpl

public ComponentDefinitionRegistryImpl()
Method Detail

reset

public void reset()

containsComponentDefinition

public boolean containsComponentDefinition(java.lang.String name)
Description copied from interface: ComponentDefinitionRegistry
Determine if the component registry contains a component definition for the given id

Specified by:
containsComponentDefinition in interface ComponentDefinitionRegistry
Returns:

getComponentDefinition

public ComponentMetadata getComponentDefinition(java.lang.String name)
Description copied from interface: ComponentDefinitionRegistry
Retrieve a component's metadata by id

Specified by:
getComponentDefinition in interface ComponentDefinitionRegistry
Parameters:
name - The id of the component. This is either the id specified in the Blueprint xml or the generated id of an unnamed component
Returns:
the ComponentMetadata or null if the id does not match any registered component

getComponentDefinitionNames

public java.util.Set<java.lang.String> getComponentDefinitionNames()
Description copied from interface: ComponentDefinitionRegistry
Returns a set of the id of top-level blueprint components (both named and unnamed). The ids of unnamed components are Blueprint generated. Anonymous components, which have no id, are not part of the set.

Specified by:
getComponentDefinitionNames in interface ComponentDefinitionRegistry
Returns:

registerComponentDefinition

public void registerComponentDefinition(ComponentMetadata component)
Description copied from interface: ComponentDefinitionRegistry
Register a new component The ComponentMetadata argument must have an id. So unnamed components should have an id generated prior to invoking this method. Also, no component definition may already be registered under the same id.

Specified by:
registerComponentDefinition in interface ComponentDefinitionRegistry
Parameters:
component - the component to be registered

removeComponentDefinition

public void removeComponentDefinition(java.lang.String name)
Description copied from interface: ComponentDefinitionRegistry
Remove the component definition with a given id If no component is registered under the id, this method is a no-op.

Specified by:
removeComponentDefinition in interface ComponentDefinitionRegistry
Parameters:
name - the id of the component definition to be removed

registerTypeConverter

public void registerTypeConverter(Target component)
Specified by:
registerTypeConverter in interface ComponentDefinitionRegistry

getTypeConverters

public java.util.List<Target> getTypeConverters()
Specified by:
getTypeConverters in interface ComponentDefinitionRegistry

registerInterceptorWithComponent

public void registerInterceptorWithComponent(ComponentMetadata component,
                                             Interceptor interceptor)
Description copied from interface: ComponentDefinitionRegistry
Register an interceptor for a given component Since the interceptor is registered against a ComponentMetadata instance and not an id, interceptors can be registered for anonymous components as well as named and unnamed components. Note: Although an interceptor is registered against a specific ComponentMetadata instance, an interceptor should not rely on this fact. This will allow NamespaceHandlers and ComponentDefinitionRegistryProcessors to respect registered interceptors even when the actual ComponentMetadata instance is changed or augmented. If an interceptor does not support such a scenario it should nevertheless fail gracefully in the case of modified ComponentMetadata instances. Note: at the time of this writing (version 0.1) interceptors are only supported for BeanMetadata. Interceptors registered against other component types will be ignored.

Specified by:
registerInterceptorWithComponent in interface ComponentDefinitionRegistry
Parameters:
component - the component the interceptor is to be registered against
interceptor - the interceptor to be used

getInterceptors

public java.util.List<Interceptor> getInterceptors(ComponentMetadata component)
Description copied from interface: ComponentDefinitionRegistry
Retrieve all interceptors registered against a ComponentMetadata instance

Specified by:
getInterceptors in interface ComponentDefinitionRegistry
Returns:
a list of interceptors sorted by decreasing rank. The list may be empty if no interceptors have been defined


Copyright © 2009-2011 The Apache Software Foundation. All Rights Reserved.