Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-03-25 04:44:24 +0000
committerslewis2014-03-25 04:44:24 +0000
commit5b5e004b91e6dca670fd3e53594f40bae5b0887c (patch)
tree56769a1ab609b6ba1e4dcad5d4fd0f957db8500c /providers
parent4a28b10d002806219f531aebc19addeecb7459e0 (diff)
downloadorg.eclipse.ecf-5b5e004b91e6dca670fd3e53594f40bae5b0887c.tar.gz
org.eclipse.ecf-5b5e004b91e6dca670fd3e53594f40bae5b0887c.tar.xz
org.eclipse.ecf-5b5e004b91e6dca670fd3e53594f40bae5b0887c.zip
Initial checkin of generic provider java8 remote services support
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.classpath7
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.gitignore1
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.project28
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.pde.core.prefs3
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF17
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/about.html28
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/build.properties8
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.properties10
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.xml40
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8GenericContainerInstantiator.java67
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8RemoteServiceContainerAdapterFactory.java58
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPClientSOContainer.java19
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPServerSOContainer.java25
14 files changed, 318 insertions, 0 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.classpath b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.classpath
new file mode 100644
index 000000000..eca7bdba8
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.gitignore b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.gitignore
new file mode 100644
index 000000000..e660fd93d
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.gitignore
@@ -0,0 +1 @@
+bin/
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.project b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.project
new file mode 100644
index 000000000..7fed21f82
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.ecf.provider.remoteservice.java8</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.jdt.core.prefs b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..0c68a61dc
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.pde.core.prefs b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 000000000..706f07e8a
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+pluginProject.extensions=true
+resolve.requirebundle=false
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5dfaaed49
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.ecf.provider.remoteservice.java8;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: %pluginProvider
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.ecf;bundle-version="3.3.0",
+ org.eclipse.ecf.provider;bundle-version="4.4.0",
+ org.eclipse.ecf.provider.remoteservice;bundle-version="4.1.0",
+ org.eclipse.ecf.sharedobject;bundle-version="2.4.0",
+ org.eclipse.equinox.common;bundle-version="3.6.200",
+ org.eclipse.ecf.remoteservice;bundle-version="8.3.0"
+Import-Package: org.eclipse.equinox.concurrent.future;version="1.1.0",
+ org.osgi.framework;version="1.8.0"
+Bundle-Localization: plugin
+
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/about.html b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/about.html
new file mode 100644
index 000000000..4c79781a5
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 25, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html> \ No newline at end of file
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/build.properties b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/build.properties
new file mode 100644
index 000000000..7b3c227b8
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/build.properties
@@ -0,0 +1,8 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html
+src.includes = about.html
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.properties
new file mode 100644
index 000000000..b5ccef319
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.properties
@@ -0,0 +1,10 @@
+############################################################################
+# Copyright (c) 2014 Composent Inc. and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+############################################################################
+pluginName = ECF Generic Provider RemoteServices Java8 Support
+providerName = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.xml
new file mode 100644
index 000000000..3fa1bdf64
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8GenericContainerInstantiator"
+ description="ECF Java8 Generic Server"
+ hidden="false"
+ name="ecf.generic.server.java8"
+ server="true">
+ </containerFactory>
+ </extension>
+ <extension
+ point="org.eclipse.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8GenericContainerInstantiator"
+ description="ECF Java8 Generic Client"
+ hidden="true"
+ name="ecf.generic.client.java8">
+ </containerFactory>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.ecf.provider.internal.remoteservice.java8.J8TCPClientSOContainer"
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8RemoteServiceContainerAdapterFactory">
+ <adapter type="org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter"/>
+ </factory>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.ecf.provider.internal.remoteservice.java8.J8TCPServerSOContainer"
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8RemoteServiceContainerAdapterFactory">
+ <adapter type="org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter"/>
+ </factory>
+ </extension>
+
+</plugin>
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8GenericContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8GenericContainerInstantiator.java
new file mode 100644
index 000000000..1f6401160
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8GenericContainerInstantiator.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.remoteservice.java8;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.provider.generic.GenericContainerInstantiator;
+import org.eclipse.ecf.provider.generic.SOContainerConfig;
+
+public class J8GenericContainerInstantiator extends
+ GenericContainerInstantiator {
+
+ public static final String JAVA8_CLIENT_NAME = "ecf.generic.client.java8";
+ public static final String JAVA8_SERVER_NAME = "ecf.generic.server.java8";
+
+ @Override
+ protected boolean isClient(ContainerTypeDescription description) {
+ if (description.getName().equals(JAVA8_SERVER_NAME))
+ return false;
+ return true;
+ }
+
+ @Override
+ protected IContainer createClientContainer(GenericContainerArgs gcargs)
+ throws Exception {
+ return new J8TCPClientSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getKeepAlive().intValue());
+ }
+
+ @Override
+ protected IContainer createServerContainer(GenericContainerArgs gcargs)
+ throws Exception {
+ return new J8TCPServerSOContainer(new SOContainerConfig(gcargs.getID()), gcargs.getBindAddress(), gcargs.getKeepAlive().intValue());
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ public String[] getImportedConfigs(ContainerTypeDescription description, String[] exporterSupportedConfigs) {
+ if (exporterSupportedConfigs == null)
+ return null;
+ List results = new ArrayList();
+ List supportedConfigs = Arrays.asList(exporterSupportedConfigs);
+ // For a server, if exporter is a client then we can be an importer
+ if (JAVA8_SERVER_NAME.equals(description.getName())) {
+ if (supportedConfigs.contains(JAVA8_CLIENT_NAME))
+ results.add(JAVA8_SERVER_NAME);
+ // For a client, if exporter is server we can import
+ // or if remote is either generic server or generic client
+ } else if (JAVA8_CLIENT_NAME.equals(description.getName())) {
+ if (supportedConfigs.contains(JAVA8_SERVER_NAME) || supportedConfigs.contains(TCPCLIENT_NAME))
+ results.add(JAVA8_CLIENT_NAME);
+ }
+ if (results.size() == 0)
+ return null;
+ return (String[]) results.toArray(new String[] {});
+ }
+
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8RemoteServiceContainerAdapterFactory.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8RemoteServiceContainerAdapterFactory.java
new file mode 100644
index 000000000..9a91c810d
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8RemoteServiceContainerAdapterFactory.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.remoteservice.java8;
+
+import java.util.concurrent.CompletableFuture;
+
+import org.eclipse.ecf.core.identity.ID;
+import org.eclipse.ecf.core.sharedobject.*;
+import org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceContainerAdapterFactory;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceImpl;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceRegistrationImpl;
+import org.eclipse.ecf.remoteservice.IRemoteCall;
+import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
+import org.eclipse.ecf.remoteservice.events.IRemoteCallCompleteEvent;
+import org.eclipse.ecf.remoteservice.events.IRemoteCallEvent;
+
+public class J8RemoteServiceContainerAdapterFactory extends RemoteServiceContainerAdapterFactory {
+
+ protected ISharedObject createAdapter(ISharedObjectContainer container, @SuppressWarnings("rawtypes") Class adapterType, ID adapterID) {
+ if (adapterType.equals(IRemoteServiceContainerAdapter.class)) {
+ return new RegistrySharedObject() {
+ @Override
+ protected RemoteServiceImpl createRemoteService(
+ RemoteServiceRegistrationImpl registration) {
+ return new RemoteServiceImpl(this,registration) {
+ @SuppressWarnings("unchecked")
+ @Override
+ protected Object callFuture(IRemoteCall call, @SuppressWarnings("rawtypes") Class returnType) {
+ if (CompletableFuture.class.isAssignableFrom(returnType)) {
+ @SuppressWarnings("rawtypes")
+ CompletableFuture result = new CompletableFuture();
+ callAsyncWithResult(call, (IRemoteCallEvent e) -> {
+ if (e instanceof IRemoteCallCompleteEvent) {
+ IRemoteCallCompleteEvent cce = (IRemoteCallCompleteEvent) e;
+ if (cce.hadException())
+ result.completeExceptionally(cce.getException());
+ else
+ result.complete(cce.getResponse());
+ }
+ });
+ return result;
+ }
+ return super.callFuture(call, returnType);
+ }
+ };
+ }
+ };
+ }
+ return null;
+ }
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPClientSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPClientSOContainer.java
new file mode 100644
index 000000000..243fd4ebd
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPClientSOContainer.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.remoteservice.java8;
+
+import org.eclipse.ecf.core.sharedobject.ISharedObjectContainerConfig;
+import org.eclipse.ecf.provider.generic.TCPClientSOContainer;
+
+public class J8TCPClientSOContainer extends TCPClientSOContainer {
+
+ public J8TCPClientSOContainer(ISharedObjectContainerConfig config, int ka) {
+ super(config, ka);
+ }
+} \ No newline at end of file
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPServerSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPServerSOContainer.java
new file mode 100644
index 000000000..637cf822c
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8TCPServerSOContainer.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Composent, Inc. and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Composent, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.ecf.provider.internal.remoteservice.java8;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.URISyntaxException;
+
+import org.eclipse.ecf.core.sharedobject.ISharedObjectContainerConfig;
+import org.eclipse.ecf.provider.generic.TCPServerSOContainer;
+
+public class J8TCPServerSOContainer extends TCPServerSOContainer {
+
+ public J8TCPServerSOContainer(ISharedObjectContainerConfig config,
+ InetAddress bindAddress, int keepAlive) throws IOException,
+ URISyntaxException {
+ super(config, bindAddress, keepAlive);
+ }
+} \ No newline at end of file

Back to the top