Class ClusterConfigServiceImpl

java.lang.Object
org.graylog2.cluster.ClusterConfigServiceImpl
All Implemented Interfaces:
ClusterConfigService

public class ClusterConfigServiceImpl extends Object implements ClusterConfigService
  • Constructor Details

  • Method Details

    • get

      public <T> T get(String key, Class<T> type)
      Description copied from interface: ClusterConfigService
      Retrieve Java class of a certain type for the given key from the cluster configuration.
      Specified by:
      get in interface ClusterConfigService
      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.
    • get

      public <T> T get(Class<T> type)
      Description copied from interface: ClusterConfigService
      Retrieve Java class of a certain type from the cluster configuration.
      Specified by:
      get in interface ClusterConfigService
      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.
    • getOrDefault

      public <T> T getOrDefault(Class<T> type, T defaultValue)
      Description copied from interface: ClusterConfigService
      Retrieve Java class of a certain type from the cluster configuration or return a default value in case that failed.
      Specified by:
      getOrDefault in interface ClusterConfigService
      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

      public <T> void write(T payload)
      Description copied from interface: ClusterConfigService
      Write a configuration bean to the cluster configuration.
      Specified by:
      write in interface ClusterConfigService
      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!
    • write

      public <T> void write(String key, T payload)
      Description copied from interface: ClusterConfigService
      Write a configuration bean to the cluster configuration with the specified key.
      Specified by:
      write in interface ClusterConfigService
      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!
    • remove

      public <T> int remove(Class<T> type)
      Description copied from interface: ClusterConfigService
      Remove a configuration bean from the cluster configuration.
      Specified by:
      remove in interface ClusterConfigService
      Parameters:
      type - The Class of the Java configuration bean to remove.
      Returns:
      The number of removed entries from the cluster configuration.
    • list

      public Set<Class<?>> list()
      Description copied from interface: ClusterConfigService
      List all classes of configuration beans in the database.
      Specified by:
      list in interface ClusterConfigService
      Returns:
      The list of Java classes being used in the database.