Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'examples/bundles')
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.async/META-INF/MANIFEST.MF2
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.async/pom.xml2
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java7
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent.xml2
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds/src/com/mycorp/examples/timeservice/consumer/ds/TimeServiceComponent.java4
5 files changed, 10 insertions, 7 deletions
diff --git a/examples/bundles/com.mycorp.examples.timeservice.async/META-INF/MANIFEST.MF b/examples/bundles/com.mycorp.examples.timeservice.async/META-INF/MANIFEST.MF
index 50340dd18..036dd5f9e 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.async/META-INF/MANIFEST.MF
+++ b/examples/bundles/com.mycorp.examples.timeservice.async/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: ECF RS Example Timeservice Async API
Bundle-SymbolicName: com.mycorp.examples.timeservice.async
Automatic-Module-Name: com.mycorp.examples.timeservice.async
-Bundle-Version: 2.0.100.qualifier
+Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: Eclipse.org - ECF
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: com.mycorp.examples.timeservice;version="2.0.0"
diff --git a/examples/bundles/com.mycorp.examples.timeservice.async/pom.xml b/examples/bundles/com.mycorp.examples.timeservice.async/pom.xml
index b3515c516..ec4245ee7 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.async/pom.xml
+++ b/examples/bundles/com.mycorp.examples.timeservice.async/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.ecf</groupId>
<artifactId>com.mycorp.examples.timeservice.async</artifactId>
- <version>2.0.100-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java
index 50b1bf2af..333cf0ef5 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java
@@ -26,7 +26,12 @@ public class TimeServiceComponentAsync {
// Get the CompletableFuture...no blocking here
CompletableFuture<Long> cf = timeService.getCurrentTimeAsync();
// print out time when done...no blocking anywhere!
- cf.thenAccept((time) -> System.out.println("Remote time is: " + time));
+ cf.whenComplete((time, exception) -> {
+ if (exception != null)
+ exception.printStackTrace();
+ else
+ System.out.println("Remote time is: " + time);
+ });
}
void unbindTimeService(ITimeServiceAsync timeService) {
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent.xml b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent.xml
index b138f9026..1c55cc390 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent.xml
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent">
- <reference bind="bindTimeService" cardinality="1..n" interface="com.mycorp.examples.timeservice.ITimeService" name="TimeService" policy="dynamic" unbind="unbindTimeService"/>
+ <reference bind="bindTimeService" interface="com.mycorp.examples.timeservice.ITimeService" name="TimeService" unbind="unbindTimeService"/>
<implementation class="com.mycorp.examples.timeservice.consumer.ds.TimeServiceComponent"/>
</scr:component> \ No newline at end of file
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/src/com/mycorp/examples/timeservice/consumer/ds/TimeServiceComponent.java b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/src/com/mycorp/examples/timeservice/consumer/ds/TimeServiceComponent.java
index 9939bcb03..9fbcbbba7 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/src/com/mycorp/examples/timeservice/consumer/ds/TimeServiceComponent.java
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds/src/com/mycorp/examples/timeservice/consumer/ds/TimeServiceComponent.java
@@ -10,8 +10,6 @@ package com.mycorp.examples.timeservice.consumer.ds;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.annotations.ReferenceCardinality;
-import org.osgi.service.component.annotations.ReferencePolicy;
import com.mycorp.examples.timeservice.ITimeService;
@@ -19,7 +17,7 @@ import com.mycorp.examples.timeservice.ITimeService;
public class TimeServiceComponent {
// Called by DS upon ITimeService discovery
- @Reference(policy=ReferencePolicy.DYNAMIC, cardinality=ReferenceCardinality.AT_LEAST_ONE)
+ @Reference
void bindTimeService(ITimeService timeService) {
System.out.println("Discovered ITimeService via DS. Instance="+timeService);
// Call the service and print out result!

Back to the top