Bruce Conrad
Unregistered
|
|
We've been using a package called JFig to manage system configuration and properties. JFig uses OO concepts such as inheritance and variable interpolation. The result is an extremely flexible dynamic way to manage properties and configurations that solves many of the problems in managing configurations in business environments. Version 1.1 will add an option to set configuration values as properties if necessary as well as adapters to use JFig with Ant and Maven.
I've used JFig on a variety of projects and four development teams are currently using it where I work.
The project is at: http://sourceforge.net/projects/jfig/ http://jfig.sourceforge.net/
The jar is at: http://prdownloads.sourceforge.net/jfig/jfig-1.0.jar?download
You can get the zip, including documentation and source code at: http://prdownloads.sourceforge.net/jfig/jfig-1.0.zip?download
PS If I sound partial to it, it's because I wrote it...
|
vlad_roubtsov
member
Reged: 06/21/03
Posts: 169
|
|
JFig looks pretty cool. I certainly don't get by with just simple .properties in real work, but I also don't find that I need very elaborate schemes requiring a separate product very often either.
The article was a simple Q&A post geared towards beginners who besiege various Java forums asking how they can figure out where their application are installed or how to load a .gif icon by its file name etc. My simple answer is: in many cases just jar it together with the app classes and load via getResourceAsStream().
|
Antti Brax
Unregistered
|
|
Well, now that we're puffing software I might also advertise the property/configuration loading (proof of concept) library I wrote. In my approach the program doesn't load the properties but instead the properties load the program (with the help of a short bootstrap code). Basic reflection stuff but IMHO a pretty neat trick .
http://xmlconfig.sourceforge.net/
|
Andy_Sumner
stranger
Reged: 07/20/04
Posts: 1
|
|
Bruce, is there any way I can get in contact with you to discuss configuring jfig with log4j?
Andy sumnera at fish dot govt dot nz
|
Jean-Seb
Unregistered
|
|
I use JFig, but I have a probleme with it... I want to put regexp parttern in it, but the problem is that I have some " or ' into it, so it crash JFig... I've tried to do a thing like this: """ or '"', but no way... all quotes are escaped with \ like this: \' or \" here is a example of a pattern: [h|H][r|R][e|E][f|F]=[\"|\']?([^\"|^\'|^ ]*)[\"|\']? if anyone as an idea ?
thanks a lot !
|
Anonymous
Unregistered
|
|
Here's what sucks about JFig 1. too complicated 2. xml config files suck 3. the good things about the framework such as "include" don't work in .ini files, only with xml (see item #2) here's a better way to go:
creating a heirarchical resource (like resource bundle) is a good way to go. For example let's say you have a set of folders like this - foo/ (folder) - bar/ (folder) - baz/ (folder) Then inside those folders you have one or more properties files. Your configuration app would then assume the properties are prefixed with the directory (or choose your approach here), so when you ask for the property via ConfigManager (or choose your own class name here) via some method like: ConfigManager cm = getConfigManager ... cm.getProperty("foo.property..."); // returns property in foo or cm.getPropety("baz.property..."); // returns a property in baz
I implemented something like this for a Swing (yuk) app I worked on that has a folder named "global" for the global application properties and then i implement a <code>public String getName();</code> method for every component that needed config settings so it could grab properties in a folder with the same name as the component, otherwise it would get the global properties with that key. It works out pretty well because you can override configuration settings for particular components, otherwise use the global properties for things like labels, input field defaults and so on.
If you are interested in this code just email me josgraha [at] gmail [dot] com.
BR_Joe_Graham
|
Anonymous
Unregistered
|
|
Guys, why not use standard config dir pattern? (These directories are suffixed with ".d" in SysV UNIXes).
1. Load master configuration file, e.g. "foo.properties"; 2. Load all configuration files in "foo.d/" in order, e.g. "foo.d/01-very-common.properties", "foo.d/50-not-so-common.properties", "foo.d/99-my-local.properties".
Please, don't invent bicycle again...
Volodymyr M. Lisivka
|
Unregistered
|
|
Why re-invent the wheel? http://static.springframework.org/spring/docs/2.0.x/reference/new-in-2.html#new-in-2-ioc
Spring Inverson of Control does this very well, and is very mature.
|
Unregistered
|
|
What about Apache Commons Configurations...? http://commons.apache.org/configuration
|
greiser
newbie
Reged: 05/02/06
Posts: 28
|
|
I have used JFig with great success for several years now. The Apache Commons configurator looks interesting, however, there are just too many dependencies with that solution, IMHO.
|