You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2007/03/21 21:09:04 UTC
How is autowired reference resolved in the composite hierarchy?
Hi,
I'm looking into the extension story with the code base in trunk. As we
know, some of the components in the extensions will have dependencies on
components in the system composite, for example, LoaderRegistry.
By debugging the code, I found that the DefaultAutowireResolver first
searches the siblings in the same composite, if no matching service is
found, then it try to look up the primordial components. Is it the correct
behavior?
Let's take the following hierarchy as example:
composite1
component11 (implemented by composite2)
composite2
component21 (reference211)
component22 (service221)
component12 (service121)
Assuming reference211 is autowired. So if service221 matches the service
contract for reference211, then service221 will be picked as the target. If
not, do we navigate up in the hierarchy to find service121 if its service
contract matches?
Thanks,
Raymond
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: How is autowired reference resolved in the composite hierarchy?
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Hi,
I checked with the spec and added my comments below.
Venkata Krishnan wrote:
> Hi,
>
> For this to happen, mustn't reference211 first be promoted to its
> composite
> level i.e. as a reference of Composite2. For a component reference
> that is
> not wired, I did not find the specs (from whatever I read and
> understood) as
> saying it will be automatically promoted to the composite level. As
> far as
> autowiring goes I thinks it must look up only within the composite in
> question.
This is my understanding too. An autowired reference is resolved within
the composite. Here's the relevant extract from the 1.0 spec: "When the
autowire feature is used, a component reference which is not promoted
and which is not explicitly wired to a service within a composite is
automatically wired to a target service within the same composite.
Autowire works by searching within the composite for a service interface
which matches the interface of the references."
>
> My opinion is that, when the CompositeComponentType leaves the
> CompositeLoader it must have been validated for all the wiring within it.
> If there is a component reference that is not wired then it is either
> automatically promoted (which is something that I did not find in the
> specs
> as far as I saw) or an error must be thrown.
An error should be thrown unless the reference has multiplicity 0..1 or
0..n or specifies wiredByImpl=true.
>
> Thanks
>
> - Venkat
>
>
>
> - if there is a reference in a component that is not wired to any target,
>
>
> On 3/22/07, Raymond Feng <en...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm looking into the extension story with the code base in trunk. As we
>> know, some of the components in the extensions will have dependencies on
>> components in the system composite, for example, LoaderRegistry.
>>
>> By debugging the code, I found that the DefaultAutowireResolver first
>> searches the siblings in the same composite, if no matching service is
>> found, then it try to look up the primordial components. Is it the
>> correct
>> behavior?
>>
>> Let's take the following hierarchy as example:
>>
>> composite1
>> component11 (implemented by composite2)
>> composite2
>> component21 (reference211)
>> component22 (service221)
>> component12 (service121)
>>
>> Assuming reference211 is autowired. So if service221 matches the service
>> contract for reference211, then service221 will be picked as the target.
>> If
>> not, do we navigate up in the hierarchy to find service121 if its
>> service
>> contract matches?
>>
>> Thanks,
>> Raymond
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>>
>>
>
--
Jean-Sebastien
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org
Re: How is autowired reference resolved in the composite hierarchy?
Posted by Venkata Krishnan <fo...@gmail.com>.
Hi,
For this to happen, mustn't reference211 first be promoted to its composite
level i.e. as a reference of Composite2. For a component reference that is
not wired, I did not find the specs (from whatever I read and understood) as
saying it will be automatically promoted to the composite level. As far as
autowiring goes I thinks it must look up only within the composite in
question.
My opinion is that, when the CompositeComponentType leaves the
CompositeLoader it must have been validated for all the wiring within it.
If there is a component reference that is not wired then it is either
automatically promoted (which is something that I did not find in the specs
as far as I saw) or an error must be thrown.
Thanks
- Venkat
- if there is a reference in a component that is not wired to any target,
On 3/22/07, Raymond Feng <en...@gmail.com> wrote:
>
> Hi,
>
> I'm looking into the extension story with the code base in trunk. As we
> know, some of the components in the extensions will have dependencies on
> components in the system composite, for example, LoaderRegistry.
>
> By debugging the code, I found that the DefaultAutowireResolver first
> searches the siblings in the same composite, if no matching service is
> found, then it try to look up the primordial components. Is it the correct
> behavior?
>
> Let's take the following hierarchy as example:
>
> composite1
> component11 (implemented by composite2)
> composite2
> component21 (reference211)
> component22 (service221)
> component12 (service121)
>
> Assuming reference211 is autowired. So if service221 matches the service
> contract for reference211, then service221 will be picked as the target.
> If
> not, do we navigate up in the hierarchy to find service121 if its service
> contract matches?
>
> Thanks,
> Raymond
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-dev-help@ws.apache.org
>
>