org.openbp.common.setting
Interface SettingProvider

All Known Implementing Classes:
FixedSettingProvider, PropertyFileProvider, RootDirProvider, SystemPropertyProvider

public interface SettingProvider

A setting provider can retrieve and load setting values from/to persistent storage. Setting values may be strings, booleans and integers.

Author:
Heiko Erhardt

Method Summary
 java.lang.Object getSetting(java.lang.String name)
          Gets a setting value.
 boolean loadSettings()
          Loads the settings.
 boolean saveSettings()
          Saves the settings.
 boolean setSetting(java.lang.String name, java.lang.Object value)
          Sets a setting.
 

Method Detail

getSetting

java.lang.Object getSetting(java.lang.String name)
Gets a setting value.

Parameters:
name - Name of the setting
Returns:
The setting value or null if the setting does not exist

setSetting

boolean setSetting(java.lang.String name,
                   java.lang.Object value)
Sets a setting.

Parameters:
name - Name of the setting
value - Value of the setting
Returns:
true If the provider was able to save the setting.
false If the provider does not feel responsible for this setting or cannot save the setting.

loadSettings

boolean loadSettings()
Loads the settings. Forces the provider to (re-)load the settings.

Returns:
true If the setting were successfully loaded. false If the settings could not be loaded.

saveSettings

boolean saveSettings()
Saves the settings. Makes the provider to save the current setting values.
Note that some providers may save the setting values automatically if setSetting(java.lang.String, java.lang.Object) is called. In this case, this method will do nothing and should return true.

Returns:
true If the setting were successfully saved or the provider is not save-capable. false If there was an error saving the properties.


Copyright © 2011. All Rights Reserved.