Class FtpFileSystemConfigBuilder

java.lang.Object
org.apache.commons.vfs2.FileSystemConfigBuilder
org.apache.commons.vfs2.provider.ftp.FtpFileSystemConfigBuilder

public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder
The config builder for various FTP configuration options.
  • Field Details

    • _PREFIX

      private static final String _PREFIX
    • BUILDER

      private static final FtpFileSystemConfigBuilder BUILDER
    • AUTODETECT_UTF8

      private static final String AUTODETECT_UTF8
    • CONNECT_TIMEOUT

      private static final String CONNECT_TIMEOUT
    • DATA_TIMEOUT

      private static final String DATA_TIMEOUT
    • DEFAULT_DATE_FORMAT

      private static final String DEFAULT_DATE_FORMAT
    • ENCODING

      private static final String ENCODING
    • FACTORY_KEY

      private static final String FACTORY_KEY
    • FILE_TYPE

      private static final String FILE_TYPE
    • PASSIVE_MODE

      private static final String PASSIVE_MODE
    • PROXY

      private static final String PROXY
    • RECENT_DATE_FORMAT

      private static final String RECENT_DATE_FORMAT
    • REMOTE_VERIFICATION

      private static final String REMOTE_VERIFICATION
    • SERVER_LANGUAGE_CODE

      private static final String SERVER_LANGUAGE_CODE
    • SERVER_TIME_ZONE_ID

      private static final String SERVER_TIME_ZONE_ID
    • SHORT_MONTH_NAMES

      private static final String SHORT_MONTH_NAMES
    • SO_TIMEOUT

      private static final String SO_TIMEOUT
    • CONTROL_KEEP_ALIVE_TIMEOUT

      private static final String CONTROL_KEEP_ALIVE_TIMEOUT
    • CONTROL_KEEP_ALIVE_REPLY_TIMEOUT

      private static final String CONTROL_KEEP_ALIVE_REPLY_TIMEOUT
    • USER_DIR_IS_ROOT

      private static final String USER_DIR_IS_ROOT
    • TRANSFER_ABORTED_OK_REPLY_CODES

      private static final String TRANSFER_ABORTED_OK_REPLY_CODES
    • MDTM_LAST_MODIFED_TIME

      private static final String MDTM_LAST_MODIFED_TIME
  • Constructor Details

    • FtpFileSystemConfigBuilder

      private FtpFileSystemConfigBuilder()
    • FtpFileSystemConfigBuilder

      protected FtpFileSystemConfigBuilder(String prefix)
      Create new config builder with specified prefix string.
      Parameters:
      prefix - prefix string to use for parameters of this config builder.
      Since:
      2.1
  • Method Details

    • getInstance

      public static FtpFileSystemConfigBuilder getInstance()
      Gets the singleton instance.
      Returns:
      the singleton instance.
    • getSaneTransferAbortedOkReplyCodes

      public static List<Integer> getSaneTransferAbortedOkReplyCodes()
    • getAutodetectUtf8

      public Boolean getAutodetectUtf8(FileSystemOptions options)
      Gets whether to try to autodetect the server encoding (only UTF8 is supported).
      Parameters:
      options - The FileSystemOptions.
      Returns:
      True if autodetection should be done.
      Since:
      2.4
    • getConfigClass

      protected Class<? extends FileSystem> getConfigClass()
      Description copied from class: FileSystemConfigBuilder
      Gets the target of this configuration.
      Specified by:
      getConfigClass in class FileSystemConfigBuilder
      Returns:
      the specific file system class
    • getConnectTimeout

      @Deprecated public Integer getConnectTimeout(FileSystemOptions options)
      Gets the timeout in milliseconds to use for the socket connection.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The timeout in milliseconds to use for the socket connection.
      Since:
      2.1
    • getConnectTimeoutDuration

      public Duration getConnectTimeoutDuration(FileSystemOptions options)
      Gets the timeout in milliseconds to use for the socket connection.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The timeout in milliseconds to use for the socket connection.
      Since:
      2.8.0
    • getControlEncoding

      public String getControlEncoding(FileSystemOptions options)
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The encoding.
      Since:
      2.0
    • getControlKeepAliveReplyTimeout

      public Duration getControlKeepAliveReplyTimeout(FileSystemOptions options)
      Parameters:
      options - The FileSystem options
      Returns:
      The controlKeepAliveReplyTimeout value.
      Since:
      2.8.0
    • getControlKeepAliveTimeout

      public Duration getControlKeepAliveTimeout(FileSystemOptions options)
      Parameters:
      options - The FileSystem options
      Returns:
      The controlKeepAliveTimeout value.
      Since:
      2.8.0
    • getDataTimeout

      @Deprecated public Integer getDataTimeout(FileSystemOptions options)
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The timeout for opening the data channel in milliseconds.
      See Also:
    • getDataTimeoutDuration

      public Duration getDataTimeoutDuration(FileSystemOptions options)
      Gets the timeout for opening the data channel.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The timeout for opening the data channel.
      Since:
      2.8.0
      See Also:
    • getDefaultDateFormat

      public String getDefaultDateFormat(FileSystemOptions options)
      Get the default date format used by the server. See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions
      Returns:
      The default date format.
    • getEntryParser

      public String getEntryParser(FileSystemOptions options)
      Parameters:
      options - The FileSystemOptions.
      Returns:
      the key to the EntryParser.
      See Also:
    • getEntryParserFactory

      public org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory getEntryParserFactory(FileSystemOptions options)
      Parameters:
      options - The FlleSystemOptions.
      Returns:
      An FTPFileEntryParserFactory.
      See Also:
    • getFileType

      public FtpFileType getFileType(FileSystemOptions options)
      Gets the file type parameter.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      A FtpFileType
      Since:
      2.1
    • getMdtmLastModifiedTime

      public Boolean getMdtmLastModifiedTime(FileSystemOptions options)
      Gets the option to use FTP MDTM for FileContent.getLastModifiedTime().
      Parameters:
      options - The FileSystemOptions.
      Returns:
      true if MDTM should be used.
      Since:
      2.8.0
    • getPassiveMode

      public Boolean getPassiveMode(FileSystemOptions options)
      Parameters:
      options - The FileSystemOptions.
      Returns:
      true if passive mode is set.
      See Also:
    • getProxy

      public Proxy getProxy(FileSystemOptions options)
      Gets the Proxy.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      the Proxy
      Since:
      2.1
    • getRecentDateFormat

      public String getRecentDateFormat(FileSystemOptions options)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The recent date format.
    • getRemoteVerification

      public Boolean getRemoteVerification(FileSystemOptions options)
      Gets whether to use remote verification.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      True if remote verification should be done.
    • getServerLanguageCode

      public String getServerLanguageCode(FileSystemOptions options)
      Get the language code used by the server. See FTPClientConfig for details and examples.
      Parameters:
      options - The FilesystemOptions.
      Returns:
      The language code of the server.
    • getServerTimeZoneId

      public String getServerTimeZoneId(FileSystemOptions options)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      The server timezone id.
    • getShortMonthNames

      public String[] getShortMonthNames(FileSystemOptions options)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      An array of short month names.
    • getSoTimeout

      @Deprecated public Integer getSoTimeout(FileSystemOptions options)
      Gets The so timeout duration in milliseconds.
      Parameters:
      options - The FileSystem options.
      Returns:
      The so timeout duration in milliseconds.
      Since:
      2.0
      See Also:
    • getSoTimeoutDuration

      public Duration getSoTimeoutDuration(FileSystemOptions options)
      Gets The so timeout duration.
      Parameters:
      options - The FileSystem options.
      Returns:
      The timeout value in milliseconds.
      Since:
      2.8.0
      See Also:
    • getTransferAbortedOkReplyCodes

      public List<Integer> getTransferAbortedOkReplyCodes(FileSystemOptions options)
      Parameters:
      options - The FileSystem options.
      Returns:
      The list of reply codes (apart from 200) that are considered as OK when prematurely closing a stream.
      Since:
      2.4
    • getUserDirIsRoot

      public Boolean getUserDirIsRoot(FileSystemOptions options)
      Returns Boolean.TRUE if VFS should treat the user directory as the root directory. Defaults to Boolean.TRUE if the method setUserDirIsRoot(FileSystemOptions, boolean) has not been invoked.
      Parameters:
      options - The FileSystemOptions.
      Returns:
      Boolean.TRUE if VFS treats the user directory as the root directory.
      See Also:
    • setAutodetectUtf8

      public void setAutodetectUtf8(FileSystemOptions options, Boolean autodetectUTF8)
      Sets whether to try to autodetect the server encoding (only UTF8 is supported).
      Parameters:
      options - The FileSystemOptions.
      autodetectUTF8 - true if autodetection should be done.
      Since:
      2.4
    • setConnectTimeout

      public void setConnectTimeout(FileSystemOptions options, Duration duration)
      Sets the timeout for the initial control connection.

      If you set the connectTimeout to null no connectTimeout will be set.

      Parameters:
      options - The FileSystemOptions.
      duration - the timeout duration in milliseconds
      Since:
      2.8.0
    • setConnectTimeout

      @Deprecated public void setConnectTimeout(FileSystemOptions options, Integer duration)
      Sets the timeout for the initial control connection.

      If you set the connectTimeout to null no connectTimeout will be set.

      Parameters:
      options - The FileSystemOptions.
      duration - the timeout duration.
      Since:
      2.1
    • setControlEncoding

      public void setControlEncoding(FileSystemOptions options, String encoding)
      See FTP.setControlEncoding(java.lang.String) for details and examples.
      Parameters:
      options - The FileSystemOptions.
      encoding - the encoding to use
      Since:
      2.0
    • setControlKeepAliveReplyTimeout

      public void setControlKeepAliveReplyTimeout(FileSystemOptions options, Duration duration)
      Sets the control keep alive reply timeout for the FTP client.
      Parameters:
      options - The FileSystem options.
      duration - timeout duration.
      Since:
      2.8.0
    • setControlKeepAliveTimeout

      public void setControlKeepAliveTimeout(FileSystemOptions options, Duration duration)
      Sets the control keep alive timeout for the FTP client.

      Set the controlKeepAliveTimeout to ensure the socket be alive after download huge file.

      Parameters:
      options - The FileSystem options.
      duration - The timeout duration.
      Since:
      2.8.0
    • setDataTimeout

      public void setDataTimeout(FileSystemOptions options, Duration duration)
      Set the data timeout for the FTP client.

      If you set the dataTimeout to null, no dataTimeout will be set on the FTP client.

      Parameters:
      options - The FileSystemOptions.
      duration - The timeout duration.
      Since:
      2.8.0
    • setDataTimeout

      @Deprecated public void setDataTimeout(FileSystemOptions options, Integer duration)
      Set the data timeout for the FTP client.

      If you set the dataTimeout to null, no dataTimeout will be set on the FTP client.

      Parameters:
      options - The FileSystemOptions.
      duration - The timeout value.
    • setDefaultDateFormat

      public void setDefaultDateFormat(FileSystemOptions options, String defaultDateFormat)
      Set the default date format used by the server. See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      defaultDateFormat - The default date format.
    • setEntryParser

      public void setEntryParser(FileSystemOptions options, String key)
      Set the FQCN of your FileEntryParser used to parse the directory listing from your server.

      If you do not use the default commons-net FTPFileEntryParserFactory e.g. by using setEntryParserFactory(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory) this is the "key" parameter passed as argument into your custom factory.

      Parameters:
      options - The FileSystemOptions.
      key - The key.
    • setEntryParserFactory

      public void setEntryParserFactory(FileSystemOptions options, org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory factory)
      FTPFileEntryParserFactory which will be used for ftp-entry parsing.
      Parameters:
      options - The FileSystemOptions.
      factory - instance of your factory
    • setFileType

      public void setFileType(FileSystemOptions options, FtpFileType ftpFileType)
      Sets the file type parameter.
      Parameters:
      options - The FileSystemOptions.
      ftpFileType - A FtpFileType
      Since:
      2.1
    • setMdtmLastModifiedTime

      public void setMdtmLastModifiedTime(FileSystemOptions options, boolean mdtm)
      Sets the option to use FTP MDTM for FileContent.getLastModifiedTime().
      Parameters:
      options - The FileSystemOptions.
      mdtm - true if MDTM should be used.
      Since:
      2.8.0
    • setPassiveMode

      public void setPassiveMode(FileSystemOptions options, boolean passiveMode)
      Enter into passive mode.
      Parameters:
      options - The FileSystemOptions.
      passiveMode - true if passive mode should be used.
    • setProxy

      public void setProxy(FileSystemOptions options, Proxy proxy)
      Sets the Proxy.

      You might need to make sure that passive mode is activated.

      Parameters:
      options - the FileSystem options.
      proxy - the Proxy
      Since:
      2.1
    • setRecentDateFormat

      public void setRecentDateFormat(FileSystemOptions options, String recentDateFormat)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      recentDateFormat - The recent date format.
    • setRemoteVerification

      public void setRemoteVerification(FileSystemOptions options, boolean remoteVerification)
      Sets whether to use remote verification.
      Parameters:
      options - The FileSystemOptions.
      remoteVerification - True if verification should be done.
    • setServerLanguageCode

      public void setServerLanguageCode(FileSystemOptions options, String serverLanguageCode)
      Set the language code used by the server. See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      serverLanguageCode - The servers language code.
    • setServerTimeZoneId

      public void setServerTimeZoneId(FileSystemOptions options, String serverTimeZoneId)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      serverTimeZoneId - The server timezone id.
    • setShortMonthNames

      public void setShortMonthNames(FileSystemOptions options, String[] shortMonthNames)
      See FTPClientConfig for details and examples.
      Parameters:
      options - The FileSystemOptions.
      shortMonthNames - an array of short month name Strings.
    • setSoTimeout

      public void setSoTimeout(FileSystemOptions options, Duration timeout)
      Sets the socket timeout for the FTP client.

      If you set the soTimeout to null, no socket timeout will be set on the FTP client.

      Parameters:
      options - The FileSystem options.
      timeout - The timeout value in milliseconds.
      Since:
      2.8.0
    • setSoTimeout

      @Deprecated public void setSoTimeout(FileSystemOptions options, Integer timeout)
      Sets the socket timeout for the FTP client.

      If you set the soTimeout to null, no socket timeout will be set on the FTP client.

      Parameters:
      options - The FileSystem options.
      timeout - The timeout value in milliseconds.
      Since:
      2.0
    • setTransferAbortedOkReplyCodes

      public void setTransferAbortedOkReplyCodes(FileSystemOptions options, List<Integer> replyCodes)
      Sets the list of reply codes that are considered as OK when prematurely closing a stream.

      If you set the replyCodes to an empty list, all reply codes besides 200 will be considered as an error.

      Parameters:
      options - The FileSystem options.
      replyCodes - The reply codes.
      Since:
      2.4
    • setUserDirIsRoot

      public void setUserDirIsRoot(FileSystemOptions options, boolean userDirIsRoot)
      Use user directory as root (do not change to fs root).
      Parameters:
      options - The FileSystemOptions.
      userDirIsRoot - true if the user directory should be treated as the root.