org.eclipse.stp.core.sca
Interface Component

All Superinterfaces:
SCAObject
All Known Subinterfaces:
ImplementationComponent, ModuleComponent

public interface Component
extends SCAObject

A representation of the model object 'Component'.

This interface is not intended to be implemented by clients.

The following features are supported:

See Also:
SCAPackage.getComponent()

Field Summary
static java.lang.String copyright
           
static int STATE_ABSTRACT
          Indicates the Abstract state.
static int STATE_IMPLEMENTED
          Indicates the Implemented state.
static int STATE_TYPED
          Indicates the Typed state.
static java.lang.String TYPE_ABSTRACT
          The type string for the abstract type ("implementation.abstract").
 
Method Summary
 Composite getComposite()
           
 Implementation getImplementation()
          The Implementation is a substitution group element that will be specialized for each component type.
 java.lang.String getName()
          Returns the value of the 'Name' attribute.
 PropertyValuesSet getPropertyValuesSet()
          Returns the value of the 'Property Values Set' containment reference.
 java.util.List getReferenceValues()
           
 java.util.List getReferenceValues(Reference reference)
           
 java.util.List getReferenceValues(java.lang.String referenceName)
           
 WireSource getSingleWireSource()
           
 WireTarget getSingleWireTarget()
           
 int getState()
           
 java.lang.String getType()
           
 WireSource getWireSource(Reference reference)
           
 WireSource getWireSource(java.lang.String referenceName)
           
 java.util.Collection getWireSourcesWiredToTarget(WireTarget wireTarget)
          Return a collection of WireSource elements that have a wire to the passed wireTarget.
 WireTarget getWireTarget(Service service)
           
 WireTarget getWireTarget(java.lang.String serviceName)
           
 ComponentType resolveComponentType()
          Uses the Implementation to resolve the ComponentType.
 Implementation setAbstractImplementation(ComponentType aComponentType)
          A convenience method to set an abstract implementation type (SCAPackage.eINSTANCE.getSCACoreRoot_ImplementationAbstract()).
 void setName(java.lang.String value)
          Sets the value of the 'Name' attribute.
 void setPropertyValuesSet(PropertyValuesSet value)
          Sets the value of the 'Property Values Set' containment reference.
 void setReferenceValue(Reference reference, WireTarget target)
          Create a new ReferenceValue that uses the reference as the source and the passed target to configure the target value.
 Implementation setSpecializedImplementation(Implementation newImplementation)
          To correctly support substitution groups, the specific EMF feature for an implementation element type must be specified through a FeatureAdapter attached to the Implementation.
 
Methods inherited from interface org.eclipse.stp.core.sca.SCAObject
addStatus, clearStatus, getEObject, getFlags, getStatus
 

Field Detail

TYPE_ABSTRACT

static final java.lang.String TYPE_ABSTRACT
The type string for the abstract type ("implementation.abstract").

See Also:
Constant Field Values

STATE_ABSTRACT

static final int STATE_ABSTRACT
Indicates the Abstract state. An Abstract component either has no implementation or an AbstractImplementation.

See Also:
AbstractImplementation, SCAPackage.getAbstractImplementation(), Constant Field Values

STATE_TYPED

static final int STATE_TYPED
Indicates the Typed state. A Typed component has an AbstractImplementation with the type set AbstractImplementation.getType().

See Also:
AbstractImplementation, AbstractImplementation.setType(String), AbstractImplementation.getType(), Constant Field Values

STATE_IMPLEMENTED

static final int STATE_IMPLEMENTED
Indicates the Implemented state. An Implemented component has a specialized Implementation set.

See Also:
Constant Field Values

copyright

static final java.lang.String copyright

See Also:
Constant Field Values
Method Detail

getPropertyValuesSet

PropertyValuesSet getPropertyValuesSet()
Returns the value of the 'Property Values Set' containment reference.

If the meaning of the 'Property Values Set' containment reference isn't clear, there really should be more of a description here...

Returns:
the value of the 'Property Values Set' containment reference.
See Also:
setPropertyValuesSet(PropertyValuesSet), SCAPackage.getComponent_PropertyValuesSet()

setPropertyValuesSet

void setPropertyValuesSet(PropertyValuesSet value)
Sets the value of the 'Property Values Set' containment reference.

Parameters:
value - the new value of the 'Property Values Set' containment reference.
See Also:
getPropertyValuesSet()

getName

java.lang.String getName()
Returns the value of the 'Name' attribute.

If the meaning of the 'Name' attribute isn't clear, there really should be more of a description here...

Specified by:
getName in interface SCAObject
Returns:
the value of the 'Name' attribute.
See Also:
setName(String), SCAPackage.getComponent_Name()

setName

void setName(java.lang.String value)
Sets the value of the 'Name' attribute.

Specified by:
setName in interface SCAObject
Parameters:
value - the new value of the 'Name' attribute.
See Also:
getName()

resolveComponentType

ComponentType resolveComponentType()
Uses the Implementation to resolve the ComponentType.

If the Implementation is abstract, then the ComponentType is an embedded element and cannot be shared. Otherwise, the ComponentType could be shared; the underlying implementation will determine if the ComponentType can be shared and handle it automatically.

