Hi all, I'd like to suggest a change to something in [configuration] that has been itching me for quite some time: the inconsistencies between the various file based configurations with regard to data persistence.

Currently we have several inconsistent constructors, and load()/save() methods between PropertiesConfiguration, XMLConfiguration and HierarchicalXMLConfiguration. For example, XMLConfiguration can be constructed from a File object, but not the others, HierarchicalXMLConfiguration can be loaded from an URL but not saved, PropertiesConfiguration can be loaded directly from an InputStream, etc.

There are also exception inconsistencies, for example save(OutputStream) throws a ConfigurationException in XMLConfiguration and an IOException in PropertiesConfiguration.

I summarized these differences in the attached excel sheet (I hope everyone can read it, if not I'll export it to HTML). I think in order to provide a clean and well thought out API we must implement the same methods everywhere. Hence I suggest the following:

- replace BasePathLoader with a FileConfiguration interface. This interface will declare the load/save methods and the get/setters for the file name and the base path.

- replace BasePathConfiguration with AbstractFileConfiguration. It provides a default implementation for the get/setters and for some load/save methods.

- complete PropertiesConfiguration, XMLConfiguration and HierarchicalXMLConfiguration with the missing constructors and methods.

What do you think ?

Emmanuel Bourg


Attachment: loadsave.xls
Description: MS-Excel spreadsheet

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to