Search in sources :

Example 1 with Parser

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

the class ListenerContextBuilder method createParser.

private Parser createParser(final OMElement definitions) throws AxisFault {
    OMElement conditionsElem = definitions.getFirstChildWithName(new QName(EvaluatorConstants.CONDITIONS));
    if (conditionsElem == null) {
        handleException("Conditions configuration is mandatory for priority based routing");
    }
    assert conditionsElem != null;
    OMAttribute defPriorityAttr = conditionsElem.getAttribute(new QName(EvaluatorConstants.DEFAULT_PRIORITY));
    Parser parser;
    if (defPriorityAttr != null) {
        parser = new Parser(Integer.parseInt(defPriorityAttr.getAttributeValue()));
    } else {
        parser = new Parser();
    }
    try {
        parser.init(conditionsElem);
    } catch (EvaluatorException e) {
        handleException("Invalid " + EvaluatorConstants.CONDITIONS + " configuration for priority based mediation", e);
    }
    return parser;
}
Also used : EvaluatorException(org.apache.synapse.commons.evaluators.EvaluatorException) QName(javax.xml.namespace.QName) OMElement(org.apache.axiom.om.OMElement) OMAttribute(org.apache.axiom.om.OMAttribute) Parser(org.apache.synapse.commons.evaluators.Parser)

Aggregations

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