Class YamlRulesFactory

java.lang.Object
com.helixframework.rules.config.YamlRulesFactory

public class YamlRulesFactory extends Object
Loads rules from a yaml configuration file. Expected file format:
 - name: ruleA
   type: spel
   classification: foo
   description: "Appends an 'A' to the string"
   dependencies:
     - ruleB
     - ruleD
   expression:
     "#root.concat('A')"
   tags:
     fooTag: fooTagValue
   timeout: 1000

 - name: ruleB
   type: spel
   classification: foo
   description: "Appends a 'B' to the string"
   dependencies:
     - ruleC
   expression:
     "#root.concat('B')"
   tags:
     fooTag: fooTagValue
     barTag: barTagValue

 - name: ruleC
   type: spel
   classification: bar
   description: "Appends a 'C' to the string"
   expression:
     "#root.concat('C')"

 - name: ruleD
   type: java
   classification: baz
   description: "Appends a 'D' to the string"
   className: com.helixframework.rules.config.rules.RuleD
 
  • Method Details

    • load

      public static Set<Rule> load(String filePath) throws IOException
      Loads rules from the file path.
      Parameters:
      filePath - file path
      Returns:
      a set of Rule
      Throws:
      IOException - if file cannot be read
    • load

      public static Set<Rule> load(Path filePath) throws IOException
      Loads rules from the file path.
      Parameters:
      filePath - file path
      Returns:
      a set of Rule
      Throws:
      IOException - if file cannot be read
    • load

      public static Set<Rule> load(File file) throws IOException
      Loads rules from the supplied file.
      Parameters:
      file - file
      Returns:
      a set of Rule
      Throws:
      IOException - if file cannot be read
    • load

      public static Set<Rule> load(InputStream inputStream) throws IOException
      Loads rules from the supplied input stream.
      Parameters:
      inputStream - input stream
      Returns:
      a set of Rule
      Throws:
      IOException - if inputstream cannot be read