Apache Tuscany SCA Kernel Sub-Project

org.apache.tuscany.spi.model
Class ComponentType<S extends ServiceDefinition,R extends ReferenceDefinition,P extends Property<?>>

java.lang.Object
  extended by org.apache.tuscany.spi.model.ModelObject
      extended by org.apache.tuscany.spi.model.ComponentType<S,R,P>
Direct Known Subclasses:
CompositeComponentType, JavaMappedComponentType, PojoComponentType

public class ComponentType<S extends ServiceDefinition,R extends ReferenceDefinition,P extends Property<?>>
extends ModelObject

The definition of the configurable aspects of an implementation in terms of the services it exposes, the services it references, and properties that can be used to configure it.

A service represents an addressable interface provided by the implementation. Such a service may be the target of a wire from another component.

A reference represents a requirement that an implementation has on a service provided by another component or by a resource outside the SCA system. Such a reference may be the source of a wire to another component.

A property allows the behaviour of the implementation to be configured through externally set values.

A component type may also declare that it wishes to be initialized upon activation of the scope that contains it and may specify an order relative to other eagerly initializing components. For example, an implementation that pre-loads some form of cache could declare that it should be eagerly initialized at the start of the scope so that the cache load occured on startup rather than first use.

Version:
$Rev: 430937 $ $Date: 2006-08-11 18:17:56 -0700 (Fri, 11 Aug 2006) $

Constructor Summary
ComponentType()
           
 
Method Summary
 void add(P property)
          Add a property that can be used to configure the implementation.
 void add(R reference)
          Add a reference to a service consumed by the implementation.
 void add(S service)
          Add a service to those provided by the implementation.
 int getInitLevel()
          Returns the default initialization level for components of this type.
 Map<String,P> getProperties()
          Returns a live Map of properties that can be used to configure the implementation.
 Map<String,R> getReferences()
          Returns a live Map of references to services consumed by the implementation.
 Map<String,S> getServices()
          Returns a live Map of the services provided by the implementation.
 boolean isEagerInit()
          Returns true if this component should be eagerly initialized.
 void setEagerInit(boolean eagerInit)
          Deprecated. 
 void setInitLevel(int initLevel)
          Sets the default initialization level for components of this type.
 
Methods inherited from class org.apache.tuscany.spi.model.ModelObject
getExtensions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentType

public ComponentType()
Method Detail

getInitLevel

public int getInitLevel()
Returns the default initialization level for components of this type. A value greater than zero indicates that components should be eagerly initialized.

Returns:
the default initialization level

setInitLevel

public void setInitLevel(int initLevel)
Sets the default initialization level for components of this type. A value greater than zero indicates that components should be eagerly initialized.

Parameters:
initLevel - default initialization level for components of this type

isEagerInit

public boolean isEagerInit()
Returns true if this component should be eagerly initialized.

Returns:
true if this component should be eagerly initialized

setEagerInit

@Deprecated
public void setEagerInit(boolean eagerInit)
Deprecated. 

Obsolete method for indicating that this component should be eagerly initialized. If true, sets the init level to 50; if false, sets it to zero.

Parameters:
eagerInit - flag indicating that this component should be eagerly initialized

getServices

public Map<String,S> getServices()
Returns a live Map of the services provided by the implementation.

Returns:
a live Map of the services provided by the implementation

add

public void add(S service)
Add a service to those provided by the implementation. Any existing service with the same name is replaced.

Parameters:
service - a service provided by the implementation

getReferences

public Map<String,R> getReferences()
Returns a live Map of references to services consumed by the implementation.

Returns:
a live Map of references to services consumed by the implementation

add

public void add(R reference)
Add a reference to a service consumed by the implementation. Any existing reference with the same name is replaced.

Parameters:
reference - a reference to a service consumed by the implementation

getProperties

public Map<String,P> getProperties()
Returns a live Map of properties that can be used to configure the implementation.

Returns:
a live Map of properties that can be used to configure the implementation

add

public void add(P property)
Add a property that can be used to configure the implementation. Any existing property with the same name is replaced.

Parameters:
property - a property that can be used to configure the implementation

Apache Tuscany SCA Kernel Sub-Project

-