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

Anonymous
Unregistered




Re: A much smarter way to load properties and onfi
      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


Entire topic
Subject Posted by Posted on
* A much smarter way to load properties and onfig Bruce Conrad 08/14/03 02:17 PM
. * * Re: A much smarter way to load properties and onfi greiser   11/29/07 05:39 PM
. * * Re: A much smarter way to load properties and onfig    06/16/07 04:32 PM
. * * Re: A much smarter way to load properties and onfi    10/12/07 04:00 PM
. * * Re: A much smarter way to load properties and onfi Anonymous   03/06/06 02:56 PM
. * * Re: A SysV UNIX solution Anonymous   03/10/06 10:13 AM
. * * Re: A much smarter way to load properties and onfig Andy_Sumner   07/20/04 07:37 PM
. * * Re: A much smarter way to load properties and onfi Jean-Seb   08/06/04 09:45 AM
. * * Re: A much smarter way to load properties and onfi Antti Brax   08/15/03 04:50 AM
. * * Re: A much smarter way to load properties and onfig vlad_roubtsov   08/14/03 07:24 PM

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

Moderator:   



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

Rating:
Thread views: 40815

Rate this thread

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5