commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oliver Heger <>
Subject Re: [configuration] Intenttion of class "FileBased"
Date Sun, 05 May 2013 16:59:19 GMT
Hi Oliver,

great to get some feedback on the new re-designed trunk!

Am 05.05.2013 01:17, schrieb Oliver Kopp:
> Hi,
> I'm working with the trunk version of apache.commons.configuration. There,
> FileHandler allows to have passed a "FileBased" object in the constructor.
> I thought, I could implement that interface to provide an abstraction to
> the underlying file system. However, if I do it htat way, there is an
> exception "No file name has been set!". When going through the code, it
> seems that this object is the internal data storage for the configuration
> and not the external file storage.
> Possibly, just the header comments of this constructor should be updated.
> Like sort of saying "this constructor is for internal use only".

The purpose of FileHandler is to manage a file description in various 
formats (File, URL, file name, etc.). It can be associated with a 
FileBased object which has a read() and a write() method and thus more 
or less defines the content of the file.

The typical usage scenario is that you create a FileHandler and 
associate it with a FileBased object (all file-based configurations now 
implement this interface). Then you use some of the set() methods to 
define the file name. Finally, you can call load() to get the FileBased 
object loaded. Alternatively, you can use one of the load() methods 
expecting a parameter (again various parameter types are supported).

There is still the FileSystem class which provides an abstraction over 
concrete file operations. So this is probably the class you are after. 
(Note: I plan to move this class also into the io package. And maybe it 
can be a bit simplified.)


> Cheers,
> Oliver

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message