org.pentaho.di.job.entries.ftpsget
Class FTPSConnection

java.lang.Object
  extended by org.pentaho.di.job.entries.ftpsget.FTPSConnection
All Implemented Interfaces:
EventListener, org.ftp4che.event.FTPListener

public class FTPSConnection
extends Object
implements org.ftp4che.event.FTPListener


Field Summary
static String COMMAND_SUCCESSUL
           
static String[] connection_type_Code
           
static String[] connection_type_Desc
           
static int CONNECTION_TYPE_FTP
           
static int CONNECTION_TYPE_FTP_AUTH_SSL
           
static int CONNECTION_TYPE_FTP_AUTH_TLS
           
static int CONNECTION_TYPE_FTP_IMPLICIT_SSL
           
static int CONNECTION_TYPE_FTP_IMPLICIT_SSL_WITH_CRYPTED
           
static int CONNECTION_TYPE_FTP_IMPLICIT_TLS
           
static int CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED
           
static String HOME_FOLDER
           
 
Constructor Summary
FTPSConnection(int connectionType, String hostname, int port, String username, String password)
           
 
Method Summary
 void changeDirectory(String directory)
          this method change FTP working directory
 void connect()
          this method is used to connect to a remote host
 void connectionStatusChanged(org.ftp4che.event.FTPEvent arg0)
           
 void createDirectory(String directory)
          this method is used to create a directory in remote host
 void deleteFile(org.ftp4che.util.ftpfile.FTPFile file)
          this method is used to delete a file in remote host
 void deleteFile(String filename)
          this method is used to delete a file in remote host
 void disconnect()
          this method is used to disconnect the connection
 void downloadFile(org.ftp4che.util.ftpfile.FTPFile file, String localFilename)
          this method is used to download a file from a remote host
 int getConnectionType()
           
static String getConnectionType(int i)
           
static int getConnectionTypeByCode(String tt)
           
static int getConnectionTypeByDesc(String tt)
           
static String getConnectionTypeCode(int i)
           
static String getConnectionTypeCode(String tt)
           
static String getConnectionTypeDesc(int i)
           
static String getConnectionTypeDesc(String tt)
           
 List<org.ftp4che.util.ftpfile.FTPFile> getFileList(String folder)
           
 String[] getFileNames()
          this method is used to return filenames in working directory
 ArrayList<String> getReplies()
           
 int getTimeOut()
          this method is used to return the timeout
 String getWorkingDirectory()
          Returns the working directory
 boolean isDirectoryExists(String directory)
          Checks if a directory exists
 boolean isFileExists(String filename)
          Checks if a file exists on remote host
 boolean isPassiveMode()
          this method is used to return the passive mode
 void moveToFolder(org.ftp4che.util.ftpfile.FTPFile fromFile, String targetFoldername)
          this method is used to move a file to remote directory
 void replyMessageArrived(org.ftp4che.event.FTPEvent event)
           
 void setBinaryMode(boolean type)
          public void setBinaryMode(boolean type) this method is used to set the transfer type to binary
 void setConnectionType(int connectiontype)
          this method is used to set the connection type
 void setPassiveMode(boolean passivemode)
          this method is used to set the mode to passive
 void setProxyHost(String proxyhost)
          this method is used to set the proxy host
 void setProxyPassword(String password)
          this method is used to set the proxy password
 void setProxyPort(int proxyport)
          this method is used to set the proxy port
 void setProxyUser(String username)
          this method is used to set the proxy username
 void setTimeOut(int timeout)
          this method is used to set the timeout
 void uploadFile(String localFileName, String shortFileName)
          this method is used to upload a file to a remote host
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOME_FOLDER

public static final String HOME_FOLDER
See Also:
Constant Field Values

COMMAND_SUCCESSUL

public static final String COMMAND_SUCCESSUL
See Also:
Constant Field Values

CONNECTION_TYPE_FTP

public static final int CONNECTION_TYPE_FTP
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_IMPLICIT_SSL

public static final int CONNECTION_TYPE_FTP_IMPLICIT_SSL
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_AUTH_SSL

public static final int CONNECTION_TYPE_FTP_AUTH_SSL
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_IMPLICIT_SSL_WITH_CRYPTED

public static final int CONNECTION_TYPE_FTP_IMPLICIT_SSL_WITH_CRYPTED
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_AUTH_TLS

public static final int CONNECTION_TYPE_FTP_AUTH_TLS
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_IMPLICIT_TLS

public static final int CONNECTION_TYPE_FTP_IMPLICIT_TLS
See Also:
Constant Field Values

CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED

public static final int CONNECTION_TYPE_FTP_IMPLICIT_TLS_WITH_CRYPTED
See Also:
Constant Field Values

connection_type_Desc

public static final String[] connection_type_Desc

connection_type_Code

public static final String[] connection_type_Code
Constructor Detail

FTPSConnection

