You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by Tobias Arnold <ar...@studi.informatik.uni-stuttgart.de> on 2008/09/01 13:35:06 UTC

Duplicate component name (Components in different Composites)

Hi everyone,

i tried to to deploy the store example shipped with tuscany twice in the
same domain.

Therefore i renamed the target namespace in one contribution to
http://store1 the composite name to store1. In the other composite i did the
same: target namespace http://store2 composite name: store2.

I deployed both composites to tuscany (within different contributions). When
i try to start a node i get the following error:
WARNUNG: Duplicate component name: Composite = {
http://tuscany.apache.org/xmlns/sca/1.0}domain Component = CurrencyConverter
... for every component.

When I try to rename all componets in one composite to for example
CurrencyConverter1... it works fine.

The SCA Spec says component names must be different in the same composite,
but why is there an error with two composites and different namespaces? Did
i do something wrong?


Thanks!

Tobias

The two composite files:

File1:

<?xml version="1.0" encoding="UTF-8"?>
<composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
        xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
        targetNamespace="http://store1"
        name="store1">

    <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"/>
    </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.java class="services.CurrencyConverterImpl"/>
    </component>

</composite>

File2:

<?xml version="1.0" encoding="UTF-8"?>
<composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
        xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
        targetNamespace="http://store2"
        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"/>
    </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.java class="services.CurrencyConverterImpl"/>
    </component>

</composite>


For deployment i used:

<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
http://store1">
 <deployable composite="s:store1"/>
 </contribution>

and

<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
http://store2">
 <deployable composite="s:store2"/>
 </contribution>

Re: Duplicate component name (Components in different Composites)

Posted by Tobias Arnold <ar...@studi.informatik.uni-stuttgart.de>.
Hi Simon,

thanks for the explenation. Can you think of an easier way then renaming all
components to solve the problem?

thanks,
Tobias

2008/9/1 Simon Laws <si...@googlemail.com>

>
>
> On Mon, Sep 1, 2008 at 12:35 PM, Tobias Arnold <
> arnoldts@studi.informatik.uni-stuttgart.de> wrote:
>
>> Hi everyone,
>>
>> i tried to to deploy the store example shipped with tuscany twice in the
>> same domain.
>>
>> Therefore i renamed the target namespace in one contribution to
>> http://store1 the composite name to store1. In the other composite i did
>> the same: target namespace http://store2 composite name: store2.
>>
>> I deployed both composites to tuscany (within different contributions).
>> When i try to start a node i get the following error:
>> WARNUNG: Duplicate component name: Composite = {
>> http://tuscany.apache.org/xmlns/sca/1.0}domain<http://tuscany.apache.org/xmlns/sca/1.0%7Ddomain>Component = CurrencyConverter
>> ... for every component.
>>
>> When I try to rename all componets in one composite to for example
>> CurrencyConverter1... it works fine.
>>
>> The SCA Spec says component names must be different in the same composite,
>> but why is there an error with two composites and different namespaces? Did
>> i do something wrong?
>>
>>
>> Thanks!
>>
>> Tobias
>>
>> The two composite files:
>>
>> File1:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
>>         xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
>>         targetNamespace="http://store1"
>>         name="store1">
>>
>>     <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"/>
>>     </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.java class="services.CurrencyConverterImpl"/>
>>     </component>
>>
>> </composite>
>>
>> File2:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
>>         xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
>>         targetNamespace="http://store2"
>>         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"/>
>>     </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.java class="services.CurrencyConverterImpl"/>
>>     </component>
>>
>> </composite>
>>
>>
>> For deployment i used:
>>
>> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
>> http://store1">
>>  <deployable composite="s:store1"/>
>>  </contribution>
>>
>> and
>>
>> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
>> http://store2">
>>  <deployable composite="s:store2"/>
>>  </contribution>
>>
>>
>
> Hi Tobias
>
> The reason you are getting the duplicate component name warnings is that
> the domain includes the top level component from all deployed composites
> into a virtual composite in order that it can configure these domain level
> components and create wires between then. You can see this virtual domain
> level composite referenced in the warning message as "Composite = {
> http://tuscany.apache.org/xmlns/sca/1.0}domain<http://tuscany.apache.org/xmlns/sca/1.0%7Ddomain>".
> In this process it follows the <include> semantics from section 1.6.6 of the
> SCA Assembly Model spec V1.0. I.e.
>
> 1978 The semantics of included composites are that the content of the
> included composite is inlined
> 1979 into the using composite xxx.composite file through include elements
> in the using composite.
> 1980 The effect is one of textual inclusion – that is, the text content of
> the included composite is
> 1981 placed into the using composite in place of the include statement. The
> included composite
> 1982 element itself is discarded in this process – only its contents are
> included.
>
> So the Tuscany runtime doesn't take any notice of the namespace of the
> composite file from which the individual components come. It just goes ahead
> and includes the text from those files.
>
> Simon
>

Re: Duplicate component name (Components in different Composites)

Posted by Simon Laws <si...@googlemail.com>.
On Mon, Sep 1, 2008 at 12:35 PM, Tobias Arnold <
arnoldts@studi.informatik.uni-stuttgart.de> wrote:

> Hi everyone,
>
> i tried to to deploy the store example shipped with tuscany twice in the
> same domain.
>
> Therefore i renamed the target namespace in one contribution to
> http://store1 the composite name to store1. In the other composite i did
> the same: target namespace http://store2 composite name: store2.
>
> I deployed both composites to tuscany (within different contributions).
> When i try to start a node i get the following error:
> WARNUNG: Duplicate component name: Composite = {
> http://tuscany.apache.org/xmlns/sca/1.0}domain<http://tuscany.apache.org/xmlns/sca/1.0%7Ddomain>Component = CurrencyConverter
> ... for every component.
>
> When I try to rename all componets in one composite to for example
> CurrencyConverter1... it works fine.
>
> The SCA Spec says component names must be different in the same composite,
> but why is there an error with two composites and different namespaces? Did
> i do something wrong?
>
>
> Thanks!
>
> Tobias
>
> The two composite files:
>
> File1:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
>         xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
>         targetNamespace="http://store1"
>         name="store1">
>
>     <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"/>
>
>     </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.java class="services.CurrencyConverterImpl"/>
>     </component>
>
> </composite>
>
> File2:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <composite    xmlns="http://www.osoa.org/xmlns/sca/1.0"
>         xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
>         targetNamespace="http://store2"
>         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"/>
>
>     </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.java class="services.CurrencyConverterImpl"/>
>     </component>
>
> </composite>
>
>
> For deployment i used:
>
> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
> http://store1">
>  <deployable composite="s:store1"/>
>  </contribution>
>
> and
>
> <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:s="
> http://store2">
>  <deployable composite="s:store2"/>
>  </contribution>
>
>

Hi Tobias

The reason you are getting the duplicate component name warnings is that the
domain includes the top level component from all deployed composites into a
virtual composite in order that it can configure these domain level
components and create wires between then. You can see this virtual domain
level composite referenced in the warning message as "Composite = {
http://tuscany.apache.org/xmlns/sca/1.0}domain<http://tuscany.apache.org/xmlns/sca/1.0%7Ddomain>".
In this process it follows the <include> semantics from section 1.6.6 of the
SCA Assembly Model spec V1.0. I.e.

1978 The semantics of included composites are that the content of the
included composite is inlined
1979 into the using composite xxx.composite file through include elements in
the using composite.
1980 The effect is one of textual inclusion – that is, the text content of
the included composite is
1981 placed into the using composite in place of the include statement. The
included composite
1982 element itself is discarded in this process – only its contents are
included.

So the Tuscany runtime doesn't take any notice of the namespace of the
composite file from which the individual components come. It just goes ahead
and includes the text from those files.

Simon