net.sf.genuine.preferences
Class DefaultPreferencesService

java.lang.Object
  extended bynet.sf.genuine.preferences.DefaultPreferencesService
All Implemented Interfaces:
PreferencesService, Service

class DefaultPreferencesService
extends java.lang.Object
implements PreferencesService

Default implementation of the preferences service.


Constructor Summary
(package private) DefaultPreferencesService(java.lang.String preferencesRoot)
           
 
Method Summary
 java.util.prefs.Preferences getPreferences(java.lang.String identificationPath)
          Returns a Preferences object using which the preference settings for a PreferencesPage may be retrieved and stored.
 boolean isActive()
          The service is always active.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPreferencesService

DefaultPreferencesService(java.lang.String preferencesRoot)
Method Detail

isActive

public boolean isActive()
The service is always active.

Specified by:
isActive in interface Service

getPreferences

public java.util.prefs.Preferences getPreferences(java.lang.String identificationPath)
Description copied from interface: PreferencesService
Returns a Preferences object using which the preference settings for a PreferencesPage may be retrieved and stored. As parameter the identification path of the preference page has to be passed (see PreferencesPage.getIdentificationPath(). The Preferences object that is returned is the preferences node you get if you concatenate the preferences root node of the application (set by configuration properties of the preferences module) and the identification path.

Example: The following property is set as part of the configuration data for the preferences module:

   <property key="PreferencesRoot" value="net/sf/genuine/example/crm/"/>
 
If you would like to get the Preferences object for general appearance preferences, these values are handled by the class AppearancePreferencesPage that is provided by Genuine itself. Its method getIdentificationPath looks as follows:
   public String getIdentificationPath() {
     return "general/appearance";
   }
 
You should therefore call this method passing the parameter "general/appearance". You retrieve the same preference node as if you call
   Preferences.userRoot().node("net/sf/genuine/example/crm/general/appearance").
 

Every application class may retrieve a Preferences object using the identification path of any preference page to check its preferences settings.

Genuine uses the default preferences means of the Java plattform. To use a different preferences storage mechanism, you need to set up this mechanism in your own application. See the JavaDoc comment of PreferencesModule.

Specified by:
getPreferences in interface PreferencesService