Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-03-29 19:11:28 +0000
committerslewis2014-03-29 19:11:28 +0000
commit13dabf26528a07883a2205b9dc67de66d9dec7ec (patch)
tree49cc3875684b34d9207d07c08178b9d8dba89a99
parent0c7a3a1287fd45106d8691b1cf61bb5c26a8f953 (diff)
downloadorg.eclipse.ecf-13dabf26528a07883a2205b9dc67de66d9dec7ec.tar.gz
org.eclipse.ecf-13dabf26528a07883a2205b9dc67de66d9dec7ec.tar.xz
org.eclipse.ecf-13dabf26528a07883a2205b9dc67de66d9dec7ec.zip
Added no extension registry support to java8 generic provider
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF5
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java68
2 files changed, 72 insertions, 1 deletions
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
index 5dfaaed49..5f462461f 100644
--- 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
@@ -12,6 +12,9 @@ Require-Bundle: org.eclipse.ecf;bundle-version="3.3.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"
+ org.osgi.framework;version="1.8.0",
+ org.osgi.util.tracker;version="1.5.1"
Bundle-Localization: plugin
+Bundle-ActivationPolicy: lazy
+Bundle-Activator: org.eclipse.ecf.provider.internal.remoteservice.java8.Activator
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java
new file mode 100644
index 000000000..3da80c269
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java
@@ -0,0 +1,68 @@
+package org.eclipse.ecf.provider.internal.remoteservice.java8;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.util.AdapterManagerTracker;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceContainerAdapterFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private List<IAdapterFactory> rscAdapterFactories;
+
+ private static IAdapterManager getAdapterManager(BundleContext ctx) {
+ AdapterManagerTracker t = new AdapterManagerTracker(ctx);
+ t.open();
+ IAdapterManager am = t.getAdapterManager();
+ t.close();
+ return am;
+ }
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithoutRegistry() throws Exception {
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8GenericContainerInstantiator.JAVA8_SERVER_NAME, new J8GenericContainerInstantiator(), "ECF Generic Server", true, false), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8GenericContainerInstantiator.JAVA8_CLIENT_NAME, new J8GenericContainerInstantiator(), "ECF Generic Client", false, true), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_CLIENT_NAME, new J8SSLGenericContainerInstantiator(), "ECF SSL Generic Server", true, false), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_SERVER_NAME, new J8SSLGenericContainerInstantiator(), "ECF SSL Generic Client", false, true), null); //$NON-NLS-1$
+ IAdapterManager am = getAdapterManager(context);
+ if (am != null) {
+ rscAdapterFactories = new ArrayList<IAdapterFactory>();
+ IAdapterFactory af = new J8RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8SSLServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8TCPServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8SSLClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8TCPClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ }
+ }
+ });
+
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (rscAdapterFactories != null) {
+ IAdapterManager am = getAdapterManager(context);
+ if (am != null) {
+ for (IAdapterFactory af : rscAdapterFactories)
+ am.unregisterAdapters(af);
+ }
+ }
+ }
+
+}

Back to the top