org.apache.commons.vfs2.provider.sftp
Class SftpFileSystemConfigBuilder

java.lang.Object
  extended by org.apache.commons.vfs2.FileSystemConfigBuilder
      extended by org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder

public final class SftpFileSystemConfigBuilder
extends FileSystemConfigBuilder

The config BUILDER for various sftp configuration options.

Author:
Commons VFS team

Nested Class Summary
static class SftpFileSystemConfigBuilder.ProxyType
          Proxy type.
 
Field Summary
static SftpFileSystemConfigBuilder.ProxyType PROXY_HTTP
          HTTP Proxy.
static SftpFileSystemConfigBuilder.ProxyType PROXY_SOCKS5
          SOCKS Proxy.
 
Method Summary
 String getCompression(FileSystemOptions opts)
           
protected  Class<? extends FileSystem> getConfigClass()
           
 File[] getIdentities(FileSystemOptions opts)
           
static SftpFileSystemConfigBuilder getInstance()
           
 File getKnownHosts(FileSystemOptions opts)
           
 String getPreferredAuthentications(FileSystemOptions opts)
          Get authentication order.
 String getProxyHost(FileSystemOptions opts)
          Get the proxy to use for sftp connection.
 int getProxyPort(FileSystemOptions opts)
          Get the proxy-port to use for sftp the connection You have to set the ProxyHost too if you would like to have the proxy relly used.
 SftpFileSystemConfigBuilder.ProxyType getProxyType(FileSystemOptions opts)
          Get the proxy type to use for sftp connection.
 String getStrictHostKeyChecking(FileSystemOptions opts)
           
 Integer getTimeout(FileSystemOptions opts)
           
 Boolean getUserDirIsRoot(FileSystemOptions opts)
           
 com.jcraft.jsch.UserInfo getUserInfo(FileSystemOptions opts)
           
 void setCompression(FileSystemOptions opts, String compression)
          configure the compression to use.
e.g.
 void setIdentities(FileSystemOptions opts, File[] identities)
          Set the identity files (your private key files).
Need to use a java.io.File as JSch cant deal with vfs FileObjects ;-)
 void setKnownHosts(FileSystemOptions opts, File sshdir)
          Set the known_hosts file.
 void setPreferredAuthentications(FileSystemOptions opts, String preferredAuthentications)
          Configure authentication order.
 void setProxyHost(FileSystemOptions opts, String proxyHost)
          Set the proxy to use for sftp connection.
You have to set the ProxyPort too if you would like to have the proxy relly used.
 void setProxyPort(FileSystemOptions opts, int proxyPort)
          Set the proxy-port to use for sftp connection.
 void setProxyType(FileSystemOptions opts, SftpFileSystemConfigBuilder.ProxyType proxyType)
          Set the proxy type to use for sftp connection.
 void setStrictHostKeyChecking(FileSystemOptions opts, String hostKeyChecking)
          configure the host key checking to use.
valid arguments are only yes, no and ask.
See the jsch documentation for details.
 void setTimeout(FileSystemOptions opts, Integer timeout)
          set the timeout value on jsch session.
 void setUserDirIsRoot(FileSystemOptions opts, boolean userDirIsRoot)
          use user directory as root (do not change to fs root).
 void setUserInfo(FileSystemOptions opts, com.jcraft.jsch.UserInfo info)
          Set the userinfo class to use if e.g.
 
Methods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setRootURI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROXY_HTTP

public static final SftpFileSystemConfigBuilder.ProxyType PROXY_HTTP
HTTP Proxy.


PROXY_SOCKS5

public static final SftpFileSystemConfigBuilder.ProxyType PROXY_SOCKS5
SOCKS Proxy.

Method Detail

getInstance

public static SftpFileSystemConfigBuilder getInstance()

setUserInfo

public void setUserInfo(FileSystemOptions opts,
                        com.jcraft.jsch.UserInfo info)
Set the userinfo class to use if e.g. a password or a not known host will be contacted.

Parameters:
opts - The FileSystem options.
info - User information.

getUserInfo

public com.jcraft.jsch.UserInfo getUserInfo(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
The UserInfo.
See Also:
setUserInfo(org.apache.commons.vfs2.FileSystemOptions, com.jcraft.jsch.UserInfo)

setKnownHosts

public void setKnownHosts(FileSystemOptions opts,
                          File sshdir)
                   throws FileSystemException
Set the known_hosts file. e.g. /home/user/.ssh/known_hosts2
Need to use a java.io.File as JSch cant deal with vfs FileObjects ;-)

Parameters:
opts - The FileSystem options.
sshdir - The known hosts directory.
Throws:
FileSystemException - if an error occurs.

getKnownHosts

