Search in sources :

Example 1 with Condition

use of org.apache.synapse.commons.evaluators.Condition in project wso2-synapse by wso2.

the class ConditionFactory method createCondition.

public Condition createCondition(OMElement ruleElement) throws EvaluatorException {
    Condition r = new Condition();
    OMAttribute priorityAtt = ruleElement.getAttribute(new QName(EvaluatorConstants.PRIORITY));
    if (priorityAtt != null) {
        int p = Integer.parseInt(priorityAtt.getAttributeValue());
        r.setPriority(p);
    }
    OMElement ce = ruleElement.getFirstElement();
    EvaluatorFactory ef = EvaluatorFactoryFinder.getInstance().findEvaluatorFactory(ce.getLocalName());
    if (ef == null) {
        handleException("Invalid configuration element: " + ce.getLocalName());
        return null;
    }
    Evaluator evaluator = ef.create(ce);
    r.setEvaluator(evaluator);
    return r;
}
Also used : Condition(org.apache.synapse.commons.evaluators.Condition) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) Evaluator(org.apache.synapse.commons.evaluators.Evaluator) OMAttribute(org.apache.axiom.om.OMAttribute)

Aggregations

QName (javax.xml.namespace.QName)1 OMAttribute (org.apache.axiom.om.OMAttribute)1 OMElement (org.apache.axiom.om.OMElement)1 Condition (org.apache.synapse.commons.evaluators.Condition)1 Evaluator (org.apache.synapse.commons.evaluators.Evaluator)1