public class DelegatingFileSystemOptionsBuilder
extends java.lang.Object
Example:
FileSystemOptions fso = new FileSystemOptions(); DelegatingFileSystemOptionsBuilder delegate = new DelegatingFileSystemOptionsBuilder(VFS.getManager()); delegate.setConfigString(fso, "sftp", "identities", "c:/tmp/test.ident"); delegate.setConfigString(fso, "http", "proxyPort", "8080"); delegate.setConfigClass(fso, "sftp", "userinfo", TrustEveryoneUserInfo.class);
Modifier and Type | Class and Description |
---|---|
private static class |
DelegatingFileSystemOptionsBuilder.Context
Context.
|
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>>> |
beanMethods |
private static org.apache.commons.logging.Log |
log |
private FileSystemManager |
manager |
private static java.util.Map<java.lang.String,java.lang.Class<?>> |
PRIMATIVE_TO_OBJECT |
private static java.lang.Class<java.lang.String>[] |
STRING_PARAM |
Constructor and Description |
---|
DelegatingFileSystemOptionsBuilder(FileSystemManager manager)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
convertValuesAndInvoke(java.lang.reflect.Method configSetter,
DelegatingFileSystemOptionsBuilder.Context ctx)
Tries to convert the value and pass it to the given method
|
private java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>> |
createSchemeMethods(java.lang.String scheme)
Creates the list of all set*() methods for the given scheme
|
private boolean |
fillConfigSetters(DelegatingFileSystemOptionsBuilder.Context ctx)
Fills all available set*() methods for the context-scheme into the context.
|
protected FileSystemManager |
getManager() |
private java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>> |
getSchemeMethods(java.lang.String scheme)
Gets (cached) list of set*() methods for the given scheme
|
private void |
invokeSetter(java.lang.Class<?> valueParameter,
DelegatingFileSystemOptionsBuilder.Context ctx,
java.lang.reflect.Method configSetter,
java.lang.Object values)
Invokes the method with the converted values
|
void |
setConfigClass(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.Class<?> className)
Sets a single class value.
|
void |
setConfigClasses(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.Class<?>[] classNames)
Sets an array of class values.
|
void |
setConfigString(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.String value)
Sets a single string value.
|
void |
setConfigStrings(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.String[] values)
Sets an array of string value.
|
private void |
setValues(DelegatingFileSystemOptionsBuilder.Context ctx)
Sets the values using the informations of the given context.
|
private static final java.lang.Class<java.lang.String>[] STRING_PARAM
private static final java.util.Map<java.lang.String,java.lang.Class<?>> PRIMATIVE_TO_OBJECT
private static final org.apache.commons.logging.Log log
private final FileSystemManager manager
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>>> beanMethods
public DelegatingFileSystemOptionsBuilder(FileSystemManager manager)
Pass in your fileSystemManager instance.
manager
- the manager to use to get the fileSystemConfigBuilder assocated to a schemeprotected FileSystemManager getManager()
public void setConfigString(FileSystemOptions fso, java.lang.String scheme, java.lang.String name, java.lang.String value) throws FileSystemException
fso
- FileSystemOptionsscheme
- schemename
- namevalue
- valueFileSystemException
- if an error occurs.public void setConfigStrings(FileSystemOptions fso, java.lang.String scheme, java.lang.String name, java.lang.String[] values) throws FileSystemException
fso
- FileSystemOptionsscheme
- schemename
- namevalues
- valuesFileSystemException
- if an error occurs.public void setConfigClass(FileSystemOptions fso, java.lang.String scheme, java.lang.String name, java.lang.Class<?> className) throws FileSystemException, java.lang.IllegalAccessException, java.lang.InstantiationException
The class has to implement a no-args constructor, else the instantiation might fail.
fso
- FileSystemOptionsscheme
- schemename
- nameclassName
- classNameFileSystemException
- if an error occurs.java.lang.IllegalAccessException
- if a class canoot be accessed.java.lang.InstantiationException
- if a class cannot be instantiated.public void setConfigClasses(FileSystemOptions fso, java.lang.String scheme, java.lang.String name, java.lang.Class<?>[] classNames) throws FileSystemException, java.lang.IllegalAccessException, java.lang.InstantiationException
The class has to implement a no-args constructor, else the instantiation might fail.
fso
- FileSystemOptionsscheme
- schemename
- nameclassNames
- classNamesFileSystemException
- if an error occurs.java.lang.IllegalAccessException
- if a class canoot be accessed.java.lang.InstantiationException
- if a class cannot be instantiated.private void setValues(DelegatingFileSystemOptionsBuilder.Context ctx) throws FileSystemException
FileSystemException
private boolean convertValuesAndInvoke(java.lang.reflect.Method configSetter, DelegatingFileSystemOptionsBuilder.Context ctx) throws FileSystemException
FileSystemException
private void invokeSetter(java.lang.Class<?> valueParameter, DelegatingFileSystemOptionsBuilder.Context ctx, java.lang.reflect.Method configSetter, java.lang.Object values) throws FileSystemException
FileSystemException
private boolean fillConfigSetters(DelegatingFileSystemOptionsBuilder.Context ctx) throws FileSystemException
FileSystemException
private java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>> getSchemeMethods(java.lang.String scheme) throws FileSystemException
FileSystemException
private java.util.Map<java.lang.String,java.util.List<java.lang.reflect.Method>> createSchemeMethods(java.lang.String scheme) throws FileSystemException
FileSystemException