**DONOTDELETE**
(Unregistered)
08/14/03 02:17 PM
A much smarter way to load properties and onfig

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)
08/14/03 07:24 PM
Re: A much smarter way to load properties and onfig

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().


**DONOTDELETE**
(Unregistered)
08/15/03 04:50 AM
Re: A much smarter way to load properties and onfi

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)
07/20/04 07:37 PM
Re: A much smarter way to load properties and onfig

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


**DONOTDELETE**
(Unregistered)
08/06/04 09:45 AM
Re: A much smarter way to load properties and onfi

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 !


**DONOTDELETE**
(Unregistered)
03/06/06 02:56 PM
Re: A much smarter way to load properties and onfi

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


**DONOTDELETE**
(Unregistered)
03/10/06 10:13 AM
Re: A SysV UNIX solution

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


**DONOTDELETE**
(Unregistered)
06/16/07 04:32 PM
Re: A much smarter way to load properties and onfig

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.


**DONOTDELETE**
(Unregistered)
10/12/07 04:00 PM
Re: A much smarter way to load properties and onfi

What about Apache Commons Configurations...?
http://commons.apache.org/configuration


greiser
(newbie)
11/29/07 05:39 PM
Re: A much smarter way to load properties and onfi

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.


Contact us JavaWorld

Powered by UBB.threads™ 6.5.5

Featured White Papers


RESEARCH CENTERS: Java Standard Edition | Java Enterprise Edition | Java Micro Edition | Development Tools
About Us | Advertise | Contact Us | Terms of Service/Privacy
Copyright, 2006-2008 Network World, Inc. All rights reserved.