Class FtpSession

java.lang.Object
org.frankframework.filesystem.ftp.FtpSession
All Implemented Interfaces:
HasApplicationContext, IConfigurable, IScopeProvider, HasKeystore, HasTruststore
Direct Known Subclasses:
FtpFileSystem

public class FtpSession extends Object implements IConfigurable, HasKeystore, HasTruststore
Base class for FTP(s) connections
Author:
John Dekker
  • Constructor Details

    • FtpSession

      public FtpSession()
  • Method Details

    • configure

      public void configure() throws ConfigurationException
      Description copied from interface: IConfigurable
      Configure this component.

      configure() is called once at startup of the framework in the configure method of the owner of this IConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in the configure(), to improve performance.

      In the case of a container, this will propagate the configure signal to all components that apply.

      Specified by:
      configure in interface IConfigurable
      Throws:
      ConfigurationException - in case it was not able to configure the component.
    • openClient

      public org.apache.commons.net.ftp.FTPClient openClient(String remoteDirectory) throws FileSystemException
      Throws:
      FileSystemException
    • close

      public static void close(org.apache.commons.net.ftp.FTPClient ftpClient)
    • close

      public void close()
    • setHost

      public void setHost(String string)
      Name or ip address of remote host
    • setPort

      public void setPort(int i)
      Port number of remote host
      Default value
      21
    • setAuthAlias

      public void setAuthAlias(String string)
      Name of the alias to obtain credentials to authenticatie on remote server
    • setUsername

      public void setUsername(String string)
      Name of the user to authenticatie on remote server
    • setPassword

      public void setPassword(String string)
      Password to authenticatie on remote server
    • setProxyHost

      public void setProxyHost(String string)
      Proxy hostname
    • setProxyPort

      public void setProxyPort(int i)
      Proxy port
      Default value
      1080
    • setFtpType

      public void setFtpType(FtpSession.FtpType value)
      FTP protocol to use
      Default value
      FTP
    • setFileType

      public void setFileType(FtpSession.FileType value)
    • setPassive

      public void setPassive(boolean b)
      If true, passive ftp is used: before data is sent, a pasv command is issued, and the connection is set up by the server
      Default value
      true
    • setProxyTransportType

      public void setProxyTransportType(FtpSession.TransportType type)
      (ftps) Transport type in case of sftp
      Default value
      SOCKS5
    • setKeystore

      public void setKeystore(String string)
      (ftps) Resource url to keystore or certificate to be used for authentication. If none specified, the JVMs default keystore will be used.
      Specified by:
      setKeystore in interface HasKeystore
    • setKeystoreType

      public void setKeystoreType(KeystoreType value)
      (ftps) Type of keystore
      Specified by:
      setKeystoreType in interface HasKeystore
      Default value
      pkcs12
    • setKeystoreAuthAlias

      public void setKeystoreAuthAlias(String string)
      (ftps) Authentication alias used to obtain keystore password
      Specified by:
      setKeystoreAuthAlias in interface HasKeystore
    • setKeystorePassword

      public void setKeystorePassword(String string)
      (ftps) Default password to access keystore
      Specified by:
      setKeystorePassword in interface HasKeystore
    • setKeyManagerAlgorithm

      public void setKeyManagerAlgorithm(String keyManagerAlgorithm)
      (ftps) Key manager algorithm. Can be left empty to use the servers default algorithm
      Specified by:
      setKeyManagerAlgorithm in interface HasKeystore
    • setKeystoreAlias

      public void setKeystoreAlias(String string)
      (ftps) Alias to obtain specific certificate or key in keystore
      Specified by:
      setKeystoreAlias in interface HasKeystore
    • setKeystoreAliasAuthAlias

      public void setKeystoreAliasAuthAlias(String string)
      (ftps) Authentication alias to authenticate access to certificate or key indicated by keystoreAlias
      Specified by:
      setKeystoreAliasAuthAlias in interface HasKeystore
    • setKeystoreAliasPassword

      public void setKeystoreAliasPassword(String string)
      (ftps) Default password to authenticate access to certificate or key indicated by keystoreAlias
      Specified by:
      setKeystoreAliasPassword in interface HasKeystore
    • setTruststore

      public void setTruststore(String string)
      (ftps) Resource url to truststore to be used for authenticating peer. If none specified, the JVMs default truststore will be used.
      Specified by:
      setTruststore in interface HasTruststore
    • setTruststoreType

      public void setTruststoreType(KeystoreType value)
      (ftps) Type of truststore
      Specified by:
      setTruststoreType in interface HasTruststore
      Default value
      jks
    • setTruststoreAuthAlias

      public void setTruststoreAuthAlias(String string)
      (ftps) Authentication alias used to obtain truststore password
      Specified by:
      setTruststoreAuthAlias in interface HasTruststore
    • setTruststorePassword

      public void setTruststorePassword(String string)
      (ftps) Default password to access truststore
      Specified by:
      setTruststorePassword in interface HasTruststore
    • setTrustManagerAlgorithm

      public void setTrustManagerAlgorithm(String trustManagerAlgorithm)
      (ftps) Trust manager algorithm. Can be left empty to use the servers default algorithm
      Specified by:
      setTrustManagerAlgorithm in interface HasTruststore
    • setVerifyHostname

      @Unsafe public void setVerifyHostname(boolean b)
      (ftps) If true, the hostname in the certificate will be checked against the actual hostname of the peer
      Specified by:
      setVerifyHostname in interface HasTruststore
    • setAllowSelfSignedCertificates

      @Unsafe public void setAllowSelfSignedCertificates(boolean b)
      (ftps) If true, self signed certificates are accepted
      Specified by:
      setAllowSelfSignedCertificates in interface HasTruststore
      Default value
      false
    • setIgnoreCertificateExpiredException

      @Unsafe public void setIgnoreCertificateExpiredException(boolean b)
      (ftps) If true, CertificateExpiredExceptions are ignored
      Specified by:
      setIgnoreCertificateExpiredException in interface HasTruststore
      Default value
      false
    • setProt

      public void setProt(FtpSession.Prot prot)
      Sets the Data Channel Protection Level.
      Default value
      C