org.apache.commons.vfs.provider.sftp
Class SftpClientFactory

java.lang.Object
  extended by org.apache.commons.vfs.provider.sftp.SftpClientFactory

public class SftpClientFactory
extends java.lang.Object

Create a HttpClient instance

Version:
$Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
Author:
Mario Ivankovits

Field Summary
private static java.lang.String SSH_DIR_NAME
           
 
Constructor Summary
private SftpClientFactory()
           
 
Method Summary
static com.jcraft.jsch.Session createConnection(java.lang.String hostname, int port, char[] username, char[] password, FileSystemOptions fileSystemOptions)
          Creates a new connection to the server.
private static java.io.File findSshDir()
          Finds the .ssh directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SSH_DIR_NAME

private static final java.lang.String SSH_DIR_NAME
See Also:
Constant Field Values
Constructor Detail

SftpClientFactory

private SftpClientFactory()
Method Detail

createConnection

public static com.jcraft.jsch.Session createConnection(java.lang.String hostname,
                                                       int port,
                                                       char[] username,
                                                       char[] password,
                                                       FileSystemOptions fileSystemOptions)
                                                throws FileSystemException
Creates a new connection to the server.

Throws:
FileSystemException

findSshDir

private static java.io.File findSshDir()
Finds the .ssh directory.

The lookup order is:

  1. The system property vfs.sftp.sshdir (the override mechanism)
  2. {user.home}/.ssh
  3. On Windows only: C:\cygwin\home\{user.name}\.ssh
  4. The current directory, as a last resort.
    1. Windows Notes: The default installation directory for Cygwin is C:\cygwin. On my set up (Gary here), I have Cygwin in C:\bin\cygwin, not the default. Also, my .ssh directory was created in the {user.home} directory.

      Returns:
      The .ssh directory