Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-09 19:06:54 +0000
committerslewis2018-03-09 19:06:54 +0000
commita2c6a6429af436a2e30749f75c8a9f88fca9fa45 (patch)
treeede21afe45ca2761bfacccae5c7ddf82ff04d425
parentdc9ea56b7e71e9001c8748c7dfdc0c29b96b6270 (diff)
downloadorg.eclipse.ecf-a2c6a6429af436a2e30749f75c8a9f88fca9fa45.tar.gz
org.eclipse.ecf-a2c6a6429af436a2e30749f75c8a9f88fca9fa45.tar.xz
org.eclipse.ecf-a2c6a6429af436a2e30749f75c8a9f88fca9fa45.zip
Moved target platform to oxygen for tycho-based build. Also added
access to org.osgi.util.promise package (in oxygen only) to support osgi.async intent (R7) Change-Id: I0000000000000000000000000000000000000000
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF6
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/pom.xml2
-rw-r--r--framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java22
-rw-r--r--pom.xml2
4 files changed, 27 insertions, 5 deletions
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF
index e0388a1e8..0d9177f30 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/META-INF/MANIFEST.MF
@@ -3,10 +3,12 @@ Bundle-ManifestVersion: 2
Bundle-Name: %bundle.name
Bundle-SymbolicName: org.eclipse.ecf.remoteservice.asyncproxy
Automatic-Module-Name: org.eclipse.ecf.remoteservice.asyncproxy
-Bundle-Version: 2.0.200.qualifier
+Bundle-Version: 2.1.0.qualifier
Bundle-Vendor: %bundle.provider
-Import-Package: org.eclipse.equinox.concurrent.future
+Import-Package: org.eclipse.equinox.concurrent.future,
+ org.osgi.util.promise
Bundle-Localization: bundle
Export-Package: org.eclipse.ecf.remoteservice.asyncproxy;version="2.0.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.osgi.util;bundle-version="3.3.100";resolution:=optional
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/pom.xml b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/pom.xml
index d396896e8..0405e2680 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/pom.xml
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.ecf</groupId>
<artifactId>org.eclipse.ecf.remoteservice.asyncproxy</artifactId>
- <version>2.0.200-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
index c3c96a3d2..e38874844 100644
--- a/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
+++ b/framework/bundles/org.eclipse.ecf.remoteservice.asyncproxy.j8/src/org/eclipse/ecf/remoteservice/asyncproxy/AbstractAsyncProxyRemoteService.java
@@ -10,10 +10,14 @@
*****************************************************************************/
package org.eclipse.ecf.remoteservice.asyncproxy;
+import java.lang.reflect.Method;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
import java.util.concurrent.Future;
import org.eclipse.equinox.concurrent.future.IFuture;
+import org.osgi.util.promise.Deferred;
+import org.osgi.util.promise.Promise;
public abstract class AbstractAsyncProxyRemoteService {
@@ -25,11 +29,27 @@ public abstract class AbstractAsyncProxyRemoteService {
protected abstract void callCompletableAsync(AbstractAsyncProxyRemoteCall call, IAsyncProxyCompletable completable);
+ protected boolean isReturnAsync(Object proxy, Method method, Object[] args) {
+ @SuppressWarnings("rawtypes")
+ Class returnType = method.getReturnType();
+ return (CompletableFuture.class.isAssignableFrom(returnType) || CompletionStage.class.isAssignableFrom(returnType) ||
+ Future.class.isAssignableFrom(returnType) || IFuture.class.isAssignableFrom(returnType));
+ }
+
@SuppressWarnings("unchecked")
protected Object callFuture(AbstractAsyncProxyRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
+ if (Promise.class.isAssignableFrom(returnType)) {
+ @SuppressWarnings("rawtypes")
+ Deferred d = new Deferred();
+ callCompletableAsync(call, (r,hadException,exception) -> {
+ if (hadException) d.fail(exception);
+ else d.resolve(r);
+ });
+ return d.getPromise();
+ }
// If the result value is a CompletableFuture then
// we callCompletableAsync
- if (CompletableFuture.class.isAssignableFrom(returnType)) {
+ if (CompletableFuture.class.isAssignableFrom(returnType) || CompletionStage.class.isAssignableFrom(returnType)) {
@SuppressWarnings("rawtypes")
CompletableFuture result = new CompletableFuture();
callCompletableAsync(call, (r,hadException,exception) -> {
diff --git a/pom.xml b/pom.xml
index de9d548e3..7776fa140 100644
--- a/pom.xml
+++ b/pom.xml
@@ -83,7 +83,7 @@
<properties>
<tycho-version>1.0.0</tycho-version>
<cbi-version>1.1.4</cbi-version>
- <target-platform>neon</target-platform>
+ <target-platform>oxygen</target-platform>
<project.build.sourceEncoding>ISO-8859-1</project.build.sourceEncoding>
<project.resources.sourceEncoding>ISO-8859-1</project.resources.sourceEncoding>
<tycho.scmUrl>${project.scm.connection}</tycho.scmUrl>

Back to the top