Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-09 14:06:54 -0500
committerslewis2018-03-09 14:06:54 -0500
commita2c6a6429af436a2e30749f75c8a9f88fca9fa45 (patch)
treeede21afe45ca2761bfacccae5c7ddf82ff04d425 /framework/bundles
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
Diffstat (limited to 'framework/bundles')
-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
3 files changed, 26 insertions, 4 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) -> {

Back to the top