Package com.sodius.oslc.server
Class SettingStore
- java.lang.Object
-
- com.sodius.oslc.server.SettingStore
-
-
Constructor Summary
Constructors Constructor Description SettingStore()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract void
delete(String key, Optional<String> scope)
Deletes a setting.static SettingStore
getInstance()
Returns the current store instance.protected abstract Optional<String>
getValue(String key, Optional<String> scope)
Returns existing setting for the given key.static void
setInstance(SettingStore store)
Replaces the current store instance with the given one.protected abstract void
setValue(String key, String value, Optional<String> scope)
Adds a setting.
-
-
-
Method Detail
-
getInstance
public static SettingStore getInstance()
Returns the current store instance.- Returns:
- the current instance.
- See Also:
setInstance(SettingStore)
-
setInstance
public static void setInstance(SettingStore store)
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
protected abstract void delete(String key, Optional<String> scope) throws SettingStoreException
Deletes a setting. If the setting does not exists, 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
-
-