Hi, Daniel.

Check this out: http://cwiki.apache.org/confluence/display/TUSCANYWIKI/Multiple+bindings+and+reference+multiplicity

Thanks,
Raymond

--------------------------------------------------
From: <[EMAIL PROTECTED]>
Sent: Thursday, April 24, 2008 8:35 AM
To: <tuscany-user@ws.apache.org>
Subject: How to use references using multiplicity="1..n" with binding.ws or binding.rmi

Hi all,

I have set up a composite, where service CrawlerControllerComponent has
one or more references to Crawlers. This runs without any problem using
binding.sca. Here is the content of the .compiste file, where 2 Crawlers
are refferenced:

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

<component name="CrawlerControllerComponent">
<implementation.java
class="impl.CrawlerControllerImpl"/>
<service name="CrawlerController">
<interface.java
interface="interfaces.CrawlerController" />
  </service>
<reference name="connectivity"
target="ConnectivityComponent">
<binding.sca />
</reference>
<reference name="crawlers" multiplicity="1..n"
target="CrawlerComponent SpecialCrawlerComponent">
</reference>

</component>

<component name="ConnectivityComponent">
<implementation.java class="impl.ConnectivityImpl"/>
<service name="Connectivity">
<interface.java
interface="interfaces.Connectivity" />
  </service>
</component>

<component name="CrawlerComponent">
<implementation.java class="impl.CrawlerImpl"/>
<service name="Crawler">
<interface.java interface="interfaces.Crawler"
/>
  </service>
<property name="crawlerId">normal_crawler</property>

</component>

<component name="SpecialCrawlerComponent">
<implementation.java class="impl.SpecialCrawlerImpl"/>
<service name="Crawler">
<interface.java interface="interfaces.Crawler"
/>
  </service>
<property name="crawlerId">special_crawler</property>
</component>
</composite>


But what do I have to do, to make this sample work using binding.ws (or
binding.rmi) ???

Just adding <binding.ws ...> to CrawlerComponent and
SpecialCrawlerComponent leads to the following warning
WARNUNG: Component reference doesn't have a matching binding

I tried to configure multiple <binding> tags, but then both target
entries of reference "crawlers" use the first binding tag (in this case
http://AFA-19393:8088/CrawlerComponent). How can I have the targets use
different bindings ?

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

<component name="CrawlerControllerComponent">
<implementation.java
class="impl.CrawlerControllerImpl"/>
<service name="CrawlerController">
<interface.java
interface="interfaces.CrawlerController" />
  </service>
<reference name="connectivity"
target="ConnectivityComponent">
<binding.sca />
</reference>
<reference name="crawlers" multiplicity="1..n"
target="CrawlerComponent SpecialCrawlerComponent">
<binding.ws
uri="http://AFA-19393:8088/CrawlerComponent"; target="CrawlerComponent"
/>
<binding.ws
uri="http://AFA-19393:8088/SpecialCrawlerComponent";
target="SpecialCrawlerComponent"/>
</reference>

</component>

<component name="ConnectivityComponent">
<implementation.java class="impl.ConnectivityImpl"/>
<service name="Connectivity">
<interface.java
interface="interfaces.Connectivity" />
  </service>
</component>

<component name="CrawlerComponent">
<implementation.java class="impl.CrawlerImpl"/>
<service name="Crawler">
<interface.java interface="interfaces.Crawler"
/>
<binding.ws
uri="http://AFA-19393:8088/CrawlerComponent"; />
  </service>
<property name="crawlerId">normal_crawler</property>

</component>

<component name="SpecialCrawlerComponent">
<implementation.java class="impl.SpecialCrawlerImpl"/>
<service name="Crawler">
<interface.java interface="interfaces.Crawler"
/>
<binding.ws
uri="http://AFA-19393:8088/SpecialCrawlerComponent"; />
  </service>
<property name="crawlerId">special_crawler</property>
</component>
</composite>


Bye,
Daniel



Reply via email to