The
java.util.prefs.Preferences API
provides a generic mechanism for storing user and system preferences, as well as configuration data. Jetspeed 2 relies on this API to provide a
wide ranging of functionality to higher level services. Some of the Jetspeed components leveraging the
java.util.prefs.Preferences
API are:
/portlet_application/${Portlet Application Name}/portlets/${Portlet Name}/preferences/${Preference Name}/values
. The preferences values are stored under the
values
node as a map of key/values.
/user/${User Name}/userinfo
. The user attributes are stored as a preferences key/values map under the userinfo node.
Preferences
model can be found in the
security section
of the documentation.
The Preferences API provides a generic implementation for organizing properties as illustrated below:
<preferences EXTERNAL_XML_VERSION="1.0"> <root type="user"> <map /> <node name="user"> <map /> <node name="principal1"> <map /> <node name="propertyset1"> <map> <entry key="set1prop1" value="256" /> <entry key="set1prop2" value="314" /> </map> </node> </node> </root>
A good reference article can be found at ONJava.com.
Jetspeed 2
Preferences
implementation leverages the following classes:
Class | Description |
---|---|
PreferencesFactoryImpl
|
Implements the java.util.prefs.PreferencesFactory that generates
Preferences objects. The PreferencesFactoryImpl is
configured through spring assembly (prefs.xml ) to use a
PreferencesProvider that encapsalutes the backing store implementation.
|
PreferencesImpl
|
Extends the java.util.prefs.AbstractPreferences and implements the SPI by
leveraging the PreferencesProvider API. Jetspeed Preferences
implementation can be configured to validate that preferences map key/values are created
for predefined keys. A PropertyManager enforces the checks if enabled.
|
PreferencesProvider
|
Encapsulates the preferences implementation again a specific backing store. In Jetspeed 2, the
default implementation is provided by
org.apache.jetspeed.prefs.impl.PersistenceBrokerPreferencesProvider
|