You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2008/11/29 13:23:13 UTC
svn commit: r721672 - in /activemq/camel/branches/camel-1.x: ./
components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/
Author: davsclaus
Date: Sat Nov 29 04:23:12 2008
New Revision: 721672
URL: http://svn.apache.org/viewvc?rev=721672&view=rev
Log:
Merged revisions 721669 via svnmerge from
https://svn.apache.org/repos/asf/activemq/camel/trunk
........
r721669 | davsclaus | 2008-11-29 13:15:07 +0100 (lo, 29 nov 2008) | 1 line
CAMEL-1130: Added privateKeyFile support to SFTP
........
Modified:
activemq/camel/branches/camel-1.x/ (props changed)
activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sat Nov 29 04:23:12 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669
Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java?rev=721672&r1=721671&r2=721672&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConfiguration.java Sat Nov 29 04:23:12 2008
@@ -36,6 +36,8 @@
private Expression expression;
private boolean passiveMode;
private String knownHosts;
+ private String privateKeyFile;
+ private String privateKeyFilePassphrase;
public RemoteFileConfiguration() {
}
@@ -195,4 +197,21 @@
public void setPassiveMode(boolean passiveMode) {
this.passiveMode = passiveMode;
}
+
+ public String getPrivateKeyFile() {
+ return privateKeyFile;
+ }
+
+ public void setPrivateKeyFile(String privateKeyFile) {
+ this.privateKeyFile = privateKeyFile;
+ }
+
+ public String getPrivateKeyFilePassphrase() {
+ return privateKeyFilePassphrase;
+ }
+
+ public void setPrivateKeyFilePassphrase(String privateKeyFilePassphrase) {
+ this.privateKeyFilePassphrase = privateKeyFilePassphrase;
+ }
+
}
Modified: activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java?rev=721672&r1=721671&r2=721672&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java (original)
+++ activemq/camel/branches/camel-1.x/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java Sat Nov 29 04:23:12 2008
@@ -25,6 +25,7 @@
import org.apache.camel.Processor;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import static org.apache.camel.util.ObjectHelper.isNotNullAndNonEmpty;
public class SftpEndpoint extends RemoteFileEndpoint<RemoteFileExchange> {
protected final transient Log log = LogFactory.getLog(getClass());
@@ -49,8 +50,20 @@
protected Session createSession() throws JSchException {
final JSch jsch = new JSch();
+
+ String privateKeyFile = getConfiguration().getPrivateKeyFile();
+ if (isNotNullAndNonEmpty(privateKeyFile)) {
+ log.debug("Using private keyfile: " + privateKeyFile);
+ String privateKeyFilePassphrase = getConfiguration().getPrivateKeyFilePassphrase();
+ if (isNotNullAndNonEmpty(privateKeyFilePassphrase)) {
+ jsch.addIdentity(privateKeyFile, privateKeyFilePassphrase);
+ } else {
+ jsch.addIdentity(privateKeyFile);
+ }
+ }
+
String knownHostsFile = getConfiguration().getKnownHosts();
- if (knownHostsFile != null && knownHostsFile.trim().length() > 0) {
+ if (isNotNullAndNonEmpty(knownHostsFile)) {
log.debug("Using knownHosts: " + knownHostsFile);
jsch.setKnownHosts(knownHostsFile);
}