Rule mediator has been implemented based on Java Rule Engine API - JSR-94.This provides the capability required for mediation using rules. Figure 1 shows a Rule Mediator UI.
Figure1: Rule Mediator
Each of configuration elements is described in following section
Rule script can be given as a registry key or an in-lined script. To give rule script as in-lined, you can use editor.
Source Format - XML or native
The format (language) of the rule script . If it is a XML, then this attribute should be 'xml'. Any other value, rule mediator assumes that the rule script is in native format. If the rule script is in native format, it should be given by wrapping as a CDATA section inside a XML tag ex: <X><![CDATA[ native code]]></X>.
Note: The key or in-lined rule script must be defined. Otherwise, rule mediator is invalid.
Session Type - Indicates the stateful or stateless behavior of the rule engine. If this has value ' stateful ' , then rule engine will executes rules in a state full manner , for any other value , it assumes as stateless.
property - Those are used when creating rule session.
It is possible to exists properties for rules set creation, registration, deregistration and there are add property options for each.
Example Usage: When using Drool native language (.drl) for rule script, it is needed to provide .dsl file .This can be done using attribute named 'source' and value 'drl'.
<ruleSet> <creation> <property name="source" value="drl"/> </creation> </ruleSet>
Fatcs defines what are the facts that should injected to Rule Engine in order to fire rules whereas Results describes what should do with return value form rule engine.
Figure 2 - shows a one senario of addting fact / result
Figure 2: Facts/Results of the Rule Mediator
Type : This is the only mandatory field. Fact selector can be used to specify any registered fact types
Name : The name of the fact
Fact Source Type : Can be literal, a registry key or an expression
Value : The registry or Message context key .This is used for getting data from either registry or message context
Registry Browser : If the key is registry resource, the browser to select the resource.
NS Editor : You can click this link to add namespaces if you are providing an expression. You will be provided another panel named 'Namespace Editor' where you can provide any number of namespace prefixes and url
Action : Delete the input out put
Adding properties option is in RuleSet and RuleSession. Figure 3 shows UI on adding property.
Figure3: Rule Mediator Properties
Name: Name for the property
Value: The type of the property value.
Action: Delete the property