This is version . It is not the current version, and thus it cannot be edited.
[Back to current version]   [Restore this version]

With JDK 1.4 Java has expanded on its Properties class and now provides a Preferences API. This is the product of JSR-10 (Java Specification Request) Preferences API Specication: A simple API allowing programs to manipulate user preference data and configuration data, and is a substantial improvement on the Preferences functionality.

Part of the reason I'm looking into this is that given it provides a hierarchical preferences model, it might suit the needs of WikiFarms.

Overview #

[this overview c/o Sun's J2SE documentation]

Applications require preference and configuration data to adapt to the needs of different users and environments. The java.util.prefs package provides a way for applications to store and retrieve user and system preference and configuration data. The data is stored persistently in an implementation-dependent backing store. There are two separate trees of preference nodes, one for user preferences and one for system preferences.

All of the methods that modify preference data are permitted to operate asynchronously. They may return immediately, and changes will eventually propagate to the persistent backing store. The flush method can be used to force updates to the backing store.

The methods in the Preferences class may be invoked concurrently by multiple threads in a single JVM without the need for external synchronization, and the results will be equivalent to some serial execution. If this class is used concurrently by multiple JVMs that store their preference data in the same backing store, the data store will not be corrupted, but no other guarantees are made concerning the consistency of the preference data.

For more details, choose from the following links:

[end of Sun's Overview]


The J2SE includes documentation and information about the persistent storage implementation, but that's all directed at implementors at the J2SE level. Every J2SE implementation must have an implementation (and does, apparently). This seems to confuse some people: there's no reason why any developer using the Preferences API would need to either replace those implementations unless one were developing software for an OS that didn't already have a J2SE available; the whole point of the Preferences API was to simplify this stuff (for developers) not make it more complicated. Only if one were developing a J2SE implementation would you need to pay attention to this. There's a note in bold in the javadocs for java.util.prefs.PreferencesFactory:

This class is for Preferences implementers only. Normal users of the Preferences facility should have no need to consult this documentation.


Articles and Projects#

Add new attachment

Only authorized users are allowed to upload new attachments.
« This particular version was published on 17-Dec-2006 16:01 by MurrayAltheim.