File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Enhanced java.util.Properties Implementation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Enhanced java.util.Properties Implementation" Watch "Enhanced java.util.Properties Implementation" New topic

Enhanced java.util.Properties Implementation

Jon Chase

Joined: Feb 14, 2004
Posts: 7
Hey! I'd like to allow users of our web application to edit its configuration files through the web interface, and I've got the following idea of how to do it (and by the way, I am NOT considering using XML for configuration).

Say you've got a standard .properties file, like:

prop1.displayName=Property 1

prop2.displayName=Property 2

I'd like to get some type of objects back from reading this properties file which would give me something like the following:

Class: EnhancedProperties // represents the entire file
- Members:
- List properties // one entry for each main property, in our case, we'd have 2 entries (prop1 and prop2)

Class: EnhancedProperty // represents one entry from the EnhancedProperties class
- Members
- String name // in our case, "prop1"
- String displayName // in our case, "Property 1"
- String [] possibleValues // in our case, {"1","2","3","a","b","c"}
- String value // in our case, 2

Using this class, we'd automatically get all main properties, a list of their possible values (for dropdowns), a display name, and a current value, all stored in one place.

Does anyone know of anything out there similar to this? Or for that matter, something that will make config file editing for users of a UI as easy to add as this?
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
I agree with you solution BUT

I think , it not good solution for edit/change data in properties file at RUNTIME. because you MUST create Management Class to manage properties file, it so hard...

You should be use XML file with JAXP : DOM, SAX or Dom4j/JDOM, it suite.

Java Developer, Thailand
I agree. Here's the link:
subject: Enhanced java.util.Properties Implementation
It's not a secret anymore!