Package com.sodius.oslc.server
Class SettingStore
java.lang.Object
com.sodius.oslc.server.SettingStore
Manages persistence of Setting.
- Since:
- 2.0.0
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidDeletes a setting.static SettingStoreReturns the current store instance.Returns existing setting for the given key.static voidsetInstance(SettingStore store) Replaces the current store instance with the given one.protected abstract voidAdds a setting.
-
Constructor Details
-
SettingStore
public SettingStore()
-
-
Method Details
-
getInstance
Returns the current store instance.- Returns:
- the current instance.
- See Also:
-
setInstance
Replaces the current store instance with the given one.- Parameters:
store- the new store.
-
getValue
protected abstract Optional<String> getValue(String key, Optional<String> scope) throws SettingStoreException Returns existing setting for the given key.- Parameters:
key- the setting keyscope- the scope identifier- Returns:
- the stored setting
- Throws:
SettingStoreException- if an error occurs while querying the store
-
setValue
protected abstract void setValue(String key, String value, Optional<String> scope) throws SettingStoreException Adds a setting. If the setting key already exists, the value is updated.- Parameters:
key- the setting keyvalue- the setting valuescope- the scope identifier- Throws:
SettingStoreException- if an error occurs while querying the store
-
delete
Deletes a setting. If the setting does not exist, nothing is done and no error is thrown.- Parameters:
key- the setting keyscope- the scope identifier- Throws:
SettingStoreException- if an error occurs while querying the store
-