You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by xuhongbo <xu...@tongtech.com> on 2008/08/27 09:06:48 UTC

if two composite contribut to same scaDomain, both contain a component whose name is same, how could I choice the differnent component's service?

Hello,
	The sca assembly model v100 defined the component's name should be
unique across all the components in the composite. But different composite
may occasionally contain  component whose name is same;
	So if I contribute such two different composite to one scaDomain,
how could I choice the two different component whose name is same, but
reside in two different composite?
	
	ScaDomain.getService() is not applicable, yet, as it's only required
component name ,and doesn't require any argument to distinguish composite

	Etc:
	ScaDomain.newInstance(domainUri, contextRoot,
"CompositeA.composite", "CompositeB.composite");
	ScaDomain.getService(UniqueService.class, "Unique") //which
composite's "unique" component?

	CompositeA.composite:

	<composite name="CompositeA" .>
		<component name="Unique" .>
		</component>
		..
	</composite>

	CompositeB.composite:

	<composite name="CompositeA" .>
		<component name="Unique" .>
		</component>
		..
	</composite>
	
	 



Re: if two composite contribut to same scaDomain, both contain a component whose name is same, how could I choice the differnent component's service?

Posted by Simon Laws <si...@googlemail.com>.
On Wed, Aug 27, 2008 at 8:06 AM, xuhongbo <xu...@tongtech.com> wrote:

> Hello,
>        The sca assembly model v100 defined the component's name should be
> unique across all the components in the composite. But different composite
> may occasionally contain  component whose name is same;
>        So if I contribute such two different composite to one scaDomain,
> how could I choice the two different component whose name is same, but
> reside in two different composite?
>
>        ScaDomain.getService() is not applicable, yet, as it's only required
> component name ,and doesn't require any argument to distinguish composite
>
>        Etc:
>        ScaDomain.newInstance(domainUri, contextRoot,
> "CompositeA.composite", "CompositeB.composite");
>        ScaDomain.getService(UniqueService.class, "Unique") //which
> composite's "unique" component?
>
>        CompositeA.composite:
>
>        <composite name="CompositeA" .>
>                <component name="Unique" .>
>                </component>
>                ..
>        </composite>
>
>        CompositeB.composite:
>
>        <composite name="CompositeA" .>
>                <component name="Unique" .>
>                </component>
>                ..
>        </composite>
>
>
>
>
>
You should consider that in order to enable 2 separate composites they need
to be contributed to the domain in some way. For example,

1 - composites contributed as deployable
2 - included in other composites that are included as deployable composites
3 - named as component implementations using implementation.composite

In cases 1 and 2 the composite is flattened out and become part of another
composite (in case 1 this other composite is the virtual domain composite).
The component name must be unique in this context.

Simon