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()
Gets the target of this configuration.
|
com.jcraft.jsch.ConfigRepository |
getConfigRepository(FileSystemOptions opts)
Gets the config repository.
|
Integer |
getConnectTimeoutMillis(FileSystemOptions opts) |
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 infos.
|
IdentityProvider[] |
getIdentityProvider(FileSystemOptions opts)
Gets the identity providers.
|
IdentityRepositoryFactory |
getIdentityRepositoryFactory(FileSystemOptions opts)
Get the identity repository factory.
|
static SftpFileSystemConfigBuilder |
getInstance()
Gets the singleton builder.
|
String |
getKeyExchangeAlgorithm(FileSystemOptions opts) |
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.
|
Integer |
getSessionTimeoutMillis(FileSystemOptions opts) |
String |
getStrictHostKeyChecking(FileSystemOptions opts) |
Integer |
getTimeout(FileSystemOptions opts)
Deprecated.
|
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) |
boolean |
isDisableDetectExecChannel(FileSystemOptions opts)
Returns
true if the detection of the exec channel should be disabled. |
boolean |
isLoadOpenSSHConfig(FileSystemOptions opts)
Returns
Boolean.TRUE if VFS should load the OpenSSH config. |
void |
setCompression(FileSystemOptions opts,
String compression)
Configures the compression algorithms to use.
|
void |
setConfigRepository(FileSystemOptions opts,
com.jcraft.jsch.ConfigRepository configRepository)
Sets the config repository.
|
void |
setConnectTimeoutMillis(FileSystemOptions opts,
Integer timeout)
Sets the timeout value to create a Jsch connection.
|
void |
setDisableDetectExecChannel(FileSystemOptions opts,
boolean disableDetectExecChannel)
Sets whether detection of exec channel is disabled.
|
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)
Deprecated.
|
void |
setIdentityProvider(FileSystemOptions opts,
IdentityProvider... identites)
Sets the identity info (your private key files).
|
void |
setIdentityRepositoryFactory(FileSystemOptions opts,
IdentityRepositoryFactory factory)
Sets the identity repository.
|
void |
setKeyExchangeAlgorithm(FileSystemOptions opts,
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 opts,
File knownHosts)
Sets the known_hosts file.
|
void |
setLoadOpenSSHConfig(FileSystemOptions opts,
boolean loadOpenSSHConfig)
Sets the whether to load OpenSSH config.
|
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 |
setSessionTimeoutMillis(FileSystemOptions opts,
Integer timeout)
Sets the timeout value on Jsch session.
|
void |
setStrictHostKeyChecking(FileSystemOptions opts,
String hostKeyChecking)
Configures the host key checking to use.
|
void |
setTimeout(FileSystemOptions opts,
Integer timeout)
Deprecated.
|
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, 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 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 com.jcraft.jsch.ConfigRepository getConfigRepository(FileSystemOptions opts)
opts
- The FileSystem options.public Integer getConnectTimeoutMillis(FileSystemOptions opts)
opts
- The FileSystem options.setConnectTimeoutMillis(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
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 IdentityProvider[] getIdentityProvider(FileSystemOptions opts)
opts
- The FileSystem options.setIdentityProvider(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.vfs2.provider.sftp.IdentityProvider...)
public IdentityRepositoryFactory getIdentityRepositoryFactory(FileSystemOptions opts)
opts
- The FileSystem options.public String getKeyExchangeAlgorithm(FileSystemOptions opts)
opts
- The FileSystem options.setKeyExchangeAlgorithm(FileSystemOptions, String)
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 Integer getSessionTimeoutMillis(FileSystemOptions opts)
opts
- The FileSystem options.setSessionTimeoutMillis(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)
public String getStrictHostKeyChecking(FileSystemOptions opts)
opts
- The FileSystem options.setStrictHostKeyChecking(FileSystemOptions, String)
@Deprecated public Integer getTimeout(FileSystemOptions opts)
getSessionTimeoutMillis(FileSystemOptions)
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 boolean isDisableDetectExecChannel(FileSystemOptions opts)
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.opts
- The FileSystemOptions.true
if detection of exec channel should be disabled.setDisableDetectExecChannel(FileSystemOptions, boolean)
public boolean isLoadOpenSSHConfig(FileSystemOptions opts)
Boolean.TRUE
if VFS should load the OpenSSH config. Defaults to Boolean.FALSE
if the
method setLoadOpenSSHConfig(FileSystemOptions, boolean)
has not been invoked.opts
- The FileSystemOptions.Boolean.TRUE
if VFS should load the OpenSSH config.setLoadOpenSSHConfig(org.apache.commons.vfs2.FileSystemOptions, boolean)
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 setConfigRepository(FileSystemOptions opts, com.jcraft.jsch.ConfigRepository configRepository) throws FileSystemException
/home/user/.ssh/config
.
This is useful when you want to use OpenSSHConfig.
opts
- The FileSystem options.configRepository
- An config repository.FileSystemException
- if an error occurs.public void setConnectTimeoutMillis(FileSystemOptions opts, Integer timeout)
opts
- The FileSystem options.timeout
- The connect timeout in milliseconds.public void setDisableDetectExecChannel(FileSystemOptions opts, boolean disableDetectExecChannel)
opts
- The FileSystem options.disableDetectExecChannel
- true if the detection of exec channel should be disabled.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.@Deprecated public void setIdentityInfo(FileSystemOptions opts, IdentityInfo... identites) throws FileSystemException
setIdentityProvider(FileSystemOptions,IdentityProvider...)
opts
- The FileSystem options.identites
- An array of identity info.FileSystemException
- if an error occurs.public void setIdentityProvider(FileSystemOptions opts, IdentityProvider... 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 setKeyExchangeAlgorithm(FileSystemOptions opts, String keyExchangeAlgoritm)
opts
- The FileSystem options.keyExchangeAlgoritm
- The key exchange algorithm picked.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 setLoadOpenSSHConfig(FileSystemOptions opts, boolean loadOpenSSHConfig)
opts
- The FileSystem options.loadOpenSSHConfig
- true if the OpenSSH config should be loaded.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)
The possibles values are:
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 setSessionTimeoutMillis(FileSystemOptions opts, Integer timeout)
opts
- The FileSystem options.timeout
- The session timeout in milliseconds.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.@Deprecated public void setTimeout(FileSystemOptions opts, Integer timeout)
setSessionTimeoutMillis(FileSystemOptions, Integer)
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.