Hi all,

i tried to use the same composite as an implementation for two different
components. In detail i tried to have two instances of the store example
sharing the same currency converter. When i start the nodes for the two
shops no erros are displayed. But in one of the shops the currency converter
doesn't work (catalog isn't displayed). If i undeploy the working shop, the
other shop works too, but not both at the same time.

Isn't it allowed to use the same composite as an implementation for two
components?

 Here are the composites:

store1:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
        xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0";
        targetNamespace="http://store2";
        xmlns:store3="http://store3";
        name="store2">

    <component name="Store">
        <t:implementation.widget location="uiservices/store.html"/>
        <service name="Widget">
            <t:binding.http uri="/store"/>
        </service>
        <reference name="catalog" target="Catalog">
             <t:binding.jsonrpc/>
         </reference>
         <reference name="shoppingCart" target="ShoppingCart/Cart">
             <t:binding.atom/>
         </reference>
         <reference name="shoppingTotal" target="ShoppingCart/Total">
             <t:binding.jsonrpc/>
         </reference>
    </component>

    <component name="Catalog">
        <implementation.java class="services.FruitsCatalogImpl"/>
        <property name="currencyCode">USD</property>
        <service name="Catalog">
            <t:binding.jsonrpc/>
           </service>
        <reference name="currencyConverter"
target="CurrencyConverter/CurrencyService"/>
    </component>

    <component name="ShoppingCart">
        <implementation.java class="services.ShoppingCartImpl"/>
        <service name="Cart">
            <t:binding.atom uri="/ShoppingCart/Cart"/>
        </service>
        <service name="Total">
            <t:binding.jsonrpc/>
        </service>
    </component>

    <component name="CurrencyConverter">
        <implementation.composite name="store3:store3"/>
    </component>

</composite>


store2:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
        xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0";
        targetNamespace="http://store1";
        xmlns:store3="http://store3";
        name="store1">

    <component name="Store1">
        <t:implementation.widget location="uiservices/store.html"/>
        <service name="Widget">
            <t:binding.http uri="/store"/>
        </service>
        <reference name="catalog" target="Catalog1/Catalog2">
             <t:binding.jsonrpc/>
         </reference>
         <reference name="shoppingCart" target="ShoppingCart1/Cart">
             <t:binding.atom/>
         </reference>
         <reference name="shoppingTotal" target="ShoppingCart1/Total">
             <t:binding.jsonrpc/>
         </reference>
    </component>

    <component name="Catalog1">
        <implementation.java class="services.FruitsCatalogImpl"/>
        <property name="currencyCode">USD</property>
        <service name="Catalog2">
            <t:binding.jsonrpc/>
           </service>
        <reference name="currencyConverter"
target="CurrencyConverter1/CurrencyService"/>
    </component>

    <component name="ShoppingCart1">
        <implementation.java class="services.ShoppingCartImpl"/>
        <service name="Cart">
            <t:binding.atom uri="/ShoppingCart1/Cart"/>
        </service>
        <service name="Total">
            <t:binding.jsonrpc/>
        </service>
    </component>

    <component name="CurrencyConverter1">
        <implementation.composite name="store3:store3"/>
    </component>

</composite>

shared:
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
        xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0";
        targetNamespace="http://store3";
        name="store3">

    <service name="CurrencyService" promote="CurrencyConverter3">
        <interface.java interface="services.CurrencyConverter"/>
    </service>

    <component name="CurrencyConverter3">
        <implementation.java class="services.CurrencyConverterImpl"/>
    </component>

</composite>


Thanks,
Tobias

Reply via email to