|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.vfs.util.DelegatingFileSystemOptionsBuilder
public class DelegatingFileSystemOptionsBuilder
This class use reflection to set a configuration value using the fileSystemConfigBuilder
associated the a scheme.
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);
Nested Class Summary | |
---|---|
private static class |
DelegatingFileSystemOptionsBuilder.Context
|
Field Summary | |
---|---|
private java.util.Map |
beanMethods
|
private org.apache.commons.logging.Log |
log
|
private FileSystemManager |
manager
|
private static java.util.Map |
primitiveToObject
|
private static java.lang.Class[] |
STRING_PARAM
|
Constructor Summary | |
---|---|
DelegatingFileSystemOptionsBuilder(FileSystemManager manager)
Constructor. Pass in your fileSystemManager instance. |
Method Summary | |
---|---|
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 |
createSchemeMethods(java.lang.String scheme)
create 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 |
getSchemeMethods(java.lang.String scheme)
get (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)
Set a single class value. The class has to implement a no-args constructor, else the instantiation might fail. |
void |
setConfigClasses(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.Class[] classNames)
Set an array of class values. The class has to implement a no-args constructor, else the instantiation might fail. |
void |
setConfigString(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.String value)
Set a single string value. |
void |
setConfigStrings(FileSystemOptions fso,
java.lang.String scheme,
java.lang.String name,
java.lang.String[] values)
Set an array of string value. |
private void |
setValues(DelegatingFileSystemOptionsBuilder.Context ctx)
sets the values using the informations of the given context. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private org.apache.commons.logging.Log log
private static final java.lang.Class[] STRING_PARAM
private final FileSystemManager manager
private final java.util.Map beanMethods
private static final java.util.Map primitiveToObject
Constructor Detail |
---|
public DelegatingFileSystemOptionsBuilder(FileSystemManager manager)
manager
- the manager to use to get the fileSystemConfigBuilder assocated to a schemeMethod Detail |
---|
protected 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
- value
FileSystemException
public void setConfigStrings(FileSystemOptions fso, java.lang.String scheme, java.lang.String name, java.lang.String[] values) throws FileSystemException
fso
- FileSystemOptionsscheme
- schemename
- namevalues
- values
FileSystemException
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
fso
- FileSystemOptionsscheme
- schemename
- nameclassName
- className
FileSystemException
java.lang.IllegalAccessException
java.lang.InstantiationException
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
fso
- FileSystemOptionsscheme
- schemename
- nameclassNames
- classNames
FileSystemException
java.lang.IllegalAccessException
java.lang.InstantiationException
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 getSchemeMethods(java.lang.String scheme) throws FileSystemException
FileSystemException
private java.util.Map createSchemeMethods(java.lang.String scheme) throws FileSystemException
FileSystemException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |