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.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFtpFileSystemConfigBuilder(java.lang.String prefix)Create new config builder with specified prefix string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description org.apache.commons.lang3.Range<java.lang.Integer>getActivePortRange(FileSystemOptions options)Gets the active port range.java.lang.BooleangetAutodetectUtf8(FileSystemOptions options)Gets whether to try to autodetect the server encoding (only UTF8 is supported).protected java.lang.Class<? extends FileSystem>getConfigClass()Gets the target of this configuration.java.lang.IntegergetConnectTimeout(FileSystemOptions options)Deprecated.java.time.DurationgetConnectTimeoutDuration(FileSystemOptions options)Gets the timeout in milliseconds to use for the socket connection.java.lang.StringgetControlEncoding(FileSystemOptions options)Gets the control encoding.java.time.DurationgetControlKeepAliveReplyTimeout(FileSystemOptions options)Gets the controlKeepAliveReplyTimeout duration.java.time.DurationgetControlKeepAliveTimeout(FileSystemOptions options)Gets the controlKeepAliveTimeout duration.java.lang.IntegergetDataTimeout(FileSystemOptions options)Deprecated.java.time.DurationgetDataTimeoutDuration(FileSystemOptions options)Gets the timeout for opening the data channel.java.lang.StringgetDefaultDateFormat(FileSystemOptions options)Gets the default date format used by the server.java.lang.StringgetEntryParser(FileSystemOptions options)Gets the key to the EntryParser.org.apache.commons.net.ftp.parser.FTPFileEntryParserFactorygetEntryParserFactory(FileSystemOptions options)Gets the FTPFileEntryParserFactory parameter.FtpFileTypegetFileType(FileSystemOptions options)Gets the file type parameter.static FtpFileSystemConfigBuildergetInstance()Gets the singleton instance.java.lang.BooleangetMdtmLastModifiedTime(FileSystemOptions options)Gets the option to use FTP MDTM forFileContent.getLastModifiedTime().java.lang.BooleangetPassiveMode(FileSystemOptions options)Tests whether passive mode is set.java.net.ProxygetProxy(FileSystemOptions options)Gets the Proxy.java.lang.StringgetRecentDateFormat(FileSystemOptions options)SeeFTPClientConfigfor details and examples.java.lang.BooleangetRemoteVerification(FileSystemOptions options)Gets whether to use remote verification.static java.util.List<java.lang.Integer>getSaneTransferAbortedOkReplyCodes()Gets special retry code.java.lang.StringgetServerLanguageCode(FileSystemOptions options)Gets the language code used by the server.java.lang.StringgetServerTimeZoneId(FileSystemOptions options)SeeFTPClientConfigfor details and examples.java.lang.String[]getShortMonthNames(FileSystemOptions options)SeeFTPClientConfigfor details and examples.java.lang.IntegergetSoTimeout(FileSystemOptions options)Deprecated.java.time.DurationgetSoTimeoutDuration(FileSystemOptions options)Gets The so timeout duration.java.util.List<java.lang.Integer>getTransferAbortedOkReplyCodes(FileSystemOptions options)Gets the list of reply codes (apart from 200) that are considered as OK when prematurely closing a stream.java.lang.BooleangetUserDirIsRoot(FileSystemOptions options)Tests whether if VFS should treat the user directory as the root directory.voidsetActivePortRange(FileSystemOptions options, org.apache.commons.lang3.Range<java.lang.Integer> portRange)Sets the active port range.voidsetAutodetectUtf8(FileSystemOptions options, java.lang.Boolean autodetectUTF8)Sets whether to try to autodetect the server encoding (only UTF8 is supported).voidsetConnectTimeout(FileSystemOptions options, java.lang.Integer duration)Deprecated.voidsetConnectTimeout(FileSystemOptions options, java.time.Duration duration)Sets the timeout for the initial control connection.voidsetControlEncoding(FileSystemOptions options, java.lang.String encoding)SeeFTP.setControlEncoding(java.lang.String)for details and examples.voidsetControlKeepAliveReplyTimeout(FileSystemOptions options, java.time.Duration duration)Sets the control keep alive reply timeout for the FTP client.voidsetControlKeepAliveTimeout(FileSystemOptions options, java.time.Duration duration)Sets the control keep alive timeout for the FTP client.voidsetDataTimeout(FileSystemOptions options, java.lang.Integer duration)Deprecated.voidsetDataTimeout(FileSystemOptions options, java.time.Duration duration)Sets the data timeout for the FTP client.voidsetDefaultDateFormat(FileSystemOptions options, java.lang.String defaultDateFormat)Sets the default date format used by the server.voidsetEntryParser(FileSystemOptions options, java.lang.String key)Sets the FQCN of your FileEntryParser used to parse the directory listing from your server.voidsetEntryParserFactory(FileSystemOptions options, org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory factory)FTPFileEntryParserFactory which will be used for ftp-entry parsing.voidsetFileType(FileSystemOptions options, FtpFileType ftpFileType)Sets the file type parameter.voidsetMdtmLastModifiedTime(FileSystemOptions options, boolean mdtm)Sets the option to use FTP MDTM forFileContent.getLastModifiedTime().voidsetPassiveMode(FileSystemOptions options, boolean passiveMode)Enter into passive mode.voidsetProxy(FileSystemOptions options, java.net.Proxy proxy)Sets the Proxy.voidsetRecentDateFormat(FileSystemOptions options, java.lang.String recentDateFormat)SeeFTPClientConfigfor details and examples.voidsetRemoteVerification(FileSystemOptions options, boolean remoteVerification)Sets whether to use remote verification.voidsetServerLanguageCode(FileSystemOptions options, java.lang.String serverLanguageCode)Sets the language code used by the server.voidsetServerTimeZoneId(FileSystemOptions options, java.lang.String serverTimeZoneId)SeeFTPClientConfigfor details and examples.voidsetShortMonthNames(FileSystemOptions options, java.lang.String[] shortMonthNames)SeeFTPClientConfigfor details and examples.voidsetSoTimeout(FileSystemOptions options, java.lang.Integer timeout)Deprecated.voidsetSoTimeout(FileSystemOptions options, java.time.Duration timeout)Sets the socket timeout for the FTP client.voidsetTransferAbortedOkReplyCodes(FileSystemOptions options, java.util.List<java.lang.Integer> replyCodes)Sets the list of reply codes that are considered as OK when prematurely closing a stream.voidsetUserDirIsRoot(FileSystemOptions options, boolean userDirIsRoot)Use user directory as root (do not change to fs root).-
Methods inherited from class org.apache.commons.vfs2.FileSystemConfigBuilder
getBoolean, getBoolean, getBoolean, getByte, getByte, getByte, getCharacter, getCharacter, getCharacter, getDouble, getDouble, getDouble, getDuration, getDuration, getDurationInteger, getDurationInteger, getEnum, getEnum, getFloat, getFloat, getFloat, getInteger, getInteger, getInteger, getLong, getLong, getLong, getParam, getParamOrDefault, getRootURI, getShort, getShort, getShort, getString, getString, hasObject, hasParam, setParam, setParam, setRootURI, toBooleanObject
-
-
-
-
Constructor Detail
-
FtpFileSystemConfigBuilder
protected FtpFileSystemConfigBuilder(java.lang.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 Detail
-
getInstance
public static FtpFileSystemConfigBuilder getInstance()
Gets the singleton instance.- Returns:
- the singleton instance.
-
getSaneTransferAbortedOkReplyCodes
public static java.util.List<java.lang.Integer> getSaneTransferAbortedOkReplyCodes()
Gets special retry code. See VFS-674, its accompanying PR and https://github.com/apache/commons-vfs/pull/51 as to why 426 and 550 are here.- Returns:
- special retry code.
-
getActivePortRange
public org.apache.commons.lang3.Range<java.lang.Integer> getActivePortRange(FileSystemOptions options)
Gets the active port range.- Parameters:
options- The FileSystemOptions.- Returns:
- the Range of active ports
- Since:
- 2.10.0
-
getAutodetectUtf8
public java.lang.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 java.lang.Class<? extends FileSystem> getConfigClass()
Description copied from class:FileSystemConfigBuilderGets the target of this configuration.- Specified by:
getConfigClassin classFileSystemConfigBuilder- Returns:
- the specific file system class
-
getConnectTimeout
@Deprecated public java.lang.Integer getConnectTimeout(FileSystemOptions options)
Deprecated.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 java.time.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 java.lang.String getControlEncoding(FileSystemOptions options)
Gets the control encoding.- Parameters:
options- The FileSystemOptions.- Returns:
- The control encoding.
- Since:
- 2.0
-
getControlKeepAliveReplyTimeout
public java.time.Duration getControlKeepAliveReplyTimeout(FileSystemOptions options)
Gets the controlKeepAliveReplyTimeout duration.- Parameters:
options- The FileSystem options- Returns:
- The controlKeepAliveReplyTimeout duration.
- Since:
- 2.8.0
-
getControlKeepAliveTimeout
public java.time.Duration getControlKeepAliveTimeout(FileSystemOptions options)
Gets the controlKeepAliveTimeout duration.- Parameters:
options- The FileSystem options- Returns:
- The controlKeepAliveTimeout duration.
- Since:
- 2.8.0
-
getDataTimeout
@Deprecated public java.lang.Integer getDataTimeout(FileSystemOptions options)
Deprecated.Gets timeout for opening the data channel in milliseconds.- Parameters:
options- The FileSystemOptions.- Returns:
- The timeout for opening the data channel in milliseconds.
- See Also:
setDataTimeout(org.apache.commons.vfs2.FileSystemOptions, java.time.Duration)
-
getDataTimeoutDuration
public java.time.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:
setDataTimeout(org.apache.commons.vfs2.FileSystemOptions, java.time.Duration)
-
getDefaultDateFormat
public java.lang.String getDefaultDateFormat(FileSystemOptions options)
Gets the default date format used by the server. SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions- Returns:
- The default date format.
-
getEntryParser
public java.lang.String getEntryParser(FileSystemOptions options)
Gets the key to the EntryParser.- Parameters:
options- The FileSystemOptions.- Returns:
- the key to the EntryParser.
- See Also:
setEntryParser(org.apache.commons.vfs2.FileSystemOptions, java.lang.String)
-
getEntryParserFactory
public org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory getEntryParserFactory(FileSystemOptions options)
Gets the FTPFileEntryParserFactory parameter.- Parameters:
options- The FileSystemOptions.- Returns:
- The FTPFileEntryParserFactory parameter.
- See Also:
setEntryParserFactory(org.apache.commons.vfs2.FileSystemOptions, org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory)
-
getFileType
public FtpFileType getFileType(FileSystemOptions options)
Gets the file type parameter.- Parameters:
options- The FileSystemOptions.- Returns:
- A FtpFileType
- Since:
- 2.1
-
getMdtmLastModifiedTime
public java.lang.Boolean getMdtmLastModifiedTime(FileSystemOptions options)
Gets the option to use FTP MDTM forFileContent.getLastModifiedTime().- Parameters:
options- The FileSystemOptions.- Returns:
- true if MDTM should be used.
- Since:
- 2.8.0
-
getPassiveMode
public java.lang.Boolean getPassiveMode(FileSystemOptions options)
Tests whether passive mode is set.- Parameters:
options- The FileSystemOptions.- Returns:
- whether passive mode is set.
- See Also:
setPassiveMode(org.apache.commons.vfs2.FileSystemOptions, boolean)
-
getProxy
public java.net.Proxy getProxy(FileSystemOptions options)
Gets the Proxy.- Parameters:
options- The FileSystemOptions.- Returns:
- the Proxy
- Since:
- 2.1
-
getRecentDateFormat
public java.lang.String getRecentDateFormat(FileSystemOptions options)
SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.- Returns:
- The recent date format.
-
getRemoteVerification
public java.lang.Boolean getRemoteVerification(FileSystemOptions options)
Gets whether to use remote verification.- Parameters:
options- The FileSystemOptions.- Returns:
- True if remote verification should be done.
-
getServerLanguageCode
public java.lang.String getServerLanguageCode(FileSystemOptions options)
Gets the language code used by the server. SeeFTPClientConfigfor details and examples.- Parameters:
options- The FilesystemOptions.- Returns:
- The language code of the server.
-
getServerTimeZoneId
public java.lang.String getServerTimeZoneId(FileSystemOptions options)
SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.- Returns:
- The server timezone id.
-
getShortMonthNames
public java.lang.String[] getShortMonthNames(FileSystemOptions options)
SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.- Returns:
- An array of short month names.
-
getSoTimeout
@Deprecated public java.lang.Integer getSoTimeout(FileSystemOptions options)
Deprecated.Gets The so timeout duration in milliseconds.- Parameters:
options- The FileSystem options.- Returns:
- The so timeout duration in milliseconds.
- Since:
- 2.0
- See Also:
getDataTimeout(org.apache.commons.vfs2.FileSystemOptions)
-
getSoTimeoutDuration
public java.time.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:
getDataTimeout(org.apache.commons.vfs2.FileSystemOptions)
-
getTransferAbortedOkReplyCodes
public java.util.List<java.lang.Integer> getTransferAbortedOkReplyCodes(FileSystemOptions options)
Gets the list of reply codes (apart from 200) that are considered as OK when prematurely closing a stream.- 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 java.lang.Boolean getUserDirIsRoot(FileSystemOptions options)
Tests whether if VFS should treat the user directory as the root directory. Defaults toBoolean.TRUEif the methodsetUserDirIsRoot(FileSystemOptions, boolean)has not been invoked.- Parameters:
options- The FileSystemOptions.- Returns:
Boolean.TRUEif VFS treats the user directory as the root directory.- See Also:
setUserDirIsRoot(org.apache.commons.vfs2.FileSystemOptions, boolean)
-
setActivePortRange
public void setActivePortRange(FileSystemOptions options, org.apache.commons.lang3.Range<java.lang.Integer> portRange)
Sets the active port range.- Parameters:
options- The FileSystemOptions.portRange- the Range of active ports- Since:
- 2.10.0
-
setAutodetectUtf8
public void setAutodetectUtf8(FileSystemOptions options, java.lang.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, java.time.Duration duration)
Sets the timeout for the initial control connection.If you set the connectTimeout to
nullno 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, java.lang.Integer duration)
Deprecated.Sets the timeout for the initial control connection.If you set the connectTimeout to
nullno connectTimeout will be set.- Parameters:
options- The FileSystemOptions.duration- the timeout duration.- Since:
- 2.1
-
setControlEncoding
public void setControlEncoding(FileSystemOptions options, java.lang.String encoding)
SeeFTP.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, java.time.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, java.time.Duration duration)
Sets the control keep alive timeout for the FTP client.Sets the
controlKeepAliveTimeoutto 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, java.time.Duration duration)
Sets the data timeout for the FTP client.If you set the
dataTimeouttonull, 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, java.lang.Integer duration)
Deprecated.Sets the data timeout for the FTP client.If you set the
dataTimeouttonull, no dataTimeout will be set on the FTP client.- Parameters:
options- The FileSystemOptions.duration- The timeout value.
-
setDefaultDateFormat
public void setDefaultDateFormat(FileSystemOptions options, java.lang.String defaultDateFormat)
Sets the default date format used by the server. SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.defaultDateFormat- The default date format.
-
setEntryParser
public void setEntryParser(FileSystemOptions options, java.lang.String key)
Sets 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 forFileContent.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, java.net.Proxy proxy)
Sets the Proxy.You might need to make sure that
passive modeis activated.- Parameters:
options- the FileSystem options.proxy- the Proxy- Since:
- 2.1
-
setRecentDateFormat
public void setRecentDateFormat(FileSystemOptions options, java.lang.String recentDateFormat)
SeeFTPClientConfigfor 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, java.lang.String serverLanguageCode)
Sets the language code used by the server. SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.serverLanguageCode- The servers language code.
-
setServerTimeZoneId
public void setServerTimeZoneId(FileSystemOptions options, java.lang.String serverTimeZoneId)
SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.serverTimeZoneId- The server timezone id.
-
setShortMonthNames
public void setShortMonthNames(FileSystemOptions options, java.lang.String[] shortMonthNames)
SeeFTPClientConfigfor details and examples.- Parameters:
options- The FileSystemOptions.shortMonthNames- an array of short month name Strings.
-
setSoTimeout
public void setSoTimeout(FileSystemOptions options, java.time.Duration timeout)
Sets the socket timeout for the FTP client.If you set the
soTimeouttonull, 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, java.lang.Integer timeout)
Deprecated.Sets the socket timeout for the FTP client.If you set the
soTimeouttonull, 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, java.util.List<java.lang.Integer> replyCodes)
Sets the list of reply codes that are considered as OK when prematurely closing a stream.If you set the
replyCodesto 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.
-
-