public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder
Modifier and Type | Class and Description |
---|---|
static class |
SftpFileSystemConfigBuilder.ProxyType
Proxy type.
|
Modifier and Type | Field and Description |
---|---|
static SftpFileSystemConfigBuilder.ProxyType |
PROXY_HTTP
HTTP Proxy.
|
static SftpFileSystemConfigBuilder.ProxyType |
PROXY_SOCKS5
SOCKS Proxy.
|
static SftpFileSystemConfigBuilder.ProxyType |
PROXY_STREAM
Connects to the SFTP server through a remote host reached by SSH.
|
Modifier and Type | Method and Description |
---|---|
String |
getCompression(FileSystemOptions opts) |
protected Class<? extends FileSystem> |
getConfigClass()
Get the target of this configuration.
|
String |
getFileNameEncoding(FileSystemOptions opts)
Gets the file name encoding.
|
File[] |
getIdentities(FileSystemOptions opts)
Deprecated.
As of 2.1 use
getIdentityInfo(FileSystemOptions) |
IdentityInfo[] |
getIdentityInfo(FileSystemOptions opts)
Gets the identity info.
|
IdentityRepositoryFactory |
getIdentityRepositoryFactory(FileSystemOptions opts)
Get the identity repository factory.
|
static SftpFileSystemConfigBuilder |
getInstance()
Gets the singleton builder.
|
File |
getKnownHosts(FileSystemOptions opts) |
String |
getPreferredAuthentications(FileSystemOptions opts)
Gets authentication order.
|
String |
getProxyCommand(FileSystemOptions opts)
Gets the command that will be run on the proxy
host when using a SftpStreamProxy.
|
String |
getProxyHost(FileSystemOptions opts)
Gets the proxy to use for the SFTP connection.
|
FileSystemOptions |
getProxyOptions(FileSystemOptions opts)
Gets the proxy options that are used to connect
to the proxy host.
|
String |
getProxyPassword(FileSystemOptions opts)
Gets the proxy password that are used to connect
to the proxy host.
|
int |
getProxyPort(FileSystemOptions opts)
Gets the proxy-port to use for the SFTP the connection.
|
SftpFileSystemConfigBuilder.ProxyType |
getProxyType(FileSystemOptions opts)
Gets the proxy type to use for the SFTP connection.
|
String |
getProxyUser(FileSystemOptions opts)
Gets the user name for the proxy used for the SFTP connection.
|
String |
getStrictHostKeyChecking(FileSystemOptions opts) |
Integer |
getTimeout(FileSystemOptions opts) |
Boolean |
getUserDirIsRoot(FileSystemOptions opts)
Returns
Boolean.TRUE if VFS should treat the user directory as the root directory. |
com.jcraft.jsch.UserInfo |
getUserInfo(FileSystemOptions opts) |
void |
setCompression(FileSystemOptions opts,
String compression)
Configures the compression algorithms to use.
|
void |
setFileNameEncoding(FileSystemOptions opts,
String fileNameEncoding)
Sets the file name encoding.
|
void |
setIdentities(FileSystemOptions opts,
File... identityFiles)
Deprecated.
As of 2.1 use
setIdentityInfo(FileSystemOptions, IdentityInfo...) |
void |
setIdentityInfo(FileSystemOptions opts,
IdentityInfo... identites)
Sets the identity info (your private key files).
|
void |
setIdentityRepositoryFactory(FileSystemOptions opts,
IdentityRepositoryFactory factory)
Set the identity repository.
|
void |
setKnownHosts(FileSystemOptions opts,
File knownHosts)
Sets the known_hosts file.
|
void |
setPreferredAuthentications(FileSystemOptions opts,
String preferredAuthentications)
Configures authentication order.
|
void |
setProxyCommand(FileSystemOptions opts,
String proxyCommand)
Sets the proxy username to use for the SFTP connection.
|
void |
setProxyHost(FileSystemOptions opts,
String proxyHost)
Sets the proxy to use for the SFTP connection.
|
void |
setProxyOptions(FileSystemOptions opts,
FileSystemOptions proxyOptions)
Sets the proxy username to use for the SFTP connection.
|
void |
setProxyPassword(FileSystemOptions opts,
String proxyPassword)
Sets the proxy password to use for the SFTP connection.
|
void |
setProxyPort(FileSystemOptions opts,
int proxyPort)
Sets the proxy port to use for the SFTP connection.
|
void |
setProxyType(FileSystemOptions opts,
SftpFileSystemConfigBuilder.ProxyType proxyType)
Sets the proxy type to use for the SFTP connection.
|
void |
setProxyUser(FileSystemOptions opts,
String proxyUser)
Sets the proxy username to use for the SFTP connection.
|
void |
setStrictHostKeyChecking(FileSystemOptions opts,
String hostKeyChecking)
Configures the host key checking to use.
|
void |
setTimeout(FileSystemOptions opts,
Integer timeout)
Sets the timeout value on Jsch session.
|
void |
setUserDirIsRoot(FileSystemOptions opts,
boolean userDirIsRoot)
Sets the whether to use the user directory as root (do not change to file system root).
|
void |
setUserInfo(FileSystemOptions opts,
com.jcraft.jsch.UserInfo info)
Sets the Jsch UserInfo class to use.
|
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getEnum, getEnum, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI
public static final SftpFileSystemConfigBuilder.ProxyType PROXY_HTTP
public static final SftpFileSystemConfigBuilder.ProxyType PROXY_SOCKS5
public static final SftpFileSystemConfigBuilder.ProxyType PROXY_STREAM
On this proxy host, a command (e.g. SftpStreamProxy.NETCAT_COMMAND or SftpStreamProxy.NETCAT_COMMAND) is run to forward input/output streams between the target host and the VFS host.
When used, the proxy username (setProxyUser(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)) and hostname (setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)) must be set. Optionnaly, the command (setProxyCommand(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)), password (setProxyPassword(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)) and connection options (setProxyOptions(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.FileSystemOptions)) can be set.
public static SftpFileSystemConfigBuilder getInstance()
public String getCompression(FileSystemOptions opts)
opts
- The FileSystem options.setCompression(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
protected Class<? extends FileSystem> getConfigClass()
FileSystemConfigBuilder
getConfigClass
in class FileSystemConfigBuilder
public String getFileNameEncoding(FileSystemOptions opts)
opts
- The FileSystem options.@Deprecated public File[] getIdentities(FileSystemOptions opts)
getIdentityInfo(FileSystemOptions)
We use java.io.File because JSch cannot deal with VFS FileObjects.
opts
- The FileSystem options.setIdentities(org.apache.commons.vfs2.FileSystemOptions, java.io.File...)
public IdentityInfo[] getIdentityInfo(FileSystemOptions opts)
opts
- The FileSystem options.setIdentityInfo(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.provider.sftp.IdentityInfo...)
public IdentityRepositoryFactory getIdentityRepositoryFactory(FileSystemOptions opts)
opts
- The FileSystem options.public File getKnownHosts(FileSystemOptions opts)
opts
- The FileSystem options.setKnownHosts(org.apache.commons.vfs2.FileSystemOptions, java.io.File)
public String getPreferredAuthentications(FileSystemOptions opts)
opts
- The FileSystem options.public String getProxyCommand(FileSystemOptions opts)
opts
- The FileSystem options.SftpStreamProxy
,
setProxyOptions(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.FileSystemOptions)
public String getProxyHost(FileSystemOptions opts)
opts
- The FileSystem options.getProxyPort(org.apache.commons.vfs2.FileSystemOptions)
,
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public FileSystemOptions getProxyOptions(FileSystemOptions opts)
opts
- The FileSystem options.SftpStreamProxy
,
setProxyOptions(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.FileSystemOptions)
public String getProxyPassword(FileSystemOptions opts)
opts
- The FileSystem options.SftpStreamProxy
,
setProxyPassword(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public int getProxyPort(FileSystemOptions opts)
opts
- The FileSystem options.setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)
,
getProxyHost(org.apache.commons.vfs2.FileSystemOptions)
public SftpFileSystemConfigBuilder.ProxyType getProxyType(FileSystemOptions opts)
opts
- The FileSystem options.public String getProxyUser(FileSystemOptions opts)
opts
- The FileSystem options.setProxyUser(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public String getStrictHostKeyChecking(FileSystemOptions opts)
opts
- The FileSystem options.setStrictHostKeyChecking(FileSystemOptions, String)
public Integer getTimeout(FileSystemOptions opts)
opts
- The FileSystem options.setTimeout(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
public Boolean getUserDirIsRoot(FileSystemOptions opts)
Boolean.TRUE
if VFS should treat the user directory as the root directory. Defaults to
Boolean.TRUE
if the method setUserDirIsRoot(FileSystemOptions, boolean)
has not been
invoked.opts
- The FileSystemOptions.Boolean.TRUE
if VFS treats the user directory as the root directory.setUserDirIsRoot(org.apache.commons.vfs2.FileSystemOptions, boolean)
public com.jcraft.jsch.UserInfo getUserInfo(FileSystemOptions opts)
opts
- The FileSystem options.setUserInfo(org.apache.commons.vfs2.FileSystemOptions, com.jcraft.jsch.UserInfo)
public void setCompression(FileSystemOptions opts, String compression) throws FileSystemException
For example, use "zlib,none"
to enable compression.
See the Jsch documentation (in particular the README file) for details.
opts
- The FileSystem options.compression
- The names of the compression algorithms, comma-separated.FileSystemException
- if an error occurs.public void setFileNameEncoding(FileSystemOptions opts, String fileNameEncoding)
opts
- The FileSystem options.fileNameEncoding
- The name of the encoding to use for file names.@Deprecated public void setIdentities(FileSystemOptions opts, File... identityFiles) throws FileSystemException
setIdentityInfo(FileSystemOptions, IdentityInfo...)
We use File
because JSch cannot deal with VFS FileObjects.
opts
- The FileSystem options.identityFiles
- An array of identity Files.FileSystemException
- if an error occurs.public void setIdentityInfo(FileSystemOptions opts, IdentityInfo... identites) throws FileSystemException
opts
- The FileSystem options.identites
- An array of identity info.FileSystemException
- if an error occurs.public void setIdentityRepositoryFactory(FileSystemOptions opts, IdentityRepositoryFactory factory) throws FileSystemException
This is useful when you want to use e.g. an SSH agent as provided.
opts
- The FileSystem options.factory
- An identity repository.FileSystemException
- if an error occurs.public void setKnownHosts(FileSystemOptions opts, File knownHosts) throws FileSystemException
/home/user/.ssh/known_hosts2
.
We use File
because JSch cannot deal with VFS FileObjects.
opts
- The FileSystem options.knownHosts
- The known hosts file.FileSystemException
- if an error occurs.public void setPreferredAuthentications(FileSystemOptions opts, String preferredAuthentications)
opts
- The FileSystem options.preferredAuthentications
- The authentication order.public void setProxyCommand(FileSystemOptions opts, String proxyCommand)
opts
- The FileSystem options.proxyCommand
- the portgetProxyOptions(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyHost(FileSystemOptions opts, String proxyHost)
opts
- The FileSystem options.proxyHost
- the hostsetProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)
public void setProxyOptions(FileSystemOptions opts, FileSystemOptions proxyOptions)
opts
- The FileSystem options.proxyOptions
- the optionsgetProxyOptions(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyPassword(FileSystemOptions opts, String proxyPassword)
opts
- The FileSystem options.proxyPassword
- the username used to connect to the proxygetProxyPassword(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyPort(FileSystemOptions opts, int proxyPort)
You MUST also set the proxy host to use the proxy.
opts
- The FileSystem options.proxyPort
- the portsetProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public void setProxyType(FileSystemOptions opts, SftpFileSystemConfigBuilder.ProxyType proxyType)
opts
- The FileSystem options.proxyType
- the type of the proxy to use.public void setProxyUser(FileSystemOptions opts, String proxyUser)
opts
- The FileSystem options.proxyUser
- the username used to connect to the proxygetProxyUser(org.apache.commons.vfs2.FileSystemOptions)
public void setStrictHostKeyChecking(FileSystemOptions opts, String hostKeyChecking) throws FileSystemException
Valid arguments are: "yes"
, "no"
and "ask"
.
See the jsch documentation for details.
opts
- The FileSystem options.hostKeyChecking
- The host key checking to use.FileSystemException
- if an error occurs.public void setTimeout(FileSystemOptions opts, Integer timeout)
opts
- The FileSystem options.timeout
- The timeout in milliseconds.public void setUserDirIsRoot(FileSystemOptions opts, boolean userDirIsRoot)
opts
- The FileSystem options.userDirIsRoot
- true if the user directory is the root directory.public void setUserInfo(FileSystemOptions opts, com.jcraft.jsch.UserInfo info)
opts
- The FileSystem options.info
- User information.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.