Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2016-12-03 16:50:30 -0500
committerslewis2016-12-03 16:50:30 -0500
commit1eb29864461190a1d14e2a3edfbed04f6239582c (patch)
tree83c84bc134423377404edb0a6206ab1512e03b42
parent367b397c30ef8251017d0ad4227cc304f811eb19 (diff)
downloadorg.eclipse.ecf-bug508640.tar.gz
org.eclipse.ecf-bug508640.tar.xz
org.eclipse.ecf-bug508640.zip
Added partial support for not using extension registry inbug508640
org.eclipse.ecf.provider.filetransfer.httpclient4 Change-Id: I6059fbfd3dc2e9bda9f5fd452d1e8602c824fc3c
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/internal/provider/filetransfer/Activator.java40
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java6
2 files changed, 44 insertions, 2 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/internal/provider/filetransfer/Activator.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/internal/provider/filetransfer/Activator.java
index 9a2038170..27066f59d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/internal/provider/filetransfer/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/internal/provider/filetransfer/Activator.java
@@ -13,6 +13,7 @@ package org.eclipse.ecf.internal.provider.filetransfer;
import java.io.IOException;
import java.net.URL;
import java.net.URLConnection;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -24,6 +25,7 @@ import java.util.Set;
import java.util.StringTokenizer;
import org.eclipse.core.net.proxy.IProxyService;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.core.runtime.IAdapterManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionDelta;
@@ -32,7 +34,10 @@ import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IRegistryChangeEvent;
import org.eclipse.core.runtime.IRegistryChangeListener;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.core.util.LogHelper;
import org.eclipse.ecf.core.util.PlatformHelper;
import org.eclipse.ecf.filetransfer.service.IRemoteFileSystemBrowser;
@@ -42,7 +47,11 @@ import org.eclipse.ecf.filetransfer.service.IRetrieveFileTransferFactory;
import org.eclipse.ecf.filetransfer.service.ISendFileTransfer;
import org.eclipse.ecf.filetransfer.service.ISendFileTransferFactory;
import org.eclipse.ecf.provider.filetransfer.IFileTransferProtocolToFactoryMapper;
+import org.eclipse.ecf.provider.filetransfer.browse.MultiProtocolFileSystemBrowserAdapterFactory;
+import org.eclipse.ecf.provider.filetransfer.identity.FileTransferNamespace;
+import org.eclipse.ecf.provider.filetransfer.outgoing.MultiProtocolOutgoingAdapterFactory;
import org.eclipse.ecf.provider.filetransfer.retrieve.MultiProtocolRetrieveAdapter;
+import org.eclipse.ecf.provider.filetransfer.retrieve.MultiProtocolRetrieveAdapterFactory;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
@@ -269,8 +278,30 @@ public class Activator implements BundleActivator, IFileTransferProtocolToFactor
loadProtocolHandlers();
// Finally, register this object as a IFileTransferProtocolToFactoryMapper service
protocolMapperRegistration = context.registerService(IFileTransferProtocolToFactoryMapper.class.getName(), this, null);
+
+ SafeRunner.run(new ExtensionRegistryRunnable(this.context) {
+ protected void runWithoutRegistry() throws Exception {
+ getContext().registerService(Namespace.class, new FileTransferNamespace(), null);
+ IAdapterManager am = getAdapterManager();
+ if (am != null) {
+ rscAdapterFactories = new ArrayList();
+ IAdapterFactory af = new MultiProtocolRetrieveAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.core.BaseContainer.class);
+ rscAdapterFactories.add(af);
+ af = new MultiProtocolOutgoingAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.core.BaseContainer.class);
+ rscAdapterFactories.add(af);
+ af = new MultiProtocolFileSystemBrowserAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.core.BaseContainer.class);
+ rscAdapterFactories.add(af);
+ }
+ }
+ });
+
}
+ private List rscAdapterFactories;
+
public boolean reinitialize() {
try {
loadProtocolHandlers();
@@ -327,7 +358,14 @@ public class Activator implements BundleActivator, IFileTransferProtocolToFactor
this.protocolMapperRegistration.unregister();
this.protocolMapperRegistration = null;
}
-
+ if (rscAdapterFactories != null) {
+ IAdapterManager am = getAdapterManager();
+ if (am != null) {
+ for (Iterator i = rscAdapterFactories.iterator(); i.hasNext();)
+ am.unregisterAdapters((IAdapterFactory) i.next());
+ }
+ rscAdapterFactories = null;
+ }
synchronized (this) {
this.context = null;
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
index 5252af1d7..851227d23 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferNamespace.java
@@ -28,6 +28,10 @@ public class FileTransferNamespace extends Namespace {
public static final String PROTOCOL = Messages.FileTransferNamespace_Namespace_Protocol;
+ public FileTransferNamespace() {
+ super("ecf.provider.filetransfer", "ECF File Transfer Provider Namespace"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
private String getInitFromExternalForm(Object[] args) {
if (args == null || args.length < 1 || args[0] == null)
return null;
@@ -93,7 +97,7 @@ public class FileTransferNamespace extends Namespace {
* @see org.eclipse.ecf.core.identity.Namespace#getSupportedParameterTypesForCreateInstance()
*/
public Class[][] getSupportedParameterTypes() {
- return new Class[][] { {URL.class}, {String.class}};
+ return new Class[][] {{URL.class}, {String.class}};
}
}

Back to the top