public FTPSConnection(int connectionType,
                      String hostname,
                      int port,
                      String username,
                      String password)
Method Detail

setProxyHost

public void setProxyHost(String proxyhost)
this method is used to set the proxy host

Parameters:
type - true: proxy host

setProxyPort

public void setProxyPort(int proxyport)
this method is used to set the proxy port

Parameters:
type - true: proxy port

setProxyUser

public void setProxyUser(String username)
this method is used to set the proxy username

Parameters:
type - true: proxy username

setProxyPassword

public void setProxyPassword(String password)
this method is used to set the proxy password

Parameters:
type - true: proxy password

connect

public void connect()
             throws KettleException
this method is used to connect to a remote host

Throws:
KettleException

getConnectionTypeDesc

public static String getConnectionTypeDesc(String tt)

getConnectionTypeCode

public static String getConnectionTypeCode(String tt)

getConnectionTypeDesc

public static String getConnectionTypeDesc(int i)

getConnectionType

public static String getConnectionType(int i)

getConnectionTypeByDesc

public static int getConnectionTypeByDesc(String tt)

getConnectionTypeByCode

public static int getConnectionTypeByCode(String tt)

getConnectionTypeCode

public static String getConnectionTypeCode(int i)

setBinaryMode

public void setBinaryMode(boolean type)
                   throws KettleException
public void setBinaryMode(boolean type) this method is used to set the transfer type to binary

Parameters:
type - true: Binary
Throws:
KettleException

setPassiveMode

public void setPassiveMode(boolean passivemode)
this method is used to set the mode to passive

Parameters:
type - true: passive mode

isPassiveMode

public boolean isPassiveMode()
this method is used to return the passive mode

Returns:
TRUE if we use passive mode

setTimeOut

public void setTimeOut(int timeout)
this method is used to set the timeout

Parameters:
timeout -

getTimeOut

public int getTimeOut()
this method is used to return the timeout

Returns:
timeout

getReplies

public ArrayList<String> getReplies()

setConnectionType

public void setConnectionType(int connectiontype)
this method is used to set the connection type

Parameters:
type - true: connection type

getConnectionType

public int getConnectionType()

connectionStatusChanged

public void connectionStatusChanged(org.ftp4che.event.FTPEvent arg0)
Specified by:
connectionStatusChanged in interface org.ftp4che.event.FTPListener

replyMessageArrived

public void replyMessageArrived(org.ftp4che.event.FTPEvent event)
Specified by:
replyMessageArrived in interface org.ftp4che.event.FTPListener

changeDirectory

public void changeDirectory(String directory)
                     throws KettleException
this method change FTP working directory

Parameters:
directory - change the working directory
Throws:
KettleException

createDirectory

public void createDirectory(String directory)
                     throws KettleException
this method is used to create a directory in remote host

Parameters:
directory - directory name on remote host
Throws:
KettleException

getFileList

public List<org.ftp4che.util.ftpfile.FTPFile> getFileList(String folder)
                                                   throws KettleException
Throws:
KettleException

downloadFile

public void downloadFile(org.ftp4che.util.ftpfile.FTPFile file,
                         String localFilename)
                  throws KettleException
this method is used to download a file from a remote host

Parameters:
file - remote file to download
localFilename - target filename in local host
Throws:
KettleException

uploadFile

public void uploadFile(String localFileName,
                       String shortFileName)
                throws KettleException
this method is used to upload a file to a remote host

Parameters:
localFileName - Local full filename
shortFileName - Filename in remote host
Throws:
KettleException

getFileNames

public String[] getFileNames()
                      throws KettleException
this method is used to return filenames in working directory

Returns:
filenames
Throws:
KettleException

deleteFile

public void deleteFile(org.ftp4che.util.ftpfile.FTPFile file)
                throws KettleException
this method is used to delete a file in remote host

Parameters:
file - File on remote host to delete
Throws:
KettleException

deleteFile

public void deleteFile(String filename)
                throws KettleException
this method is used to delete a file in remote host

Parameters:
filename - Name of file on remote host to delete
Throws:
KettleException

moveToFolder

public void moveToFolder(org.ftp4che.util.ftpfile.FTPFile fromFile,
                         String targetFoldername)
                  throws KettleException
this method is used to move a file to remote directory

Parameters:
fromFile - File on remote host to move
targetFoldername - Target remote folder
Throws:
KettleException

isDirectoryExists

public boolean isDirectoryExists(String directory)
Checks if a directory exists

Returns:
true if the directory exists

isFileExists

public boolean isFileExists(String filename)
Checks if a file exists on remote host

Parameters:
filename - the name of the file to check
Returns:
true if the file exists

getWorkingDirectory

public String getWorkingDirectory()
                           throws Exception
Returns the working directory

Returns:
working directory
Throws:
Exception

disconnect

public void disconnect()
this method is used to disconnect the connection