|
Article Excerpt Property files are frequently used in systems built using lava 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?
The Properties Editor Framework detailed in this article was developed to solve the problem of managing application properties. It provides a convenient way to define a data type for each property and have a companion component in Swing to edit the property value. The framework can be used as a standalone tool or as part of a user interface.
One of the framework's design criteria was that it should work out of a property file, i.e., no other files or databases should be required for managing the property fide. This is achieved by using certain meta-attributes to describe the characteristics of each property in the properties file. These meta-attributes are embedded along with each property in the property file as comments (Any line, in a property file, starting with '#' is considered a comment in Java).
In this article, we'll describe the framework's use, the concept of meta-attributes, and the default set of the attributes supported by the framework. And then, we'll explain the frameworks design and how to extend it to support a new property data type.
Using the Property Editor Framework
The first step in using the Property Editor Framework is to decide on the Parameter type of each property in the properties file. Currently the framework supports the types listed in Table 1.
The next step is to modify the properties file and add the necessary meta-attributes for each property. Listing 1 shows a sample properties fide with meta-attributes.
The final step is to set up the environment for the Property Editor Framework and invoke the Property Editor Dialog to start updating the property values. Figure...
|
|

More articles from Java Developer's Journal
OSS: the market landscape: why the OSS industry can--for the first tim..., June 01, 2005 Jtest 7.0.: by Parasoft.(LABS), June 01, 2005 MKS integrity suite 2005.(Labs), June 01, 2005 Star Trek technology Java3D: building a particle system for Java3D.(FE..., June 01, 2005
Looking for additional articles?
Search our database of over 3 million articles.
Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication
name or publication date.
About Goliath
Whether you're looking for sales prospects, competitive information, company
analysis or best practices in managing your organization,
Goliath can help you meet your business needs.
Our extensive business information databases empower business
professionals with both the breadth and depth of credible,
authoritative information they need to support their business
goals. Whether it be strategic planning, sales prospecting,
company research or defining management best practices -
Goliath is your leading source for accurate information.
|
|