diff --git a/plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
index 0522e7bbebb72dc0488c1e3d3c8126fd4dc54acd..69bb3cd416608039818a000276d4a4b65bf82864 100644
--- a/plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
+++ b/plugins/org.jkiss.dbeaver.core/META-INF/MANIFEST.MF
@@ -126,7 +126,6 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.search,
org.jkiss.dbeaver.model;visibility:=reexport,
org.jkiss.utils;visibility:=reexport,
- com.jcraft.jsch,
org.objectweb.asm,
org.eclipse.e4.core.contexts,
org.eclipse.e4.core.services,
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.jsch/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.net.ssh.jsch/META-INF/MANIFEST.MF
index 59a8759725b5925a995b355ec1acfb469e784d9c..ad5d5d9d1fb34f68ee1fbcaaaf1166ca755278ad 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.jsch/META-INF/MANIFEST.MF
+++ b/plugins/org.jkiss.dbeaver.net.ssh.jsch/META-INF/MANIFEST.MF
@@ -7,13 +7,7 @@ Bundle-Version: 1.0.0
Bundle-Release-Date: 20180319
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.jkiss.dbeaver.net.ssh.jsch.Activator
Bundle-ClassPath: .
-Require-Bundle: org.eclipse.equinox.security,
- org.eclipse.core.runtime,
- org.eclipse.core.expressions,
- org.eclipse.core.commands,
- org.eclipse.core.resources,
- org.jkiss.dbeaver.model;visibility:=reexport,
- org.jkiss.utils;visibility:=reexport
+Require-Bundle: org.jkiss.dbeaver.model,
+ com.jcraft.jsch
Bundle-Localization: OSGI-INF/l10n/bundle
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.jsch/OSGI-INF/l10n/bundle.properties b/plugins/org.jkiss.dbeaver.net.ssh.jsch/OSGI-INF/l10n/bundle.properties
index 0984589b60c85fe0e5ed11365e75c5f183ac584c..710a6962e82a974169fd8198283c4944f822c103 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.jsch/OSGI-INF/l10n/bundle.properties
+++ b/plugins/org.jkiss.dbeaver.net.ssh.jsch/OSGI-INF/l10n/bundle.properties
@@ -1,5 +1,2 @@
Bundle-Vendor = JKISS
-Bundle-Name = DBeaver SSH tunnels
-
-extension-point.org.jkiss.dbeaver.net.ssh.name = SSH implementations
-
+Bundle-Name = DBeaver SSH implementation (JSch)
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.jsch/plugin.xml b/plugins/org.jkiss.dbeaver.net.ssh.jsch/plugin.xml
index 3ebb9580918bf9062f7ca09c6169208379bb9b01..5d068d9578bfbe1216326d5e4c49d2ce946140ca 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.jsch/plugin.xml
+++ b/plugins/org.jkiss.dbeaver.net.ssh.jsch/plugin.xml
@@ -3,5 +3,8 @@
+
+
+
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationJsch.java b/plugins/org.jkiss.dbeaver.net.ssh.jsch/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationJsch.java
similarity index 100%
rename from plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationJsch.java
rename to plugins/org.jkiss.dbeaver.net.ssh.jsch/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationJsch.java
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.sshj/META-INF/MANIFEST.MF b/plugins/org.jkiss.dbeaver.net.ssh.sshj/META-INF/MANIFEST.MF
index 4ab2f5e5c2b736fbe7d92ac753dd0c465c8c3c2b..7c2e55d4a77c05407d940cd8e079196482130976 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.sshj/META-INF/MANIFEST.MF
+++ b/plugins/org.jkiss.dbeaver.net.ssh.sshj/META-INF/MANIFEST.MF
@@ -7,13 +7,7 @@ Bundle-Version: 1.0.0
Bundle-Release-Date: 20180319
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
-Bundle-Activator: org.jkiss.dbeaver.net.ssh.sshj.Activator
Bundle-ClassPath: .
-Require-Bundle: org.eclipse.equinox.security,
- org.eclipse.core.runtime,
- org.eclipse.core.expressions,
- org.eclipse.core.commands,
- org.eclipse.core.resources,
- org.jkiss.dbeaver.model;visibility:=reexport,
- org.jkiss.utils;visibility:=reexport
+Require-Bundle: org.jkiss.dbeaver.model,
+ com.hierynomus.sshj
Bundle-Localization: OSGI-INF/l10n/bundle
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.sshj/OSGI-INF/l10n/bundle.properties b/plugins/org.jkiss.dbeaver.net.ssh.sshj/OSGI-INF/l10n/bundle.properties
index 0984589b60c85fe0e5ed11365e75c5f183ac584c..13728711c5e0b087bcc1335b7d94b69485ffb954 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.sshj/OSGI-INF/l10n/bundle.properties
+++ b/plugins/org.jkiss.dbeaver.net.ssh.sshj/OSGI-INF/l10n/bundle.properties
@@ -1,5 +1,3 @@
Bundle-Vendor = JKISS
-Bundle-Name = DBeaver SSH tunnels
-
-extension-point.org.jkiss.dbeaver.net.ssh.name = SSH implementations
+Bundle-Name = DBeaver SSH implementation (SSHJ)
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.sshj/plugin.xml b/plugins/org.jkiss.dbeaver.net.ssh.sshj/plugin.xml
index 3ebb9580918bf9062f7ca09c6169208379bb9b01..36b7d22f939d9a83a51f25ab7c4987a6d04d3e17 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.sshj/plugin.xml
+++ b/plugins/org.jkiss.dbeaver.net.ssh.sshj/plugin.xml
@@ -3,5 +3,8 @@
+
+
+
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationSshj.java b/plugins/org.jkiss.dbeaver.net.ssh.sshj/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationSshj.java
similarity index 100%
rename from plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationSshj.java
rename to plugins/org.jkiss.dbeaver.net.ssh.sshj/src/org/jkiss/dbeaver/model/net/ssh/SSHImplementationSshj.java
diff --git a/plugins/org.jkiss.dbeaver.net.ssh.ui/src/org/jkiss/dbeaver/ui/net/ssh/SSHTunnelConfiguratorUI.java b/plugins/org.jkiss.dbeaver.net.ssh.ui/src/org/jkiss/dbeaver/ui/net/ssh/SSHTunnelConfiguratorUI.java
index d7b3da13dbb961475433146eb7c0bbc1cd3bfecf..d8346a10d2d9fe4d01fdec8820bcc01ab6544166 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh.ui/src/org/jkiss/dbeaver/ui/net/ssh/SSHTunnelConfiguratorUI.java
+++ b/plugins/org.jkiss.dbeaver.net.ssh.ui/src/org/jkiss/dbeaver/ui/net/ssh/SSHTunnelConfiguratorUI.java
@@ -25,7 +25,8 @@ import org.eclipse.swt.widgets.*;
import org.jkiss.dbeaver.core.DBeaverUI;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.ssh.SSHConstants;
-import org.jkiss.dbeaver.model.net.ssh.SSHImplType;
+import org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor;
+import org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationRegistry;
import org.jkiss.dbeaver.ui.IObjectPropertyConfigurator;
import org.jkiss.dbeaver.ui.UIUtils;
import org.jkiss.dbeaver.ui.controls.TextWithOpen;
@@ -97,7 +98,7 @@ public class SSHTunnelConfiguratorUI implements IObjectPropertyConfigurator
-
+
Application meta info
@@ -18,26 +18,12 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -45,48 +31,12 @@
-
+
-
-
-
-
-
- [Enter the first release in which this extension point appears.]
-
-
-
-
-
-
-
-
- [Enter extension point usage example here.]
-
-
-
-
-
-
-
-
- [Enter API information here.]
-
-
-
-
-
-
-
-
- [Enter information about supplied implementation of this extension point.]
-
-
-
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplType.java b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplType.java
deleted file mode 100644
index d71b78a7c90e75685638344cc6bf64c3dfc908df..0000000000000000000000000000000000000000
--- a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHImplType.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * DBeaver - Universal Database Manager
- * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.jkiss.dbeaver.model.net.ssh;
-
-import org.jkiss.code.NotNull;
-
-/**
- * SSH implementation enum
- */
-public enum SSHImplType {
-
- JSCH("jsch", "JSch", SSHImplementationJsch.class),
- SSHJ("sshj", "SSHJ", SSHImplementationSshj.class);
-
- private String id;
- private String label;
- private Class extends SSHImplementation> implClass;
-
- SSHImplType(@NotNull String id, @NotNull String label, @NotNull Class extends SSHImplementation> implClass) {
- this.id = id;
- this.label = label;
- this.implClass = implClass;
- }
-
- @NotNull
- public String getId() {
- return id;
- }
-
- @NotNull
- public String getLabel() {
- return label;
- }
-
- @NotNull
- public Class extends SSHImplementation> getImplClass() {
- return implClass;
- }
-
- @NotNull
- public static SSHImplType getById(String id) throws IllegalArgumentException {
- for (SSHImplType it : values()) {
- if (it.getId().equals(id)) {
- return it;
- }
- }
- throw new IllegalArgumentException("Bad SSH impl: " + id);
- }
-}
\ No newline at end of file
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHTunnelImpl.java b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHTunnelImpl.java
index 913fe270a13bf73464d5d09da2763f5e494c7a5f..1f1d156d38c020a380da25f6626db4bf23abb33e 100644
--- a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHTunnelImpl.java
+++ b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/SSHTunnelImpl.java
@@ -17,11 +17,12 @@
package org.jkiss.dbeaver.model.net.ssh;
import org.jkiss.dbeaver.DBException;
-import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.app.DBPPlatform;
import org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration;
import org.jkiss.dbeaver.model.net.DBWHandlerConfiguration;
import org.jkiss.dbeaver.model.net.DBWTunnel;
+import org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationDescriptor;
+import org.jkiss.dbeaver.model.net.ssh.registry.SSHImplementationRegistry;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.utils.CommonUtils;
@@ -33,7 +34,7 @@ import java.util.Map;
*/
public class SSHTunnelImpl implements DBWTunnel {
- private static final Log log = Log.getLog(SSHTunnelImpl.class);
+ private static final String DEF_IMPLEMENTATION = "jsch";
private SSHImplementation implementation;
@@ -43,17 +44,17 @@ public class SSHTunnelImpl implements DBWTunnel {
{
Map properties = configuration.getProperties();
String implId = properties.get(SSHConstants.PROP_IMPLEMENTATION);
-
- SSHImplType implType = SSHImplType.JSCH;
- if (!CommonUtils.isEmpty(implId)) {
- try {
- implType = SSHImplType.getById(implId);
- } catch (IllegalArgumentException e) {
- log.error(e);
- }
+ if (CommonUtils.isEmpty(implId)) {
+ // Backward compatibility
+ implId = DEF_IMPLEMENTATION;
}
+
try {
- implementation = implType.getImplClass().newInstance();
+ SSHImplementationDescriptor implDesc = SSHImplementationRegistry.getInstance().getDescriptor(implId);
+ if (implDesc == null) {
+ implDesc = SSHImplementationRegistry.getInstance().getDescriptor(DEF_IMPLEMENTATION);
+ }
+ implementation = implDesc.getImplClass().createInstance(SSHImplementation.class);
} catch (Throwable e) {
throw new DBException("Can't create SSH tunnel implementation", e);
}
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationDescriptor.java b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationDescriptor.java
new file mode 100644
index 0000000000000000000000000000000000000000..5c1b5124ad4ef9f6684e6de62cee9ba08982865c
--- /dev/null
+++ b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationDescriptor.java
@@ -0,0 +1,65 @@
+/*
+ * DBeaver - Universal Database Manager
+ * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jkiss.dbeaver.model.net.ssh.registry;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.jkiss.dbeaver.DBException;
+import org.jkiss.dbeaver.model.impl.AbstractDescriptor;
+import org.jkiss.dbeaver.model.net.ssh.SSHImplementation;
+import org.jkiss.dbeaver.registry.AbstractContextDescriptor;
+import org.jkiss.dbeaver.registry.RegistryConstants;
+
+/**
+ * SSHImplementationDescriptor
+ */
+public class SSHImplementationDescriptor extends AbstractContextDescriptor
+{
+ static final String EXTENSION_ID = "org.jkiss.dbeaver.net.ssh"; //$NON-NLS-1$
+
+ private final AbstractDescriptor.ObjectType implClass;
+ private final String id;
+ private final String label;
+
+ SSHImplementationDescriptor(
+ IConfigurationElement config)
+ {
+ super(config);
+
+ this.id = config.getAttribute(RegistryConstants.ATTR_ID);
+ this.label = config.getAttribute(RegistryConstants.ATTR_LABEL);
+ this.implClass = new AbstractDescriptor.ObjectType(config.getAttribute(RegistryConstants.ATTR_CLASS));
+ }
+
+ public ObjectType getImplClass() {
+ return implClass;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public SSHImplementation createImplementation()
+ throws DBException
+ {
+ return implClass.createInstance(SSHImplementation.class);
+ }
+
+}
diff --git a/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationRegistry.java b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationRegistry.java
new file mode 100644
index 0000000000000000000000000000000000000000..d95b5013794995708d496ca5494b50fba3c157a7
--- /dev/null
+++ b/plugins/org.jkiss.dbeaver.net.ssh/src/org/jkiss/dbeaver/model/net/ssh/registry/SSHImplementationRegistry.java
@@ -0,0 +1,65 @@
+/*
+ * DBeaver - Universal Database Manager
+ * Copyright (C) 2010-2017 Serge Rider (serge@jkiss.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jkiss.dbeaver.model.net.ssh.registry;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SSHImplementationRegistry
+{
+ private static SSHImplementationRegistry instance = null;
+
+ public synchronized static SSHImplementationRegistry getInstance()
+ {
+ if (instance == null) {
+ instance = new SSHImplementationRegistry(Platform.getExtensionRegistry());
+ }
+ return instance;
+ }
+
+ private final List descriptors = new ArrayList<>();
+
+ private SSHImplementationRegistry(IExtensionRegistry registry)
+ {
+ // Load data descriptors from external plugins
+ {
+ IConfigurationElement[] extElements = registry.getConfigurationElementsFor(SSHImplementationDescriptor.EXTENSION_ID);
+ for (IConfigurationElement ext : extElements) {
+ SSHImplementationDescriptor descriptor = new SSHImplementationDescriptor(ext);
+ descriptors.add(descriptor);
+ }
+ }
+ }
+
+ public List getDescriptors() {
+ return descriptors;
+ }
+
+ public SSHImplementationDescriptor getDescriptor(String id) {
+ for (SSHImplementationDescriptor desc : descriptors) {
+ if (desc.getId().equals(id)) {
+ return desc;
+ }
+ }
+ return null;
+ }
+
+}