Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2018-03-09 14:05:50 -0500
committerslewis2018-03-09 14:05:50 -0500
commitdc9ea56b7e71e9001c8748c7dfdc0c29b96b6270 (patch)
tree2c638b3872df15d34ab33f6e8ff45b05b42ce420 /providers/bundles
parent79c46b125fcfe725bb0001347cef84f63cd42bbe (diff)
downloadorg.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.tar.gz
org.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.tar.xz
org.eclipse.ecf-dc9ea56b7e71e9001c8748c7dfdc0c29b96b6270.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: Iee0e76cd137f684aade4ee52d5c286eb1159ea7e
Diffstat (limited to 'providers/bundles')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/pom.xml2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java39
3 files changed, 40 insertions, 3 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF
index 9494008e0..6c6898b83 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.remoteservice;singleton:=true
Automatic-Module-Name: org.eclipse.ecf.provider.remoteservice
-Bundle-Version: 4.3.200.qualifier
+Bundle-Version: 4.4.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.remoteservice.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/pom.xml b/providers/bundles/org.eclipse.ecf.provider.remoteservice/pom.xml
index 601fde4d8..5bae02316 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/pom.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/pom.xml
@@ -10,6 +10,6 @@
</parent>
<groupId>org.eclipse.ecf</groupId>
<artifactId>org.eclipse.ecf.provider.remoteservice</artifactId>
- <version>4.3.200-SNAPSHOT</version>
+ <version>4.4.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
index 60b3c3d86..c3dbdfb3a 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java
@@ -11,8 +11,11 @@ package org.eclipse.ecf.provider.remoteservice.generic;
import java.io.IOException;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.security.*;
import java.util.*;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.ContainerConnectException;
import org.eclipse.ecf.core.events.*;
@@ -23,6 +26,7 @@ import org.eclipse.ecf.core.sharedobject.*;
import org.eclipse.ecf.core.sharedobject.events.ISharedObjectActivatedEvent;
import org.eclipse.ecf.core.status.SerializableStatus;
import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.core.util.reflection.ClassUtil;
import org.eclipse.ecf.internal.provider.remoteservice.Activator;
import org.eclipse.ecf.internal.provider.remoteservice.IRemoteServiceProviderDebugOptions;
import org.eclipse.ecf.remoteservice.*;
@@ -1444,6 +1448,39 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
/**
+ * @since 4.4
+ */
+ @SuppressWarnings("unchecked")
+ protected Object invokeLocal(RemoteServiceRegistrationImpl reg, RemoteCallImpl call) throws InvocationTargetException, Exception, NoClassDefFoundError {
+ Object[] callArgs = call.getParameters();
+ Object[] args = (callArgs == null) ? SharedObjectMsg.nullArgs : callArgs;
+ Object service = reg.getService();
+ // Find appropriate method on service
+ final Method method = ClassUtil.getMethod(service.getClass(), call.getMethod(), SharedObjectMsg.getTypesForParameters(args));
+ AccessController.doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws Exception {
+ if (!method.isAccessible())
+ method.setAccessible(true);
+ return null;
+ }
+ });
+ // Actually invoke method on service object
+ Object result = method.invoke(service, args);
+ if (result != null) {
+ // provider must expose osgi.async property
+ if (reg.getProperty(Constants.OSGI_ASYNC_INTENT) != null) {
+ Class returnType = method.getReturnType();
+ if (returnType.isAssignableFrom(Future.class))
+ result = ((Future) result).get(call.getTimeout(), TimeUnit.MILLISECONDS);
+ else if (returnType.isAssignableFrom(IFuture.class))
+ result = ((IFuture) result).get();
+ // XXX test for Promise here
+ }
+ }
+ return result;
+ }
+
+ /**
* @param executor executor to use to execute request
* @param request the request to execute
* @param responseTarget response target
@@ -1465,7 +1502,7 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
if (callPolicy != null)
callPolicy.checkRemoteCall(responseTarget, localRegistration, call);
- result = localRegistration.callService(call);
+ result = invokeLocal(localRegistration, call);
response = new Response(request.getRequestId(), result);
// Invocation target exception happens if the local method being invoked throws (cause)

Back to the top