Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-03-29 06:33:17 +0000
committerslewis2014-03-29 06:33:17 +0000
commit0c7a3a1287fd45106d8691b1cf61bb5c26a8f953 (patch)
treeb15777e50b4b6baaa009537c975e6d9f6491831a /providers
parentefab5302c57e1cca1b960e13648ffc00df4cb137 (diff)
downloadorg.eclipse.ecf-0c7a3a1287fd45106d8691b1cf61bb5c26a8f953.tar.gz
org.eclipse.ecf-0c7a3a1287fd45106d8691b1cf61bb5c26a8f953.tar.xz
org.eclipse.ecf-0c7a3a1287fd45106d8691b1cf61bb5c26a8f953.zip
Added support for generic provider container type registration and
adapter factory registration without extension registry for bug 421569 Change-Id: I0000000000000000000000000000000000000000
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java50
1 files changed, 46 insertions, 4 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java
index 1a2531ce3..30a6342e8 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java
@@ -8,9 +8,12 @@
******************************************************************************/
package org.eclipse.ecf.internal.provider.remoteservice;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ecf.core.util.LogHelper;
-import org.eclipse.ecf.core.util.SystemLogService;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceContainerAdapterFactory;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceNamespace;
import org.osgi.framework.*;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
@@ -39,8 +42,39 @@ public class Activator implements BundleActivator {
plugin = this;
}
- public void start(BundleContext ctxt) throws Exception {
+ private List rscAdapterFactories;
+
+ private static IAdapterManager getAdapterManager(BundleContext ctx) {
+ AdapterManagerTracker t = new AdapterManagerTracker(ctx);
+ t.open();
+ IAdapterManager am = t.getAdapterManager();
+ t.close();
+ return am;
+ }
+
+ public void start(final BundleContext ctxt) throws Exception {
this.context = ctxt;
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithoutRegistry() throws Exception {
+ ctxt.registerService(Namespace.class, new RemoteServiceNamespace(org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceNamespace.NAME, "Generic remote service namespace"), null); //$NON-NLS-1$
+ IAdapterManager am = getAdapterManager(ctxt);
+ if (am != null) {
+ rscAdapterFactories = new ArrayList();
+ IAdapterFactory af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.SSLServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.TCPServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.SSLClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.TCPClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ }
+ }
+ });
}
public void stop(BundleContext ctxt) throws Exception {
@@ -49,6 +83,14 @@ public class Activator implements BundleActivator {
logServiceTracker = null;
logService = null;
}
+ if (rscAdapterFactories != null) {
+ IAdapterManager am = getAdapterManager(this.context);
+ if (am != null) {
+ for (Iterator i = rscAdapterFactories.iterator(); i.hasNext();)
+ am.unregisterAdapters((IAdapterFactory) i.next());
+ }
+ rscAdapterFactories = null;
+ }
this.context = null;
plugin = null;
}

Back to the top