Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-06-12 20:08:41 +0000
committerslewis2014-06-12 20:08:41 +0000
commitd3dfa412d7f20ca4dc540922537be8e1f3dce094 (patch)
tree406c481459d946b563b6168187b7aba44fa18766 /providers
parentc28a9bebcf78dc077f1313504035a9db3cecbcad (diff)
parente6a34a588cbfec3b900de463ae0568f1743d0203 (diff)
downloadorg.eclipse.ecf-424059.tar.gz
org.eclipse.ecf-424059.tar.xz
org.eclipse.ecf-424059.zip
Merge remote-tracking branch 'origin/master' into 424059424059
Conflicts: framework/bundles/org.eclipse.ecf.discovery/META-INF/MANIFEST.MF osgi/bundles/org.eclipse.ecf.osgi.services.remoteserviceadmin/src/org/eclipse/ecf/osgi/services/remoteserviceadmin/RemoteServiceAdmin.java providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF merged manually by sbl Change-Id: If086dde4fffb137f44a48d183f6280f068c8eb17
Diffstat (limited to 'providers')
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.datashare.nio/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.datashare/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.datashare/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.datashare/plugin.xml18
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.datashare/src/org/eclipse/ecf/internal/provider/datashare/Activator.java42
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java18
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.dnssd/META-INF/MANIFEST.MF8
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.dnssd/plugin.xml4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/Activator.java14
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/DnsSdNamespace.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java47
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java20
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java28
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/Activator.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/ConnectingSocketMonitor.java47
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientDefaultSSLSocketFactoryModifier.java7
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientFileSystemBrowser.java34
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientRetrieveFileTransfer.java31
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java72
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java137
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java109
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java22
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.irc/src/org/eclipse/ecf/internal/provider/irc/container/IRCRootContainer.java2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java26
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/ContainerInstantiator.java16
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/identity/JMDNSNamespace.java11
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java17
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/provider/jslp/identity/JSLPNamespace.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.local/META-INF/MANIFEST.MF4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/internal/provider/local/Activator.java15
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/provider/local/identity/LocalNamespace.java4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF3
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java13
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java1
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiRemoteServiceNamespace.java4
-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.MF20
-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.xml75
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java67
-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.java27
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLClientSOContainer.java19
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLGenericContainerInstantiator.java67
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLServerSOContainer.java25
-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
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/META-INF/MANIFEST.MF3
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/internal/provider/remoteservice/Activator.java50
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.remoteservice/src/org/eclipse/ecf/provider/remoteservice/generic/RegistrySharedObject.java9
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp.datashare/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/META-INF/MANIFEST.MF2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/plugin.properties2
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/XMPPContainerPresenceHelper.java96
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java11
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/META-INF/MANIFEST.MF4
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/plugin.xml8
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java14
-rw-r--r--providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java2
82 files changed, 1273 insertions, 269 deletions
diff --git a/providers/bundles/org.eclipse.ecf.provider.datashare.nio/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.datashare.nio/plugin.properties
index d42b4d795..4f9564d3c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.datashare.nio/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.datashare.nio/plugin.properties
@@ -9,5 +9,5 @@
# Remy Chi Jian Suen <remy.suen@gmail.com> - initial API and implementation
################################################################################
-plugin.name = ECF NIO Datashare Implementation
+plugin.name = ECF DataShare NIO Provider
plugin.provider = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.datashare/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.datashare/META-INF/MANIFEST.MF
index 04cb9629d..c0c72691e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.datashare/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.datashare/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.datashare;singleton:=true
-Bundle-Version: 1.4.100.qualifier
+Bundle-Version: 1.5.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.datashare.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.properties
index 64b776234..6763b5f10 100644
--- a/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.properties
@@ -6,6 +6,6 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-plugin.name=ECF Datashare Provider
+plugin.name=ECF Generic Provider DataShare Support
plugin.provider=Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.xml
index bf74e668b..38cd24e8c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.datashare/plugin.xml
@@ -18,5 +18,23 @@
<adapter type="org.eclipse.ecf.datashare.IChannelContainerAdapter"/>
</factory>
</extension>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.ecf.provider.generic.SSLClientSOContainer"
+ class="org.eclipse.ecf.provider.datashare.DatashareContainerAdapterFactory">
+ <adapter type="org.eclipse.ecf.datashare.IChannelContainerAdapter"/>
+ </factory>
+ </extension>
+
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.ecf.provider.generic.SSLServerSOContainer"
+ class="org.eclipse.ecf.provider.datashare.DatashareContainerAdapterFactory">
+ <adapter type="org.eclipse.ecf.datashare.IChannelContainerAdapter"/>
+ </factory>
+ </extension>
</plugin>
diff --git a/providers/bundles/org.eclipse.ecf.provider.datashare/src/org/eclipse/ecf/internal/provider/datashare/Activator.java b/providers/bundles/org.eclipse.ecf.provider.datashare/src/org/eclipse/ecf/internal/provider/datashare/Activator.java
index 1c29ebfcf..035178190 100644
--- a/providers/bundles/org.eclipse.ecf.provider.datashare/src/org/eclipse/ecf/internal/provider/datashare/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.datashare/src/org/eclipse/ecf/internal/provider/datashare/Activator.java
@@ -11,11 +11,11 @@
package org.eclipse.ecf.internal.provider.datashare;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.IStatus;
+import java.util.List;
+import org.eclipse.core.runtime.*;
import org.eclipse.ecf.core.IContainerManager;
-import org.eclipse.ecf.core.util.LogHelper;
-import org.eclipse.ecf.core.util.PlatformHelper;
+import org.eclipse.ecf.core.util.*;
+import org.eclipse.ecf.provider.datashare.DatashareContainerAdapterFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -35,7 +35,7 @@ public class Activator implements BundleActivator {
private ServiceTracker logServiceTracker = null;
- private ServiceTracker adapterManagerTracker = null;
+ private AdapterManagerTracker adapterManagerTracker = null;
private ServiceTracker containerManagerTracker = null;
@@ -61,11 +61,32 @@ public class Activator implements BundleActivator {
}
}
+ List rscAdapterFactories;
+
/**
* This method is called upon plug-in activation
*/
- public void start(BundleContext ctxt) throws Exception {
+ public void start(final BundleContext ctxt) throws Exception {
this.context = ctxt;
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithoutRegistry() throws Exception {
+ IAdapterManager am = getAdapterManager();
+ if (am != null) {
+ IAdapterFactory af = new DatashareContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.SSLServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new DatashareContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.TCPServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new DatashareContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.SSLClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new DatashareContainerAdapterFactory();
+ am.registerAdapters(af, org.eclipse.ecf.provider.generic.TCPClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ }
+ }
+ });
}
/**
@@ -103,15 +124,10 @@ public class Activator implements BundleActivator {
public IAdapterManager getAdapterManager() {
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
/**
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.discovery/META-INF/MANIFEST.MF
index 89c849e83..84d8b55a8 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.discovery;singleton:=true
-Bundle-Version: 2.1.200.qualifier
+Bundle-Version: 2.2.0.qualifier
Bundle-Vendor: %pluginProvider
Import-Package: org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework,
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java
index 829b484c1..ced3201c6 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/Activator.java
@@ -12,12 +12,16 @@ package org.eclipse.ecf.internal.provider.discovery;
import java.util.HashSet;
import java.util.Properties;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.ecf.core.ContainerConnectException;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IDiscoveryLocator;
import org.eclipse.ecf.discovery.service.IDiscoveryService;
-import org.eclipse.ecf.provider.discovery.CompositeDiscoveryContainer;
+import org.eclipse.ecf.provider.discovery.*;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -47,6 +51,17 @@ public class Activator implements BundleActivator {
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(final BundleContext context) throws Exception {
+
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithoutRegistry() throws Exception {
+ context.registerService(Namespace.class, new CompositeNamespace(), null);
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.composite", new CompositeDiscoveryContainerInstantiator(), "Composite Discovery Container", true, false), null); //$NON-NLS-1$ //$NON-NLS-2$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.singleton.discovery", new SingletonDiscoveryContainerInstantiator(), "Composite Discovery Container Locator", true, false), null); //$NON-NLS-1$ //$NON-NLS-2$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.composite.locator", new CompositeDiscoveryContainerInstantiator(), "Composite Discovery Container Locator"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.composite.advertiser", new CompositeDiscoveryContainerInstantiator(), "Composite Discovery Container Advertiser"), null); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ });
+
final Properties props = new Properties();
props.put(IDiscoveryLocator.CONTAINER_NAME, CompositeDiscoveryContainer.NAME);
props.put(Constants.SERVICE_RANKING, new Integer(1000));
@@ -119,6 +134,7 @@ public class Activator implements BundleActivator {
((CompositeDiscoveryContainer) service).dispose();
}
}, props);
+
}
/*
diff --git a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
index e37e23168..5ffc44e04 100644
--- a/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.discovery/src/org/eclipse/ecf/internal/provider/discovery/CompositeNamespace.java
@@ -20,6 +20,10 @@ public class CompositeNamespace extends Namespace {
private static final long serialVersionUID = -4774766051014928510L;
public static final String NAME = "ecf.namespace.composite"; //$NON-NLS-1$
+ public CompositeNamespace() {
+ super(NAME, "Composite Namespace"); //$NON-NLS-1$
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
diff --git a/providers/bundles/org.eclipse.ecf.provider.dnssd/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.dnssd/META-INF/MANIFEST.MF
index e3ee241ed..2b7a86804 100644
--- a/providers/bundles/org.eclipse.ecf.provider.dnssd/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.dnssd/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: ECF Discovery Provider based on DNS-SD
+Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.dnssd;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.ecf.provider.dnssd.Activator
-Bundle-Vendor: Eclipse.org - ECF
+Bundle-Vendor: %pluginProvider
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Import-Package: org.eclipse.ecf.core;version="3.0.0",
org.eclipse.ecf.core.events,
@@ -22,5 +22,5 @@ Import-Package: org.eclipse.ecf.core;version="3.0.0",
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.ecf.provider.dnssd;version="1.0.0"
Require-Bundle: org.xbill.dns;bundle-version="2.0.8",
- org.eclipse.equinox.common;bundle-version="3.5.0"
+ org.eclipse.equinox.common
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.dnssd/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.dnssd/plugin.xml
index a93033e6b..43aac56d7 100644
--- a/providers/bundles/org.eclipse.ecf.provider.dnssd/plugin.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.dnssd/plugin.xml
@@ -5,7 +5,7 @@
point="org.eclipse.ecf.containerFactory">
<containerFactory
class="org.eclipse.ecf.provider.dnssd.ContainerInstantiator"
- description="Discovery Locator Container "
+ description="Discovery Locator Container"
name="ecf.discovery.dnssd.locator">
</containerFactory>
</extension>
@@ -13,7 +13,7 @@
point="org.eclipse.ecf.containerFactory">
<containerFactory
class="org.eclipse.ecf.provider.dnssd.ContainerInstantiator"
- description="Discovery Advertiser Container "
+ description="Discovery Advertiser Container"
name="ecf.discovery.dnssd.advertiser">
</containerFactory>
</extension>
diff --git a/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/Activator.java b/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/Activator.java
index b60c52fbb..d5471c4e5 100644
--- a/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/Activator.java
@@ -16,8 +16,12 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.ecf.core.ContainerConnectException;
+import org.eclipse.ecf.core.ContainerTypeDescription;
import org.eclipse.ecf.core.IContainer;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IDiscoveryLocator;
import org.osgi.framework.Bundle;
@@ -46,9 +50,17 @@ public class Activator implements BundleActivator {
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
- public void start(BundleContext context) throws Exception {
+ public void start(final BundleContext context) throws Exception {
this.context = context;
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithoutRegistry() throws Exception {
+ context.registerService(Namespace.class, new DnsSdNamespace(), null);
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(DISCOVERY_CONTAINER_NAME_VALUE + LOCATOR,new ContainerInstantiator(),"Discovery Locator Container"), null);
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(DISCOVERY_CONTAINER_NAME_VALUE + ADVERTISER,new ContainerInstantiator(),"Discovery Advertiser Container"), null);
+ }
+ });
+
// register a managed factory for the locator service
final Properties locCmProps = new Properties();
locCmProps.put(Constants.SERVICE_PID, DISCOVERY_CONTAINER_NAME_VALUE + LOCATOR);
diff --git a/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/DnsSdNamespace.java b/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/DnsSdNamespace.java
index 57bb9a9ef..7c1c2ac41 100644
--- a/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/DnsSdNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.dnssd/src/org/eclipse/ecf/provider/dnssd/DnsSdNamespace.java
@@ -26,6 +26,10 @@ public class DnsSdNamespace extends Namespace {
public static final String SCHEME = "dnssd"; //$NON-NLS-1$
public static final String NAME = "ecf.namespace.dnssd"; //$NON-NLS-1$
+ public DnsSdNamespace() {
+ super(NAME,"Dns SD Namespace");
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
index 7120b3e08..ac271d36e 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.httpclient;singleton:=true
-Bundle-Version: 4.0.300.qualifier
+Bundle-Version: 4.0.500.qualifier
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.httpclient.Activator
Require-Bundle: org.eclipse.equinox.common,
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java
index a725abc58..3f713e923 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/Activator.java
@@ -110,7 +110,7 @@ public class Activator implements BundleActivator {
return plugin;
}
- protected LogService getLogService() {
+ private synchronized LogService getLogService() {
if (logServiceTracker == null) {
logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
logServiceTracker.open();
@@ -125,7 +125,7 @@ public class Activator implements BundleActivator {
}
}
- public SSLSocketFactory getSSLSocketFactory() {
+ public synchronized SSLSocketFactory getSSLSocketFactory() {
if (sslSocketFactoryTracker == null) {
sslSocketFactoryTracker = new ServiceTracker(this.context, SSLSocketFactory.class.getName(), null);
sslSocketFactoryTracker.open();
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
index 39d8f5aca..407e17651 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient/ConnectingSocketMonitor.java
@@ -11,8 +11,19 @@
package org.eclipse.ecf.internal.provider.filetransfer.httpclient;
-import java.util.*;
-import org.eclipse.ecf.filetransfer.events.socket.*;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.ecf.core.util.Trace;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketClosedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketConnectedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketCreatedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
public class ConnectingSocketMonitor implements ISocketListener {
@@ -26,6 +37,16 @@ public class ConnectingSocketMonitor implements ISocketListener {
connectingSockets = Collections.synchronizedMap(new HashMap());
}
+ /**
+ * Callers of this method should not iterate through the returned
+ * Collection, as a CME is possible...as reported by bug
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ * Rather than call this method and iterate through the Collection,
+ * to close the connecting sockets call closeConnectingSockets
+ * instead.
+ * @return Collection the existing collection of underlying connecting
+ * Socket instances
+ */
public Collection getConnectingSockets() {
return Collections.unmodifiableCollection(connectingSockets.keySet());
}
@@ -34,6 +55,28 @@ public class ConnectingSocketMonitor implements ISocketListener {
connectingSockets.clear();
}
+ /**
+ * Method added to synchronize access to underlying keySet
+ * to prevent CME as reported in bug
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ */
+ public void closeSockets() {
+ // synchronize on the connectingSockets map
+ // so all changes caused by handleSocketEvent
+ // are prevented via synchronized Map
+ synchronized (connectingSockets) {
+ for (Iterator iterator = connectingSockets.keySet().iterator(); iterator.hasNext();) {
+ Socket socket = (Socket) iterator.next();
+ try {
+ Trace.trace(Activator.PLUGIN_ID, "Call socket.close() for socket=" + socket.toString()); //$NON-NLS-1$
+ socket.close();
+ } catch (IOException e) {
+ Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
public void handleSocketEvent(ISocketEvent event) {
if (event instanceof ISocketCreatedEvent) {
connectingSockets.put(event.getFactorySocket(), event);
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java
index 25c55eb99..4b0dccbb4 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientDefaultSSLSocketFactoryModifier.java
@@ -32,7 +32,7 @@ public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFact
// empty
}
- public SSLSocketFactory getSSLSocketFactory() throws IOException {
+ public synchronized SSLSocketFactory getSSLSocketFactory() throws IOException {
if (null == sslContext) {
try {
sslContext = getSSLContext(defaultProtocolNames);
@@ -45,7 +45,7 @@ public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFact
return (sslContext == null) ? (SSLSocketFactory) SSLSocketFactory.getDefault() : sslContext.getSocketFactory();
}
- public SSLContext getSSLContext(String protocols) {
+ public synchronized SSLContext getSSLContext(String protocols) {
SSLContext rtvContext = null;
if (protocols != null) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
index daa428875..d2e60a7fe 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientFileSystemBrowser.java
@@ -15,9 +15,7 @@ package org.eclipse.ecf.provider.filetransfer.httpclient;
import java.io.IOException;
import java.net.HttpURLConnection;
-import java.net.Socket;
import java.net.URL;
-import java.util.Iterator;
import java.util.Map;
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.Header;
@@ -144,15 +142,7 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
}
}
if (connectingSockets != null) {
- // this should unblock socket connect calls, if any
- for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
- Socket socket = (Socket) iterator.next();
- try {
- socket.close();
- } catch (IOException e) {
- Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
- }
- }
+ connectingSockets.closeSockets();
}
}
@@ -218,8 +208,14 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
// Define a CredentialsProvider - found that possibility while debugging in org.apache.commons.httpclient.HttpMethodDirector.processProxyAuthChallenge(HttpMethod)
// Seems to be another way to select the credentials.
headMethod.getParams().setParameter(CredentialsProvider.PROVIDER, credProvider);
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- headMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ headMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ headMethod.addRequestHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
headMethod.addRequestHeader("Connection", "Keep-Alive"); //$NON-NLS-1$ //$NON-NLS-2$
long lastModified = 0;
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
index a58b6cb50..de027fdeb 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient/src/org/eclipse/ecf/provider/filetransfer/httpclient/HttpClientRetrieveFileTransfer.java
@@ -17,7 +17,6 @@ import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
-import java.net.Socket;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
@@ -370,16 +369,7 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
}
}
if (connectingSockets != null) {
- // this should unblock socket connect calls, if any
- for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
- Socket socket = (Socket) iterator.next();
- try {
- Trace.trace(Activator.PLUGIN_ID, "Call socket.close() for socket=" + socket.toString()); //$NON-NLS-1$
- socket.close();
- } catch (IOException e) {
- Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
- }
- }
+ connectingSockets.closeSockets();
}
hardClose();
if (fireDoneEvent) {
@@ -488,8 +478,14 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
Trace.trace(Activator.PLUGIN_ID, "retrieve range header=" + rangeHeader); //$NON-NLS-1$
setRangeHeader(rangeHeader);
}
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- getMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ getMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ getMethod.addRequestHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
@@ -898,8 +894,14 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
if (this.bytesReceived <= 0 || this.fileLength <= this.bytesReceived)
throw new IOException(Messages.HttpClientRetrieveFileTransfer_RESUME_START_ERROR);
setRangeHeader("bytes=" + this.bytesReceived + "-"); //$NON-NLS-1$ //$NON-NLS-2$
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- getMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ getMethod.addRequestHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ getMethod.addRequestHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF
index 753e8c6c6..7ae5588fd 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.httpclient4;singleton:=true
-Bundle-Version: 1.0.300.qualifier
+Bundle-Version: 1.0.500.qualifier
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.httpclient4.Activator
Require-Bundle: org.eclipse.equinox.common,
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/Activator.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/Activator.java
index 43cce0f16..139dcab26 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/Activator.java
@@ -97,7 +97,7 @@ public class Activator implements BundleActivator {
return plugin;
}
- protected LogService getLogService() {
+ private synchronized LogService getLogService() {
if (logServiceTracker == null) {
logServiceTracker = new ServiceTracker(this.context, LogService.class.getName(), null);
logServiceTracker.open();
@@ -112,7 +112,7 @@ public class Activator implements BundleActivator {
}
}
- public SSLSocketFactory getSSLSocketFactory() {
+ public synchronized SSLSocketFactory getSSLSocketFactory() {
if (sslSocketFactoryTracker == null) {
sslSocketFactoryTracker = new ServiceTracker(this.context, SSLSocketFactory.class.getName(), null);
sslSocketFactoryTracker.open();
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/ConnectingSocketMonitor.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/ConnectingSocketMonitor.java
index 9aae0dc5e..a95d76d8d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/ConnectingSocketMonitor.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/internal/provider/filetransfer/httpclient4/ConnectingSocketMonitor.java
@@ -11,8 +11,19 @@
package org.eclipse.ecf.internal.provider.filetransfer.httpclient4;
-import java.util.*;
-import org.eclipse.ecf.filetransfer.events.socket.*;
+import java.io.IOException;
+import java.net.Socket;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.eclipse.ecf.core.util.Trace;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketClosedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketConnectedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketCreatedEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketEvent;
+import org.eclipse.ecf.filetransfer.events.socket.ISocketListener;
public class ConnectingSocketMonitor implements ISocketListener {
@@ -26,6 +37,16 @@ public class ConnectingSocketMonitor implements ISocketListener {
connectingSockets = Collections.synchronizedMap(new HashMap());
}
+ /**
+ * Callers of this method should not iterate through the returned
+ * Collection, as a CME is possible...as reported by bug
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ * Rather than call this method and iterate through the Collection,
+ * to close the connecting sockets call closeConnectingSockets
+ * instead.
+ * @return Collection the existing collection of underlying connecting
+ * Socket instances
+ */
public Collection getConnectingSockets() {
return Collections.unmodifiableCollection(connectingSockets.keySet());
}
@@ -34,6 +55,28 @@ public class ConnectingSocketMonitor implements ISocketListener {
connectingSockets.clear();
}
+ /**
+ * Method added to synchronize access to underlying keySet
+ * to prevent CME as reported in bug
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ */
+ public void closeSockets() {
+ // synchronize on the connectingSockets map
+ // so all changes caused by handleSocketEvent
+ // are prevented via synchronized Map
+ synchronized (connectingSockets) {
+ for (Iterator iterator = connectingSockets.keySet().iterator(); iterator.hasNext();) {
+ Socket socket = (Socket) iterator.next();
+ try {
+ Trace.trace(Activator.PLUGIN_ID, "Call socket.close() for socket=" + socket.toString()); //$NON-NLS-1$
+ socket.close();
+ } catch (IOException e) {
+ Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+
public void handleSocketEvent(ISocketEvent event) {
if (event instanceof ISocketCreatedEvent) {
connectingSockets.put(event.getFactorySocket(), event);
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientDefaultSSLSocketFactoryModifier.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientDefaultSSLSocketFactoryModifier.java
index cb59b4120..2e4753ef9 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientDefaultSSLSocketFactoryModifier.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientDefaultSSLSocketFactoryModifier.java
@@ -12,8 +12,6 @@
package org.eclipse.ecf.provider.filetransfer.httpclient4;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ISSLSocketFactoryModifier;
-
import java.io.IOException;
import java.net.Socket;
import javax.net.ssl.SSLContext;
@@ -21,6 +19,7 @@ import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import org.eclipse.ecf.core.util.StringUtils;
import org.eclipse.ecf.filetransfer.events.socketfactory.INonconnectedSocketFactory;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ISSLSocketFactoryModifier;
public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFactoryModifier, INonconnectedSocketFactory {
public static final String DEFAULT_SSL_PROTOCOL = "https.protocols"; //$NON-NLS-1$
@@ -33,7 +32,7 @@ public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFact
// empty
}
- public SSLSocketFactory getSSLSocketFactory() throws IOException {
+ public synchronized SSLSocketFactory getSSLSocketFactory() throws IOException {
if (null == sslContext) {
try {
sslContext = getSSLContext(defaultProtocolNames);
@@ -46,7 +45,7 @@ public class HttpClientDefaultSSLSocketFactoryModifier implements ISSLSocketFact
return (sslContext == null) ? (SSLSocketFactory) SSLSocketFactory.getDefault() : sslContext.getSocketFactory();
}
- public SSLContext getSSLContext(String protocols) {
+ public synchronized SSLContext getSSLContext(String protocols) {
SSLContext rtvContext = null;
if (protocols != null) {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientFileSystemBrowser.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientFileSystemBrowser.java
index 1a668b885..eb20d6c0c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientFileSystemBrowser.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientFileSystemBrowser.java
@@ -13,18 +13,10 @@
package org.eclipse.ecf.provider.filetransfer.httpclient4;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.Activator;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ConnectingSocketMonitor;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.DebugOptions;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.HttpClientProxyCredentialProvider;
-import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.Messages;
-
import java.io.IOException;
import java.net.HttpURLConnection;
-import java.net.Socket;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpHost;
@@ -57,6 +49,11 @@ import org.eclipse.ecf.filetransfer.IRemoteFile;
import org.eclipse.ecf.filetransfer.IRemoteFileSystemListener;
import org.eclipse.ecf.filetransfer.IRemoteFileSystemRequest;
import org.eclipse.ecf.filetransfer.identity.IFileID;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.Activator;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.ConnectingSocketMonitor;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.DebugOptions;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.HttpClientProxyCredentialProvider;
+import org.eclipse.ecf.internal.provider.filetransfer.httpclient4.Messages;
import org.eclipse.ecf.provider.filetransfer.browse.AbstractFileSystemBrowser;
import org.eclipse.ecf.provider.filetransfer.browse.URLRemoteFile;
import org.eclipse.ecf.provider.filetransfer.events.socket.SocketEventSource;
@@ -191,17 +188,10 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
}
}
if (connectingSockets != null) {
- // this should unblock socket connect calls, if any
- for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
- Socket socket = (Socket) iterator.next();
- try {
- socket.close();
- } catch (IOException e) {
- Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
- }
- }
+ // Change for preventing CME from bug
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ connectingSockets.closeSockets();
}
-
}
protected boolean hasForceNTLMProxyOption() {
@@ -249,8 +239,14 @@ public class HttpClientFileSystemBrowser extends AbstractFileSystemBrowser {
setupAuthentication(urlString);
headMethod = new HttpHead(urlString);
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- headMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ headMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ headMethod.addHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
long lastModified = 0;
long fileLength = -1;
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientRetrieveFileTransfer.java
index 0c14292ff..5759cf846 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.httpclient4/src/org/eclipse/ecf/provider/filetransfer/httpclient4/HttpClientRetrieveFileTransfer.java
@@ -18,7 +18,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.InetAddress;
-import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collections;
@@ -176,7 +175,7 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
registerSchemes(socketEventSource, connectingSockets);
}
- private void registerSchemes(ISocketEventSource source, ISocketListener socketListener) {
+ private synchronized void registerSchemes(ISocketEventSource source, ISocketListener socketListener) {
SchemeRegistry schemeRegistry = this.httpClient.getConnectionManager().getSchemeRegistry();
Scheme http = new Scheme(HttpClientRetrieveFileTransfer.HTTP, HTTP_PORT, new ECFHttpClientProtocolSocketFactory(SocketFactory.getDefault(), source, socketListener));
@@ -246,16 +245,8 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
}
}
if (connectingSockets != null) {
- // this should unblock socket connect calls, if any
- for (Iterator iterator = connectingSockets.getConnectingSockets().iterator(); iterator.hasNext();) {
- Socket socket = (Socket) iterator.next();
- try {
- Trace.trace(Activator.PLUGIN_ID, "Call socket.close() for socket=" + socket.toString()); //$NON-NLS-1$
- socket.close();
- } catch (IOException e) {
- Trace.catching(Activator.PLUGIN_ID, DebugOptions.EXCEPTIONS_CATCHING, this.getClass(), "cancel", e); //$NON-NLS-1$
- }
- }
+ // Added to prevent CME in bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=430704
+ connectingSockets.closeSockets();
}
hardClose();
if (fireDoneEvent) {
@@ -370,8 +361,14 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
Trace.trace(Activator.PLUGIN_ID, "retrieve range header=" + rangeHeader); //$NON-NLS-1$
setRangeHeader(rangeHeader);
}
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ getMethod.addHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
@@ -824,8 +821,14 @@ public class HttpClientRetrieveFileTransfer extends AbstractRetrieveFileTransfer
if (this.bytesReceived <= 0 || this.fileLength <= this.bytesReceived)
throw new IOException(Messages.HttpClientRetrieveFileTransfer_RESUME_START_ERROR);
setRangeHeader("bytes=" + this.bytesReceived + "-"); //$NON-NLS-1$ //$NON-NLS-2$
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0); //$NON-NLS-1$
// set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ getMethod.addHeader("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ getMethod.addHeader("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
index a94bbeaea..d1f06ee60 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer.scp;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.100.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.scp.Activator
Bundle-Vendor: %plugin.provider
Import-Package: com.jcraft.jsch,
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java
index 8449f005d..6f5f5d84c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpOutgoingFileTransfer.java
@@ -27,10 +27,14 @@ import org.eclipse.osgi.util.NLS;
/**
*
*/
-public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implements IScpFileTransfer {
+public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer
+ implements IScpFileTransfer {
- private static final String SCP_COMMAND = "scp -p -t "; //$NON-NLS-1$
- private static final String SCP_EXEC = "exec"; //$NON-NLS-1$
+ private static final String SCP_COMMAND = System
+ .getProperty(
+ "org.eclipse.ecf.filetransfer.scp.outgoing.scpcommand", "scp -p -t "); //$NON-NLS-1$; //$NON-NLS-1$
+ private static final String SCP_EXEC = System.getProperty(
+ "org.eclipse.ecf.filetransfer.scp.outgoing.scpcommand", "exec"); //$NON-NLS-1$
String username;
@@ -39,14 +43,19 @@ public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implem
private InputStream responseStream;
private ScpUtil scpUtil;
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#openStreams()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
+ * #openStreams()
*/
protected void openStreams() throws SendFileTransferException {
try {
final File localFile = getFileTransferInfo().getFile();
// Set input stream from local file
- setInputStream(new BufferedInputStream(new FileInputStream(localFile)));
+ setInputStream(new BufferedInputStream(new FileInputStream(
+ localFile)));
final URL url = getRemoteFileURL();
this.username = url.getUserInfo();
scpUtil = new ScpUtil(this);
@@ -63,7 +72,9 @@ public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implem
sendFileNameAndSize(localFile, targetFileName, outs, responseStream);
setOutputStream(outs);
} catch (final Exception e) {
- throw new SendFileTransferException(NLS.bind(Messages.ScpOutgoingFileTransfer_EXCEPTION_CONNECTING, getRemoteFileURL().toString()), e);
+ throw new SendFileTransferException(NLS.bind(
+ Messages.ScpOutgoingFileTransfer_EXCEPTION_CONNECTING,
+ getRemoteFileURL().toString()), e);
}
}
@@ -80,19 +91,25 @@ public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implem
return this.proxy;
}
- private void sendFileNameAndSize(File localFile, String fileName, OutputStream outs, InputStream ins) throws IOException {
+ private void sendFileNameAndSize(File localFile, String fileName,
+ OutputStream outs, InputStream ins) throws IOException {
// send "C0644 filesize filename", where filename should not include '/'
final long filesize = localFile.length();
String[] targetFile = StringUtils.split(fileName, '/');
final StringBuffer command = new StringBuffer("C0644 "); //$NON-NLS-1$
- command.append(filesize).append(" ").append(targetFile[targetFile.length - 1]).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ command.append(filesize)
+ .append(" ").append(targetFile[targetFile.length - 1]).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
outs.write(command.toString().getBytes());
outs.flush();
scpUtil.checkAck(ins);
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#hardClose()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
+ * #hardClose()
*/
protected void hardClose() {
try {
@@ -100,10 +117,6 @@ public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implem
scpUtil.sendZeroToStream(remoteFileContents);
scpUtil.checkAck(responseStream);
}
- if (remoteFileContents != null) {
- remoteFileContents.close();
- remoteFileContents = null;
- }
if (channel != null) {
channel.disconnect();
channel = null;
@@ -119,29 +132,42 @@ public class ScpOutgoingFileTransfer extends AbstractOutgoingFileTransfer implem
super.hardClose();
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
+ * #setupProxy(org.eclipse.ecf.core.util.Proxy)
*/
protected void setupProxy(Proxy proxy) {
this.proxy = proxy;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
*/
public String getUsername() {
return username;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.internal.provider.filetransfer.scp.IScpFileTransfer#getConnectContext()
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.internal.provider.filetransfer.scp.IScpFileTransfer#
+ * getConnectContext()
*/
public IConnectContext getConnectContext() {
return connectContext;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.internal.provider.filetransfer.scp.IScpFileTransfer#setUsername(java.lang.String)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ecf.internal.provider.filetransfer.scp.IScpFileTransfer#
+ * setUsername(java.lang.String)
*/
public void setUsername(String username) {
this.username = username;
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java
index 81d0e0e86..a40cec28b 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpRetrieveFileTransfer.java
@@ -26,10 +26,13 @@ import org.eclipse.osgi.util.NLS;
/**
*
*/
-public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implements IScpFileTransfer {
+public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer
+ implements IScpFileTransfer {
- private static final String SCP_COMMAND = "scp -f "; //$NON-NLS-1$
- private static final String SCP_EXEC = "exec"; //$NON-NLS-1$
+ private static final String SCP_COMMAND = System.getProperty(
+ "org.eclipse.ecf.filetransfer.scp.retrieve.scpcommand", "scp -f "); //$NON-NLS-1$
+ private static final String SCP_EXEC = System.getProperty(
+ "org.eclipse.ecf.filetransfer.scp.retrieve.scpcommand", "exec"); //$NON-NLS-1$
String username;
@@ -39,15 +42,23 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
private ScpUtil scpUtil;
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doPause()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
+ * #doPause()
*/
protected boolean doPause() {
return false;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#doResume()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
+ * #doResume()
*/
protected boolean doResume() {
return false;
@@ -61,8 +72,12 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
return options;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#openStreams()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
+ * #openStreams()
*/
protected void openStreams() throws IncomingFileTransferException {
try {
@@ -74,7 +89,8 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
final Session s = scpUtil.getSession();
s.connect();
- final String command = SCP_COMMAND + scpUtil.trimTargetFile(url.getPath());
+ final String command = SCP_COMMAND
+ + scpUtil.trimTargetFile(url.getPath());
channel = s.openChannel(SCP_EXEC);
((ChannelExec) channel).setCommand(command);
channel.connect();
@@ -82,10 +98,11 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
final InputStream ins = channel.getInputStream();
responseStream = channel.getOutputStream();
scpUtil.sendZeroToStream(responseStream);
- // read and set filesize
- final int c = ins.read();
+
+ final int c = checkAck(ins);
if (c != 'C')
- throw new IOException(Messages.ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL);
+ throw new IOException(
+ Messages.ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL);
// read '0644 '
final byte[] buf = new byte[1024];
ins.read(buf, 0, 5);
@@ -93,22 +110,58 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
setFileLength(readFileSize(ins, buf));
readFileName(ins, buf);
// set input stream for reading rest of file
- setInputStream(ins);
+ remoteFileContents = ins;
+
scpUtil.sendZeroToStream(responseStream);
fireReceiveStartEvent();
} catch (final Exception e) {
channel = null;
username = null;
- throw new IncomingFileTransferException(NLS.bind(Messages.ScpRetrieveFileTransfer_EXCEPTION_CONNECTING, getRemoteFileURL().toString()), e);
+ throw new IncomingFileTransferException(NLS.bind(
+ Messages.ScpRetrieveFileTransfer_EXCEPTION_CONNECTING,
+ getRemoteFileURL().toString()), e);
}
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#handleReceivedData(byte[], int, double, org.eclipse.core.runtime.IProgressMonitor)
+ static int checkAck(InputStream in) throws IOException {
+ int b = in.read();
+ // b may be 0 for success,
+ // 1 for error,
+ // 2 for fatal error,
+ // -1
+ if (b == 0)
+ return b;
+ if (b == -1)
+ return b;
+
+ if (b == 1 || b == 2) {
+ StringBuffer sb = new StringBuffer();
+ int c;
+ do {
+ c = in.read();
+ sb.append((char) c);
+ } while (c != '\n');
+ if (b == 1 || b == 2) { // error
+ throw new IOException(
+ Messages.ScpRetrieveFileTransfer_EXCEPTION_SCP_PROTOCOL
+ + ": " + sb.toString());
+ }
+ }
+ return b;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
+ * #handleReceivedData(byte[], int, double,
+ * org.eclipse.core.runtime.IProgressMonitor)
*/
- protected void handleReceivedData(byte[] buf, int bytes, double factor, IProgressMonitor monitor) throws IOException {
+ protected void handleReceivedData(byte[] buf, int bytes, double factor,
+ IProgressMonitor monitor) throws IOException {
if (bytes == -1) {
done = true;
} else {
@@ -131,7 +184,8 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
long filesize = 0L;
while (true) {
if (ins.read(buf, 0, 1) < 0) {
- throw new IOException(Messages.ScpRetrieveFileTransfer_EXCEPTION_ERROR_READING_FILE);
+ throw new IOException(
+ Messages.ScpRetrieveFileTransfer_EXCEPTION_ERROR_READING_FILE);
}
if (buf[0] == ' ')
break;
@@ -152,8 +206,12 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
return file;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer#hardClose()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.outgoing.AbstractOutgoingFileTransfer
+ * #hardClose()
*/
protected void hardClose() {
try {
@@ -177,7 +235,9 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
/*
* (non-Javadoc)
*
- * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#getAdapter(java.lang.Class)
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
+ * #getAdapter(java.lang.Class)
*/
public Object getAdapter(Class adapter) {
if (adapter == null)
@@ -187,22 +247,33 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
return super.getAdapter(adapter);
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer#setupProxy(org.eclipse.ecf.core.util.Proxy)
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.retrieve.AbstractRetrieveFileTransfer
+ * #setupProxy(org.eclipse.ecf.core.util.Proxy)
*/
protected void setupProxy(Proxy proxy) {
this.proxy = proxy;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getConnectContext()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getConnectContext
+ * ()
*/
public IConnectContext getConnectContext() {
return connectContext;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#getUsername()
*/
public String getUsername() {
return username;
@@ -212,12 +283,16 @@ public class ScpRetrieveFileTransfer extends AbstractRetrieveFileTransfer implem
this.username = username;
}
- /* (non-Javadoc)
- * @see org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#promptPassphrase()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ecf.provider.filetransfer.scp.IScpFileTransfer#promptPassphrase
+ * ()
*/
public boolean promptPassphrase() {
// XXX TODO
- //return (keyFile != null);
+ // return (keyFile != null);
return false;
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java
index 54620e137..d7c9ee90d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer.scp/src/org/eclipse/ecf/internal/provider/filetransfer/scp/ScpUtil.java
@@ -26,11 +26,18 @@ import org.eclipse.osgi.util.NLS;
*/
public class ScpUtil implements UserInfo, UIKeyboardInteractive {
- public static final String SCP_SSHHOMEDIRECTORY = "sshHomeDirectory"; //$NON-NLS-1$
- public static final String SCP_PUBLICKEYFILE = "keyFile"; //$NON-NLS-1$
- public static final String SCP_KNOWNHOSTSFILE = "knownHostsFile"; //$NON-NLS-1$
+ public static final String SCP_SSHHOMEDIRECTORY = System
+ .getProperty(
+ "org.eclipse.ecf.filetransfer.scp.util.sshHomeDirectory", "sshHomeDirectory"); //$NON-NLS-1$
+ public static final String SCP_PUBLICKEYFILE = System.getProperty(
+ "org.eclipse.ecf.filetransfer.scp.util.keyFile", "keyFile"); //$NON-NLS-1$
+ public static final String SCP_KNOWNHOSTSFILE = System
+ .getProperty(
+ "org.eclipse.ecf.filetransfer.scp.util.knownHostsFile", "knownHostsFile"); //$NON-NLS-1$
- public static final int DEFAULT_SCP_PORT = 22;
+ public static final int DEFAULT_SCP_PORT = Integer
+ .parseInt(System.getProperty(
+ "org.eclipse.ecf.filetransfer.scp.util.scpPort", "22"));
private IScpFileTransfer handler;
private String password;
@@ -41,7 +48,8 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
private String keyFile = null;
private String knownHostsFile = null;
- public ScpUtil(IScpFileTransfer handler) throws JSchException, IOException, UnsupportedCallbackException {
+ public ScpUtil(IScpFileTransfer handler) throws JSchException, IOException,
+ UnsupportedCallbackException {
this.handler = handler;
final JSch jsch = new JSch();
final URL url = handler.getTargetURL();
@@ -65,15 +73,18 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
void promptUsername() throws IOException, UnsupportedCallbackException {
final IConnectContext connectContext = handler.getConnectContext();
if (connectContext != null) {
- final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
+ final CallbackHandler callbackHandler = connectContext
+ .getCallbackHandler();
if (handler != null) {
final Callback[] callbacks = new Callback[2];
- final NameCallback nc = new NameCallback(Messages.ScpOutgoingFileTransfer_USERNAME_PROMPT);
+ final NameCallback nc = new NameCallback(
+ Messages.ScpOutgoingFileTransfer_USERNAME_PROMPT);
String user = handler.getUsername();
if (user != null)
nc.setName(user);
callbacks[0] = nc;
- callbacks[1] = new PasswordCallback(Messages.ScpOutgoingFileTransfer_PASSWORD_PROMPT);
+ callbacks[1] = new PasswordCallback(
+ Messages.ScpOutgoingFileTransfer_PASSWORD_PROMPT);
callbackHandler.handle(callbacks);
handler.setUsername(nc.getName());
}
@@ -84,24 +95,30 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
try {
final IConnectContext connectContext = handler.getConnectContext();
if (connectContext != null) {
- final CallbackHandler callbackHandler = connectContext.getCallbackHandler();
+ final CallbackHandler callbackHandler = connectContext
+ .getCallbackHandler();
if (handler != null) {
final Callback[] callbacks = new Callback[2];
- final NameCallback nc = new NameCallback(Messages.ScpOutgoingFileTransfer_USERNAME_PROMPT);
+ final NameCallback nc = new NameCallback(
+ Messages.ScpOutgoingFileTransfer_USERNAME_PROMPT);
String user = handler.getUsername();
if (user != null)
nc.setName(user);
callbacks[0] = nc;
if (usePassphrase) {
- callbacks[1] = new PassphraseCallback(Messages.ScpOutgoingFileTransfer_PASSPHRASE_PROMPT);
+ callbacks[1] = new PassphraseCallback(
+ Messages.ScpOutgoingFileTransfer_PASSPHRASE_PROMPT);
} else
- callbacks[1] = new PasswordCallback(Messages.ScpOutgoingFileTransfer_PASSWORD_PROMPT);
+ callbacks[1] = new PasswordCallback(
+ Messages.ScpOutgoingFileTransfer_PASSWORD_PROMPT);
callbackHandler.handle(callbacks);
handler.setUsername(nc.getName());
if (usePassphrase) {
- passphrase = ((PassphraseCallback) callbacks[1]).getPassphrase();
+ passphrase = ((PassphraseCallback) callbacks[1])
+ .getPassphrase();
} else
- password = ((PasswordCallback) callbacks[1]).getPassword();
+ password = ((PasswordCallback) callbacks[1])
+ .getPassword();
}
}
return (usePassphrase) ? this.passphrase : this.password;
@@ -110,54 +127,72 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#getPassphrase()
*/
public String getPassphrase() {
return promptCredentials(true);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#getPassword()
*/
public String getPassword() {
return promptCredentials(false);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#promptPassphrase(java.lang.String)
*/
public boolean promptPassphrase(String message) {
return (keyFile != null);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#promptPassword(java.lang.String)
*/
public boolean promptPassword(String message) {
return true;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#promptYesNo(java.lang.String)
*/
public boolean promptYesNo(String message) {
return true;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see com.jcraft.jsch.UserInfo#showMessage(java.lang.String)
*/
public void showMessage(String message) {
// do nothing
}
- /* (non-Javadoc)
- * @see com.jcraft.jsch.UIKeyboardInteractive#promptKeyboardInteractive(java.lang.String, java.lang.String, java.lang.String, java.lang.String[], boolean[])
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.jcraft.jsch.UIKeyboardInteractive#promptKeyboardInteractive(java.
+ * lang.String, java.lang.String, java.lang.String, java.lang.String[],
+ * boolean[])
*/
- public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) {
+ public String[] promptKeyboardInteractive(String destination, String name,
+ String instruction, String[] prompt, boolean[] echo) {
promptCredentials(false);
- return new String[] {password};
+ return new String[] { password };
}
/**
@@ -217,7 +252,14 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
try {
jsch.addIdentity(keyFile);
} catch (final JSchException e) {
- Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_SSH_IDENTITY, e));
+ Activator
+ .getDefault()
+ .log(new Status(
+ IStatus.ERROR,
+ Activator.PLUGIN_ID,
+ IStatus.ERROR,
+ Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_SSH_IDENTITY,
+ e));
}
}
knownHostsFile = getProperty(SCP_KNOWNHOSTSFILE);
@@ -236,7 +278,14 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
try {
jsch.setKnownHosts(knownHostsFile);
} catch (final JSchException e) {
- Activator.getDefault().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR, Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_KNOWN_HOSTS, e));
+ Activator
+ .getDefault()
+ .log(new Status(
+ IStatus.ERROR,
+ Activator.PLUGIN_ID,
+ IStatus.ERROR,
+ Messages.ScpOutgoingFileTransfer_EXCEPTION_SETTING_KNOWN_HOSTS,
+ e));
}
}
}
@@ -256,8 +305,6 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
}
String trimTargetFile(String string) {
- if (string.charAt(0) == '/')
- return string.substring(1);
return string;
}
@@ -279,10 +326,12 @@ public class ScpUtil implements UserInfo, UIKeyboardInteractive {
sb.append((char) c);
} while (c != '\n');
if (b == 1) { // error
- throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR, sb.toString()));
+ throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR,
+ sb.toString()));
}
if (b == 2) { // fatal error
- throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR, sb.toString()));
+ throw new IOException(NLS.bind(Messages.ScpUtil_SCP_ERROR,
+ sb.toString()));
}
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF
index 674f8f6d3..4c3787243 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.filetransfer;singleton:=true
-Bundle-Version: 3.2.100.qualifier
+Bundle-Version: 3.2.200.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.filetransfer.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
index 3b3edb2bb..66e2d6519 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/identity/FileTransferID.java
@@ -77,8 +77,8 @@ public class FileTransferID extends BaseID implements IFileID {
}
protected String getFileNameOnly() {
- final String path = this.fileURL.getPath();
- return path.substring(path.lastIndexOf("/") + 1); //$NON-NLS-1$;
+ String path = (fileURI != null) ? fileURI.getPath() : fileURL.getPath();
+ return (path == null) ? null : path.substring(path.lastIndexOf("/") + 1); //$NON-NLS-1$;
}
public String toString() {
diff --git a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java
index 72e8e1019..d8d847312 100644
--- a/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.filetransfer/src/org/eclipse/ecf/provider/filetransfer/retrieve/UrlConnectionRetrieveFileTransfer.java
@@ -114,9 +114,14 @@ public class UrlConnectionRetrieveFileTransfer extends AbstractRetrieveFileTrans
if (this.bytesReceived <= 0 || this.fileLength <= this.bytesReceived)
throw new IOException(Messages.UrlConnectionRetrieveFileTransfer_RESUME_START_ERROR);
setRangeHeader("bytes=" + this.bytesReceived + "-"); //$NON-NLS-1$ //$NON-NLS-2$
- // set max-age for cache control to 0 for bug
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- urlConnection.setRequestProperty("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
+ // set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ urlConnection.setRequestProperty("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ urlConnection.setRequestProperty("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
@@ -154,9 +159,14 @@ public class UrlConnectionRetrieveFileTransfer extends AbstractRetrieveFileTrans
// also see http 1.1 rfc section 14-10 in
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
urlConnection.setRequestProperty("Connection", "close"); //$NON-NLS-1$ //$NON-NLS-2$
- // set max-age for cache control to 0 for bug
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
- urlConnection.setRequestProperty("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ int maxAge = Integer.getInteger("org.eclipse.ecf.http.cache.max-age", 0).intValue(); //$NON-NLS-1$
+ // set max-age for cache control to 0 for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249990
+ // fix the fix for bug 249990 with bug 410813
+ if (maxAge == 0) {
+ urlConnection.setRequestProperty("Cache-Control", "max-age=0"); //$NON-NLS-1$//$NON-NLS-2$
+ } else if (maxAge > 0) {
+ urlConnection.setRequestProperty("Cache-Control", "max-age=" + maxAge); //$NON-NLS-1$//$NON-NLS-2$
+ }
setRequestHeaderValuesFromOptions();
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.irc/META-INF/MANIFEST.MF
index 2114e9755..ba3556cf0 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.irc/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.irc; singleton:=true
-Bundle-Version: 1.3.100.qualifier
+Bundle-Version: 1.3.200.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.irc.Activator
Bundle-Vendor: %plugin.provider
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.irc/src/org/eclipse/ecf/internal/provider/irc/container/IRCRootContainer.java b/providers/bundles/org.eclipse.ecf.provider.irc/src/org/eclipse/ecf/internal/provider/irc/container/IRCRootContainer.java
index 6b741e86d..d99aa45be 100644
--- a/providers/bundles/org.eclipse.ecf.provider.irc/src/org/eclipse/ecf/internal/provider/irc/container/IRCRootContainer.java
+++ b/providers/bundles/org.eclipse.ecf.provider.irc/src/org/eclipse/ecf/internal/provider/irc/container/IRCRootContainer.java
@@ -242,6 +242,8 @@ public class IRCRootContainer extends IRCAbstractContainer implements
public void onDisconnected() {
trace("handleOnDisconnected()"); //$NON-NLS-1$
+ fireContainerEvent(new ContainerDisconnectingEvent(getID(),
+ targetID));
synchronized (connectLock) {
if (connectWaiting) {
if (connectException == null)
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.jmdns/META-INF/MANIFEST.MF
index a19bc770f..9e1d8fd86 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.jmdns;singleton:=true
-Bundle-Version: 4.1.0.qualifier
+Bundle-Version: 4.3.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.jmdns.JMDNSPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.properties
index ebfe16aad..e555365a1 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-pluginName = ECF Zeroconf/JMDNS Discovery Provider
+pluginName = ECF Discovery Zeroconf/JMDNS Provider
providerName = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java
index 620ccbd69..0a1b56a84 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/internal/provider/jmdns/JMDNSPlugin.java
@@ -12,14 +12,17 @@ package org.eclipse.ecf.internal.provider.jmdns;
import java.util.Properties;
import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.IContainer;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.*;
import org.eclipse.ecf.core.identity.IDCreateException;
+import org.eclipse.ecf.core.identity.Namespace;
import org.eclipse.ecf.core.util.*;
import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IDiscoveryLocator;
import org.eclipse.ecf.discovery.service.IDiscoveryService;
+import org.eclipse.ecf.provider.jmdns.container.ContainerInstantiator;
import org.eclipse.ecf.provider.jmdns.container.JMDNSDiscoveryContainer;
+import org.eclipse.ecf.provider.jmdns.identity.JMDNSNamespace;
import org.osgi.framework.*;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
@@ -45,7 +48,7 @@ public class JMDNSPlugin implements BundleActivator {
plugin = this;
}
- private ServiceTracker adapterManagerTracker = null;
+ private AdapterManagerTracker adapterManagerTracker = null;
private ServiceRegistration serviceRegistration;
@@ -56,15 +59,10 @@ public class JMDNSPlugin implements BundleActivator {
public IAdapterManager getAdapterManager() {
// First, try to get the adapter manager via
if (adapterManagerTracker == null) {
- adapterManagerTracker = new ServiceTracker(this.context, IAdapterManager.class.getName(), null);
+ adapterManagerTracker = new AdapterManagerTracker(this.context);
adapterManagerTracker.open();
}
- IAdapterManager adapterManager = (IAdapterManager) adapterManagerTracker.getService();
- // Then, if the service isn't there, try to get from Platform class via
- // PlatformHelper class
- if (adapterManager == null)
- adapterManager = PlatformHelper.getPlatformAdapterManager();
- return adapterManager;
+ return adapterManagerTracker.getAdapterManager();
}
/**
@@ -78,6 +76,14 @@ public class JMDNSPlugin implements BundleActivator {
props.put(Constants.SERVICE_RANKING, new Integer(750));
String[] clazzes = new String[] {IDiscoveryService.class.getName(), IDiscoveryLocator.class.getName(), IDiscoveryAdvertiser.class.getName()};
serviceRegistration = context.registerService(clazzes, serviceFactory, props);
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithoutRegistry() throws Exception {
+ ctxt.registerService(Namespace.class, new JMDNSNamespace("JMDNS Discovery Namespace"), null);
+ ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_CONTAINER_NAME, new ContainerInstantiator(), "JMDNS Discovery Container", true, false), null);
+ ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_LOCATOR_NAME, new ContainerInstantiator(), "JMDNS Discovery Locator"), null);
+ ctxt.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(ContainerInstantiator.JMDNS_ADVERTISER_NAME, new ContainerInstantiator(), "JMDNS Discovery Advertiser"), null);
+ }
+ });
}
private final DiscoveryServiceFactory serviceFactory = new DiscoveryServiceFactory();
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/ContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/ContainerInstantiator.java
index 6fc8b3ce3..1fb03aa82 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/ContainerInstantiator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/container/ContainerInstantiator.java
@@ -17,13 +17,25 @@ import org.eclipse.ecf.discovery.IDiscoveryContainerAdapter;
public class ContainerInstantiator implements IContainerInstantiator {
+ /**
+ * @since 4.3
+ */
+ public static final String JMDNS_CONTAINER_NAME = "ecf.container.jmdns";
+ /**
+ * @since 4.3
+ */
+ public static final String JMDNS_LOCATOR_NAME = "ecf.container.jmdns.locator";
+ /**
+ * @since 4.3
+ */
+ public static final String JMDNS_ADVERTISER_NAME = "ecf.container.jmdns.advertiser";
+
/* (non-Javadoc)
* @see org.eclipse.ecf.core.provider.IContainerInstantiator#createInstance(org.eclipse.ecf.core.ContainerTypeDescription, java.lang.Object[])
*/
public IContainer createInstance(final ContainerTypeDescription description, final Object[] args) throws ContainerCreateException {
try {
- final AbstractContainer container = new JMDNSDiscoveryContainer();
- return container;
+ return new JMDNSDiscoveryContainer();
} catch (final IDCreateException e) {
final ContainerCreateException excep = new ContainerCreateException("Jmdns container create failed", e); //$NON-NLS-1$
excep.setStackTrace(e.getStackTrace());
diff --git a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/identity/JMDNSNamespace.java b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/identity/JMDNSNamespace.java
index 5c2691495..ac6a046fa 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/identity/JMDNSNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jmdns/src/org/eclipse/ecf/provider/jmdns/identity/JMDNSNamespace.java
@@ -23,6 +23,17 @@ public class JMDNSNamespace extends Namespace {
public static final String NAME = "ecf.namespace.jmdns"; //$NON-NLS-1$
+ public JMDNSNamespace() {
+ super();
+ }
+
+ /**
+ * @since 4.3
+ */
+ public JMDNSNamespace(String description) {
+ super(NAME, description);
+ }
+
private String getInitFromExternalForm(final Object[] args) {
if (args == null || args.length < 1 || args[0] == null)
return null;
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
index bc7586be5..f8b5eb56a 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.jslp;singleton:=true
-Bundle-Version: 3.0.100.qualifier
+Bundle-Version: 3.2.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.jslp.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
index 3a09c540b..49917c798 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/internal/provider/jslp/Activator.java
@@ -13,13 +13,17 @@ package org.eclipse.ecf.internal.provider.jslp;
import ch.ethz.iks.slp.Advertiser;
import ch.ethz.iks.slp.Locator;
import java.util.Properties;
-import org.eclipse.ecf.core.ContainerConnectException;
-import org.eclipse.ecf.core.IContainer;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.*;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.core.util.Trace;
import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IDiscoveryLocator;
import org.eclipse.ecf.discovery.service.IDiscoveryService;
+import org.eclipse.ecf.provider.jslp.container.ContainerInstantiator;
import org.eclipse.ecf.provider.jslp.container.JSLPDiscoveryContainer;
+import org.eclipse.ecf.provider.jslp.identity.JSLPNamespace;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -82,6 +86,15 @@ public class Activator implements BundleActivator {
public void start(final BundleContext context) throws Exception {
bundleContext = context;
+ SafeRunner.run(new ExtensionRegistryRunnable(context) {
+ protected void runWithoutRegistry() throws Exception {
+ context.registerService(Namespace.class, new JSLPNamespace(), null);
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp", new ContainerInstantiator(), "JSLP Discovery Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.locator", new ContainerInstantiator(), "JSLP Discovery Locator Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.discovery.jslp.advertiser", new ContainerInstantiator(), "JSLP Discovery Advertiser Container", true, false), null); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ });
+
// initially get the locator and add a life cycle listener
locatorSt = new ServiceTracker(context, Locator.class.getName(), null);
diff --git a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/provider/jslp/identity/JSLPNamespace.java b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/provider/jslp/identity/JSLPNamespace.java
index e0d45cc7e..505831d92 100644
--- a/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/provider/jslp/identity/JSLPNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.jslp/src/org/eclipse/ecf/provider/jslp/identity/JSLPNamespace.java
@@ -23,6 +23,10 @@ public class JSLPNamespace extends Namespace {
public static final String NAME = "ecf.namespace.slp"; //$NON-NLS-1$
+ public JSLPNamespace() {
+ super(NAME, "JSLP Namespace"); //$NON-NLS-1$
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ecf.core.identity.Namespace#createInstance(java.lang.Object[])
*/
diff --git a/providers/bundles/org.eclipse.ecf.provider.local/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.local/META-INF/MANIFEST.MF
index a0ee97a75..7aaddeb01 100644
--- a/providers/bundles/org.eclipse.ecf.provider.local/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.local/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ECF Local Remote Service Provider
Bundle-SymbolicName: org.eclipse.ecf.provider.local;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 1.3.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.local.Activator
Bundle-Vendor: Eclipse.org - ECF
Bundle-RequiredExecutionEnvironment: CDC-1.1/Foundation-1.1,
@@ -23,4 +23,4 @@ Bundle-Localization: bundle
Export-Package: org.eclipse.ecf.internal.provider.local;x-internal:=true,
org.eclipse.ecf.internal.provider.local.container;x-internal:=true,
org.eclipse.ecf.provider.local.identity;version="1.1.0"
-Require-Bundle: org.eclipse.equinox.common;bundle-version="3.6.0"
+Require-Bundle: org.eclipse.equinox.common
diff --git a/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/internal/provider/local/Activator.java b/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/internal/provider/local/Activator.java
index 5add95bcd..40c0f7b8b 100644
--- a/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/internal/provider/local/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/internal/provider/local/Activator.java
@@ -1,5 +1,11 @@
package org.eclipse.ecf.internal.provider.local;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
+import org.eclipse.ecf.internal.provider.local.container.LocalRemoteServiceContainerInstantiator;
+import org.eclipse.ecf.provider.local.identity.LocalNamespace;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -15,8 +21,15 @@ public class Activator implements BundleActivator {
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
- public void start(BundleContext bundleContext) throws Exception {
+ public void start(final BundleContext bundleContext) throws Exception {
Activator.context = bundleContext;
+
+ SafeRunner.run(new ExtensionRegistryRunnable(bundleContext) {
+ protected void runWithoutRegistry() throws Exception {
+ bundleContext.registerService(Namespace.class, new LocalNamespace(), null);
+ bundleContext.registerService(ContainerTypeDescription.class, new ContainerTypeDescription("ecf.local", new LocalRemoteServiceContainerInstantiator(), "Local Container Instantiator", false, false), null); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ });
}
/*
diff --git a/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/provider/local/identity/LocalNamespace.java b/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/provider/local/identity/LocalNamespace.java
index cc4cdfa48..58355279c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/provider/local/identity/LocalNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.local/src/org/eclipse/ecf/provider/local/identity/LocalNamespace.java
@@ -19,6 +19,10 @@ public class LocalNamespace extends Namespace {
public static final String NAME = "ecf.namespace.local"; //$NON-NLS-1$
public static final String SCHEME = "local"; //$NON-NLS-1$
+ public LocalNamespace() {
+ super(NAME, "Local Namespace"); //$NON-NLS-1$
+ }
+
public ID createInstance(Object[] parameters) throws IDCreateException {
try {
final String init = getInitStringFromExternalForm(parameters);
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
index f2dca6cb8..322738f0d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/META-INF/MANIFEST.MF
@@ -2,8 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: org.eclipse.ecf.provider.r_osgi;singleton:=true
-Bundle-Version: 3.2.100.qualifier
+Bundle-Version: 3.4.0.qualifier
Import-Package: org.eclipse.ecf.core.util.reflection,
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.equinox.concurrent.future;version="1.0.0",
org.osgi.framework;version="1.3.0",
org.osgi.util.tracker;version="1.3.3"
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.r_osgi/plugin.properties
index 3cefe1983..f93beaab3 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/plugin.properties
@@ -9,5 +9,5 @@
# Jan S. Rellermeyer - initial API and implementation
############################################################################
-plugin.name=ECF R-OSGi Remoteservice Provider
+plugin.name=ECF RemoteServices r-OSGi Provider
plugin.provider=Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
index e5d33c2bb..216b2fcad 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/Activator.java
@@ -12,6 +12,12 @@
package org.eclipse.ecf.internal.provider.r_osgi;
import ch.ethz.iks.r_osgi.RemoteOSGiService;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
+import org.eclipse.ecf.provider.r_osgi.identity.R_OSGiNamespace;
+import org.eclipse.ecf.provider.r_osgi.identity.R_OSGiRemoteServiceNamespace;
import org.eclipse.equinox.concurrent.future.IExecutor;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -64,6 +70,13 @@ public final class Activator implements BundleActivator {
this.context = bc;
r_osgi_tracker = new ServiceTracker(context, RemoteOSGiService.class.getName(), null);
r_osgi_tracker.open();
+ SafeRunner.run(new ExtensionRegistryRunnable(bc) {
+ protected void runWithoutRegistry() throws Exception {
+ bc.registerService(Namespace.class, new R_OSGiNamespace(), null);
+ bc.registerService(Namespace.class, new R_OSGiRemoteServiceNamespace(), null);
+ bc.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(R_OSGiContainerInstantiator.NAME, new R_OSGiContainerInstantiator(), "R_OSGi Container", true, false), null); //$NON-NLS-1$
+ }
+ });
}
/**
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
index db3bd9eaa..4e88fd40f 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/internal/provider/r_osgi/R_OSGiContainerInstantiator.java
@@ -104,6 +104,7 @@ public final class R_OSGiContainerInstantiator implements IContainerInstantiator
}
private static final String ROSGI_CONFIG = "ecf.r_osgi.peer"; //$NON-NLS-1$
+ public static final String NAME = ROSGI_CONFIG;
private static final String[] ROSGI_CONFIGS = new String[] {ROSGI_CONFIG};
diff --git a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiRemoteServiceNamespace.java b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiRemoteServiceNamespace.java
index ac1ff8569..db8983bec 100644
--- a/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiRemoteServiceNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.r_osgi/src/org/eclipse/ecf/provider/r_osgi/identity/R_OSGiRemoteServiceNamespace.java
@@ -23,6 +23,10 @@ public class R_OSGiRemoteServiceNamespace extends Namespace {
public static final String NAME = "ecf.namespace.r_osgi.remoteservice"; //$NON-NLS-1$
+ public R_OSGiRemoteServiceNamespace() {
+ super(NAME, "R_OSGi Remote Service Namespace"); //$NON-NLS-1$
+ }
+
public ID createInstance(Object[] parameters) throws IDCreateException {
if (parameters == null || parameters.length != 2)
throw new IDCreateException("Parameters incorrect for remote ID creation"); //$NON-NLS-1$
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..5f462461f
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+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",
+ 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/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..a8e6731fb
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/plugin.xml
@@ -0,0 +1,75 @@
+<?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.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8SSLGenericContainerInstantiator"
+ description="ECF Java8 Generic SSL Server"
+ hidden="false"
+ name="ecf.generic.ssl.server.java8"
+ server="true">
+ </containerFactory>
+ </extension>
+ <extension
+ point="org.eclipse.ecf.containerFactory">
+ <containerFactory
+ class="org.eclipse.ecf.provider.internal.remoteservice.java8.J8SSLGenericContainerInstantiator"
+ description="ECF Java8 Generic SSL Client"
+ hidden="true"
+ name="ecf.generic.ssl.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>
+ <extension
+ point="org.eclipse.core.runtime.adapters">
+ <factory
+ adaptableType="org.eclipse.ecf.provider.internal.remoteservice.java8.J8SSLClientSOContainer"
+ 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.J8SSLServerSOContainer"
+ 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/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..4791bf408
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/Activator.java
@@ -0,0 +1,67 @@
+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.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 Java8 Generic Server", true, false), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8GenericContainerInstantiator.JAVA8_CLIENT_NAME, new J8GenericContainerInstantiator(), "ECF Java8 Generic Client", false, false), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_CLIENT_NAME, new J8SSLGenericContainerInstantiator(), "ECF Java8 SSL Generic Client", false, false), null); //$NON-NLS-1$
+ context.registerService(ContainerTypeDescription.class, new ContainerTypeDescription(J8SSLGenericContainerInstantiator.JAVA8_SSL_SERVER_NAME, new J8SSLGenericContainerInstantiator(), "ECF Java8 SSL Generic Server", true, false), 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 J8RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8TCPServerSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new J8RemoteServiceContainerAdapterFactory();
+ am.registerAdapters(af, J8SSLClientSOContainer.class);
+ rscAdapterFactories.add(af);
+ af = new J8RemoteServiceContainerAdapterFactory();
+ 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);
+ }
+ }
+ }
+
+}
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..c5644795a
--- /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(JAVA8_CLIENT_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..c591adee3
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8RemoteServiceContainerAdapterFactory.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * 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.identity.ID;
+import org.eclipse.ecf.core.sharedobject.ISharedObject;
+import org.eclipse.ecf.core.sharedobject.ISharedObjectContainer;
+import org.eclipse.ecf.provider.remoteservice.generic.RegistrySharedObject;
+import org.eclipse.ecf.provider.remoteservice.generic.RemoteServiceContainerAdapterFactory;
+import org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter;
+
+public class J8RemoteServiceContainerAdapterFactory extends RemoteServiceContainerAdapterFactory {
+
+ protected ISharedObject createAdapter(ISharedObjectContainer container, @SuppressWarnings("rawtypes") Class adapterType, ID adapterID) {
+ if (adapterType.equals(IRemoteServiceContainerAdapter.class)) {
+ return new RegistrySharedObject() {
+ };
+ }
+ return null;
+ }
+}
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLClientSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLClientSOContainer.java
new file mode 100644
index 000000000..fe82ee5a6
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLClientSOContainer.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.SSLClientSOContainer;
+
+public class J8SSLClientSOContainer extends SSLClientSOContainer {
+
+ public J8SSLClientSOContainer(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/J8SSLGenericContainerInstantiator.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLGenericContainerInstantiator.java
new file mode 100644
index 000000000..da2e1898f
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLGenericContainerInstantiator.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.SOContainerConfig;
+import org.eclipse.ecf.provider.generic.SSLGenericContainerInstantiator;
+
+public class J8SSLGenericContainerInstantiator extends
+ SSLGenericContainerInstantiator {
+
+ public static final String JAVA8_SSL_CLIENT_NAME = "ecf.generic.ssl.client.java8";
+ public static final String JAVA8_SSL_SERVER_NAME = "ecf.generic.ssl.server.java8";
+
+ @Override
+ protected boolean isClient(ContainerTypeDescription description) {
+ if (description.getName().equals(JAVA8_SSL_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_SSL_SERVER_NAME.equals(description.getName())) {
+ if (supportedConfigs.contains(JAVA8_SSL_CLIENT_NAME))
+ results.add(JAVA8_SSL_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_SSL_CLIENT_NAME.equals(description.getName())) {
+ if (supportedConfigs.contains(JAVA8_SSL_SERVER_NAME) || supportedConfigs.contains(JAVA8_SSL_CLIENT_NAME))
+ results.add(JAVA8_SSL_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/J8SSLServerSOContainer.java b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLServerSOContainer.java
new file mode 100644
index 000000000..e3356c6ef
--- /dev/null
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice.java8/src/org/eclipse/ecf/provider/internal/remoteservice/java8/J8SSLServerSOContainer.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.SSLServerSOContainer;
+
+public class J8SSLServerSOContainer extends SSLServerSOContainer {
+
+ public J8SSLServerSOContainer(ISharedObjectContainerConfig config,
+ InetAddress bindAddress, int keepAlive) throws IOException,
+ URISyntaxException {
+ super(config, bindAddress, keepAlive);
+ }
+} \ 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/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
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 a278031c5..ddeeacb5e 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
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.remoteservice;singleton:=true
-Bundle-Version: 4.0.100.qualifier
+Bundle-Version: 4.1.0.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.remoteservice.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -18,6 +18,7 @@ Require-Bundle: org.eclipse.equinox.common,
org.eclipse.ecf.provider,
org.eclipse.ecf.remoteservice;bundle-version="6.0.0"
Import-Package: org.eclipse.core.runtime.jobs,
+ org.eclipse.ecf.remoteservice.asyncproxy;version="1.0.0",
org.eclipse.equinox.concurrent.future,
org.eclipse.osgi.framework.eventmgr,
org.osgi.framework,
diff --git a/providers/bundles/org.eclipse.ecf.provider.remoteservice/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.remoteservice/plugin.properties
index 97c0ea152..fc3411bce 100644
--- a/providers/bundles/org.eclipse.ecf.provider.remoteservice/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.remoteservice/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-pluginName = ECF RemoteService Provider
+pluginName = ECF Generic Provider RemoteServices Support
providerName = Eclipse.org - ECF
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;
}
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 577d5f3d4..688004cde 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
@@ -199,6 +199,13 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
}
}
+ /**
+ * @since 4.1
+ */
+ protected RemoteServiceImpl createRemoteService(RemoteServiceRegistrationImpl registration) {
+ return new RemoteServiceImpl(this, registration);
+ }
+
/* (non-Javadoc)
* @see org.eclipse.ecf.remoteservice.IRemoteServiceContainerAdapter#getRemoteService(org.eclipse.ecf.remoteservice.IRemoteServiceReference)
*/
@@ -207,7 +214,7 @@ public class RegistrySharedObject extends BaseSharedObject implements IRemoteSer
final RemoteServiceRegistrationImpl registration = getRemoteServiceRegistrationImpl(reference);
if (registration == null)
return null;
- final RemoteServiceImpl remoteService = new RemoteServiceImpl(this, registration);
+ final RemoteServiceImpl remoteService = createRemoteService(registration);
synchronized (refToImplMap) {
List remoteServiceImplList = (List) refToImplMap.get(reference);
if (remoteServiceImplList == null)
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.datashare/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.xmpp.datashare/plugin.properties
index bf1af2bde..f6db0c12a 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp.datashare/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.datashare/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-pluginName = ECF XMPP Datashare Support Fragment
+pluginName = ECF XMPP Provider DataShare Support
providerName = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/META-INF/MANIFEST.MF
index cab43138f..8334b52ab 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.xmpp.remoteservice;singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Version: 1.1.0.qualifier
Fragment-Host: org.eclipse.ecf.provider.xmpp
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-Vendor: %providerName
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/plugin.properties
index e7023dc38..0ab30196a 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp.remoteservice/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-pluginName = ECF XMPP RemoteServices Support Fragment
+pluginName = ECF XMPP Provider RemoteServices Support
providerName = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF
index 308f0ae2c..01a6c6a16 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ecf.provider.xmpp;singleton:=true
-Bundle-Version: 3.2.100.qualifier
+Bundle-Version: 3.2.200.qualifier
Bundle-Activator: org.eclipse.ecf.internal.provider.xmpp.XmppPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -12,7 +12,7 @@ Require-Bundle: org.eclipse.ecf;bundle-version="3.1.0",
org.eclipse.ecf.filetransfer,
org.jivesoftware.smack;bundle-version="3.3.0",
org.eclipse.ecf.sharedobject,
- org.eclipse.equinox.common;bundle-version="3.5.0"
+ org.eclipse.equinox.common
Eclipse-LazyStart: true
Export-Package: org.eclipse.ecf.internal.provider.xmpp;x-internal:=true,
org.eclipse.ecf.internal.provider.xmpp.events;x-internal:=true,
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/plugin.properties b/providers/bundles/org.eclipse.ecf.provider.xmpp/plugin.properties
index 4292c605a..2e019f5c8 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/plugin.properties
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/plugin.properties
@@ -6,5 +6,5 @@
# http://www.eclipse.org/legal/epl-v10.html
#
############################################################################
-pluginName = ECF XMPP Provider
+pluginName = ECF Presence XMPP Provider
providerName = Eclipse.org - ECF
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/XMPPContainerPresenceHelper.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/XMPPContainerPresenceHelper.java
index c2d44f172..9be97880c 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/XMPPContainerPresenceHelper.java
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/internal/provider/xmpp/XMPPContainerPresenceHelper.java
@@ -59,9 +59,9 @@ import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
-import org.jivesoftware.smack.packet.RosterPacket;
import org.jivesoftware.smack.packet.Presence.Mode;
import org.jivesoftware.smack.packet.Presence.Type;
+import org.jivesoftware.smack.packet.RosterPacket;
import org.jivesoftware.smackx.packet.VCard;
public class XMPPContainerPresenceHelper implements ISharedObject {
@@ -391,13 +391,53 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
}
}
+ private boolean replace(IRosterItem i1, IRosterItem i2) {
+ if (i1 instanceof IRosterEntry) {
+ IRosterEntry re1 = (IRosterEntry) i1;
+ if (!(i2 instanceof IRosterEntry))
+ return false;
+ IRosterEntry re2 = (IRosterEntry) i2;
+ XMPPID id1 = (XMPPID) re1.getUser().getID();
+ XMPPID id2 = (XMPPID) re2.getUser().getID();
+ String jid1 = id1.getUsernameAtHost();
+ String jid2 = id2.getUsernameAtHost();
+ if (jid1.equals(jid2)) {
+ String r1 = id1.getResourceName();
+ String r2 = id2.getResourceName();
+ if (r1 == null && r2 != null)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private void addUnique(Collection existingItems, IRosterItem newItem) {
+ List toAdd = new ArrayList();
+ if (existingItems.size() == 0)
+ toAdd.add(newItem);
+ else {
+ boolean addNewItem = true;
+ for (Iterator i = existingItems.iterator(); i.hasNext();) {
+ IRosterItem existing = (IRosterItem) i.next();
+ // If the same then we don't add it
+ if (existing.equals(newItem))
+ addNewItem = false;
+ // else if the new item should replace the existing then remove
+ if (replace(existing, newItem))
+ i.remove();
+ }
+ if (addNewItem)
+ toAdd.add(newItem);
+ }
+ for (Iterator i = toAdd.iterator(); i.hasNext();)
+ existingItems.add(i.next());
+ }
+
private void addUniqueToRoster(IRosterItem[] newItems) {
Collection existingItems = roster.getItems();
synchronized (existingItems) {
- for (int i = 0; i < newItems.length; i++) {
- if (!existingItems.contains(newItems[i]))
- existingItems.add(newItems[i]);
- }
+ for (int i = 0; i < newItems.length; i++)
+ addUnique(existingItems, newItems[i]);
}
rosterManager.notifyRosterUpdate(roster);
}
@@ -411,17 +451,20 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
}
protected IRosterEntry createRosterEntry(RosterEntry entry) {
- final XMPPID xmppid = createIDFromName(entry.getUser());
- final String name = (entry.getName() == null) ? xmppid.getUsername()
- : XMPPID.unfixEscapeInNode(entry.getName());
- return createRosterEntry(xmppid, name, entry.getGroups().iterator());
+ XMPPID xmppid = createIDFromName(entry.getUser());
+ return createRosterEntry(xmppid, getEntryName(xmppid, entry.getName()),
+ entry.getGroups().iterator());
+ }
+
+ private String getEntryName(XMPPID xmppid, String entryName) {
+ return (entryName == null) ? xmppid.getUsername() : XMPPID
+ .unfixEscapeInNode(entryName);
}
protected IRosterEntry createRosterEntry(XMPPID xmppid,
RosterPacket.Item entry) {
- final String name = (entry.getName() == null) ? xmppid.getUsername()
- : XMPPID.unfixEscapeInNode(entry.getName());
- return createRosterEntry(xmppid, name, entry.getGroupNames().iterator());
+ return createRosterEntry(xmppid, getEntryName(xmppid, entry.getName()),
+ entry.getGroupNames().iterator());
}
protected void handleIQEvent(IQEvent evt) {
@@ -435,10 +478,8 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
.iterator(); i.hasNext();) {
final RosterPacket.Item item = (RosterPacket.Item) i.next();
final RosterPacket.ItemType itemType = item.getItemType();
- boolean remove = false;
XMPPID newID = createIDFromName(item.getUser());
- final IRosterItem items[] = createRosterEntries(newID, item);
- final IRosterEntry entry = createRosterEntry(newID, item);
+ boolean remove = false;
if (itemType == RosterPacket.ItemType.none
|| itemType == RosterPacket.ItemType.remove) {
removeItemFromRoster(roster.getItems(),
@@ -446,10 +487,10 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
remove = true;
} else {
remove = false;
- addUniqueToRoster(items);
+ addUniqueToRoster(createRosterEntries(newID, item));
}
// In both cases fire set roster entry
- fireSetRosterEntry(remove, entry);
+ fireSetRosterEntry(remove, createRosterEntry(newID, item));
}
}
} else {
@@ -530,13 +571,14 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
final List xhtmlbodylist = new ArrayList();
for (; xhtmlbodies.hasNext();)
xhtmlbodylist.add(xhtmlbodies.next());
- chatManager.fireXHTMLChatMessage(fromID, threadID, msg
- .getType(), subject, body, ECFConnection
- .getPropertiesFromPacket(msg), xhtmlbodylist);
+ chatManager.fireXHTMLChatMessage(fromID, threadID,
+ msg.getType(), subject, body,
+ ECFConnection.getPropertiesFromPacket(msg),
+ xhtmlbodylist);
} else if (body != null) {
chatManager.fireChatMessage(fromID, threadID,
- msg.getType(), subject, body, ECFConnection
- .getPropertiesFromPacket(msg));
+ msg.getType(), subject, body,
+ ECFConnection.getPropertiesFromPacket(msg));
}
}
}
@@ -904,8 +946,8 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
final Presence newPresence = new Presence(
createPresenceType(ipresence), ipresence.getStatus(), 0,
createPresenceMode(ipresence));
- ECFConnection.setPropertiesInPacket(newPresence, ipresence
- .getProperties());
+ ECFConnection.setPropertiesInPacket(newPresence,
+ ipresence.getProperties());
return newPresence;
}
@@ -998,9 +1040,9 @@ public class XMPPContainerPresenceHelper implements ISharedObject {
protected IRosterItem[] createRosterEntries(RosterEntry entry) {
final XMPPID xmppid = createIDFromName(entry.getUser());
final String name = entry.getName();
- final User newUser = (name == null) ? new User(xmppid, xmppid
- .getUsername()) : new User(xmppid, XMPPID
- .unfixEscapeInNode(name));
+ final User newUser = (name == null) ? new User(xmppid,
+ xmppid.getUsername()) : new User(xmppid,
+ XMPPID.unfixEscapeInNode(name));
return createRosterEntries(entry.getGroups().iterator(), roster,
newUser);
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java
index ccb8d1c26..231908d5d 100644
--- a/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java
+++ b/providers/bundles/org.eclipse.ecf.provider.xmpp/src/org/eclipse/ecf/provider/xmpp/identity/XMPPID.java
@@ -97,6 +97,9 @@ public class XMPPID extends BaseID implements IChatID, IFQID {
public XMPPID(Namespace namespace, String unamehost)
throws URISyntaxException {
super(namespace);
+ // System.out.println("XMPPID.init unamehost=" + unamehost);
+ // Exception except = new Exception();
+ // except.printStackTrace();
unamehost = fixPercentEscape(unamehost);
if (unamehost == null)
throw new URISyntaxException(unamehost,
@@ -148,15 +151,11 @@ public class XMPPID extends BaseID implements IChatID, IFQID {
// Get resources from this and other
String thisResourceName = getResourceName();
String otherResourceName = other.getResourceName();
- // The resources are considered equal if either one is null (not known
- // yet), or they are equal by
- // string comparison
boolean resourceEquals = false;
- if (thisResourceName == null) {
+ if (thisResourceName == null)
resourceEquals = (otherResourceName == null) ? true : false;
- } else {
+ else
resourceEquals = thisResourceName.equals(otherResourceName);
- }
return resourceEquals
&& getUsernameAtHost().equals(other.getUsernameAtHost());
}
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/META-INF/MANIFEST.MF b/providers/bundles/org.eclipse.ecf.provider.zookeeper/META-INF/MANIFEST.MF
index 2448edb65..8bf393314 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/META-INF/MANIFEST.MF
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %bundle.name
Bundle-SymbolicName: org.eclipse.ecf.provider.zookeeper;singleton:=true
-Bundle-Version: 1.0.100.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.ecf.provider.zookeeper.DiscoveryActivator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
@@ -20,7 +20,7 @@ Import-Package: org.apache.zookeeper,
org.osgi.framework;version="1.5.0",
org.osgi.service.log;version="1.3.0",
org.osgi.util.tracker;version="1.4.2"
-Require-Bundle: org.eclipse.equinox.common;bundle-version="3.5.0",
+Require-Bundle: org.eclipse.equinox.common,
org.eclipse.ecf.discovery;bundle-version="3.0.0",
org.apache.hadoop.zookeeper;bundle-version="[3.3.3,3.4.0)"
Export-Package: org.eclipse.ecf.provider.zookeeper;version="1.0.0",
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/plugin.xml b/providers/bundles/org.eclipse.ecf.provider.zookeeper/plugin.xml
index 2ca709379..97fa861c0 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/plugin.xml
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/plugin.xml
@@ -5,17 +5,17 @@
point="org.eclipse.ecf.containerFactory">
<containerFactory
class="org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainerInstantiator"
- description="Discovery Container"
+ description="Zookeeper Discovery Container"
name="ecf.discovery.zoodiscovery">
</containerFactory>
<containerFactory
class="org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainerInstantiator"
- description="Discovery Container"
+ description="Zookeeper Discovery Advertiser Container"
name="ecf.discovery.zoodiscovery.advertiser">
</containerFactory>
<containerFactory
class="org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainerInstantiator"
- description="Discovery Container"
+ description="Zookeeper Discovery Locator Container"
name="ecf.discovery.zoodiscovery.locator">
</containerFactory>
</extension>
@@ -23,7 +23,7 @@
point="org.eclipse.ecf.identity.namespace">
<namespace
class="org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryNamespace"
- description="ZooKeeper Based Discovery Namespace"
+ description="ZooKeeper Based Discovery Namespace"
name="ecf.namespace.zoodiscovery">
</namespace>
</extension>
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
index 0bac43bda..8175053f6 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/DiscoveryActivator.java
@@ -16,10 +16,15 @@ import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
+import org.eclipse.core.runtime.SafeRunner;
+import org.eclipse.ecf.core.ContainerTypeDescription;
+import org.eclipse.ecf.core.identity.Namespace;
+import org.eclipse.ecf.core.util.ExtensionRegistryRunnable;
import org.eclipse.ecf.discovery.IDiscoveryAdvertiser;
import org.eclipse.ecf.discovery.IDiscoveryLocator;
import org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainer;
import org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryContainerInstantiator;
+import org.eclipse.ecf.provider.zookeeper.core.ZooDiscoveryNamespace;
import org.eclipse.ecf.provider.zookeeper.core.internal.BundleStoppingListener;
import org.eclipse.ecf.provider.zookeeper.util.Logger;
import org.eclipse.ecf.provider.zookeeper.util.PrettyPrinter;
@@ -42,6 +47,15 @@ public class DiscoveryActivator implements BundleActivator {
public void start(final BundleContext ctxt) {
context = ctxt;
+ SafeRunner.run(new ExtensionRegistryRunnable(ctxt) {
+ protected void runWithoutRegistry() throws Exception {
+ ctxt.registerService(Namespace.class,new ZooDiscoveryNamespace(), null);
+ ctxt.registerService(ContainerTypeDescription.class,new ContainerTypeDescription(ZooDiscoveryContainerInstantiator.NAME,new ZooDiscoveryContainerInstantiator(),"Zookeeper Discovery Container"), null);
+ ctxt.registerService(ContainerTypeDescription.class,new ContainerTypeDescription(ZooDiscoveryContainerInstantiator.NAME+".advertiser",new ZooDiscoveryContainerInstantiator(),"Zookeeper Discovery Advertiser Container"), null);
+ ctxt.registerService(ContainerTypeDescription.class,new ContainerTypeDescription(ZooDiscoveryContainerInstantiator.NAME+".locator",new ZooDiscoveryContainerInstantiator(),"Zookeeper Discovery Locator Container"), null);
+ }
+ });
+
final Properties props = new Properties();
props.put(IDiscoveryLocator.CONTAINER_NAME, ZooDiscoveryContainerInstantiator.NAME);
props.put(IDiscoveryAdvertiser.CONTAINER_NAME, ZooDiscoveryContainerInstantiator.NAME);
diff --git a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
index a6e5339a5..bc15ecb60 100644
--- a/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
+++ b/providers/bundles/org.eclipse.ecf.provider.zookeeper/src/org/eclipse/ecf/provider/zookeeper/core/ZooDiscoveryNamespace.java
@@ -26,7 +26,7 @@ public class ZooDiscoveryNamespace extends Namespace {
public static final String NAME = "ecf.namespace.zoodiscovery"; //$NON-NLS-1$
public ZooDiscoveryNamespace() {
- super(NAME, "ZooKeeper Based Discovery Namespace"); //$NON-NLS-1$
+ super(NAME, "ZooKeeper Discovery Namespace"); //$NON-NLS-1$
}
public ID createInstance(Object[] parameters) throws IDCreateException {

Back to the top