Examples of RouterMediator


Examples of org.wso2.carbon.mediators.router.impl.RouterMediator

        if (!ROUTER_Q.equals(elem.getQName())) {
            handleException("Unable to create the Router mediator. " +
                "Unexpected element as the Router mediator configuration");
        }

        RouterMediator m = new RouterMediator();

        OMAttribute continueAfterAttr = elem.getAttribute(ATT_CONTINUE_AFTER);
        if (continueAfterAttr != null && continueAfterAttr.getAttributeValue() != null) {
            m.setContinueAfter(Boolean.parseBoolean(continueAfterAttr.getAttributeValue()));
        }

        for (Iterator itr = elem.getChildrenWithName(ROUTE_Q); itr.hasNext();) {

            OMElement routeElement = (OMElement) itr.next();

            OMAttribute expressionAttr = routeElement.getAttribute(ATT_EXPRN);
            OMAttribute matchAttr = routeElement.getAttribute(ATT_MATCH);
            OMAttribute breakRouterAttr = routeElement.getAttribute(ATT_BREAK_ROUTER);
            OMElement targetElem = routeElement.getFirstChildWithName(TARGET_Q);

            Route route = new Route();

            if (expressionAttr != null && expressionAttr.getAttributeValue() != null) {

                try {
                    route.setExpression(
                        SynapseXPathFactory.getSynapseXPath(routeElement, ATT_EXPRN));
                } catch (JaxenException e) {
                    handleException("Couldn't build the xpath from the expression : "
                        + expressionAttr.getAttributeValue(), e);
                }
            } else {

                handleException("Route without an expression attribute has been found, " +
                    "but it is required to have an expression for all routes");
            }

            if (matchAttr != null && matchAttr.getAttributeValue() != null) {
                route.setMatch(Pattern.compile(matchAttr.getAttributeValue()));
            }

            if (breakRouterAttr != null && breakRouterAttr.getAttributeValue() != null) {
                route.setBreakRouter(Boolean.parseBoolean(breakRouterAttr.getAttributeValue()));
            }

            if (targetElem != null) {

                route.setTarget(TargetFactory.createTarget(targetElem, properties));

            } else {
                handleException("Route has to have a target for it, " +
                    "missing the taregt of the route");
            }

            m.addRoute(route);
        }

        return m;
    }

Examples of org.wso2.carbon.mediators.router.impl.RouterMediator

        if (!(mediator instanceof RouterMediator)) {
            handleException("Unsupported mediator passed in for serialization : "
                + mediator.getType());
        }

        RouterMediator m = (RouterMediator) mediator;

        OMElement routerElem = fac.createOMElement("router", synNS);
        saveTracingState(routerElem, m);

        if (m.isContinueAfter()) {
            routerElem.addAttribute(fac.createOMAttribute("continueAfter", nullNS, "true"));
        }

        for (Route route : m.getRoutes()) {

            OMElement routeElem = fac.createOMElement("route", synNS);

            if (route.getExpression() != null) {
                SynapseXPathSerializer.serializeXPath(

Examples of org.wso2.carbon.mediators.router.impl.RouterMediator

        if (!(m instanceof RouterMediator)) {
            return null;
        }

        List<ConfigurationObject> providers = new ArrayList<ConfigurationObject>();
        RouterMediator routerMediator  = (RouterMediator) m;
        List<Route> routes = routerMediator.getRoutes();

        for (Route r : routes) {
            resolveTarget(r.getTarget(), providers);
        }
TOP
Copyright © 2018 www.massapi.com. 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.