Configuration adapter for WDConfiguration and Java property files
In a client project, we used WD configuration files a lot to influence the runtime behaviour of our application. Unfortunately, we were forced to stop and restart the application to make changes effective, which destroyed the session context of currently logged in users.
We switched to db tables for the more dynamic attributes of our configuration. But know we had different APIs to access property values (WDConfig, DAO, …).
That’s why I decided to implement IWDConfiguration in an Adapter class. You can initialize the class with any Java property object, which can easily be created from any key/value pair (our DB-table) or even read from a server via http/file access.
Using the Adapter class, WD is able to set Defaults, read Dates, Numbers and arrays and provide the same error handling mechanisms.
I find this very useful, so I’d like to share it with you in my first blog post.
edit: As thesource file is quite long, I moved it to the wiki/snippet section. And keep in mind that I use commons-lang helper functionality from jakarta commons, you should have the jar in your classpath to test the example.