I have been trying out a configuration management package for a recent project,
JFig. First I built a wrapper class as I want to have a defined set of configuration values and cross platform handling of configuration file locations. Then I built the functionality I needed into the rest of the application, fired things up, and everything seems to be working well. But then I noticed, that's strange, the configuration file isn't getting updated. Isn't JFig supposed to handle that for me?
The short version is no, not only does it not handle it for me, it doesn't provide any way to save configuration changes at all!
My first clue should have been the setConfiguration javadocs, which hinted at this problem by saying it was "rarely used." Instead of that subtle hint, it should read "if you find yourself using this function, go find another configuration solution." It seems JFig was designed for the very specific situation of read-only configuration files mainly in a web application context; if your web application or gui application needs to change the configuration, do not use this solution. Do not be fooled by the documentation which says this is a good solution for "maintaining" and "managing" your configuration, as it doesn't do this at all, it only reads the configurations you are managing yourself by hand-coding the xml files.
Anyway, time to stop whining and find another solution. My initial search has turned up
jConfig, which seems to be closer to what I actually want. And this time I will do some tests before doing a complete implementation to make sure it actually does what I want it to.
This is a great example of why you should write wrapper classes. Because I used that method instead of JFig directly, all I need to do now is fix my wrapper and not my codebase which is now full of wrapper class calls (and would have been full of JFig calls otherwise).