Class SftpClientFactory
java.lang.Object
org.apache.commons.vfs2.provider.sftp.SftpClientFactory
Create a JSch Session instance.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInterface JSchLogger with JCL. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaddIdentities(com.jcraft.jsch.JSch jsch, File sshDir, IdentityProvider[] identities) private static voidaddIdentity(com.jcraft.jsch.JSch jsch, IdentityProvider identity) static com.jcraft.jsch.SessioncreateConnection(String hostname, int port, char[] username, char[] password, FileSystemOptions fileSystemOptions) Creates a new connection to the server.private static com.jcraft.jsch.ProxyHTTPcreateProxyHTTP(String proxyHost, int proxyPort) private static com.jcraft.jsch.ProxySOCKS5createProxySOCKS5(String proxyHost, int proxyPort) private static com.jcraft.jsch.ProxycreateStreamProxy(String proxyHost, int proxyPort, FileSystemOptions fileSystemOptions, SftpFileSystemConfigBuilder builder) private static FileFinds the.sshdirectory.private static voidsetConfigRepository(com.jcraft.jsch.JSch jsch, File sshDir, com.jcraft.jsch.ConfigRepository configRepository, boolean loadOpenSSHConfig) private static voidsetKnownHosts(com.jcraft.jsch.JSch jsch, File sshDir, File knownHostsFile)
-
Field Details
-
SSH_DIR_NAME
- See Also:
-
OPENSSH_CONFIG_NAME
- See Also:
-
LOG
private static final org.apache.commons.logging.Log LOG
-
-
Constructor Details
-
SftpClientFactory
private SftpClientFactory()
-
-
Method Details
-
addIdentities
private static void addIdentities(com.jcraft.jsch.JSch jsch, File sshDir, IdentityProvider[] identities) throws FileSystemException - Throws:
FileSystemException
-
addIdentity
private static void addIdentity(com.jcraft.jsch.JSch jsch, IdentityProvider identity) throws FileSystemException - Throws:
FileSystemException
-
createConnection
public static com.jcraft.jsch.Session createConnection(String hostname, int port, char[] username, char[] password, FileSystemOptions fileSystemOptions) throws FileSystemException Creates a new connection to the server.- Parameters:
hostname- The name of the host to connect to.port- The port to use.username- The user's id.password- The user's password.fileSystemOptions- The FileSystem options.- Returns:
- A Session, never null.
- Throws:
FileSystemException- if an error occurs.
-
createProxyHTTP
-
createProxySOCKS5
-
createStreamProxy
private static com.jcraft.jsch.Proxy createStreamProxy(String proxyHost, int proxyPort, FileSystemOptions fileSystemOptions, SftpFileSystemConfigBuilder builder) -
findSshDir
Finds the.sshdirectory.The lookup order is:
- The system property
vfs.sftp.sshdir(the override mechanism) user.home/.ssh- On Windows only:
C:\cygwin\home[user.name]\.ssh - The current directory, as a last resort.
Windows Notes
The default installation directory for Cygwin is
C:\cygwin. On my set up (Gary here), I have Cygwin inC:\bin\cygwin, not the default. Also, my .ssh directory was created in theuser.homedirectory.- Returns:
- The
.sshdirectory
- The system property
-
setConfigRepository
private static void setConfigRepository(com.jcraft.jsch.JSch jsch, File sshDir, com.jcraft.jsch.ConfigRepository configRepository, boolean loadOpenSSHConfig) throws FileSystemException - Throws:
FileSystemException
-
setKnownHosts
private static void setKnownHosts(com.jcraft.jsch.JSch jsch, File sshDir, File knownHostsFile) throws FileSystemException - Throws:
FileSystemException
-