Rule Mediator - User Guide

Rule Mediator

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.

Rule

Figure1: Rule Mediator

Each of configuration elements is described in following section

RuleSource

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.

RuleServicePprovider

Class - Rule service provider class (The rule service provider implementation). The default value is Drools implementation.

URI- Rule service provider Uri. The default value is Drools implementation.

property - Those are used when creating the rule service provider.

RuleSession

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.

RuleSet

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>

Input / Output

Input defines what are the facts that should injected to Rule Engine in order to fire rules whereas Output describes what should do with return value form rule engine.

Adding Input / Output

Figure 2 shows a one senario of addting input

Rule Mediator Inputs

Figure 2 Inputs of the Rule Mediator

Type : According to current implementation valid types are as bellow.

Name : Value Type Static Value or XPath expression

Value / Expression :value - Represents any static value. expression- XPath expression is used to extract data from either external XML source or SOAP envelope. There is no default value.

Registry Key : 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

Adding properties option is in RuleServiceProvider , RuleSet and RuleSession. Figure 3 shows UI on adding property.

Property Adding

Figure3: Rule Mediator Properties

Name: Name for the property

Value: The type of the property value.

Action: Delete the property