Package org.apache.synapse.commons.evaluators

Examples of org.apache.synapse.commons.evaluators.OrEvaluator


*/
public class OrFactory implements EvaluatorFactory {
    private Log log = LogFactory.getLog(OrFactory.class);

    public Evaluator create(OMElement e) throws EvaluatorException {
        OrEvaluator o = new OrEvaluator();

        Iterator it = e.getChildElements();

        List<Evaluator> evaluators = new ArrayList<Evaluator>();

        while (it.hasNext()) {
            OMElement evaluatorElement = (OMElement) it.next();

            EvaluatorFactory ef = EvaluatorFactoryFinder.getInstance().
                    findEvaluatorFactory(evaluatorElement.getLocalName());

            if (ef == null) {
                handleException("Invalid configuration element: " +
                        evaluatorElement.getLocalName());
                return null;
            }

            Evaluator evaluator = ef.create(evaluatorElement);
            evaluators.add(evaluator);
        }

        if (evaluators.size() > 1) {
            o.setEvaluators(evaluators.toArray(new Evaluator[evaluators.size()]));
        } else {
            handleException("Two or more expressions " +
                    "should be provided under Or");

            return null;
View Full Code Here


    public OMElement serialize(OMElement parent, Evaluator evaluator) throws EvaluatorException {
        if (!(evaluator instanceof OrEvaluator)) {
            throw new IllegalArgumentException("Evalutor should be a OrEvalutor");
        }

        OrEvaluator orEvaluator = (OrEvaluator) evaluator;

        OMElement orElement = fac.createOMElement(new QName((EvaluatorConstants.OR)));
        serializeChildren(orElement, orEvaluator.getEvaluators());

        if (parent != null) {
            parent.addChild(orElement);
        }
View Full Code Here

TOP

Related Classes of org.apache.synapse.commons.evaluators.OrEvaluator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.