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 TypeMethodDescriptionprotected Class<? extends FileSystem>
Get the target of this configuration.Gets the file name encoding.File[]
Deprecated.Gets the identity info.Get the identity repository factory.static SftpFileSystemConfigBuilder
Gets the singleton builder.Gets authentication order.Gets the command that will be run on the proxy host when using a SftpStreamProxy.Gets the proxy to use for the SFTP connection.Gets the proxy options that are used to connect to the proxy host.Gets the proxy password that are used to connect to the proxy host.int
Gets the proxy-port to use for the SFTP the connection.Gets the proxy type to use for the SFTP connection.Gets the user name for the proxy used for the SFTP connection.getTimeout
(FileSystemOptions opts) ReturnsBoolean.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 usesetIdentityInfo(FileSystemOptions, IdentityInfo...)
void
setIdentityInfo
(FileSystemOptions opts, IdentityInfo... identites) Sets the identity info (your private key files).void
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.Methods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
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
-
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. 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.
-
-
Method Details
-
getInstance
Gets the singleton builder.- Returns:
- the singleton builder.
-
getCompression
- Parameters:
opts
- The FileSystem options.- Returns:
- The names of the compression algorithms, comma-separated.
- See Also:
-
getConfigClass
Description copied from class:FileSystemConfigBuilder
Get the target of this configuration.- Specified by:
getConfigClass
in classFileSystemConfigBuilder
- Returns:
- the specific file system class
-
getFileNameEncoding
Gets the file name encoding.- Parameters:
opts
- 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:
opts
- The FileSystem options.- Returns:
- the array of identity Files.
- See Also:
-
getIdentityInfo
Gets the identity info.- Parameters:
opts
- The FileSystem options.- Returns:
- the array of identity info instances.
- See Also:
-
getIdentityRepositoryFactory
Get the identity repository factory.- Parameters:
opts
- The FileSystem options.- Returns:
- the IdentityRepositoryFactory
-
getKnownHosts
- Parameters:
opts
- The FileSystem options.- Returns:
- the known hosts File.
- See Also:
-
getPreferredAuthentications
Gets authentication order.- Parameters:
opts
- 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:
opts
- The FileSystem options.- Returns:
- proxyOptions
- Since:
- 2.1
- See Also:
-
getProxyHost
Gets the proxy to use for the SFTP connection.- Parameters:
opts
- The FileSystem options.- Returns:
- proxyHost
- See Also:
-
getProxyOptions
Gets the proxy options that are used to connect to the proxy host.- Parameters:
opts
- 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:
opts
- The FileSystem options.- Returns:
- proxyOptions
- Since:
- 2.1
- See Also:
-
getProxyPort
Gets the proxy-port to use for the SFTP the connection.- Parameters:
opts
- 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:
opts
- The FileSystem options.- Returns:
- The ProxyType.
-
getProxyUser
Gets the user name for the proxy used for the SFTP connection.- Parameters:
opts
- The FileSystem options.- Returns:
- proxyUser
- Since:
- 2.1
- See Also:
-
getStrictHostKeyChecking
- Parameters:
opts
- The FileSystem options.- Returns:
- the option value The host key checking.
- See Also:
-
getTimeout
- Parameters:
opts
- The FileSystem options.- Returns:
- The timeout value in milliseconds.
- See Also:
-
getUserDirIsRoot
ReturnsBoolean.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:
opts
- The FileSystemOptions.- Returns:
Boolean.TRUE
if VFS treats the user directory as the root directory.- See Also:
-
getUserInfo
- Parameters:
opts
- The FileSystem options.- Returns:
- The UserInfo.
- 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:
opts
- The FileSystem options.compression
- The names of the compression algorithms, comma-separated.- Throws:
FileSystemException
- if an error occurs.
-
setFileNameEncoding
Sets the file name encoding.- Parameters:
opts
- The FileSystem options.fileNameEncoding
- The name of the encoding to use for file names.
-
setIdentities
@Deprecated public void setIdentities(FileSystemOptions opts, File... identityFiles) throws FileSystemException 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:
opts
- The FileSystem options.identityFiles
- An array of identity Files.- Throws:
FileSystemException
- if an error occurs.
-
setIdentityInfo
public void setIdentityInfo(FileSystemOptions opts, IdentityInfo... identites) throws FileSystemException Sets the identity info (your private key files).- Parameters:
opts
- The FileSystem options.identites
- An array of identity info.- Throws:
FileSystemException
- if an error occurs.- Since:
- 2.1
-
setIdentityRepositoryFactory
public void setIdentityRepositoryFactory(FileSystemOptions opts, IdentityRepositoryFactory factory) throws FileSystemException Set the identity repository.This is useful when you want to use e.g. an SSH agent as provided.
- Parameters:
opts
- The FileSystem options.factory
- An identity repository.- Throws:
FileSystemException
- if an error occurs.- See Also:
-
setKnownHosts
Sets the known_hosts file. e.g./home/user/.ssh/known_hosts2
.We use
File
because JSch cannot deal with VFS FileObjects.- Parameters:
opts
- The FileSystem options.knownHosts
- The known hosts file.- Throws:
FileSystemException
- if an error occurs.
-
setPreferredAuthentications
Configures authentication order.- Parameters:
opts
- The FileSystem options.preferredAuthentications
- The authentication order.- Since:
- 2.0
-
setProxyCommand
Sets the proxy username to use for the SFTP connection.- Parameters:
opts
- 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:
opts
- The FileSystem options.proxyHost
- the host- See Also:
-
setProxyOptions
Sets the proxy username to use for the SFTP connection.- Parameters:
opts
- The FileSystem options.proxyOptions
- the options- Since:
- 2.1
- See Also:
-
setProxyPassword
Sets the proxy password to use for the SFTP connection.- Parameters:
opts
- 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:
opts
- The FileSystem options.proxyPort
- the port- See Also:
-
setProxyType
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:
opts
- The FileSystem options.proxyType
- the type of the proxy to use.
-
setProxyUser
Sets the proxy username to use for the SFTP connection.- Parameters:
opts
- The FileSystem options.proxyUser
- the username used to connect to the proxy- Since:
- 2.1
- See Also:
-
setStrictHostKeyChecking
public void setStrictHostKeyChecking(FileSystemOptions opts, 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:
opts
- The FileSystem options.hostKeyChecking
- The host key checking to use.- Throws:
FileSystemException
- if an error occurs.
-
setTimeout
Sets the timeout value on Jsch session.- Parameters:
opts
- 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:
opts
- The FileSystem options.userDirIsRoot
- true if the user directory is the root directory.
-
setUserInfo
Sets the Jsch UserInfo class to use.- Parameters:
opts
- The FileSystem options.info
- User information.
-
getIdentityInfo(FileSystemOptions)