Enum Class RemoteRuleFallbackManager

java.lang.Object
java.lang.Enum<RemoteRuleFallbackManager>
org.languagetool.RemoteRuleFallbackManager
All Implemented Interfaces:
Serializable, Comparable<RemoteRuleFallbackManager>, Constable

public enum RemoteRuleFallbackManager extends Enum<RemoteRuleFallbackManager>
  • Enum Constant Details

  • Field Details

  • Constructor Details

    • RemoteRuleFallbackManager

      private RemoteRuleFallbackManager()
  • Method Details

    • values

      public static RemoteRuleFallbackManager[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RemoteRuleFallbackManager valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • init

      public void init(@NotNull File remoteRuleConfigFile)
      Initialize RemoteRuleFallbackManager from remoteRuleConfigFile, can only been called once
      Parameters:
      remoteRuleConfigFile -
    • init_for_tests_only

      @TestOnly public void init_for_tests_only(@NotNull List<RemoteRuleConfig> config)
      This method is only for internal tests and must not been called from production code
      Parameters:
      config -
    • setup

      private void setup(@NotNull List<RemoteRuleConfig> finalConfig)
    • getInhouseFallback

      @Nullable public RemoteRuleConfig getInhouseFallback(@NotNull String ruleId)
      Parameters:
      ruleId - a remote RuleId
      Returns:
      the RemoteRuleConfig for the given RuleId
    • isRuleOrFallbackAvailable

      @Nullable public String isRuleOrFallbackAvailable(@NotNull RemoteRule rule, @NotNull Map<String,RemoteRule> remoteRules)
      Check the current status of the circuitBreaker of a remoteRule, and get the fallback option if not available
      Parameters:
      rule -
      remoteRules -
      Returns:
      A RuleId: 1. Same RuleID as rule.getId() -> The rule is available 2. Other RuleID as rule.getId() -> The rule is not available, and you get the fallbackID 3. Null -> The rule is not available and has no available fallbacks
    • isRuleOrFallbackAvailable

      @Nullable private String isRuleOrFallbackAvailable(@NotNull RemoteRule rule, @NotNull Map<String,RemoteRule> remoteRules, Set<String> visited)