jSettings 0.2 review
DownloadjSettings package is meant to provide a Java library for dealing with program settings
|
|
jSettings package is meant to provide a Java library for dealing with program settings. (I use "settings" as just another synonym for preferences, properties, etc but I chose the word settings because of the already existing Preferences and Properties frameworks in Java). It wants to be a powerful tool for the developers of Java programs that want to manipulate structures of settings.
The code (as well as this page) is at an early development and testing stage. On top of that, I am only doing it as a means to teach myself Java (I'm an economist by training and by profession) , so even at later stages you can expect the quality of the code to be quite low.
If you feel like any part of the design, code, Javadoc, examples etc is silly please don't hesitate to let me know about it. Also, I would also be happy to include requested features as long as I can understand the need for them and I also know how to do it. So please write to me if you have anything to say about this project!
Here are some key features of "jSettings":
Handles INI and FSTAB type of files and settings. There is no XML support yet, but I plan to do it if it seems to be requested.
INI settings are specified by a setting = value pair.
FSTAB settings are defined by an array of settings, each in a predefined field. I call them like this because the structure is similar to the fstab file in UNIX environments. Logical structure is quite similar to that of XML files.
Settings can be logically structured into sections.
There are two degrees of hierarchy available, called hierarchical and non-hierarchical. For example, in a hierarchical organization, the settings in a file called settings.ini, containing the following lines:
[section1]
setting1=value1
[[section1-2]] //Notice the double brackets
setting1-2=value1-2
would be refered to as
settings:section1:setting1
and
settings:section1:section1-2:setting1-2
In a non-hierarchical structure they would be
settings:section1:setting1
and
settings:section1-2:setting1-2 (section1-2 is not a child of section1 anymore).
Loads settings from external files, either from individual files in ASCII format or from archives containing several settings files.
Includes support for default values for settings, both for ini and fstab settings.
The advantage is that the actual ini and fstab files will only contain the 'deviations' from the defaults.
Includes support for system-wide and user-specific settings, for multi-user environments.
A program would first load the defaults, then the system-wide settings and then the user-specific ones. Also when modifying the settings, there is a choice between doing it at user and at system level.
Support for adding/modifying/deleting settings.
Default support for validating the settings.
Each ini-type setting and each fstab-type field have a validation rule in the form of a regular expression. When loading the value for that setting/field, it is being checked against the rule and only accepted if it confirms to the rule. Of course, if the user wants it she can have '.*' as the rule for each setting.
Support for flushing the changes made to the settings to the external files.
Extensive logging/debug messages.
jSettings 0.2 keywords