Welcome!

Java Authors: Maureen O'Gara, Liz McMillan, Walter H. Pinson, III, Yakov Werde, Tony Bishop

Related Topics: Java

Java: Article

Enterprise Java - Properties Editor Framework

Solving the problem of managing application properties

Adding a New Meta-Attribute
In some cases, you might need to add one or more custom attri-butes to handle a new type properly. Say, in the previous example, we wanted to build the ability to store the name of the base class (for the JDBC driver this would be java.sql.Driver) whose subclasses we want to select from. It would make the new control more generic. To implement it, we would need to add a new meta-attribute specific to this type, say, BASECLASS. To enable the framework to parse this new meta-attribute, you'd need to add a new regular expression pattern to the Parser class that matches the newly defined meta-attribute and then write the required processing so this data is passed to the constructor of the corresponding Parameter class.

Conclusion
Property files are frequently used in Java-based applications so their execution can be controlled externally. In this article we described the design and use of a lightweight framework for managing these property files. The framework is easily adoptable and allows for extensions. However, we believe it can be made even better. Java 1.5 supports the XML format for specifying properties. Enabling this framework support would ease the task of specifying documentation attributes (currently documentation need to be specified in a single line). We hope you enjoy working with this framework as much as we did developing it.

References

More Stories By David Bismut

David Bismut is a third-year student at the Ecole des Mines in Nantes (EMN), a French engineering school. He specializes in information management technologies. He was part of InStep, Infosys's global internship program in 2004.

More Stories By Krishnakumar Pooloth

Krishnakumar Pooloth is a senior technical architect with Infosys Technologies. His areas of expertise include object design, component technology, Java, and expert systems. He holds a Bachelor's degree in electronics and communication from Calicut University, India.

More Stories By Swaminathan Natarajan

Swaminathan Natarajan is a technical architect with Infosys Technologies. His area of expertise is Java, repository technologies, and metadata management.

Comments (1) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Java Developer's Journal 07/31/05 06:42:09 PM EDT

Enterprise Java - Properties Editor Framework
Property files are frequently used in systems built using Java whether it's a thick Java client, a servlet, or a business component. Java specifies the format for a property file and provides the Properties class to read from and write to these files. However, Java is silent on the aspects related to validations of a value entered in a property file, providing room for errors to creep into an application system. How many times have you started to debug a failure in an application only to realize that it's because of an incorrect value in a property file?