Class AbstractFtpSessionFactory<T extends org.apache.commons.net.ftp.FTPClient>

java.lang.Object
org.springframework.integration.ftp.session.AbstractFtpSessionFactory<T>
All Implemented Interfaces:
SessionFactory<org.apache.commons.net.ftp.FTPFile>
Direct Known Subclasses:
DefaultFtpSessionFactory, DefaultFtpsSessionFactory

public abstract class AbstractFtpSessionFactory<T extends org.apache.commons.net.ftp.FTPClient>
extends Object
implements SessionFactory<org.apache.commons.net.ftp.FTPFile>
Base class for FTP SessionFactory implementations.
Since:
2.0
Author:
Iwein Fuld, Mark Fisher, Oleg Zhurakousky
  • Field Details

  • Constructor Details

  • Method Details

    • setFileType

      public void setFileType​(int fileType)
      File types defined by FTP constants:
      • FTP.ASCII_FILE_TYPE
      • FTP.EBCDIC_FILE_TYPE
      • FTP.BINARY_FILE_TYPE (DEFAULT)
      • FTP.LOCAL_FILE_TYPE
      Parameters:
      fileType - The file type.
    • setControlEncoding

      public void setControlEncoding​(String controlEncoding)
    • setConfig

      public void setConfig​(org.apache.commons.net.ftp.FTPClientConfig config)
    • setBufferSize

      public void setBufferSize​(int bufferSize)
    • setHost

      public void setHost​(String host)
    • setPort

      public void setPort​(int port)
    • setUsername

      public void setUsername​(String user)
    • setPassword

      public void setPassword​(String pass)
    • setClientMode

      public void setClientMode​(int clientMode)
      ACTIVE_LOCAL_DATA_CONNECTION_MODE = 0
      A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server should connect to the client's data port to initiate a data transfer. This is the default data connection mode when and FTPClient instance is created. PASSIVE_LOCAL_DATA_CONNECTION_MODE = 2
      A constant indicating the FTP session is expecting all transfers to occur between the client (local) and server and that the server is in passive mode, requiring the client to connect to the server's data port to initiate a transfer.
      Parameters:
      clientMode - The client mode.
    • setConnectTimeout

      public void setConnectTimeout​(int connectTimeout)
      Set the connect timeout for the socket.
      Parameters:
      connectTimeout - the timeout
    • setDefaultTimeout

      public void setDefaultTimeout​(int defaultTimeout)
      Set the (socket option) timeout on the command socket.
      Parameters:
      defaultTimeout - the timeout.
    • setDataTimeout

      public void setDataTimeout​(int dataTimeout)
      Set the (socket option) timeout on the data connection.
      Parameters:
      dataTimeout - the timeout.
    • getSession

      public FtpSession getSession()
      Specified by:
      getSession in interface SessionFactory<T extends org.apache.commons.net.ftp.FTPClient>
    • createClientInstance

      protected abstract T createClientInstance()
    • postProcessClientAfterConnect

      protected void postProcessClientAfterConnect​(T t) throws IOException
      Will handle additional initialization after client.connect() method was invoked, but before any action on the client has been taken
      Parameters:
      t - The client.
      Throws:
      IOException - Any IOException
    • postProcessClientBeforeConnect

      protected void postProcessClientBeforeConnect​(T client) throws IOException
      Will handle additional initialization before client.connect() method was invoked.
      Parameters:
      client - The client.
      Throws:
      IOException - Any IOException.