2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.

 Apache Tuscany > Home > Menus > General > SCA General Menu > Java SCA Menu > DELETE- Java SCA Architecture Overview > Java SCA Runtime Component Hierarchy User List | Dev List | Issue Tracker  

The assmebly diagram

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"

    <component name="ComponentA">
        <implementation.java class="sample.ComponentAImpl"/>

    <component name="ComponentB">
        <!-- Implemented by Composite3 -->
        <implementation.composite name="sample:Composite3"/>

        <!-- Wired to ComponentA -->
        <reference name="Reference1" target="ComponentA"/>

        <property name="Property1">ABC</property>

    <!-- ComponentB.Service1 is promoted -->
    <service name="Service1" promote="ComponentB/Service1" />

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://sample" xmlns:sample="http://sample"

    <component name="ComponentC">
        <implementation.java class="sample.ComponentAImpl" />

        <!-- Wired to ComponentD.Service1 -->
        <reference name="Reference1" target="ComponentD/Service1" />

    <component name="ComponentD">
        <!-- Implemented by Composite3 -->
        <implementation.composite name="sample:Composite3" />

        <!-- The property value is "XYZ" -->
        <property name="Property1">XYZ</property>

    <!-- ComponentD.Reference1 is promoted -->
    <reference name="Reference1" promote="ComponentD/Reference1" />

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://sample" xmlns:sample="http://sample"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Composite3">

    <component name="ComponentE">
        <implementation.java class="sample.ComponentEImpl" />
        <reference name="Reference1" target="ComponentF/Service1" />

        <!-- The property is from the composite Property1 -->
        <property name="Property1" source="$Property1" />

    <component name="ComponentF">
        <implementation.java class="sample.ComponentFImpl" />

    <service name="Service1" promote="ComponentE/Service1" />

    <reference name="Reference1" promote="ComponentF/Reference1">
        <binding.sca />

    <property name="Property1" type="xsd:string">123</property>


1) Two components are implemented by the same composite
Path a: Composite1.ComponentB is implemented by Composite3
Path b: Composite2.ComponentD is implemented by Composite3
The service/reference can be promoted to different things:
a: the final target for the ComponentF.Reference1 is Composite1.ComponentA
b: the final target for the ComponentF.Reference1 is Composite1.Reference1 (pointing to an external service)
The property can be set to different value following different composition path:
a: Composite3.ComponentE.Property1 is overrided by Composite1.ComponentB.Property1 (say value="ABC")
b: Composite3.ComponentE.Property1 is overrided by Composite2.ComponentD.Property1 (say value="XYZ")
To represent the fully-configured components, we need to clone the model for Composite3 for Path a and b so that it can be used to hold different resolved values.

Runtime Wires


I'm trying to indentify all the paths of SCA component interactions which
require to have runtime wires/invocation chains.

By the SCA spec, there are three cases for the wiring:

1) Component.Reference (A.ref1) -is wired to-> Component.Service (B.svc1)
1.1) If both the service and reference are defined by non-composite
components, then the runtime wire is as simple as A.ref1-->B.svc1.

1.2) If the service is defined on a composite component, then it can be
further resolved to the orginal atomic component service following the
service promotion chain.

For example, A.ref1 --> B.svc1 (B is implemented by another composite and
B.svc1 promotes C.svc1), then the runtime wire will be: A.ref1 --> C.svc1

1.3) If the reference is defined on a composite component, then it can be
further resolved to the orginal atomic component reference following the
reference promotion chain.

For example, A.ref1 --> B.svc1 (A is implemented by another composite and
A.ref1 promotes C.ref1), then the runtime wire will be: C.ref1 --> B.svc1

2) Composite.Reference (Composite1.ref1) -promotes-> Component.Reference
If Composite1 is the top-level composite, and the B is a non-composite
component, then the runtime wire will be: B.ref1 --> Composite1.ref1

If Composite1 is used to implement a component A in Composite2, then we need
to futher check if A.ref1 is promoted or wired until we hit the end of the
promotion chain. The final target will be either a composite reference or a
component service that the out-most reference is wired to. For example, if
A.ref1 is wired to D.svc1 in Composite2, then the runtime wire is B.ref1 -->
D.svc1. If A.ref1 is promoted by Composite2.ref1, then the runtime wire is
B.ref1 --> Composite2.ref1.

If B is a composite component, then we need to find out the final component
reference that B.ref1 promotes. For example, it promotes D.ref1, then the
runtime wire is D.ref1 --> C.ref1

3) Composite.Service (Composite1.svc1) -promotes-> Component.Service
The source will be the outmost service on the promotion chain. For example,
if Composite2.svc1 promotes B.svc1 and B is implemented by Composite1, then
it is Composite2.svc1.

The target will be the innermost service on the promotion chain. For
example, if A is implemented by Composite3 and Composite3.svc1 promotes
C.svc1, then it is C.svc1.

  • Please note, due to the spec limitation, the composite service cannot
    promote a composite reference directly.

Based on the above scenarios, it seems that we can create runtime wires
using the following algorithm (assuming multiplicity = 1..1). The key is to
get a final list of targets and selected bindings.

1) Runtime wire for references: For each of the references (r1) on
non-composite components, find the outmost reference (r0) on the reference
promotion chain. Then get the targets and selected bindings from r0. If SCA
binding is used for a target, it can be further optimized to use the
orginally promoted component service. The runtime wire should be created
between the r1 and a target (either a component service with SCA binding or
a reference binding) from r0.

2) Runtime wire for service promotions: For each of the service1 (s1) on
non-composite components, find the outmost service (s0, can be the same as
s1) on the service promotion chain. Create a runtime wire between the
selected binding of s0 and the component that defines s1. (Can we assume
that s1 is always local to s0?)

The service/reference promotions make the picture complicated. I hope my
thought makes sense.


Runtime Context Interfaces
public interface RuntimeContext<M> extends Lifecycle {
     * Create an intercetor for the model in the invocation chain. For a reference binding,
     * the interceptor is responsible to make the outbound invocation over the binding protocol.
     * For a service binding, the interceptor is responsible to dispatch the incoming call to
     * the target component service that the service promotes. For a component implementation,
     * the interceptor will be responsible for calling the implementation logic for the given
     * component.
     * @param model The service that defines the binding
     * @param operation The operation that the interceptor will handle
     * @param isCallback A flag to tell if the operation is for the callback
     * @return An interceptor that handles the invocation logic, null should be returned if no 
     * interceptor is required
    Interceptor createInterceptor(M model, Operation operation, boolean isCallback);
     * Get the effective interface contract imposed by the binding or implementation. For
     * example, it will be interface contract introspected from the WSDL portType used by the
     * endpoint for a WebService binding.
     * @param model The model object
     * @return The effective interface contract
    InterfaceContract getEffectiveInterfaceContract(M model);

public interface ReferenceBindingContext extends RuntimeContext<Reference> {
     * @param wire
    void setRuntimeWire(RuntimeWire wire);
     * @return
    RuntimeWire getWire();    

public interface ServiceBindingContext extends RuntimeContext<Service> {
     * @param wire
    void setRuntimeWire(RuntimeWire wire);
     * @return
    RuntimeWire getWire();    

public interface ImplementationContext extends RuntimeContext<Component> {
website stats