Decouple JSch from JGit Core

Motivation: JSch serves as 'default' implementations of the SSH
transport. If a client application does not use it then there is no need
to pull in this dependency.

Move the classes depending on JSch to an OSGi fragment extending the
org.eclipse.jgit bundle and keep them in the same package as before
since moving them to another package would break API. Defer moving them
to a separate package to the next major release.

Add a new feature org.eclipse.jgit.ssh.jsch feature to enable
installation. With that users can now decide which of the ssh client
integrations (JCraft JSch or Apache Mina SSHD) they want to install.
We will remove the JCraft JSch integration in a later step due to the
reasons discussed in bug 520927.

Bug: 553625
Change-Id: I5979c8a9dbbe878a2e8ac0fbfde7230059d74dc2
Also-by: Michael Dardis <git@md-5.net>
Signed-off-by: Michael Dardis <git@md-5.net>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
diff --git a/org.eclipse.jgit.ssh.apache/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory b/org.eclipse.jgit.ssh.apache/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory
new file mode 100644
index 0000000..8289411
--- /dev/null
+++ b/org.eclipse.jgit.ssh.apache/resources/META-INF/services/org.eclipse.jgit.transport.SshSessionFactory
@@ -0,0 +1 @@
+org.eclipse.jgit.transport.sshd.SshdSessionFactory
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java
index cb6b7d6..bb4e49b 100644
--- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java
+++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java
@@ -66,6 +66,8 @@
  */
 public class SshdSessionFactory extends SshSessionFactory implements Closeable {
 
+	private static final String MINA_SSHD = "mina-sshd"; //$NON-NLS-1$
+
 	private final AtomicBoolean closing = new AtomicBoolean();
 
 	private final Set<SshdSession> sessions = new HashSet<>();
@@ -133,6 +135,11 @@ public SshdSessionFactory(KeyCache keyCache, ProxyDataFactory proxies) {
 		BCryptKdfOptions.setMaxAllowedRounds(16384);
 	}
 
+	@Override
+	public String getType() {
+		return MINA_SSHD;
+	}
+
 	/** A simple general map key. */
 	private static final class Tuple {
 		private Object[] objects;