Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958382

Pages: 1
Bruce Conrad
Unregistered




A much smarter way to load properties and onfig
      #1029 - 08/14/03 02:17 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
vlad_roubtsov
member


Reged: 06/21/03
Posts: 169
Re: A much smarter way to load properties and onfig [Re: Bruce Conrad]
      #1035 - 08/14/03 07:24 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
Antti Brax
Unregistered




Re: A much smarter way to load properties and onfi [Re: Bruce Conrad]
      #1047 - 08/15/03 04:50 AM

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/


Post Extras: Print Post   Remind Me!   Notify Moderator  
Andy_Sumner
stranger


Reged: 07/20/04
Posts: 1
Re: A much smarter way to load properties and onfig [Re: Bruce Conrad]
      #9470 - 07/20/04 07:37 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
Jean-Seb
Unregistered




Re: A much smarter way to load properties and onfi [Re: Andy_Sumner]
      #10348 - 08/06/04 09:45 AM

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 !


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: A much smarter way to load properties and onfi [Re: Bruce Conrad]
      #29285 - 03/06/06 02:56 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: A SysV UNIX solution [Re: Anonymous]
      #29521 - 03/10/06 10:13 AM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  

Unregistered




Re: A much smarter way to load properties and onfig [Re: Bruce Conrad]
      #49144 - 06/16/07 04:32 PM

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.


Post Extras: Print Post   Remind Me!   Notify Moderator  

Unregistered




Re: A much smarter way to load properties and onfi [Re: Bruce Conrad]
      #55783 - 10/12/07 04:00 PM

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


Post Extras: Print Post   Remind Me!   Notify Moderator  
greiser
newbie


Reged: 05/02/06
Posts: 28
Re: A much smarter way to load properties and onfi [Re: Bruce Conrad]
      #74673 - 11/29/07 05:39 PM

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.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 3 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 40815

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5