You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Benoit Maisonny <be...@synclude.com> on 2009/05/28 20:54:05 UTC
[vfs] why is FileSystemConfigBuilder.setParam() protected?
Hi,
I'd like to configure FileSystemOptions dynamically, without knowing at
compile time which parameters to set. I'd have some config file
containing a list of parameters (builder class name, option name and its
value).
My problem is that the method
org.apache.commons.vfs.FileSystemConfigBuilder.setParam() is protected,
and FileSystemOptions can't be configured directly.
Is there another way to set parameters in a generic way?
Is there a reason for preventing direct configuration of
FileSystemOptions? I guess I could write my own sub-class of
FileSystemConfigBuilder which would offer a public setter, but this
sounds like building my own backdoor to rob the VFS house :-)
Thanks for any insight.
Benoit
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [vfs] why is FileSystemConfigBuilder.setParam() protected?
Posted by Benoit Maisonny <be...@synclude.com>.
> For the setParam(String, String) approach VFS provides the DelegatingFileSystemOptionsBuilder which then allows you to use setConfigString/setConfigClass which accepts just strings and uses reflection to coerce it to the required type. This was created to populate the configuration e.g. from an ant script or a properties file.
>
Great! This is exactly what I was looking for. May I suggest updating
the javadoc of FileSystemConfigBuilder and insert a link to
DelegatingFileSystemOptionsBuilder? As the delegate does not implement
the abstract class, it's more difficult to find it. I propose the
following text:
<p>When the VFS type is known at compile-time, developers should use the
VFS-specific *FileSystemConfigBuilder to benefit from type-safe
configuration. For generic configuration independant from the VFS type,
use {@link
org.apache.commons.vfs.util.DelegatingFileSystemOptionsBuilder}.</p>
Would be worth putting the same text in the javadoc of FileSystemOptions.
Cheers,
Benoit
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
RE: [vfs] why is FileSystemConfigBuilder.setParam() protected?
Posted by Mario Ivankovits <ma...@ops.co.at>.
> This is one of my least favorite parts of VFS. To configure
> FileSystemOptions you have to use the appropriate
> FileSystemConfigBuilder. I can't tell you why it was done this way as
> it precedes my involvement, but I've considered reinventing this more
> than once. It isn't pretty.
The reason I have done it that way was simply to have type-safe configuration parameters.
I hate it to have just setParam(String, String) or something like this.
It also was necessary to being able to mix parameters for multiple file-system implementations as
1) your url might create a layered filesystem
2) you never know exactly which filesystem implementation is going to be used
So, I still like this approach.
For the setParam(String, String) approach VFS provides the DelegatingFileSystemOptionsBuilder which then allows you to use setConfigString/setConfigClass which accepts just strings and uses reflection to coerce it to the required type. This was created to populate the configuration e.g. from an ant script or a properties file.
Ciao,
Mario
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Re: [vfs] why is FileSystemConfigBuilder.setParam() protected?
Posted by Ralph Goers <ra...@dslextreme.com>.
On May 28, 2009, at 11:54 AM, Benoit Maisonny wrote:
> Hi,
>
> I'd like to configure FileSystemOptions dynamically, without knowing
> at
> compile time which parameters to set. I'd have some config file
> containing a list of parameters (builder class name, option name and
> its
> value).
>
> My problem is that the method
> org.apache.commons.vfs.FileSystemConfigBuilder.setParam() is
> protected,
> and FileSystemOptions can't be configured directly.
>
> Is there another way to set parameters in a generic way?
>
> Is there a reason for preventing direct configuration of
> FileSystemOptions? I guess I could write my own sub-class of
> FileSystemConfigBuilder which would offer a public setter, but this
> sounds like building my own backdoor to rob the VFS house :-)
>
> Thanks for any insight.
> Benoit
This is one of my least favorite parts of VFS. To configure
FileSystemOptions you have to use the appropriate
FileSystemConfigBuilder. I can't tell you why it was done this way as
it precedes my involvement, but I've considered reinventing this more
than once. It isn't pretty.
Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org