Executables are a key concept. They allow to executeall the actions to perform (evaluate conditions, set values, etc …). They are specified by the IExecutable Java interface.
They come in several types, described below.
It’s the library core. It is specified by the IMruleExecutionSet Java interface.
So multiple MRules instances could be nested in a main one. But this practice is not recommended and shows no real interest.
One Rule Set implementation is available: RULEEXECUTIONSET. Corresponding Java class is MruleExecutionSet.
The rules are executable which evaluate conditions and perform the implied actions depending on the result of the evaluation. The implied actions are usually one or more Executables themselves . No specific interface specifies this type of Executables.
Available Rules implementations are :
BLOCK: Encapsulates execution of several Executables. Allows to control execution flow more precisely.
FOREACH: For each value in a Collection, an Array, an Accessor liste, etc … Sets a variable and launches one or more Executables.
FOREACHNUMBER: Allow to iterate on a range of numbers, given start, end or number of iterations and increment.
INDEX: Launches one or more Executable, chosen depending on a source value.
RULE: Evaluates a condition,and launches one or more Executables if true (then) or one or more otehr Executables if false (else).
These are “leaf” Executables. These implementations will perform actions which will produce desired result (updating data, writing a String, etc). They are described by the IAction Java Interface.
Available actions implementations are :
ACCEXEC: Allows to execute the action performed by an accessor. Typically used to invoke method via property access. It’s automatically instanciated when needed.
ADD: Adds a value to a Collection.
ADDALL: Adds all values of a source (such as a Collection, an Array, an iterator, etc…) to a target Collection.
CLEAR: Deletes the content of a Collection, a Map, a StringBuffer or of any Object with a “clear” method.
DEFINE: Defines a variable.
EXEC: Executes a System command and retrieves the exit code in a variable. Sdandard and error output streams are redirected to those specified in execution context.
PRINT: Writes a String into one of the standard or error stream defined in the execution context.
PRINTF: Based on FORMAT accessor, allows to format a String, in a way similar to Java Message Format.
SET: Sets a value in an output bean.