Interface ClusterConfigService

All Known Implementing Classes:
ClusterConfigServiceImpl

public interface ClusterConfigService
Service to save and retrieve cluster configuration beans.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    extractPayload(Object payload, Class<T> type)
     
    <T> T
    get(Class<T> type)
    Retrieve Java class of a certain type from the cluster configuration.
    <T> T
    get(String key, Class<T> type)
    Retrieve Java class of a certain type for the given key from the cluster configuration.
    <T> T
    getOrDefault(Class<T> type, T defaultValue)
    Retrieve Java class of a certain type from the cluster configuration or return a default value in case that failed.
    getRaw(Class<?> key)
    Retrieve raw persisted Java class.
    List all classes of configuration beans in the database.
    <T> int
    remove(Class<T> type)
    Remove a configuration bean from the cluster configuration.
    <T> void
    write(String key, T payload)
    Write a configuration bean to the cluster configuration with the specified key.
    <T> void
    write(T payload)
    Write a configuration bean to the cluster configuration.
  • Method Details

    • get

      <T> T get(Class<T> type)
      Retrieve Java class of a certain type from the cluster configuration.
      Type Parameters:
      T - The type of the Java configuration bean.
      Parameters:
      type - The Class of the Java configuration bean to retrieve.
      Returns:
      An instance of the requested type or null if it couldn't be retrieved.
    • extractPayload

      <T> T extractPayload(Object payload, Class<T> type)
    • get

      <T> T get(String key, Class<T> type)
      Retrieve Java class of a certain type for the given key from the cluster configuration.
      Type Parameters:
      T - The type of the Java configuration bean.
      Parameters:
      key - The key that is used to find the cluster config object in the database.
      type - The Class of the Java configuration bean to retrieve.
      Returns:
      An instance of the requested type or null if it couldn't be retrieved.
    • getRaw

      ClusterConfig getRaw(Class<?> key)
      Retrieve raw persisted Java class.
      Parameters:
      key - The key/type that is used to find the cluster config object in the database.
      Returns:
      An instance of the raw persisted Java class or null if it couldn't be retrieved.
    • getOrDefault

      <T> T getOrDefault(Class<T> type, T defaultValue)
      Retrieve Java class of a certain type from the cluster configuration or return a default value in case that failed.
      Type Parameters:
      T - The type of the Java configuration bean.
      Parameters:
      type - The Class of the Java configuration bean to retrieve.
      defaultValue - An instance of T which is returned as default value.
      Returns:
      An instance of the requested type.
    • write

      <T> void write(String key, T payload)
      Write a configuration bean to the cluster configuration with the specified key.
      Type Parameters:
      T - The type of the Java configuration bean.
      Parameters:
      key - The key that is used to write the cluster config object to the database.
      payload - The object to write to the cluster configuration. Must be serializable by Jackson!
    • write

      <T> void write(T payload)
      Write a configuration bean to the cluster configuration.
      Type Parameters:
      T - The type of the Java configuration bean.
      Parameters:
      payload - The object to write to the cluster configuration. Must be serializable by Jackson!
    • remove

      <T> int remove(Class<T> type)
      Remove a configuration bean from the cluster configuration.
      Parameters:
      type - The Class of the Java configuration bean to remove.
      Returns:
      The number of removed entries from the cluster configuration.
    • list

      Set<Class<?>> list()
      List all classes of configuration beans in the database.
      Returns:
      The list of Java classes being used in the database.