Class Rule

  • All Implemented Interfaces:
    java.lang.Runnable
    Direct Known Subclasses:
    CheckFDMonitor, SampleRule

    public abstract class Rule
    extends java.lang.Object
    implements java.lang.Runnable
    A rule with a condition and (optional) action. When a rule is run, the condition is checked with eval() and - if true - the action is triggered with trigger().
    Since:
    3.3
    Author:
    Bela Ban
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Log log  
      protected SUPERVISOR sv  
    • Constructor Summary

      Constructors 
      Constructor Description
      Rule()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.String condition()
      Returns a description of the condition that led to eval() returning true
      abstract java.lang.String description()
      Describes what the rules does
      void destroy()
      Called when rule is uninstalled
      abstract boolean eval()
      Evaluates the condition.
      void init()
      Called when rule is installed
      Rule log​(Log log)  
      abstract java.lang.String name()
      Returns the name of the rule.
      void run()  
      Rule supervisor​(SUPERVISOR sv)  
      abstract void trigger()
      The action of the rule.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Rule

        public Rule()
    • Method Detail

      • log

        public Rule log​(Log log)
      • name

        public abstract java.lang.String name()
        Returns the name of the rule. Should be unique if a rule needs to be uninstalled
      • description

        public abstract java.lang.String description()
        Describes what the rules does
      • init

        public void init()
        Called when rule is installed
      • destroy

        public void destroy()
        Called when rule is uninstalled
      • eval

        public abstract boolean eval()
        Evaluates the condition. If true, the rule is triggered. If true, the next execution of condition() should return a non-null string
      • condition

        public abstract java.lang.String condition()
        Returns a description of the condition that led to eval() returning true
      • trigger

        public abstract void trigger()
                              throws java.lang.Throwable
        The action of the rule. Triggered if eval() returned true
        Throws:
        java.lang.Throwable
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable