Package org.apache.commons.vfs2.util
Class DelegatingFileSystemOptionsBuilder
java.lang.Object
org.apache.commons.vfs2.util.DelegatingFileSystemOptionsBuilder
This class use reflection to set a configuration value using the fileSystemConfigBuilder associated the a scheme.
Example:
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);
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.
Pass in your fileSystemManager instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileSystemManager
void
setConfigClass
(FileSystemOptions fso, String scheme, String name, 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, String scheme, String name, 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, String scheme, String name, String value) Set a single string value.void
setConfigStrings
(FileSystemOptions fso, String scheme, String name, String[] values) Set an array of string value.
-
Constructor Details
-
DelegatingFileSystemOptionsBuilder
Constructor.
Pass in your fileSystemManager instance.- Parameters:
manager
- the manager to use to get the fileSystemConfigBuilder assocated to a scheme
-
-
Method Details
-
getManager
-
setConfigString
public void setConfigString(FileSystemOptions fso, String scheme, String name, String value) throws FileSystemException Set a single string value.- Parameters:
fso
- FileSystemOptionsscheme
- schemename
- namevalue
- value- Throws:
FileSystemException
- if an error occurs.
-
setConfigStrings
public void setConfigStrings(FileSystemOptions fso, String scheme, String name, String[] values) throws FileSystemException Set an array of string value.- Parameters:
fso
- FileSystemOptionsscheme
- schemename
- namevalues
- values- Throws:
FileSystemException
- if an error occurs.
-
setConfigClass
public void setConfigClass(FileSystemOptions fso, String scheme, String name, Class<?> className) throws FileSystemException, IllegalAccessException, InstantiationException Set a single class value.
The class has to implement a no-args constructor, else the instantiation might fail.- Parameters:
fso
- FileSystemOptionsscheme
- schemename
- nameclassName
- className- Throws:
FileSystemException
- if an error occurs.IllegalAccessException
- if a class canoot be accessed.InstantiationException
- if a class cannot be instantiated.
-
setConfigClasses
public void setConfigClasses(FileSystemOptions fso, String scheme, String name, Class<?>[] classNames) throws FileSystemException, IllegalAccessException, InstantiationException Set an array of class values.
The class has to implement a no-args constructor, else the instantiation might fail.- Parameters:
fso
- FileSystemOptionsscheme
- schemename
- nameclassNames
- classNames- Throws:
FileSystemException
- if an error occurs.IllegalAccessException
- if a class canoot be accessed.InstantiationException
- if a class cannot be instantiated.
-