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:
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
ConstructorsConstructorDescriptionConstructs a new instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected FileSystemManagerGets the FileSystemManager.voidsetConfigClass(FileSystemOptions fso, String scheme, String name, Class<?> className) Sets a single class value.voidsetConfigClasses(FileSystemOptions fso, String scheme, String name, Class<?>[] classNames) Sets an array of class values.voidsetConfigString(FileSystemOptions fso, String scheme, String name, String value) Sets a single string value.voidsetConfigStrings(FileSystemOptions fso, String scheme, String name, String[] values) Sets an array of string value.
-
Constructor Details
-
DelegatingFileSystemOptionsBuilder
Constructs a new instance.Pass in your fileSystemManager instance.
- Parameters:
manager- the manager to use to get the fileSystemConfigBuilder associated to a scheme
-
-
Method Details
-
getManager
Gets the FileSystemManager.- Returns:
- the FileSystemManager.
-
setConfigClass
public void setConfigClass(FileSystemOptions fso, String scheme, String name, Class<?> className) throws FileSystemException, ReflectiveOperationException Sets 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.ReflectiveOperationException- if a class cannot be accessed or instantiated.
-
setConfigClasses
public void setConfigClasses(FileSystemOptions fso, String scheme, String name, Class<?>[] classNames) throws FileSystemException, ReflectiveOperationException Sets 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.ReflectiveOperationException- if a class cannot be accessed or instantiated.
-
setConfigString
public void setConfigString(FileSystemOptions fso, String scheme, String name, String value) throws FileSystemException Sets 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 Sets an array of string value.- Parameters:
fso- FileSystemOptionsscheme- schemename- namevalues- values- Throws:
FileSystemException- if an error occurs.
-