Class SettingStore

java.lang.Object
com.sodius.oslc.server.SettingStore

public abstract class SettingStore extends Object
Manages persistence of Setting.
Since:
2.0.0
See Also:
  • Constructor Details

    • SettingStore

      public SettingStore()
  • Method Details

    • getInstance

      public static SettingStore getInstance()
      Returns the current store instance.
      Returns:
      the current instance.
      See Also:
    • 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 key
      scope - 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 key
      value - the setting value
      scope - 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 exist, nothing is done and no error is thrown.
      Parameters:
      key - the setting key
      scope - the scope identifier
      Throws:
      SettingStoreException - if an error occurs while querying the store