Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2016-11-27 01:32:34 +0000
committerslewis2016-11-27 01:32:34 +0000
commit75de721dc6066228f2925be1a6bb5b6677462e3a (patch)
treeabbd24a35804b06cd6903b1faa205a9729920ca2
parent6fb0fc28ca0d5ef936d82654d712a2764cacec0c (diff)
downloadorg.eclipse.ecf-75de721dc6066228f2925be1a6bb5b6677462e3a.tar.gz
org.eclipse.ecf-75de721dc6066228f2925be1a6bb5b6677462e3a.tar.xz
org.eclipse.ecf-75de721dc6066228f2925be1a6bb5b6677462e3a.zip
Fix to use ds annotations for example.
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/META-INF/MANIFEST.MF11
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync.xml (renamed from examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/timeservicecomponentasync.xml)4
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/build.properties1
-rw-r--r--examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/src/com/mycorp/examples/timeservice/consumer/ds/async/TimeServiceComponentAsync.java11
4 files changed, 19 insertions, 8 deletions
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/META-INF/MANIFEST.MF b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/META-INF/MANIFEST.MF
index 1f3a05e60..19ee97312 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/META-INF/MANIFEST.MF
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/META-INF/MANIFEST.MF
@@ -1,10 +1,11 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Async
+Bundle-Name: ECF TimeService Consumer Async
Bundle-SymbolicName: com.mycorp.examples.timeservice.consumer.ds.async
-Bundle-Version: 1.0.0.qualifier
-Bundle-Vendor: MYCORP
+Bundle-Version: 1.0.100.qualifier
+Bundle-Vendor: Eclipse.org - ECF
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Import-Package: com.mycorp.examples.timeservice;version="2.0.0"
-Service-Component: OSGI-INF/timeservicecomponentasync.xml
+Import-Package: com.mycorp.examples.timeservice;version="2.0.0",
+ org.osgi.service.component.annotations;resolution:=optional
+Service-Component: OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync.xml
Bundle-ActivationPolicy: lazy
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/timeservicecomponentasync.xml b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync.xml
index 2e13191e2..98fe75066 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/timeservicecomponentasync.xml
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/OSGI-INF/com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync.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" enabled="true" name="com.mycorp.examples.timeservice.consumer.ds.async">
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync">
+ <reference bind="bindTimeService" cardinality="1..n" interface="com.mycorp.examples.timeservice.ITimeServiceAsync" name="TimeService" policy="dynamic" unbind="unbindTimeService"/>
<implementation class="com.mycorp.examples.timeservice.consumer.ds.async.TimeServiceComponentAsync"/>
- <reference bind="bindTimeService" cardinality="1..n" interface="com.mycorp.examples.timeservice.ITimeServiceAsync" name="ITimeServiceAsync" policy="dynamic"/>
</scr:component> \ No newline at end of file
diff --git a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/build.properties b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/build.properties
index 529e35c21..6a14980bb 100644
--- a/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/build.properties
+++ b/examples/bundles/com.mycorp.examples.timeservice.consumer.ds.async/build.properties
@@ -1,7 +1,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- OSGI-INF/timeservicecomponentasync.xml,\
OSGI-INF/,\
launch/,\
about.html
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 8a038f9f4..50b1bf2af 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
@@ -10,10 +10,17 @@ package com.mycorp.examples.timeservice.consumer.ds.async;
import java.util.concurrent.CompletableFuture;
+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.ITimeServiceAsync;
+@Component(immediate=true)
public class TimeServiceComponentAsync {
+ @Reference(cardinality=ReferenceCardinality.AT_LEAST_ONE,policy=ReferencePolicy.DYNAMIC)
void bindTimeService(ITimeServiceAsync timeService) {
System.out.println("Discovered ITimeServiceAsync via DS");
// Get the CompletableFuture...no blocking here
@@ -21,4 +28,8 @@ public class TimeServiceComponentAsync {
// print out time when done...no blocking anywhere!
cf.thenAccept((time) -> System.out.println("Remote time is: " + time));
}
+
+ void unbindTimeService(ITimeServiceAsync timeService) {
+ System.out.println("Undiscovered ITimeServiceAsync via DS");
+ }
}

Back to the top