Interface CompositeConfigurationStrategy


public interface CompositeConfigurationStrategy

A composite configuration strategy allows to specifies the behaviour of a CompositeConfigurationStrategy.

It basically specifies how the composite source determines whether a result supersedes the result of a previous round (i.e. from a higher priority source), when a result is considered as resolved and what to do in case a source returns an error result.

It also provides a contextual defaulting strategy to use on the underlying sources. The CompositeConfigurationStrategy.CompositeDefaultingStrategy keeps track of the results of previous rounds in order to optimize the defaulting queries to execute on the subsequent sources.

Since:
1.0
Author:
Jeremy Kuhn
  • Method Details

    • noOp

      Returns a NoOp composite configuration strategy that ignores failures.

      The NoOp defaulting strategy does not support defaulting.

      Returns:
      a NoOp composite configuration strategy
    • noOp

      static CompositeConfigurationStrategy noOp(boolean ignoreFailure)

      Returns a NoOp composite configuration strategy.

      The NoOp strategy does not support defaulting.

      Parameters:
      ignoreFailure - true to ignore all failure, false otherwise
      Returns:
      a NoOp composite configuration strategy
    • lookup

      Returns a lookup composite configuration strategy that ignores failures.

      The lookup strategy supports defaulting by prioritizing query parameters from left to right (see DefaultingStrategy.lookup().

      Returns:
      a lookup composite configuration strategy
    • lookup

      static CompositeConfigurationStrategy lookup(boolean ignoreFailure)

      Returns a lookup composite configuration strategy that ignores failures.

      The lookup strategy supports defaulting by prioritizing query parameters from left to right (see DefaultingStrategy.lookup().

      Parameters:
      ignoreFailure - true to ignore all failure, false otherwise
      Returns:
      a lookup composite configuration strategy
    • ignoreFailure

      boolean ignoreFailure(ConfigurationSourceException error)

      Indicates whether or not the specified configuration source error should be ignored when resolving a result.

      Parameters:
      error - a configuration source error
      Returns:
      true to ignore the error, false otherwise
    • isSuperseded

      boolean isSuperseded(ConfigurationKey queryKey, ConfigurationKey previousKey, ConfigurationKey resultKey)

      Determines whether the specified result key supersedes the previous result key retained from previous sources for the specified original query key.

      Parameters:
      queryKey - the configuration key representing the original query
      previousKey - the configuration key of the previous result
      resultKey - the configuration key of the current result
      Returns:
      true if the result key superseds the previous result key, false otherwise
    • isResolved

      boolean isResolved(ConfigurationKey queryKey, ConfigurationKey resultKey)

      Determines whether the specified result key resolves the specified original query key (ie. there can't be any better result).

      Parameters:
      queryKey - the configuration key representing the original query
      resultKey - the result to test
      Returns:
      true if the result resolves the query, false otherwise
    • createDefaultingStrategy

      Returns the defaulting strategy that must be applied to sources before executing queries.

      Returns:
      a new composite defaulting strategy