I'm trying to bring the composite-impl sample up. The sample uses nested
composite files and if fails trying to wire up the references from a top
level component (which is implemented in a separate composite - see [1]) to
another component.

The failure happens during the connect phase of  DeployerImpl.deploy(). Here
it loops round all of the references specified in the model for the
component in question and then goes to the component implementation to get
the reference definition so it can subsequently create a wire. Here is the
top of the loop from DeployerImpl.connect() (I added some comments here to
highlight the points of interest)

       // for each  the references specified in the SCDL for the component
       for (ComponentReference ref : definition.getReferences()) {
           List<Wire> wires = new ArrayList<Wire>();
           String refName = ref.getName();
           // get the definition of the reference which is described by the
component implementation
           org.apache.tuscany.assembly.Reference refDefinition =
getReference(definition.getImplementation(), refName);
           assert refDefinition != null;

So when it comes to "SourceComponent" [1] it finds that the component is
implemented by another composite. When this information is read into the
model by the CompositeProcessor there is code that specifically reads the
implementation.composite element, i.e.

                       } else if
(IMPLEMENTATION_COMPOSITE_QNAME.equals(name)) {

                           // Read an implementation.composite
                           Composite implementation =
factory.createComposite();
                           implementation.setName(getQName(reader, NAME));
                           implementation.setUnresolved(true);
                           component.setImplementation(implementation);

Now all this does as far as I can see is create a composite type with just
the composite name in it (I assume that the intention is to resolve this
later on). Hence the connect step fails because the component implementation
in our example has nothing in it. Specifically it has none of the reference
definition information that it would have to look in the other composite
file to get.

The problem is I'm not sure when this information is intended to be linked
up. During the resolve phase when this component implementation is reached
the resolver just finds a composite with nothing in it and, as far as I can
tell, just ignores it. How does the system know that this implementation
refers to a composite defined elsewhere rather than just defining a
composite with nothing in it?

I would assume at the resolve or optimize stages this should happen so that
we have a complete model when it comes time to build the runtime. Maybe we
need a new type or flag to indicate that this is a composite implementing a
component.  I'll keep plugging away but if someone could give me a pointer
that would be great?

[1]
http://svn.apache.org/repos/asf/incubator/tuscany/java/sca/samples/composite-impl/src/main/resources/OuterComposite.composite

Reply via email to