|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openbp.common.setting.SettingResolver
public class SettingResolver
The setting resolver manages a chain of setting providers.
The providers may retrieve or save settings.
The setting resolver will access the registered setting providers in order to
resolve (i. e. retrieve or store) the setting.
A setting provider may be e. g. a provider that store settings in a property file,
but also a provider that may store them in a database under the name of the current user.
When a provider registers with the resolver, it can be assigned a priority.
The priority will determine the order in which the resolver will ask the providers
if they can resolve the setting.
A setting is identified by its name, which can include sub setting specifications (sections),
which are separated by the '.' character, e. g. "section1.section2.name".
The setting name may optionally include the name of the setting provider,
e. g. "user:section1.section2.name".
Some setting providers may save the settings automatically if one of the set methods is called,
whereas others may cache the settings and save them to the persistent storage after the
saveSettings(java.lang.String) method has been called.
| Field Summary | |
|---|---|
static char |
PROVIDER_SEPARATOR
Provider separator |
| Constructor Summary | |
|---|---|
SettingResolver()
Constructor. |
|
| Method Summary | |
|---|---|
void |
addProvider(java.lang.String name,
SettingProvider provider,
int priority)
Adds a provider. |
void |
clearProvider(java.lang.String name)
Clears the specified setting provider. |
java.lang.Object |
clone()
Creates a clone of this object. |
SettingProvider |
getProvider(java.lang.String name)
Gets a provider by its name. |
java.util.List |
getProviderInfoList()
Gets the provider list. |
java.lang.Object |
getSetting(java.lang.String name,
java.lang.Object dflt)
Gets a setting value or the default. |
boolean |
loadSettings(java.lang.String providerName)
Loads the current setting values of a setting provider. |
boolean |
saveSettings(java.lang.String providerName)
Saves the current setting values of a setting provider. |
SettingProvider |
setSetting(java.lang.String name,
java.lang.Object value)
Sets a setting. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final char PROVIDER_SEPARATOR
| Constructor Detail |
|---|
public SettingResolver()
| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException - Neverpublic java.lang.String toString()
toString in class java.lang.Object
public java.lang.Object getSetting(java.lang.String name,
java.lang.Object dflt)
name - Name of the settingdflt - Default value of the setting
public SettingProvider setSetting(java.lang.String name,
java.lang.Object value)
name - Name of the settingvalue - Value of the setting
public boolean loadSettings(java.lang.String providerName)
providerName - Name of the provider to save or null for all
public boolean saveSettings(java.lang.String providerName)
providerName - Name of the provider to save or null for all
public void addProvider(java.lang.String name,
SettingProvider provider,
int priority)
SettingProvider.loadSettings().
name - Name of the providerprovider - The provider to addpriority - Priority of the provider; 0 is top prioritypublic void clearProvider(java.lang.String name)
name - Name of the provider to removepublic SettingProvider getProvider(java.lang.String name)
name - Name of the provider
public java.util.List getProviderInfoList()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||