I tried to use Tuscany EmbeddedScaDomain to deploy multiple contributions which
can share some common resources. Here are my contributions:
Contribution A (http://inner) contains InnerComposite, looks like:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://inner"
name="InnerComposite">
<component name="StoreServiceComponent">
<implementation.java class="store.StoreServiceImpl"/>
<service name="StroreService">
<binding.sca uri="/StoreServiceComponent
/StoreService"/>
</service>
</component>
</composite>
Contribution B(http://outer) contains OuterComposite, looks like:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
targetNamespace="http://hello" xmlns:inner="http://inner"
name="OuterComposite">
<!--
<include name="inner:InnerComposite"/>
-->
<component name="HelloComponent">
<implementation.java class="hello.HelloImpl"/>
<reference name=”Store”/>
</component>
<wire source=”HelloComponent/Store"
Target="/StoreServiceComponent /StoreService"/>
</composite>
Both composites are declared as deployable. Contribution A is exported to
namespace http://inner and contribution B imports it.
The “Store” service is implemented using “COMPOSITE” Scope annotation, which is
intend to provide a shareable store instance for other contributions such like
B.
However, I got a warning message when deploying B after contribution A is
deployed successfully. The warning message is “Wire target not found :
HelloComponent/Store”. It looks like the wire in one composite can’t link to
components belongs to other composites.
I can make contribution B deployed only by adding the “include” declaration.
But I am not sure this will meet my requirement because now the "Store" service
belongs to two composites. The instance shouldn’t be shared among multiple
composites since its scope is “COMPOSITE”.
If there are other solutions for this problem?
Thanks
Dong