ImpactHandlers

ilog.rules.studio.model.impactHandlers

JRules 6.5

Allows plug-ins to specify impact handlers that compute the resource elements impacted by changes on a given resource.
This is used by services such as the build mechanism to determine wich resource element should be (re)compiled after a resource has changed.

<!ELEMENT extension (impactHandler+)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT impactHandler EMPTY>

<!ATTLIST impactHandler

id    CDATA #REQUIRED

class CDATA #REQUIRED>


<extension point=

"ilog.rules.studio.model.impactHandlers"

>

<!-- Handler that analyzes and returns the impact of changes on rule package resources -->

<impactHandler class=

"sample.RulePackageChangesImpactHandler"

id=

"sample.rulePackageImpactHandlerID"

/>

<!-- Handler that returns a set of ruleflows invalidated by a change on a resource (rules, functions, and any other resources) -->

<impactHandler class=

"sample.InvalidatedRuleFlowsFinder"

id=

"sample.InvalidatedRuleFlowsFinder"

/>

</extension>


There are many ways in which you can use impact handlers to perform impact analysis.
For example, you can return resource elements impacted by a given type of resource:

Set result = ...;
if ("brl".equals(resource.getFileExtension()) {
...
// Collects decision tables impacted by the action rule
set.add(decisionTables);

// Collects rules impacted by the action rule
set.add(rules);

// Collects ruleflows impacted by the action rule
set.add(rules);
}
return result;

You can also return only a specific type of artifact or handler:

Set result = ...;
Set ruleFlows = ...; // Computes or gets ruleflows that should be analyzed by the impact handler

for (Iterator it=ruleFlows.iterator();it.hasNext();) {
IlrRuleFlow ruleFlow = (IlrRuleFlow) it.next();
if (isImpactedBy(ruleFlow, resource)
result.add(ruleFlow);
}
return result;