Class SftpFileSystemConfigBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Proxy type. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SftpFileSystemConfigBuilder.ProxyType
HTTP Proxy.static final SftpFileSystemConfigBuilder.ProxyType
SOCKS Proxy.static final SftpFileSystemConfigBuilder.ProxyType
Connects to the SFTP server through a remote host reached by SSH. -
Method Summary
Modifier and TypeMethodDescriptiongetCompression
(FileSystemOptions options) Gets the names of the compression algorithms, comma-separated.protected Class<? extends FileSystem>
Gets the target of this configuration.com.jcraft.jsch.ConfigRepository
getConfigRepository
(FileSystemOptions options) Gets the config repository.getConnectTimeout
(FileSystemOptions options) Gets the connect timeout duration.getConnectTimeoutMillis
(FileSystemOptions options) Deprecated.getFileNameEncoding
(FileSystemOptions options) Gets the file name encoding.File[]
getIdentities
(FileSystemOptions options) Deprecated.As of 2.1 usegetIdentityInfo(FileSystemOptions)
getIdentityInfo
(FileSystemOptions options) Gets the identity infos.getIdentityProvider
(FileSystemOptions options) Gets the identity providers.Gets the identity repository factory.static SftpFileSystemConfigBuilder
Gets the singleton builder.getKeyExchangeAlgorithm
(FileSystemOptions options) Gets the option value for specific key exchange algorithm.getKnownHosts
(FileSystemOptions options) Gets the known hosts File.Gets authentication order.getProxyCommand
(FileSystemOptions options) Gets the command that will be run on the proxy host when using a SftpStreamProxy.getProxyHost
(FileSystemOptions options) Gets the proxy to use for the SFTP connection.getProxyOptions
(FileSystemOptions options) Gets the proxy options that are used to connect to the proxy host.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.getProxyType
(FileSystemOptions options) Gets the proxy type to use for the SFTP connection.getProxyUser
(FileSystemOptions options) Gets the user name for the proxy used for the SFTP connection.getSessionTimeout
(FileSystemOptions options) Gets the session timeout value in milliseconds.getSessionTimeoutMillis
(FileSystemOptions options) Deprecated.Gets the option value The host key checking.getTimeout
(FileSystemOptions options) Deprecated.getUserDirIsRoot
(FileSystemOptions options) GetsBoolean.TRUE
if VFS should treat the user directory as the root directory.com.jcraft.jsch.UserInfo
getUserInfo
(FileSystemOptions options) Gets the UserInfo.boolean
Returnstrue
if the detection of the exec channel should be disabled.boolean
isLoadOpenSSHConfig
(FileSystemOptions options) ReturnsBoolean.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. e.g.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 usesetIdentityInfo(FileSystemOptions, IdentityInfo...)
void
setIdentityInfo
(FileSystemOptions options, IdentityInfo... identities) Deprecated.void
setIdentityProvider
(FileSystemOptions options, IdentityProvider... identities) Sets the identity info (your private key files).void
setIdentityRepositoryFactory
(FileSystemOptions options, IdentityRepositoryFactory factory) Sets the identity repository.void
setKeyExchangeAlgorithm
(FileSystemOptions options, String keyExchangeAlgorithm) 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. e.g.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.Methods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
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, getParamOrDefault, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI, toBooleanObject
-
Field Details
-
PROXY_HTTP
HTTP Proxy. -
PROXY_SOCKS5
SOCKS Proxy. -
PROXY_STREAM
Connects to the SFTP server through a remote host reached by SSH.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. Optionally, 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.
-
-
Method Details
-
getInstance
Gets the singleton builder.- Returns:
- the singleton builder.
-
getCompression
Gets the names of the compression algorithms, comma-separated.- Parameters:
options
- The FileSystem options.- Returns:
- The names of the compression algorithms, comma-separated.
- See Also:
-
getConfigClass
Description copied from class:FileSystemConfigBuilder
Gets the target of this configuration.- Specified by:
getConfigClass
in classFileSystemConfigBuilder
- Returns:
- the specific file system class
-
getConfigRepository
Gets the config repository.- Parameters:
options
- The FileSystem options.- Returns:
- the ConfigRepository
-
getConnectTimeout
Gets the connect timeout duration.- Parameters:
options
- The FileSystem options.- Returns:
- The connect timeout duration.
- Since:
- 2.8.0
- See Also:
-
getConnectTimeoutMillis
Deprecated.Gets the connect timeout duration.- Parameters:
options
- The FileSystem options.- Returns:
- The connect timeout value in milliseconds.
- Since:
- 2.3
- See Also:
-
getFileNameEncoding
Gets the file name encoding.- Parameters:
options
- The FileSystem options.- Returns:
- the file name encoding
-
getIdentities
Deprecated.As of 2.1 usegetIdentityInfo(FileSystemOptions)
Gets the identity files (your private key files).We use java.io.File because JSch cannot deal with VFS FileObjects.
- Parameters:
options
- The FileSystem options.- Returns:
- the array of identity Files.
- See Also:
-
getIdentityInfo
Gets the identity infos.- Parameters:
options
- The FileSystem options.- Returns:
- the array of identity info.
- See Also:
-
getIdentityProvider
Gets the identity providers.- Parameters:
options
- The FileSystem options.- Returns:
- the array of identity providers.
- Since:
- 2.4
- See Also:
-
getIdentityRepositoryFactory
Gets the identity repository factory.- Parameters:
options
- The FileSystem options.- Returns:
- the IdentityRepositoryFactory
-
getKeyExchangeAlgorithm
Gets the option value for specific key exchange algorithm.- Parameters:
options
- The FileSystem options.- Returns:
- the option value for specific key exchange algorithm.
- Since:
- 2.4
- See Also:
-
getKnownHosts
Gets the known hosts File.- Parameters:
options
- The FileSystem options.- Returns:
- the known hosts File.
- See Also:
-
getPreferredAuthentications
Gets authentication order.- Parameters:
options
- The FileSystem options.- Returns:
- The authentication order.
- Since:
- 2.0
-
getProxyCommand
Gets the command that will be run on the proxy host when using a SftpStreamProxy. The command defaults to SftpStreamProxy.NETCAT_COMMAND.- Parameters:
options
- The FileSystem options.- Returns:
- proxyOptions
- Since:
- 2.1
- See Also:
-
getProxyHost
Gets the proxy to use for the SFTP connection.- Parameters:
options
- The FileSystem options.- Returns:
- proxyHost
- See Also:
-
getProxyOptions
Gets the proxy options that are used to connect to the proxy host.- Parameters:
options
- The FileSystem options.- Returns:
- proxyOptions
- Since:
- 2.1
- See Also:
-
getProxyPassword
Gets the proxy password that are used to connect to the proxy host.- Parameters:
options
- The FileSystem options.- Returns:
- proxyOptions
- Since:
- 2.1
- See Also:
-
getProxyPort
Gets the proxy-port to use for the SFTP the connection.- Parameters:
options
- The FileSystem options.- Returns:
- proxyPort: the port number or 0 if it is not set
- See Also:
-
getProxyType
Gets the proxy type to use for the SFTP connection.- Parameters:
options
- The FileSystem options.- Returns:
- The ProxyType.
-
getProxyUser
Gets the user name for the proxy used for the SFTP connection.- Parameters:
options
- The FileSystem options.- Returns:
- proxyUser
- Since:
- 2.1
- See Also:
-
getSessionTimeout
Gets the session timeout value in milliseconds.- Parameters:
options
- The FileSystem options.- Returns:
- The session timeout value in milliseconds.
- Since:
- 2.3
- See Also:
-
getSessionTimeoutMillis
Deprecated.Gets the session timeout value in milliseconds.- Parameters:
options
- The FileSystem options.- Returns:
- The session timeout value in milliseconds.
- Since:
- 2.3
- See Also:
-
getStrictHostKeyChecking
Gets the option value The host key checking.- Parameters:
options
- The FileSystem options.- Returns:
- the option value The host key checking.
- See Also:
-
getTimeout
Deprecated.Gets the timeout value in milliseconds.- Parameters:
options
- The FileSystem options.- Returns:
- The timeout value in milliseconds.
- See Also:
-
getUserDirIsRoot
GetsBoolean.TRUE
if VFS should treat the user directory as the root directory. Defaults toBoolean.TRUE
if the methodsetUserDirIsRoot(FileSystemOptions, boolean)
has not been invoked.- Parameters:
options
- The FileSystemOptions.- Returns:
Boolean.TRUE
if VFS treats the user directory as the root directory.- See Also:
-
getUserInfo
Gets the UserInfo.- Parameters:
options
- The FileSystem options.- Returns:
- The UserInfo.
- See Also:
-
isDisableDetectExecChannel
Returnstrue
if the detection of the exec channel should be disabled. Returnsfalse
if the detection of the exec channel should be enabled. Defaults tofalse
if the methodsetDisableDetectExecChannel(FileSystemOptions, boolean)
has not been invoked.- Parameters:
options
- The FileSystemOptions.- Returns:
true
if detection of exec channel should be disabled.- Since:
- 2.7.0
- See Also:
-
isLoadOpenSSHConfig
ReturnsBoolean.TRUE
if VFS should load the OpenSSH config. Defaults toBoolean.FALSE
if the methodsetLoadOpenSSHConfig(FileSystemOptions, boolean)
has not been invoked.- Parameters:
options
- The FileSystemOptions.- Returns:
Boolean.TRUE
if VFS should load the OpenSSH config.- See Also:
-
setCompression
Configures the compression algorithms to use.For example, use
"zlib,none"
to enable compression.See the Jsch documentation (in particular the README file) for details.
- Parameters:
options
- The FileSystem options.compression
- The names of the compression algorithms, comma-separated.
-
setConfigRepository
public void setConfigRepository(FileSystemOptions options, com.jcraft.jsch.ConfigRepository configRepository) Sets the config repository. e.g./home/user/.ssh/config
.This is useful when you want to use OpenSSHConfig.
- Parameters:
options
- The FileSystem options.configRepository
- An config repository.- See Also:
-
setConnectTimeout
Sets the timeout value to create a Jsch connection.- Parameters:
options
- The FileSystem options.timeout
- The connect timeout in milliseconds.- Since:
- 2.8.0
-
setConnectTimeoutMillis
Deprecated.Sets the timeout value to create a Jsch connection.- Parameters:
options
- The FileSystem options.timeout
- The connect timeout in milliseconds.- Since:
- 2.3
-
setDisableDetectExecChannel
public void setDisableDetectExecChannel(FileSystemOptions options, boolean disableDetectExecChannel) Sets whether detection of exec channel is disabled. If this value is true the FileSystem will not test if the server allows to exec commands and disable the use of the exec channel.- Parameters:
options
- The FileSystem options.disableDetectExecChannel
- true if the detection of exec channel should be disabled.- Since:
- 2.7.0
-
setFileNameEncoding
Sets the file name encoding.- Parameters:
options
- The FileSystem options.fileNameEncoding
- The name of the encoding to use for file names.
-
setIdentities
Deprecated.As of 2.1 usesetIdentityInfo(FileSystemOptions, IdentityInfo...)
Sets the identity files (your private key files).We use
File
because JSch cannot deal with VFS FileObjects.- Parameters:
options
- The FileSystem options.identityFiles
- An array of identity Files.
-
setIdentityInfo
Deprecated.Sets the identity info (your private key files).- Parameters:
options
- The FileSystem options.identities
- An array of identity info.- Since:
- 2.1
-
setIdentityProvider
Sets the identity info (your private key files).- Parameters:
options
- The FileSystem options.identities
- An array of identity info.- Since:
- 2.4
-
setIdentityRepositoryFactory
public void setIdentityRepositoryFactory(FileSystemOptions options, IdentityRepositoryFactory factory) Sets the identity repository.This is useful when you want to use e.g. an SSH agent as provided.
- Parameters:
options
- The FileSystem options.factory
- An identity repository.- See Also:
-
setKeyExchangeAlgorithm
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.- Parameters:
options
- The FileSystem options.keyExchangeAlgorithm
- The key exchange algorithm picked.- Since:
- 2.4
-
setKnownHosts
Sets the known_hosts file. e.g./home/user/.ssh/known_hosts2
.We use
File
because JSch cannot deal with VFS FileObjects.- Parameters:
options
- The FileSystem options.knownHosts
- The known hosts file.
-
setLoadOpenSSHConfig
Sets the whether to load OpenSSH config.- Parameters:
options
- The FileSystem options.loadOpenSSHConfig
- true if the OpenSSH config should be loaded.
-
setPreferredAuthentications
Configures authentication order.- Parameters:
options
- The FileSystem options.preferredAuthentications
- The authentication order.- Since:
- 2.0
-
setProxyCommand
Sets the proxy username to use for the SFTP connection.- Parameters:
options
- The FileSystem options.proxyCommand
- the port- Since:
- 2.1
- See Also:
-
setProxyHost
Sets the proxy to use for the SFTP connection. You MUST also set the proxy port to use the proxy.- Parameters:
options
- The FileSystem options.proxyHost
- the host- See Also:
-
setProxyOptions
Sets the proxy username to use for the SFTP connection.- Parameters:
options
- The FileSystem options.proxyOptions
- the options- Since:
- 2.1
- See Also:
-
setProxyPassword
Sets the proxy password to use for the SFTP connection.- Parameters:
options
- The FileSystem options.proxyPassword
- the username used to connect to the proxy- Since:
- 2.1
- See Also:
-
setProxyPort
Sets the proxy port to use for the SFTP connection.You MUST also set the proxy host to use the proxy.
- Parameters:
options
- The FileSystem options.proxyPort
- the port- See Also:
-
setProxyType
public void setProxyType(FileSystemOptions options, SftpFileSystemConfigBuilder.ProxyType proxyType) Sets the proxy type to use for the SFTP connection.The possibles values are:
- PROXY_HTTP connects using an HTTP proxy
- PROXY_SOCKS5 connects using an Socket5 proxy
- PROXY_STREAM connects through a remote host stream command
- Parameters:
options
- The FileSystem options.proxyType
- the type of the proxy to use.
-
setProxyUser
Sets the proxy username to use for the SFTP connection.- Parameters:
options
- The FileSystem options.proxyUser
- the username used to connect to the proxy- Since:
- 2.1
- See Also:
-
setSessionTimeout
Sets the timeout value on Jsch session.- Parameters:
options
- The FileSystem options.timeout
- The session timeout in milliseconds.- Since:
- 2.8.0
-
setSessionTimeoutMillis
Deprecated.Sets the timeout value on Jsch session.- Parameters:
options
- The FileSystem options.timeout
- The session timeout in milliseconds.- Since:
- 2.3
-
setStrictHostKeyChecking
public void setStrictHostKeyChecking(FileSystemOptions options, String hostKeyChecking) throws FileSystemException Configures the host key checking to use.Valid arguments are:
"yes"
,"no"
and"ask"
.See the jsch documentation for details.
- Parameters:
options
- The FileSystem options.hostKeyChecking
- The host key checking to use.- Throws:
FileSystemException
- if an error occurs.
-
setTimeout
Deprecated.Sets the timeout value on Jsch session.- Parameters:
options
- The FileSystem options.timeout
- The timeout in milliseconds.
-
setUserDirIsRoot
Sets the whether to use the user directory as root (do not change to file system root).- Parameters:
options
- The FileSystem options.userDirIsRoot
- true if the user directory is the root directory.
-
setUserInfo
Sets the Jsch UserInfo class to use.- Parameters:
options
- The FileSystem options.info
- User information.
-
getConnectTimeout(FileSystemOptions)
.