com.bea.wli.sftp.spi
Class AbstractSFtpClient

java.lang.Object
  extended by com.bea.wli.sftp.spi.AbstractSFtpClient
All Implemented Interfaces:
SFtpClient

public abstract class AbstractSFtpClient
extends Object
implements SFtpClient

This class represents the abstract implementation of the Sftp client. The user is expected to implement all the methods provided in this class using third party SFTP client implementation.


Constructor Summary
AbstractSFtpClient(String hostName)
          Constructs SFTP client given the hostName
AbstractSFtpClient(String hostName, int port)
          Constructs the SFTP client given the host name and port number
 
Method Summary
 boolean acceptUnknownHostKeys()
          Returns whether to accept keys from unknown SFTP hosts
 SFtpAuthMethod getAuthenticationMethod()
          Retrieves the SFtp client authentication method
 HashMap<String,Object> getCustomProperties()
          Retrieves additional properties for connecting to SFTP server
 String getHostname()
          Returns the Host name of the SSH server
 int getPort()
          Return the port number of the SSH server
 SFtpVersion getSSHVersion()
          Retrieves the SSH version
 String getUserName()
          Returns the user name
 void setAcceptUnknownHostKeys(boolean accept)
          Sets whether to accept unknown host server keys or not
 void setAuthenticationMethod(SFtpAuthMethod authMethod)
          Sets the SFtp client authentication method
 void setCustomProperties(HashMap<String,Object> props)
          Sets the additional properties for connecting to SFTP server
 void setPassPhrase(char[] phrase)
          Sets the Pass phrase for the private key file
 void setPassword(char[] pwd)
          Sets the password used for authentication
 void setPrivateKeyFile(String path)
          Sets the Private key file for authentication
 void setSSHVersion(SFtpVersion sshVersion)
          Sets the SSH version
 void setUserName(String userName)
          Sets the user name for authentication
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bea.wli.sftp.spi.SFtpClient
cd, connect, disconnect, get, get, get, list, list, mkdir, mkdirs, put, put, pwd, rename, rm, rmdir
 

Constructor Detail

AbstractSFtpClient

public AbstractSFtpClient(String hostName)
Constructs SFTP client given the hostName

Parameters:
hostName - - host name of SFTP server

AbstractSFtpClient

public AbstractSFtpClient(String hostName,
                          int port)
Constructs the SFTP client given the host name and port number

Parameters:
hostName - - name of sftp server
port - - port on which SFTP daemon is running
Method Detail

setAuthenticationMethod

public void setAuthenticationMethod(SFtpAuthMethod authMethod)
Sets the SFtp client authentication method

Specified by:
setAuthenticationMethod in interface SFtpClient
Parameters:
authMethod - - auth method

getAuthenticationMethod

public SFtpAuthMethod getAuthenticationMethod()
Retrieves the SFtp client authentication method

Specified by:
getAuthenticationMethod in interface SFtpClient
Returns:
Auth method

setAcceptUnknownHostKeys

public void setAcceptUnknownHostKeys(boolean accept)
Sets whether to accept unknown host server keys or not

Specified by:
setAcceptUnknownHostKeys in interface SFtpClient
Parameters:
accept - - whether to accept unknown host keys

acceptUnknownHostKeys

public boolean acceptUnknownHostKeys()
Returns whether to accept keys from unknown SFTP hosts

Specified by:
acceptUnknownHostKeys in interface SFtpClient
Returns:
whether to accept keys from unknown hosts or not

setSSHVersion

public void setSSHVersion(SFtpVersion sshVersion)
Sets the SSH version

Specified by:
setSSHVersion in interface SFtpClient
Parameters:
sshVersion - - SSH version

getSSHVersion

public SFtpVersion getSSHVersion()
Retrieves the SSH version

Specified by:
getSSHVersion in interface SFtpClient
Returns:
SSH version

setUserName

public void setUserName(String userName)
Sets the user name for authentication

Specified by:
setUserName in interface SFtpClient
Parameters:
userName - - name of the user

getUserName

public String getUserName()
Returns the user name

Specified by:
getUserName in interface SFtpClient
Returns:
user name

getHostname

public String getHostname()
Returns the Host name of the SSH server

Specified by:
getHostname in interface SFtpClient
Returns:
host name

getPort

public int getPort()
Return the port number of the SSH server

Specified by:
getPort in interface SFtpClient
Returns:
port number

setPassword

public void setPassword(char[] pwd)
Sets the password used for authentication

Specified by:
setPassword in interface SFtpClient
Parameters:
pwd - - password

setPassPhrase

public void setPassPhrase(char[] phrase)
Sets the Pass phrase for the private key file

Specified by:
setPassPhrase in interface SFtpClient
Parameters:
phrase - - pass phrase

setPrivateKeyFile

public void setPrivateKeyFile(String path)
Sets the Private key file for authentication

Specified by:
setPrivateKeyFile in interface SFtpClient
Parameters:
path - - path to the private key file

setCustomProperties

public void setCustomProperties(HashMap<String,Object> props)
Sets the additional properties for connecting to SFTP server

Specified by:
setCustomProperties in interface SFtpClient
Parameters:
props - - name value pairs

getCustomProperties

public HashMap<String,Object> getCustomProperties()
Retrieves additional properties for connecting to SFTP server

Specified by:
getCustomProperties in interface SFtpClient
Returns:
set of name/value pairs