Package org.apache.commons.vfs2
Class FileSystemConfigBuilder
- java.lang.Object
-
- org.apache.commons.vfs2.FileSystemConfigBuilder
-
- Direct Known Subclasses:
DefaultFileSystemConfigBuilder
,FtpFileSystemConfigBuilder
,HttpFileSystemConfigBuilder
,RamFileSystemConfigBuilder
,ResourceFileSystemConfigBuilder
,SftpFileSystemConfigBuilder
public abstract class FileSystemConfigBuilder extends java.lang.Object
Abstract class which has the right to fill FileSystemOptions.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FileSystemConfigBuilder()
Construct builder with default prefix.protected
FileSystemConfigBuilder(java.lang.String component)
Construct builder with specified component name.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.Boolean
getBoolean(FileSystemOptions opts, java.lang.String name)
Get named option as boolean.protected boolean
getBoolean(FileSystemOptions opts, java.lang.String name, boolean defaultValue)
Get named option as boolean.protected java.lang.Boolean
getBoolean(FileSystemOptions opts, java.lang.String name, java.lang.Boolean defaultValue)
Get named option as boolean.protected java.lang.Byte
getByte(FileSystemOptions opts, java.lang.String name)
Get named option as byte.protected byte
getByte(FileSystemOptions opts, java.lang.String name, byte defaultValue)
Get named option as byte.protected java.lang.Byte
getByte(FileSystemOptions opts, java.lang.String name, java.lang.Byte defaultValue)
Get named option as byte.protected java.lang.Character
getCharacter(FileSystemOptions opts, java.lang.String name)
Get named option as character.protected char
getCharacter(FileSystemOptions opts, java.lang.String name, char defaultValue)
Get named option as character.protected java.lang.Character
getCharacter(FileSystemOptions opts, java.lang.String name, java.lang.Character defaultValue)
Get named option as character.protected abstract java.lang.Class<? extends FileSystem>
getConfigClass()
Get the target of this configuration.protected java.lang.Double
getDouble(FileSystemOptions opts, java.lang.String name)
Get named option as double.protected double
getDouble(FileSystemOptions opts, java.lang.String name, double defaultValue)
Get named option as double.protected java.lang.Double
getDouble(FileSystemOptions opts, java.lang.String name, java.lang.Double defaultValue)
Get named option as double.protected <E extends java.lang.Enum<E>>
EgetEnum(java.lang.Class<E> enumClass, FileSystemOptions opts, java.lang.String name)
Get named option as enumeration.protected <E extends java.lang.Enum<E>>
EgetEnum(java.lang.Class<E> enumClass, FileSystemOptions opts, java.lang.String name, E defaultValue)
Get named option as enumeration.protected java.lang.Float
getFloat(FileSystemOptions opts, java.lang.String name)
Get named option as float.protected float
getFloat(FileSystemOptions opts, java.lang.String name, float defaultValue)
Get named option as float.protected java.lang.Float
getFloat(FileSystemOptions opts, java.lang.String name, java.lang.Float defaultValue)
Get named option as float.protected java.lang.Integer
getInteger(FileSystemOptions opts, java.lang.String name)
Get named option as integer.protected int
getInteger(FileSystemOptions opts, java.lang.String name, int defaultValue)
Get named option as integer.protected java.lang.Integer
getInteger(FileSystemOptions opts, java.lang.String name, java.lang.Integer defaultValue)
Get named option as integer.protected java.lang.Long
getLong(FileSystemOptions opts, java.lang.String name)
Get named option as long.protected long
getLong(FileSystemOptions opts, java.lang.String name, long defaultValue)
Get named option as long.protected java.lang.Long
getLong(FileSystemOptions opts, java.lang.String name, java.lang.Long defaultValue)
Get named option as long.protected java.lang.Object
getParam(FileSystemOptions opts, java.lang.String name)
Get named parameter.java.lang.String
getRootURI(FileSystemOptions opts)
Return the root URI of the file system.protected java.lang.Short
getShort(FileSystemOptions opts, java.lang.String name)
Get named option as short.protected short
getShort(FileSystemOptions opts, java.lang.String name, short defaultValue)
Get named option as short.protected java.lang.Short
getShort(FileSystemOptions opts, java.lang.String name, java.lang.Short defaultValue)
Get named option as short.protected java.lang.String
getString(FileSystemOptions opts, java.lang.String name)
Get named option as String.protected java.lang.String
getString(FileSystemOptions opts, java.lang.String name, java.lang.String defaultValue)
Get named option as String.protected boolean
hasObject(FileSystemOptions opts, java.lang.String name)
Is named setting specified.protected boolean
hasParam(FileSystemOptions opts, java.lang.String name)
Check if option exists.protected void
setParam(FileSystemOptions opts, java.lang.String name, boolean value)
Set named parameter.protected void
setParam(FileSystemOptions opts, java.lang.String name, java.lang.Object value)
Set named parameter.void
setRootURI(FileSystemOptions opts, java.lang.String rootURI)
The root URI of the file system.
-
-
-
Constructor Detail
-
FileSystemConfigBuilder
protected FileSystemConfigBuilder()
Construct builder with default prefix.- Since:
- 1.0
-
FileSystemConfigBuilder
protected FileSystemConfigBuilder(java.lang.String component)
Construct builder with specified component name.- Parameters:
component
- component name to be used in prefix- Since:
- 2.0
-
-
Method Detail
-
setRootURI
public void setRootURI(FileSystemOptions opts, java.lang.String rootURI)
The root URI of the file system.- Parameters:
opts
- the file system options to modifyrootURI
- The creator name to be associated with the file.- Since:
- 2.0
-
getRootURI
public java.lang.String getRootURI(FileSystemOptions opts)
Return the root URI of the file system.- Parameters:
opts
- file system options to work with- Returns:
- The root URI
- Since:
- 2.0
-
setParam
protected void setParam(FileSystemOptions opts, java.lang.String name, boolean value)
Set named parameter.- Parameters:
opts
- the file system options to modifyname
- set option with this namevalue
- boolean value to set- Since:
- 2.1
-
setParam
protected void setParam(FileSystemOptions opts, java.lang.String name, java.lang.Object value)
Set named parameter.- Parameters:
opts
- the file system options to modifyname
- set option with this namevalue
- object value to set- Since:
- 1.0
-
getParam
protected java.lang.Object getParam(FileSystemOptions opts, java.lang.String name)
Get named parameter.- Parameters:
opts
- file system options to work withname
- get option with this name- Returns:
- the named option or null
- Since:
- 1.0
-
hasParam
protected boolean hasParam(FileSystemOptions opts, java.lang.String name)
Check if option exists.- Parameters:
opts
- file system options to work withname
- the name to look up inopts
- Returns:
- true if opts have the named parameter
- Since:
- 1.0
-
hasObject
protected boolean hasObject(FileSystemOptions opts, java.lang.String name)
Is named setting specified.- Parameters:
opts
- file system options to work withname
- the option to check inopts
or system properties- Returns:
- true if option exists
- Since:
- 2.0
-
getBoolean
protected java.lang.Boolean getBoolean(FileSystemOptions opts, java.lang.String name)
Get named option as boolean.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
getBoolean(FileSystemOptions, String, Boolean)
-
getBoolean
protected boolean getBoolean(FileSystemOptions opts, java.lang.String name, boolean defaultValue)
Get named option as boolean.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
getBoolean(FileSystemOptions, String, Boolean)
-
getBoolean
protected java.lang.Boolean getBoolean(FileSystemOptions opts, java.lang.String name, java.lang.Boolean defaultValue)
Get named option as boolean.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
getBoolean(FileSystemOptions, String, Boolean)
-
getByte
protected java.lang.Byte getByte(FileSystemOptions opts, java.lang.String name)
Get named option as byte.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
getByte(FileSystemOptions, String, Byte)
-
getByte
protected byte getByte(FileSystemOptions opts, java.lang.String name, byte defaultValue)
Get named option as byte.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
getByte(FileSystemOptions, String, Byte)
-
getByte
protected java.lang.Byte getByte(FileSystemOptions opts, java.lang.String name, java.lang.Byte defaultValue)
Get named option as byte.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getCharacter
protected java.lang.Character getCharacter(FileSystemOptions opts, java.lang.String name)
Get named option as character.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
getCharacter(FileSystemOptions, String, Character)
-
getCharacter
protected char getCharacter(FileSystemOptions opts, java.lang.String name, char defaultValue)
Get named option as character.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
getCharacter(FileSystemOptions, String, Character)
-
getCharacter
protected java.lang.Character getCharacter(FileSystemOptions opts, java.lang.String name, java.lang.Character defaultValue)
Get named option as character.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getDouble
protected java.lang.Double getDouble(FileSystemOptions opts, java.lang.String name)
Get named option as double.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
getDouble(FileSystemOptions, String, Double)
-
getDouble
protected double getDouble(FileSystemOptions opts, java.lang.String name, double defaultValue)
Get named option as double.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
- See Also:
getDouble(FileSystemOptions, String, Double)
-
getDouble
protected java.lang.Double getDouble(FileSystemOptions opts, java.lang.String name, java.lang.Double defaultValue)
Get named option as double.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getEnum
protected <E extends java.lang.Enum<E>> E getEnum(java.lang.Class<E> enumClass, FileSystemOptions opts, java.lang.String name)
Get named option as enumeration.- Type Parameters:
E
- enumeration type- Parameters:
enumClass
- class of enumeration typeopts
- file system options to work withname
- the option name *- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
java.lang.IllegalArgumentException
- if option value is not a known enumeration.- Since:
- 2.1
- See Also:
getEnum(Class, FileSystemOptions, String, Enum)
-
getEnum
protected <E extends java.lang.Enum<E>> E getEnum(java.lang.Class<E> enumClass, FileSystemOptions opts, java.lang.String name, E defaultValue)
Get named option as enumeration.- Type Parameters:
E
- enumeration type- Parameters:
enumClass
- class of enumeration typeopts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.IllegalArgumentException
- if option value is not a known enumeration.- Since:
- 2.1
- See Also:
getEnum(Class, FileSystemOptions, String, Enum)
-
getFloat
protected java.lang.Float getFloat(FileSystemOptions opts, java.lang.String name)
Get named option as float.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
java.lang.NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
- See Also:
getFloat(FileSystemOptions, String, Float)
-
getFloat
protected float getFloat(FileSystemOptions opts, java.lang.String name, float defaultValue)
Get named option as float.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
- See Also:
getFloat(FileSystemOptions, String, Float)
-
getFloat
protected java.lang.Float getFloat(FileSystemOptions opts, java.lang.String name, java.lang.Float defaultValue)
Get named option as float.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid float.- Since:
- 2.0
-
getInteger
protected java.lang.Integer getInteger(FileSystemOptions opts, java.lang.String name)
Get named option as integer.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
java.lang.NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
- See Also:
getInteger(FileSystemOptions, String, Integer)
-
getInteger
protected int getInteger(FileSystemOptions opts, java.lang.String name, int defaultValue)
Get named option as integer.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
- See Also:
getInteger(FileSystemOptions, String, Integer)
-
getInteger
protected java.lang.Integer getInteger(FileSystemOptions opts, java.lang.String name, java.lang.Integer defaultValue)
Get named option as integer.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid integer.- Since:
- 2.0
-
getLong
protected java.lang.Long getLong(FileSystemOptions opts, java.lang.String name)
Get named option as long.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
java.lang.NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
- See Also:
getLong(FileSystemOptions, String, Long)
-
getLong
protected long getLong(FileSystemOptions opts, java.lang.String name, long defaultValue)
Get named option as long.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
- See Also:
getLong(FileSystemOptions, String, Long)
-
getLong
protected java.lang.Long getLong(FileSystemOptions opts, java.lang.String name, java.lang.Long defaultValue)
Get named option as long.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid long.- Since:
- 2.0
-
getShort
protected java.lang.Short getShort(FileSystemOptions opts, java.lang.String name)
Get named option as short.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Throws:
java.lang.NumberFormatException
- if option value is not a valid short.- Since:
- 2.0
- See Also:
getShort(FileSystemOptions, String, Short)
-
getShort
protected short getShort(FileSystemOptions opts, java.lang.String name, short defaultValue)
Get named option as short.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid short- Since:
- 2.0
- See Also:
getShort(FileSystemOptions, String, Short)
-
getShort
protected java.lang.Short getShort(FileSystemOptions opts, java.lang.String name, java.lang.Short defaultValue)
Get named option as short.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Throws:
java.lang.NumberFormatException
- if option value is not a valid short- Since:
- 2.0
-
getString
protected java.lang.String getString(FileSystemOptions opts, java.lang.String name)
Get named option as String.- Parameters:
opts
- file system options to work withname
- the option name- Returns:
- the option in
opts
or system properties, otherwise null - Since:
- 2.0
- See Also:
getString(FileSystemOptions, String, String)
-
getString
protected java.lang.String getString(FileSystemOptions opts, java.lang.String name, java.lang.String defaultValue)
Get named option as String.- Parameters:
opts
- file system options to work withname
- the option namedefaultValue
- value to return if option is not present- Returns:
- the option in
opts
or system properties, otherwisedefaultValue
- Since:
- 2.0
-
getConfigClass
protected abstract java.lang.Class<? extends FileSystem> getConfigClass()
Get the target of this configuration.- Returns:
- the specific file system class
- Since:
- 1.0
-
-