Here are my two cents based on my understanding of the OASIS spec:
1) SCAClient.getService() is similar to connect an SCA service using a dummy
reference without any binding declarations. The OASIS spec says the binding
for the reference will be provided by the service binding in such cases.
Taking a step further, we can view the client as a special composite
deployed to the SCA domain and it has references to all the top-level
component services. It can be illustrated as follows:
<composite name="Client" ...>
<component name="ClientComponent">
<reference name="..." target="C1/S1">
<interface.java interface="my.Service1"/>
</reference>
<reference name="..." target="C1/S2">
<interface.java interface="my.Service2"/>
</reference>
...
<reference name="..." target="Cn/Sk">
<interface.java interface="my.ServiceK"/>
</reference>
</component>
</composite>
The behavior of SCAClient.getService() should be pretty much like
ClientComponent.getService("clientRefToTheService").
2) The OASIS spec also says the meaning of composite services and references
for a top-level composite is not defined. Service/reference promotions are
only meaningful is the composite is used as "implementation.composite".
3762 11.6.1 add To Domain-Level Composite
3763 This functionality adds the composite identified by a supplied URI to
the Domain Level Composite.
3764 The supplied composite URI refers to a composite within an installed
contribution. The
3765 composite's installed contribution determines how the composite's
artifacts are resolved (directly
3766 and indirectly). The supplied composite is added to the domain
composite with semantics that
3767 correspond to the domain-level composite having an <include> statement
that references the
3768 supplied composite. All of the composites components become top-level
components and the
3769 component services become externally visible services (eg. they would
be present in a WSDL
3770 description of the Domain). The meaning of any promoted services and
references in the supplied
3771 composite is not defined; since there is no composite scope outside the
domain composite, the
3772 usual idea of promotion has no utility.
Thanks,
Raymond
--------------------------------------------------
From: "ant elder" <[email protected]>
Sent: Wednesday, April 22, 2009 8:20 AM
To: <[email protected]>
Subject: Re: SCAClient API spec proposal
On Wed, Apr 22, 2009 at 4:10 PM, Simon Laws <[email protected]>
wrote:
Currently we have this trick in our local client where a new $self$
reference created. However It sounds ok to me to say that you can only
talk to things with an SCA binding. If you want to talk to something
without an sca binding then add binding.sca to the component in
question or add a proxy component to the domain to allow you to do it.
Does that make the client API too awkward to use?
Simon
Or have the <service> outside of the component which then means
binding.sca is available as well:
<service name="MyService" promote="Service1">
<binding.jms />
</service>
<component name="Service1">
<implementation.java
class="org.apache.tuscany.sca.binding.jms.ServiceImpl"/>
</component>
I think one of the reasons most of the Tuscany examples have the
<service> within the component is that it saves a few characters (the
promote attribute) and up until this SCAClient came along it didn't
make much difference. Maybe we should revist that.
...ant