Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2010-04-01 00:57:00 -0400
committerslewis2010-04-01 00:57:00 -0400
commit4e505632ddbe3c9b4dc63b6c85cd7bc523eb795f (patch)
tree9195dd5e4d2c5218fc9e032e92adbb4746ae97b4
parent966a29444ce94191ca277e864d9b98380b3bd4c8 (diff)
downloadorg.eclipse.ecf-4e505632ddbe3c9b4dc63b6c85cd7bc523eb795f.tar.gz
org.eclipse.ecf-4e505632ddbe3c9b4dc63b6c85cd7bc523eb795f.tar.xz
org.eclipse.ecf-4e505632ddbe3c9b4dc63b6c85cd7bc523eb795f.zip
Updated/simplified example code for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=303979
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml3
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product1
-rw-r--r--examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java23
3 files changed, 8 insertions, 19 deletions
diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml
index bafae52e8..50d831ec6 100644
--- a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml
+++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/OSGI-INF/helloclient.xml
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" enabled="true" immediate="true" name="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer">
<implementation class="org.eclipse.ecf.examples.internal.remoteservices.hello.ds.consumer.HelloClientComponent"/>
- <reference bind="bindRemoteService" cardinality="0..n" interface="org.eclipse.ecf.examples.remoteservices.hello.IHello" name="IHello" policy="dynamic"/>
- <reference bind="setContainerFactory" cardinality="1..1" interface="org.eclipse.ecf.core.IContainerFactory" name="IContainerFactory" policy="static"/>
+ <reference bind="bindHello" cardinality="0..n" interface="org.eclipse.ecf.examples.remoteservices.hello.IHello" name="IHello" policy="dynamic"/>
</scr:component>
diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product
index 196696282..3ea65dad9 100644
--- a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product
+++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/products/Hello Service Consumer DS.product
@@ -53,6 +53,7 @@
<configurations>
<plugin id="org.eclipse.ecf.examples.remoteservices.hello.ds.consumer" autoStart="true" startLevel="0" />
+ <plugin id="org.eclipse.ecf.osgi.services.distribution" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.ecf.provider" autoStart="true" startLevel="3" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
diff --git a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java
index 002074ea9..911ced09f 100644
--- a/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java
+++ b/examples/bundles/org.eclipse.ecf.examples.remoteservices.hello.ds.consumer/src/org/eclipse/ecf/examples/internal/remoteservices/hello/ds/consumer/HelloClientComponent.java
@@ -9,7 +9,6 @@
******************************************************************************/
package org.eclipse.ecf.examples.internal.remoteservices.hello.ds.consumer;
-import org.eclipse.ecf.core.IContainerFactory;
import org.eclipse.ecf.examples.remoteservices.hello.IHello;
import org.eclipse.ecf.remoteservice.IRemoteCallListener;
import org.eclipse.ecf.remoteservice.IRemoteService;
@@ -22,26 +21,16 @@ public class HelloClientComponent {
private static final String CONSUMER_NAME = "helloclientcomponent";
- private IContainerFactory containerFactory;
-
- void setContainerFactory(IContainerFactory cf) {
- this.containerFactory = cf;
- }
-
- void activate() throws Exception {
- // Create client of appropriate type
- containerFactory.createContainer("ecf.generic.client");
- }
-
- public void bindRemoteService(IHello proxy) {
+ public void bindHello(IHello hello) {
// First print out on console that we got something
- System.out.println("Got proxy IHello="+proxy);
- //Call proxy
- proxy.hello(CONSUMER_NAME+" via proxy");
+ System.out.println("Got proxy IHello="+hello);
+ //Call proxy. Note that this call may block or fail due to
+ // communication with remote service
+ hello.hello(CONSUMER_NAME+" via proxy");
// Get IRemoteService from proxy. This is possible, because for all ECF providers
// the proxy also implements org.eclipse.ecf.remoteservice.IRemoteServiceProxy
- IRemoteService remoteService = ((IRemoteServiceProxy) proxy).getRemoteService();
+ IRemoteService remoteService = ((IRemoteServiceProxy) hello).getRemoteService();
// Create listener for callback in asynchronous call
IRemoteCallListener listener = new IRemoteCallListener() {
public void handleEvent(IRemoteCallEvent event) {

Back to the top