You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Greg Dritschler <gr...@gmail.com> on 2011/08/08 15:56:24 UTC

Target service scope with implementation.composite

I have the following test case:

Composite A:
  - is deployable
  - has a component reference with a reference target pointing to some
top-level component outside of A
  - does not promote the component reference

Composite B:
 - is deployable
 - reuses composite A as the implementation of a component

B fails because, when A is used within the context of B, the reference
target is not found within A.
I think it is correct that this is an error, but given some of the
discussion lately about implementation.composite, I'd like a second opinion.

Assembly says
1880 For a composite used as a component implementation, wires can only link
sources and targets that are
1881 contained in the same composite

The error happens to be discovered at the time the reference is invoked
(from within the context of B).
  "Unable to bind [] - No endpoints found in the domain that match the
reference"

It seems like it could be detected at build time.

Greg

Re: Target service scope with implementation.composite

Posted by Mike Edwards <mi...@gmail.com>.
On 09/08/2011 23:33, Greg Dritschler wrote:
> New question:  What is the scope for resolving a COMPOSITE reference target?  It seems like it is
> resolved in the context of the using composite.
>
> I recall seeing something about this somewhere but all I can find is this:
> http://www.osoa.org/jira/browse/ASSEMBLY-5
>
> Greg
Greg,

If a composite reference has a target defined, either via @target or via some binding declared on 
the reference, these are to be taken as DEFAULTS which apply when the composite is used as an 
implementation by some component (ie a component in a "higher level" composite). These targets have 
no meaning within the composite in which they are declared.

The configuration of the implementation is supplied by that using component - and the component can 
either supply all its own configuration (this is expected to be the 99% default situation) or it can 
decide to use the defaults supplied by the implementation (ie by the composite reference in this case).

When viewed this way, the target(s) of the higher level component reference are in the context of 
the higher level component - either its composite or the Domain, depending on the level of that 
component.

In my opinion, it is not a wise procedure to define targets in a composite reference either using 
@target or using an SCA binding with a @uri declared.  The reason for this is that the writer of the 
composite cannot normally know the context in which it is going to be used - so for example if they 
had @target="fooComponent/barService", how could they be sure that the using component was in any 
kind of context that had a component with the name fooComponent.

The idea of setting a default binding & target using a "concrete" binding such as binding.ws makes 
more sense - ie the composite writer can say - "here is a reference for this composite 
implementation & I know that there is one Web service over there that will satisfy the reference".

HOWEVER, either way, what counts is the confuguration on the component reference - whether this was 
explicity set by the component or was a default value derived from the composite reference - and it 
is the higher level component reference configuration that is then pushed down onto the ("proxy") 
component reference at the lower level (ie the component reference identified in the composite 
reference @promotes attribute).

Note that this process of an implementation potentially having a default configuration for a 
reference applies in principle to ANY type of implementation, not only to a composite - ie a Java 
implementation class could in principle have a reference with a binding & target defined.


I hope that this helps.


Yours,  Mike.

Re: Target service scope with implementation.composite

Posted by Greg Dritschler <gr...@gmail.com>.
New question:  What is the scope for resolving a COMPOSITE reference target?
 It seems like it is resolved in the context of the using composite.

I recall seeing something about this somewhere but all I can find is this:
http://www.osoa.org/jira/browse/ASSEMBLY-5

Greg

Re: Target service scope with implementation.composite

Posted by Mike Edwards <mi...@gmail.com>.
On 08/08/2011 14:56, Greg Dritschler wrote:
> I have the following test case:
>
> Composite A:
>    - is deployable
>    - has a component reference with a reference target pointing to some top-level component outside of A
>    - does not promote the component reference
>
> Composite B:
>   - is deployable
>   - reuses composite A as the implementation of a component
>
> B fails because, when A is used within the context of B, the reference target is not found within A.
> I think it is correct that this is an error, but given some of the discussion lately about
> implementation.composite, I'd like a second opinion.
>
> Assembly says
> 1880 For a composite used as a component implementation, wires can only link sources and targets
> that are
> 1881 contained in the same composite
>
> The error happens to be discovered at the time the reference is invoked (from within the context of B).
> "Unable to bind [] - No endpoints found in the domain that match the reference"
>
> It seems like it could be detected at build time.
>
> Greg
Greg,

Its an error.

If you have a component reference with a target which is a component service of a second component 
which is not in the composite of the first component, the only way that this reference can be 
satisifed is by some form of "include" processing which adds the target component to the context of 
the first component.  This simply can't happen when the composite is used as an implementation - it 
could happen for a composite deployed directly to the Domain.


Yours,  Mike.

Re: Target service scope with implementation.composite

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Aug 8, 2011 at 2:56 PM, Greg Dritschler
<gr...@gmail.com> wrote:
> I have the following test case:
> Composite A:
>   - is deployable
>   - has a component reference with a reference target pointing to some
> top-level component outside of A
>   - does not promote the component reference
> Composite B:
>  - is deployable
>  - reuses composite A as the implementation of a component
> B fails because, when A is used within the context of B, the reference
> target is not found within A.
> I think it is correct that this is an error, but given some of the
> discussion lately about implementation.composite, I'd like a second opinion.
> Assembly says
> 1880 For a composite used as a component implementation, wires can only link
> sources and targets that are
> 1881 contained in the same composite
> The error happens to be discovered at the time the reference is invoked
> (from within the context of B).
>   "Unable to bind [] - No endpoints found in the domain that match the
> reference"
> It seems like it could be detected at build time.
> Greg

I think you're right that this is a valid error (although given the
recent discussion I defer to Mike for the final answer).  As part of
the async model changes a while back we did include some code to allow
for build time reference checking, see
DeployerImpl.buildTimeReferenceBind(), however I think that if it
doesn't find it at build time it just assumes that it will find it at
run time. Which of course it shouldn't in your scenario. If we want to
trap the error at build time we need to add so extra code to make the
build time check fail in all but the top level case.

Can you raise a JIRA.

Thanks

Simon


-- 
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com