public File getKnownHosts(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
the known hosts File.
See Also:
setKnownHosts(org.apache.commons.vfs2.FileSystemOptions, java.io.File)

setIdentities

public void setIdentities(FileSystemOptions opts,
                          File[] identities)
                   throws FileSystemException
Set the identity files (your private key files).
Need to use a java.io.File as JSch cant deal with vfs FileObjects ;-)

Parameters:
opts - The FileSystem options.
identities - An array of identity Files.
Throws:
FileSystemException - if an error occurs.

setCompression

public void setCompression(FileSystemOptions opts,
                           String compression)
                    throws FileSystemException
configure the compression to use.
e.g. pass "zlib,none" to enable the compression.
See the jsch documentation for details.

Parameters:
opts - The FileSystem options.
compression - The compression algorithm name.
Throws:
FileSystemException - if an error occurs.

getCompression

public String getCompression(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
The name of the compression algorithm.
See Also:
setCompression(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)

getIdentities

public File[] getIdentities(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
the array of identity Files.
See Also:
setIdentities(org.apache.commons.vfs2.FileSystemOptions, java.io.File[])

setStrictHostKeyChecking

public void setStrictHostKeyChecking(FileSystemOptions opts,
                                     String hostKeyChecking)
                              throws FileSystemException
configure the host key checking to use.
valid arguments are only 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.

getStrictHostKeyChecking

public String getStrictHostKeyChecking(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
the option value The host key checking.
See Also:
setStrictHostKeyChecking(FileSystemOptions, String)

setUserDirIsRoot

public void setUserDirIsRoot(FileSystemOptions opts,
                             boolean userDirIsRoot)
use user directory as root (do not change to fs root).

Parameters:
opts - The FileSystem options.
userDirIsRoot - true if the user dir is the root directory.

getUserDirIsRoot

public Boolean getUserDirIsRoot(FileSystemOptions opts)
Parameters:
opts - The FileSystemOptions.
Returns:
true if the user directory is the root.
See Also:
setUserDirIsRoot(org.apache.commons.vfs2.FileSystemOptions, boolean)

setTimeout

public void setTimeout(FileSystemOptions opts,
                       Integer timeout)
set the timeout value on jsch session.

Parameters:
opts - The FileSystem options.
timeout - The timeout.

getTimeout

public Integer getTimeout(FileSystemOptions opts)
Parameters:
opts - The FileSystem options.
Returns:
The timeout value.
See Also:
setTimeout(org.apache.commons.vfs2.FileSystemOptions, java.lang.Integer)

getConfigClass

protected Class<? extends FileSystem> getConfigClass()
Specified by:
getConfigClass in class FileSystemConfigBuilder

setProxyHost

public void setProxyHost(FileSystemOptions opts,
                         String proxyHost)
Set the proxy to use for sftp connection.
You have to set the ProxyPort too if you would like to have the proxy relly used.

Parameters:
opts - The FileSystem options.
proxyHost - the host
See Also:
setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)

setProxyPort

public void setProxyPort(FileSystemOptions opts,
                         int proxyPort)
Set the proxy-port to use for sftp connection. You have to set the ProxyHost too if you would like to have the proxy relly used.

Parameters:
opts - The FileSystem options.
proxyPort - the port
See Also:
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)

getProxyHost

public String getProxyHost(FileSystemOptions opts)
Get the proxy to use for sftp connection. You have to set the ProxyPort too if you would like to have the proxy relly used.

Parameters:
opts - The FileSystem options.
Returns:
proxyHost
See Also:
setProxyPort(org.apache.commons.vfs2.FileSystemOptions, int)

getProxyPort

public int getProxyPort(FileSystemOptions opts)
Get the proxy-port to use for sftp the connection You have to set the ProxyHost too if you would like to have the proxy relly used.

Parameters:
opts - The FileSystem options.
Returns:
proxyPort: the port number or 0 if it is not set
See Also:
setProxyHost(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)

setProxyType

public void setProxyType(FileSystemOptions opts,
                         SftpFileSystemConfigBuilder.ProxyType proxyType)
Set the proxy type to use for sftp connection.

Parameters:
opts - The FileSystem options.
proxyType - the type of the proxy to use.

getProxyType

public SftpFileSystemConfigBuilder.ProxyType getProxyType(FileSystemOptions opts)
Get the proxy type to use for sftp connection.

Parameters:
opts - The FileSystem options.
Returns:
The ProxyType.

setPreferredAuthentications

public void setPreferredAuthentications(FileSystemOptions opts,
                                        String preferredAuthentications)
Configure authentication order.

Parameters:
opts - The FileSystem options.
preferredAuthentications - The authentication order.
Since:
2.0

getPreferredAuthentications

public String getPreferredAuthentications(FileSystemOptions opts)
Get authentication order.

Parameters:
opts - The FileSystem options.
Returns:
The authentication order.
Since:
2.0


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.