*/
public static RuleMediatorDescription create(OMElement configurationXML,
XPathFactory xPathFactory,
ExtensionBuilder configurationExtensionBuilder) {
QName tagQName = configurationXML.getQName();
QNameFactory qNameFactory = QNameFactory.getInstance();
RuleMediatorDescription ruleMediatorDescription = new RuleMediatorDescription();
QName sessionQName = qNameFactory.createQName(CommonsConstants.ELE_SESSION, tagQName);
OMElement sessionElement = configurationXML.getFirstChildWithName(sessionQName);
if (sessionElement != null) {
SessionDescription description =
SessionDescriptionFactory.create(sessionElement, xPathFactory);
ruleMediatorDescription.setSessionDescription(description);
}
QName executionSetQName = qNameFactory.createQName(CommonsConstants.ELE_RULESET,
tagQName);
OMElement executionSetElement = configurationXML.getFirstChildWithName(executionSetQName);
if (executionSetElement != null) {
RuleSetDescription description =
RuleSetDescriptionFactory.create(executionSetElement, xPathFactory,
configurationExtensionBuilder);
ruleMediatorDescription.setRuleSetDescription(description);
} else {
throw new LoggedRuntimeException("ruleset configuration element must be given",
log);
}
QName factsQName = qNameFactory.createQName("facts", tagQName);
OMElement factsElement = configurationXML.getFirstChildWithName(factsQName);
if (factsElement != null) {
QName inputQName = qNameFactory.createQName(CommonsConstants.ELE_FACT,
tagQName);
Iterator inputs = factsElement.getChildrenWithName(inputQName);
while (inputs.hasNext()) {
OMElement inputElem = (OMElement) inputs.next();
ResourceDescription input =
ResourceDescriptionFactory.createResourceDescription(inputElem,
xPathFactory);
if (input != null) {
ruleMediatorDescription.addFactDescription(input);
}
}
}
QName resultsQName = qNameFactory.createQName("results", tagQName);
OMElement resultsElement = configurationXML.getFirstChildWithName(resultsQName);
if (resultsElement != null) {
QName outputQName = qNameFactory.createQName(CommonsConstants.ELE_RESULT,
tagQName);
Iterator outputs = resultsElement.getChildrenWithName(outputQName);
while (outputs.hasNext()) {
OMElement outputElem = (OMElement) outputs.next();
ResourceDescription output =