Interface RuleRegistry

  • All Superinterfaces:
    Registry<Rule,​String>
    All Known Implementing Classes:
    RuleSupportRuleRegistryDelegate

    @NonNullByDefault
    public interface RuleRegistry
    extends Registry<Rule,​String>
    The RuleRegistry provides basic functionality for managing Rules. It can be used to
    • Add Rules with the Registry#add(Object) method.
    • Get the existing rules with the getByTag(String), getByTags(String[]) methods.
    • Update the existing rules with the Registry#update(Object) method.
    • Remove Rules with the Registry.remove(Object) method.
    • Manage the state (enabled or disabled) of the Rules:
      • A newly added Rule is always enabled.
      • To check a Rule's state, use the #isEnabled(String) method.
      • To change a Rule's state, use the #setEnabled(String, boolean) method.

    The RuleRegistry manages the status of the Rules:

    • To check a Rule's status info, use the #getStatusInfo(String) method.
    • The status of a Rule enabled with #setEnabled(String, boolean), is first set to RuleStatus.UNINITIALIZED.
    • After a Rule is enabled, a verification procedure is initiated. If the verification of the modules IDs, connections between modules and configuration values of the modules is successful, and the module handlers are correctly set, the status is set to RuleStatus.IDLE.
    • If some of the module handlers disappear, the Rule will become RuleStatus.UNINITIALIZED again.
    • If one of the Rule's Triggers is triggered, the Rule becomes RuleStatus.RUNNING. When the execution is complete, it will become RuleStatus.IDLE again.
    • If a Rule is disabled with #setEnabled(String, boolean), it's status is set to RuleStatus#DISABLED.
    Author:
    Yordan Mihaylov - Initial contribution