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 options) |
protected Class<? extends FileSystem> |
getConfigClass()
Gets the target of this configuration.
|
com.jcraft.jsch.ConfigRepository |
getConfigRepository(FileSystemOptions options)
Gets the config repository.
|
Duration |
getConnectTimeout(FileSystemOptions options)
Gets the connect timeout duration.
|
Integer |
getConnectTimeoutMillis(FileSystemOptions options)
Deprecated.
|
String |
getFileNameEncoding(FileSystemOptions options)
Gets the file name encoding.
|
File[] |
getIdentities(FileSystemOptions options)
Deprecated.
As of 2.1 use
getIdentityInfo(FileSystemOptions) |
IdentityInfo[] |
getIdentityInfo(FileSystemOptions options)
Gets the identity infos.
|
IdentityProvider[] |
getIdentityProvider(FileSystemOptions options)
Gets the identity providers.
|
IdentityRepositoryFactory |
getIdentityRepositoryFactory(FileSystemOptions options)
Get the identity repository factory.
|
static SftpFileSystemConfigBuilder |
getInstance()
Gets the singleton builder.
|
String |
getKeyExchangeAlgorithm(FileSystemOptions options) |
File |
getKnownHosts(FileSystemOptions options) |
String |
getPreferredAuthentications(FileSystemOptions options)
Gets authentication order.
|
String |
getProxyCommand(FileSystemOptions options)
Gets the command that will be run on the proxy host when using a SftpStreamProxy.
|
String |
getProxyHost(FileSystemOptions options)
Gets the proxy to use for the SFTP connection.
|
FileSystemOptions |
getProxyOptions(FileSystemOptions options)
Gets the proxy options that are used to connect to the proxy host.
|
String |
getProxyPassword(FileSystemOptions options)
Gets the proxy password that are used to connect to the proxy host.
|
int |
getProxyPort(FileSystemOptions options)
Gets the proxy-port to use for the SFTP the connection.
|
SftpFileSystemConfigBuilder.ProxyType |
getProxyType(FileSystemOptions options)
Gets the proxy type to use for the SFTP connection.
|
String |
getProxyUser(FileSystemOptions options)
Gets the user name for the proxy used for the SFTP connection.
|
Duration |
getSessionTimeout(FileSystemOptions options) |
Integer |
getSessionTimeoutMillis(FileSystemOptions options)
Deprecated.
|
String |
getStrictHostKeyChecking(FileSystemOptions options) |
Integer |
getTimeout(FileSystemOptions options)
Deprecated.
|
Boolean |
getUserDirIsRoot(FileSystemOptions options)
Returns
Boolean.TRUE if VFS should treat the user directory as the root directory. |
com.jcraft.jsch.UserInfo |
getUserInfo(FileSystemOptions options) |
boolean |
isDisableDetectExecChannel(FileSystemOptions options)
Returns
true if the detection of the exec channel should be disabled. |
boolean |
isLoadOpenSSHConfig(FileSystemOptions options)
Returns
Boolean.TRUE if VFS should load the OpenSSH config. |
void |
setCompression(FileSystemOptions options,
String compression)
Configures the compression algorithms to use.
|
void |
setConfigRepository(FileSystemOptions options,
com.jcraft.jsch.ConfigRepository configRepository)
Sets the config repository.
|
void |
setConnectTimeout(FileSystemOptions options,
Duration timeout)
Sets the timeout value to create a Jsch connection.
|
void |
setConnectTimeoutMillis(FileSystemOptions options,
Integer timeout)
Deprecated.
|
void |
setDisableDetectExecChannel(FileSystemOptions options,
boolean disableDetectExecChannel)
Sets whether detection of exec channel is disabled.
|
void |
setFileNameEncoding(FileSystemOptions options,
String fileNameEncoding)
Sets the file name encoding.
|
void |
setIdentities(FileSystemOptions options,
File... identityFiles)
Deprecated.
As of 2.1 use
setIdentityInfo(FileSystemOptions, IdentityInfo...) |
void |
setIdentityInfo(FileSystemOptions options,
IdentityInfo... identites)
Deprecated.
|
void |
setIdentityProvider(FileSystemOptions options,
IdentityProvider... identites)
Sets the identity info (your private key files).
|
void |
setIdentityRepositoryFactory(FileSystemOptions options,
IdentityRepositoryFactory factory)
Sets the identity repository.
|
void |
setKeyExchangeAlgorithm(FileSystemOptions options,
String keyExchangeAlgoritm)
Configures Key exchange algorithm explicitly e.g diffie-hellman-group14-sha1,
diffie-hellman-group-exchange-sha256, diffie-hellman-group-exchange-sha1, diffie-hellman-group1-sha1
|
void |
setKnownHosts(FileSystemOptions options,
File knownHosts)
Sets the known_hosts file.
|
void |
setLoadOpenSSHConfig(FileSystemOptions options,
boolean loadOpenSSHConfig)
Sets the whether to load OpenSSH config.
|
void |
setPreferredAuthentications(FileSystemOptions options,
String preferredAuthentications)
Configures authentication order.
|
void |
setProxyCommand(FileSystemOptions options,
String proxyCommand)
Sets the proxy username to use for the SFTP connection.
|
void |
setProxyHost(FileSystemOptions options,
String proxyHost)
Sets the proxy to use for the SFTP connection.
|
void |
setProxyOptions(FileSystemOptions options,
FileSystemOptions proxyOptions)
Sets the proxy username to use for the SFTP connection.
|
void |
setProxyPassword(FileSystemOptions options,
String proxyPassword)
Sets the proxy password to use for the SFTP connection.
|
void |
setProxyPort(FileSystemOptions options,
int proxyPort)
Sets the proxy port to use for the SFTP connection.
|
void |
setProxyType(FileSystemOptions options,
SftpFileSystemConfigBuilder.ProxyType proxyType)
Sets the proxy type to use for the SFTP connection.
|
void |
setProxyUser(FileSystemOptions options,
String proxyUser)
Sets the proxy username to use for the SFTP connection.
|
void |
setSessionTimeout(FileSystemOptions options,
Duration timeout)
Sets the timeout value on Jsch session.
|
void |
setSessionTimeoutMillis(FileSystemOptions options,
Integer timeout)
Deprecated.
|
void |
setStrictHostKeyChecking(FileSystemOptions options,
String hostKeyChecking)
Configures the host key checking to use.
|
void |
setTimeout(FileSystemOptions options,
Integer timeout)
Deprecated.
|
void |
setUserDirIsRoot(FileSystemOptions options,
boolean userDirIsRoot)
Sets the whether to use the user directory as root (do not change to file system root).
|
void |
setUserInfo(FileSystemOptions options,
com.jcraft.jsch.UserInfo info)
Sets the Jsch UserInfo class to use.
|
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getDuration, getDuration, getDurationInteger, getDurationInteger, getEnum, getEnum, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI, toBooleanObject
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 options)
options
- The FileSystem options.setCompression(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
protected Class<? extends FileSystem> getConfigClass()
FileSystemConfigBuilder
getConfigClass
in class FileSystemConfigBuilder
public com.jcraft.jsch.ConfigRepository getConfigRepository(FileSystemOptions options)
options
- The FileSystem options.public Duration getConnectTimeout(FileSystemOptions options)
options
- The FileSystem options.setConnectTimeoutMillis(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
@Deprecated public Integer getConnectTimeoutMillis(FileSystemOptions options)
getConnectTimeout(FileSystemOptions)
.options
- The FileSystem options.setConnectTimeoutMillis(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
public String getFileNameEncoding(FileSystemOptions options)
options
- The FileSystem options.@Deprecated public File[] getIdentities(FileSystemOptions options)
getIdentityInfo(FileSystemOptions)
We use java.io.File because JSch cannot deal with VFS FileObjects.
options
- The FileSystem options.setIdentities(org.apache.commons.vfs2.FileSystemOptions, java.io.File...)
public IdentityInfo[] getIdentityInfo(FileSystemOptions options)
options
- The FileSystem options.setIdentityInfo(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.provider.sftp.IdentityInfo...)
public IdentityProvider[] getIdentityProvider(FileSystemOptions options)
options
- The FileSystem options.setIdentityProvider(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.provider.sftp.IdentityProvider...)
public IdentityRepositoryFactory getIdentityRepositoryFactory(FileSystemOptions options)
options
- The FileSystem options.public String getKeyExchangeAlgorithm(FileSystemOptions options)
options
- The FileSystem options.setKeyExchangeAlgorithm(FileSystemOptions, String)
public File getKnownHosts(FileSystemOptions options)
options
- The FileSystem options.setKnownHosts(org.apache.commons.vfs2.FileSystemOptions, java.io.File)
public String getPreferredAuthentications(FileSystemOptions options)
options
- The FileSystem options.public String getProxyCommand(FileSystemOptions options)
options
- The FileSystem options.SftpStreamProxy
,
setProxyOptions(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.FileSystemOptions)
public String getProxyHost(FileSystemOptions options)
options
- The FileSystem options.getProxyPort(org.apache.commons.vfs2.FileSystemOptions)
,
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public FileSystemOptions getProxyOptions(FileSystemOptions options)
options
- The FileSystem options.SftpStreamProxy
,
setProxyOptions(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.FileSystemOptions)
public String getProxyPassword(FileSystemOptions options)
options
- The FileSystem options.SftpStreamProxy
,
setProxyPassword(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public int getProxyPort(FileSystemOptions options)
options
- The FileSystem options.setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)
,
getProxyHost(org.apache.commons.vfs2.FileSystemOptions)
public SftpFileSystemConfigBuilder.ProxyType getProxyType(FileSystemOptions options)
options
- The FileSystem options.public String getProxyUser(FileSystemOptions options)
options
- The FileSystem options.setProxyUser(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public Duration getSessionTimeout(FileSystemOptions options)
options
- The FileSystem options.setSessionTimeout(org.apache.commons.vfs2.FileSystemOptions, java.time.Duration)
@Deprecated public Integer getSessionTimeoutMillis(FileSystemOptions options)
getSessionTimeout(FileSystemOptions)
.options
- The FileSystem options.setSessionTimeoutMillis(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
public String getStrictHostKeyChecking(FileSystemOptions options)
options
- The FileSystem options.setStrictHostKeyChecking(FileSystemOptions, String)
@Deprecated public Integer getTimeout(FileSystemOptions options)
getSessionTimeoutMillis(FileSystemOptions)
options
- The FileSystem options.setTimeout(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
public Boolean getUserDirIsRoot(FileSystemOptions options)
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.options
- 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 options)
options
- The FileSystem options.setUserInfo(org.apache.commons.vfs2.FileSystemOptions, com.jcraft.jsch.UserInfo)
public boolean isDisableDetectExecChannel(FileSystemOptions options)
true
if the detection of the exec channel should be disabled.
Returns false
if the detection of the exec channel should be enabled.
Defaults to false
if the method setDisableDetectExecChannel(FileSystemOptions, boolean)
has not been invoked.options
- The FileSystemOptions.true
if detection of exec channel should be disabled.setDisableDetectExecChannel(FileSystemOptions, boolean)
public boolean isLoadOpenSSHConfig(FileSystemOptions options)
Boolean.TRUE
if VFS should load the OpenSSH config. Defaults to Boolean.FALSE
if the
method setLoadOpenSSHConfig(FileSystemOptions, boolean)
has not been invoked.options
- The FileSystemOptions.Boolean.TRUE
if VFS should load the OpenSSH config.setLoadOpenSSHConfig(org.apache.commons.vfs2.FileSystemOptions, boolean)
public void setCompression(FileSystemOptions options, String compression)
For example, use "zlib,none"
to enable compression.
See the Jsch documentation (in particular the README file) for details.
options
- The FileSystem options.compression
- The names of the compression algorithms, comma-separated.public void setConfigRepository(FileSystemOptions options, com.jcraft.jsch.ConfigRepository configRepository)
/home/user/.ssh/config
.
This is useful when you want to use OpenSSHConfig.
options
- The FileSystem options.configRepository
- An config repository.public void setConnectTimeout(FileSystemOptions options, Duration timeout)
options
- The FileSystem options.timeout
- The connect timeout in milliseconds.@Deprecated public void setConnectTimeoutMillis(FileSystemOptions options, Integer timeout)
setConnectTimeout(FileSystemOptions, Duration)
.options
- The FileSystem options.timeout
- The connect timeout in milliseconds.public void setDisableDetectExecChannel(FileSystemOptions options, boolean disableDetectExecChannel)
options
- The FileSystem options.disableDetectExecChannel
- true if the detection of exec channel should be disabled.public void setFileNameEncoding(FileSystemOptions options, String fileNameEncoding)
options
- The FileSystem options.fileNameEncoding
- The name of the encoding to use for file names.@Deprecated public void setIdentities(FileSystemOptions options, File... identityFiles)
setIdentityInfo(FileSystemOptions, IdentityInfo...)
We use File
because JSch cannot deal with VFS FileObjects.
options
- The FileSystem options.identityFiles
- An array of identity Files.@Deprecated public void setIdentityInfo(FileSystemOptions options, IdentityInfo... identites)
setIdentityProvider(FileSystemOptions,IdentityProvider...)
options
- The FileSystem options.identites
- An array of identity info.public void setIdentityProvider(FileSystemOptions options, IdentityProvider... identites)
options
- The FileSystem options.identites
- An array of identity info.public void setIdentityRepositoryFactory(FileSystemOptions options, IdentityRepositoryFactory factory)
This is useful when you want to use e.g. an SSH agent as provided.
options
- The FileSystem options.factory
- An identity repository.public void setKeyExchangeAlgorithm(FileSystemOptions options, String keyExchangeAlgoritm)
options
- The FileSystem options.keyExchangeAlgoritm
- The key exchange algorithm picked.public void setKnownHosts(FileSystemOptions options, File knownHosts)
/home/user/.ssh/known_hosts2
.
We use File
because JSch cannot deal with VFS FileObjects.
options
- The FileSystem options.knownHosts
- The known hosts file.public void setLoadOpenSSHConfig(FileSystemOptions options, boolean loadOpenSSHConfig)
options
- The FileSystem options.loadOpenSSHConfig
- true if the OpenSSH config should be loaded.public void setPreferredAuthentications(FileSystemOptions options, String preferredAuthentications)
options
- The FileSystem options.preferredAuthentications
- The authentication order.public void setProxyCommand(FileSystemOptions options, String proxyCommand)
options
- The FileSystem options.proxyCommand
- the portgetProxyOptions(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyHost(FileSystemOptions options, String proxyHost)
options
- The FileSystem options.proxyHost
- the hostsetProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)
public void setProxyOptions(FileSystemOptions options, FileSystemOptions proxyOptions)
options
- The FileSystem options.proxyOptions
- the optionsgetProxyOptions(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyPassword(FileSystemOptions options, String proxyPassword)
options
- The FileSystem options.proxyPassword
- the username used to connect to the proxygetProxyPassword(org.apache.commons.vfs2.FileSystemOptions)
public void setProxyPort(FileSystemOptions options, int proxyPort)
You MUST also set the proxy host to use the proxy.
options
- The FileSystem options.proxyPort
- the portsetProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
public void setProxyType(FileSystemOptions options, SftpFileSystemConfigBuilder.ProxyType proxyType)
The possibles values are:
options
- The FileSystem options.proxyType
- the type of the proxy to use.public void setProxyUser(FileSystemOptions options, String proxyUser)
options
- The FileSystem options.proxyUser
- the username used to connect to the proxygetProxyUser(org.apache.commons.vfs2.FileSystemOptions)
public void setSessionTimeout(FileSystemOptions options, Duration timeout)
options
- The FileSystem options.timeout
- The session timeout in milliseconds.@Deprecated public void setSessionTimeoutMillis(FileSystemOptions options, Integer timeout)
setSessionTimeout(FileSystemOptions, Duration)
.options
- The FileSystem options.timeout
- The session timeout in milliseconds.public void setStrictHostKeyChecking(FileSystemOptions options, String hostKeyChecking) throws FileSystemException
Valid arguments are: "yes"
, "no"
and "ask"
.
See the jsch documentation for details.
options
- The FileSystem options.hostKeyChecking
- The host key checking to use.FileSystemException
- if an error occurs.@Deprecated public void setTimeout(FileSystemOptions options, Integer timeout)
setSessionTimeout(FileSystemOptions, Duration)
options
- The FileSystem options.timeout
- The timeout in milliseconds.public void setUserDirIsRoot(FileSystemOptions options, boolean userDirIsRoot)
options
- The FileSystem options.userDirIsRoot
- true if the user directory is the root directory.public void setUserInfo(FileSystemOptions options, com.jcraft.jsch.UserInfo info)
options
- The FileSystem options.info
- User information.Copyright © 2002–2020 The Apache Software Foundation. All rights reserved.