The ComponentType can be shared in some cases. If the implementation introspector defines an IShareableComponentTypeFactory, then the implementation model will be converted to URI and requested through the ResourceSet of the Implementation that is supplied.

Therefore, resolve() should only be supplied implementations that are contained by a Component, which are contained by a ResourceSet. (The actual containment is Implementation > Component > Composite/Module > SCACoreRoot > Resource > ResourceSet).

The one special case is AbstractImplementation (SCAPackage.getAbstractImplementation()) which does not need to be contained to be resolved.

The feature from the implementation will be determined using the FeatureMap of the containing Component.

The containment requirement is to allow context for resolving a specialized implementation. For cases where the Component or the Implementation is not contained, use IModelIntrospectionManager.resolve(Implementation) to resolve an Implementation and explicitly supply the correct project as the context.

Returns:
The ComponentType contract for this Component

getState

int getState()
Returns:
One of STATE_ABSTRACT, STATE_TYPED, or STATE_IMPLEMENTED.

getType

java.lang.String getType()
Returns:
The type of the underlying implementation. When getState() returns STATE_ABSTRACT, the type will be "implementation.abstract". Otherwise, the type will be the substitution group name of the implementation.

setSpecializedImplementation

Implementation setSpecializedImplementation(Implementation newImplementation)
To correctly support substitution groups, the specific EMF feature for an implementation element type must be specified through a FeatureAdapter attached to the Implementation. Component Handlers or other clients should set the feature using FeatureAdapter.setFeature(SCAObject, EStructuralFeature). For the example test, a PropertiesImplementation was created which has a structural feature on the document root of PropsPackage.eINSTANCE.getDocumentRoot_ImplementationProperties(). So the correct feature to set using the FeatureAdapter for the PropertiesImplementation EClass instances is PropsPackage.eINSTANCE.getDocumentRoot_ImplementationProperties(). This will ensure that when the XML document is serialized, that it uses the substitution group element name ("implementation.properties") instead of using the xsi:type="props:PropertiesImplementation" format.

Parameters:
newImplementation - The instance of the implementation to configure this component with.
Returns:
The existing Implementation.

setAbstractImplementation

Implementation setAbstractImplementation(ComponentType aComponentType)
A convenience method to set an abstract implementation type (SCAPackage.eINSTANCE.getSCACoreRoot_ImplementationAbstract()). The serialized form will have the element name "implemenation.abstract" with a serialized, embedded ComponentType ( ...).

Parameters:
aComponentType - The component type that should be used to configure the Abstract Implementation that will be created for this Component.
Returns:
The existing Implementation.

getImplementation

Implementation getImplementation()
The Implementation is a substitution group element that will be specialized for each component type.

Returns:
The current implementation set on this Component.

getComposite

Composite getComposite()
Returns:
the Composite which owns this Component.

setReferenceValue

void setReferenceValue(Reference reference,
                       WireTarget target)
Create a new ReferenceValue that uses the reference as the source and the passed target to configure the target value.

Parameters:
reference - The reference from this Configurable's type representation.
target - The endpoint that the reference should resolve to
See Also:
ReferenceValue, WireSource.createWireToTarget(WireTarget)

getReferenceValues

java.util.List getReferenceValues()
Returns:
The list of ReferenceValue objects for this component.

getReferenceValues

java.util.List getReferenceValues(Reference reference)
Parameters:
reference -
Returns:
An unmodifiable list of ReferenceValue elements for the passed reference. The list will contain at most one entry if the multiplicity of the passed reference is one.

getReferenceValues

java.util.List getReferenceValues(java.lang.String referenceName)
Parameters:
referenceName -
Returns:
An unmodifiable list of ReferenceValue elements for the passed referenceName. The list will contain at most one entry if the multiplicity of the passed reference is one.

getSingleWireTarget

WireTarget getSingleWireTarget()
Returns:
A WireTarget only if there is one service available on this Component.

getWireTarget

WireTarget getWireTarget(java.lang.String serviceName)
Parameters:
serviceName - The name of the service on this Configurable's abstract type
Returns:
A WireTarget for the passed serviceName. The serviceName must match the name of a service defined on the ComponentType otherwise null will be returned.

getWireTarget

WireTarget getWireTarget(Service service)
Parameters:
service - The Service on this Configurable's abstract type
Returns:
A WireTarget for the passed service. The service must be a matching service defined on the ComponentType otherwise null will be returned.

getWireSource

WireSource getWireSource(java.lang.String referenceName)
Parameters:
referenceName -
Returns:
A WireSource for the passed referenceName. The referenceName must match the name of a reference defined on the ComponentType otherwise null will be returned.

getWireSource

WireSource getWireSource(Reference reference)
Parameters:
reference -
Returns:
A WireSource for the passed reference. The reference must be a matching reference defined on the ComponentType otherwise null will be returned.

getSingleWireSource

WireSource getSingleWireSource()
Returns:
A WireSource only if there is one reference available on this Component.

getWireSourcesWiredToTarget

java.util.Collection getWireSourcesWiredToTarget(WireTarget wireTarget)
Return a collection of WireSource elements that have a wire to the passed wireTarget.

Parameters:
wireTarget -
Returns:
Collection