I understood. It seems so. 

While this raise another question: Tuscany seemed skipped the 'composite' layer 
and direct access component service, then how to access services in two 
composites within same domain?

like this:

--------------------------------------------------------------------

CompositeA.composite:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"; 
targetNamespace=http://www.globalfinance.com/NASDAQ"; 
name="NASDAQ">

<component name="StockQuoteServiceComponent">

    <implementation.java class="com.ibm.stock.StockQuoteServiceImpl"/>

</component>

</composite>

--------------------------------------------------------------------

CompositeB.composite:

<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"; 
targetNamespace=http://www.globalfinance.com/HongKong"; 
name="HongKong">

<component name="StockQuoteServiceComponent">

    <implementation.java class="com.lenovo.stock.StockQuoteServiceImpl"/>

</component>

</composite>

-------------------------------------------------------------------------------

When these two composite all loaded in one SCADomain.

How do I get StockQuoteService supplied by CompositeB or CompositeA?

How can SCADomain.getService(Class, String) handle such name conflict?



----- Original Message ----- 
From: "Jean-Sebastien Delfino" <[EMAIL PROTECTED]>
To: <tuscany-dev@ws.apache.org>
Sent: Wednesday, May 30, 2007 12:24 PM
Subject: Re: (SCA)How can get the service by composite service name


> Comments inline.
> 
> Huang Kai wrote:
>> Yes, the codes seems does so.
>> But it's rather strange to access a service not by 'service name' exposed by 
>> compoiste, but by directly accessing component nested in a composite.
>>   
> 
> Here's a little more info that will help explain that design:
> 
> - When a composite is added to a domain, it is actually included in it, 
> so there is really no nesting. Components declared in the composite 
> become top level components as if they had been directly declared in the 
> composite describing the entire domain. This process is described in the 
> SCA assembly spec 1.0 in section 1.10.6.1:
> 1.10.6.1 add To Domain-Level Composite
> 3076 This functionality adds the composite identified by a supplied URI 
> to the Domain Level
> 3077 Composite. The supplied composite URI must refer to a composite 
> within a installed contribution.
> 3078 The composite's installed contribution determines how the 
> composite’s artifacts are resolved
> 3079 (directly and indirectly). The supplied composite is added to the 
> domain composite with
> 3080 semantics that correspond to the domain-level composite having an 
> <include> statement that
> 3081 references the supplied composite. All of the composite’s 
> components become top-level
> 3082 components and the services become externally visible services (eg. 
> they would be present in a
> 3083 WSDL description of the domain).
> 
> - Services offered by components in the composite become visible, and 
> can be addressed in a form consistent with what you would say in the 
> target of an SCA wire or reference, as described in section 1.6.4 of the 
> SCA assembly spec:
> 1613 The reference element of a component and the reference element of a 
> service has a list
> 1614 of one or more of the following wire-target-URI values for the 
> target, with multiple values
> 1615 separated by a space:
> 1616 • <component-name>/<service-name>
> 1617 o where the target is a service of a component. The specification 
> of the service name
> 1618 is optional if the target component only has one service with a 
> compatible interface
> 
> As the spec says "the target is a service of a component". A service is 
> not really offered by a composite, it is offered by a component. A 
> composite service declaration is just a statement that a service offered 
> by a component should be promoted / made visible to the next level of 
> composition, when the particular composite is used as a (composite) 
> component implementation (using an <implementation.composite> element). 
> The service promoted by the composite service will then be offered by 
> that new component.
> 
> Also, some components only offer one service for a given interface. In 
> that case you don't have to specify the service name, the component name 
> is sufficient to get the service matching the requested interface.
> 
> So in your particular example:
> - CalculatorServiceComponent is a top-level component.
> - getService(CalculatorService.class, "CalculatorServiceComponent") is a 
> short form for getService(CalculatorService.class, 
> "CalculatorServiceComponent/CalculatorService"), you don't need to 
> specify the service name as CalculatorServiceComponent only provides one 
> service.
> 
> Hope this helps.
> 
>> ----- Original Message ----- 
>> From: "Simon Laws" <[EMAIL PROTECTED]>
>> To: <tuscany-dev@ws.apache.org>
>> Sent: Friday, May 25, 2007 10:03 PM
>> Subject: Re: (SCA)How can get the service by composite service name
>>
>>
>>   
>>> Hi Tony,
>>>
>>> I'm assuming you are using the sample CalculatorClient style code try to
>>> access the service, i.e. the part that uses the scaDomain to get a local
>>> reference to a component service.
>>>
>>>        CalculatorService calculatorService =
>>>            scaDomain.getService(CalculatorService.class,
>>> "CalculatorServiceComponent");
>>>
>>> I just took a look at the code and currently the code behind this method
>>> only looks at the components available in the domain composite when looking
>>> for the named service, i.e. It's looking for a component and a service it
>>> provides rather than a composite service that refers to a component service.
>>> The term service is a little confusing in this regard in my opinion.
>>>
>>> Regards
>>>
>>> Simon
>>>     
>> >
> 
> 
> -- 
> Jean-Sebastien
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Reply via email to