Package org.apache.synapse.mediators.eip.splitter

Examples of org.apache.synapse.mediators.eip.splitter.IterateMediator


     * @param properties properties bag containing synapse configurations
     * @return IterateMediator created from the given configuration
     */
    protected Mediator createSpecificMediator(OMElement elem, Properties properties) {

        IterateMediator mediator = new IterateMediator();
        processAuditStatus(mediator, elem);

        OMAttribute continueParent = elem.getAttribute(ATT_CONTPAR);
        if (continueParent != null) {
            mediator.setContinueParent(
                    Boolean.valueOf(continueParent.getAttributeValue()));
        }

        OMAttribute preservePayload = elem.getAttribute(ATT_PREPLD);
        if (preservePayload != null) {
            mediator.setPreservePayload(
                    Boolean.valueOf(preservePayload.getAttributeValue()));
        }

        OMAttribute expression = elem.getAttribute(ATT_EXPRN);
        if (expression != null) {
            try {
                mediator.setExpression(SynapseXPathFactory.getSynapseXPath(elem, ATT_EXPRN));
            } catch (JaxenException e) {
                handleException("Unable to build the IterateMediator. " + "Invalid XPATH " +
                    expression.getAttributeValue(), e);
            }
        } else {
            handleException("XPATH expression is required " +
                "for an IterateMediator under the \"expression\" attribute");
        }

        OMAttribute attachPath = elem.getAttribute(ATT_ATTACHPATH);
        String attachPathValue = ".";
        if (attachPath != null && !mediator.isPreservePayload()) {
            handleException("Wrong configuration for the iterate mediator :: if the iterator " +
                "should not preserve payload, then attachPath can not be present");
        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            SynapseXPath xp = new SynapseXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
        }

        boolean asynchronous = true;
        OMAttribute asynchronousAttr = elem.getAttribute(ATT_SEQUENCIAL);
        if (asynchronousAttr != null && asynchronousAttr.getAttributeValue().equals("true")) {
            asynchronous = false;
        }

        OMElement targetElement = elem.getFirstChildWithName(TARGET_Q);
        if (targetElement != null) {
            Target target = TargetFactory.createTarget(targetElement, properties);
            if (target != null) {
                target.setAsynchronous(asynchronous);
                mediator.setTarget(target);
            }
        } else {
            handleException("Target for an iterate mediator is required :: missing target");
        }

View Full Code Here


        }
       
        OMElement itrElem = fac.createOMElement("iterate", synNS);
        saveTracingState(itrElem, m);

        IterateMediator itrMed = (IterateMediator) m;
        if (itrMed.isContinueParent()) {
            itrElem.addAttribute("continueParent", Boolean.toString(true), nullNS);
        }

        if (itrMed.isPreservePayload()) {
            itrElem.addAttribute("preservePayload", Boolean.toString(true), nullNS);
        }

        if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) {
            SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath");
        }
       
        if (itrMed.getExpression() != null) {
            SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression");
        } else {
            handleException("Missing expression of the IterateMediator which is required.");
        }

        if (itrMed.getTarget() != null && !itrMed.getTarget().isAsynchronous()) {
            itrElem.addAttribute("sequential", "false", nullNS);
        }

        itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));

        return itrElem;
    }
View Full Code Here

        }
       
        OMElement itrElem = fac.createOMElement("iterate", synNS);
        saveTracingState(itrElem, m);

        IterateMediator itrMed = (IterateMediator) m;
        if (itrMed.isContinueParent()) {
            itrElem.addAttribute("continueParent", Boolean.toString(true), nullNS);
        }

        if (itrMed.isPreservePayload()) {
            itrElem.addAttribute("preservePayload", Boolean.toString(true), nullNS);
        }

        if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) {
            itrElem.addAttribute("attachPath", itrMed.getAttachPath().toString(), nullNS);
            serializeNamespaces(itrElem, itrMed.getAttachPath());
        }
       
        if (itrMed.getExpression() != null) {
            itrElem.addAttribute("expression", itrMed.getExpression().toString(), nullNS);
            serializeNamespaces(itrElem, itrMed.getExpression());
        } else {
            handleException("Missing expression of the IterateMediator which is required.");
        }

        itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));

        // attach the serialized element to the parent if specified
        if (parent != null) {
            parent.addChild(itrElem);
        }
View Full Code Here

     * @param elem OMElement describing the configuration of the IterateMediaotr
     * @return IterateMediator created from the given configuration
     */
    public Mediator createMediator(OMElement elem) {

        IterateMediator mediator = new IterateMediator();
        processTraceState(mediator, elem);

        OMAttribute continueParent = elem.getAttribute(ATT_CONTPAR);
        if (continueParent != null) {
            mediator.setContinueParent(
                Boolean.valueOf(continueParent.getAttributeValue()).booleanValue());
        }

        OMAttribute preservePayload = elem.getAttribute(ATT_PREPLD);
        if (preservePayload != null) {
            mediator.setPreservePayload(
                Boolean.valueOf(preservePayload.getAttributeValue()).booleanValue());
        }

        OMAttribute expression = elem.getAttribute(ATT_EXPRN);
        if (expression != null) {
            try {
                AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
                OMElementUtils.addNameSpaces(xp, elem, log);
                mediator.setExpression(xp);
            } catch (JaxenException e) {
                handleException("Unable to build the IterateMediator. " + "Invalid XPATH " +
                    expression.getAttributeValue(), e);
            }
        } else {
            handleException("XPATH expression is required " +
                "for an IterateMediator under the \"expression\" attribute");
        }

        OMAttribute attachPath = elem.getAttribute(ATT_ATTACHPATH);
        String attachPathValue = ".";
        if (attachPath != null && !mediator.isPreservePayload()) {
            handleException("Wrong configuration for the iterate mediator :: if the iterator " +
                "should not preserve payload, then attachPath can not be present");
        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            AXIOMXPath xp = new AXIOMXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
        }

        OMElement targetElement = elem.getFirstChildWithName(TARGET_Q);
        if (targetElement != null) {
            mediator.setTarget(TargetFactory.createTarget(targetElement));
        } else {
            handleException("Target for an iterate mediator is required :: missing target");
        }

        return mediator;
View Full Code Here

     * @param properties properties passed
     * @return IterateMediator created from the given configuration
     */
    public Mediator createSpecificMediator(OMElement elem, Properties properties) {

        IterateMediator mediator = new IterateMediator();
        processAuditStatus(mediator, elem);

        OMAttribute id = elem.getAttribute(ID_Q);
        if (id != null) {
            mediator.setId(id.getAttributeValue());
        }

        OMAttribute continueParent = elem.getAttribute(ATT_CONTPAR);
        if (continueParent != null) {
            mediator.setContinueParent(
                    Boolean.valueOf(continueParent.getAttributeValue()));
        }

        OMAttribute preservePayload = elem.getAttribute(ATT_PREPLD);
        if (preservePayload != null) {
            mediator.setPreservePayload(
                    Boolean.valueOf(preservePayload.getAttributeValue()));
        }

        OMAttribute expression = elem.getAttribute(ATT_EXPRN);
        if (expression != null) {
            try {
                mediator.setExpression(SynapseXPathFactory.getSynapseXPath(elem, ATT_EXPRN));
            } catch (JaxenException e) {
                handleException("Unable to build the IterateMediator. " + "Invalid XPATH " +
                    expression.getAttributeValue(), e);
            }
        } else {
            handleException("XPATH expression is required " +
                "for an IterateMediator under the \"expression\" attribute");
        }

        OMAttribute attachPath = elem.getAttribute(ATT_ATTACHPATH);
        String attachPathValue = ".";
        if (attachPath != null && !mediator.isPreservePayload()) {
            handleException("Wrong configuration for the iterate mediator :: if the iterator " +
                "should not preserve payload, then attachPath can not be present");
        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            SynapseXPath xp = new SynapseXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
        }

        boolean asynchronous = true;
        OMAttribute asynchronousAttr = elem.getAttribute(ATT_SEQUENCIAL);
        if (asynchronousAttr != null && asynchronousAttr.getAttributeValue().equals("true")) {
            asynchronous = false;
        }

        OMElement targetElement = elem.getFirstChildWithName(TARGET_Q);
        if (targetElement != null) {
            Target target = TargetFactory.createTarget(targetElement, properties);
            if (target != null) {
                target.setAsynchronous(asynchronous);
                mediator.setTarget(target);
            }
        } else {
            handleException("Target for an iterate mediator is required :: missing target");
        }

View Full Code Here

        }
       
        OMElement itrElem = fac.createOMElement("iterate", synNS);
        saveTracingState(itrElem, m);

        IterateMediator itrMed = (IterateMediator) m;
        if (itrMed.isContinueParent()) {
            itrElem.addAttribute("continueParent", Boolean.toString(true), nullNS);
        }

        if (itrMed.getId() != null) {
            itrElem.addAttribute("id", itrMed.getId(), nullNS);
        }

        if (itrMed.isPreservePayload()) {
            itrElem.addAttribute("preservePayload", Boolean.toString(true), nullNS);
        }

        if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) {
            SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath");
        }
       
        if (itrMed.getExpression() != null) {
            SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression");
        } else {
            handleException("Missing expression of the IterateMediator which is required.");
        }

        if (itrMed.getTarget() != null && !itrMed.getTarget().isAsynchronous()) {
            itrElem.addAttribute("sequential", "true", nullNS);
        }

        itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));

        return itrElem;
    }
View Full Code Here

        }
       
        OMElement itrElem = fac.createOMElement("iterate", synNS);
        saveTracingState(itrElem, m);

        IterateMediator itrMed = (IterateMediator) m;
        if (itrMed.isContinueParent()) {
            itrElem.addAttribute("continueParent", Boolean.toString(true), nullNS);
        }

        if (itrMed.getId() != null) {
            itrElem.addAttribute("id", itrMed.getId(), nullNS);
        }

        if (itrMed.isPreservePayload()) {
            itrElem.addAttribute("preservePayload", Boolean.toString(true), nullNS);
        }

        if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) {
            SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath");
        }
       
        if (itrMed.getExpression() != null) {
            SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression");
        } else {
            handleException("Missing expression of the IterateMediator which is required.");
        }

        if (itrMed.getTarget() != null && !itrMed.getTarget().isAsynchronous()) {
            itrElem.addAttribute("sequential", "false", nullNS);
        }

        itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));

        return itrElem;
    }
View Full Code Here

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

        List<ConfigurationObject> providers = new ArrayList<ConfigurationObject>();
        IterateMediator iterateMediator  = (IterateMediator) m;
        resolveTarget(iterateMediator.getTarget(), providers);
        return providers;
    }
View Full Code Here

     * @param elem OMElement describing the configuration of the IterateMediaotr
     * @return IterateMediator created from the given configuration
     */
    public Mediator createMediator(OMElement elem) {

        IterateMediator mediator = new IterateMediator();
        processTraceState(mediator, elem);

        OMAttribute continueParent = elem.getAttribute(ATT_CONTPAR);
        if (continueParent != null) {
            mediator.setContinueParent(
                Boolean.valueOf(continueParent.getAttributeValue()).booleanValue());
        }

        OMAttribute preservePayload = elem.getAttribute(ATT_PREPLD);
        if (preservePayload != null) {
            mediator.setPreservePayload(
                Boolean.valueOf(preservePayload.getAttributeValue()).booleanValue());
        }

        OMAttribute expression = elem.getAttribute(ATT_EXPRN);
        if (expression != null) {
            try {
                AXIOMXPath xp = new AXIOMXPath(expression.getAttributeValue());
                OMElementUtils.addNameSpaces(xp, elem, log);
                mediator.setExpression(xp);
            } catch (JaxenException e) {
                handleException("Unable to build the IterateMediator. " + "Invalid XPATH " +
                    expression.getAttributeValue(), e);
            }
        } else {
            handleException("XPATH expression is required " +
                "for an IterateMediator under the \"expression\" attribute");
        }

        OMAttribute attachPath = elem.getAttribute(ATT_ATTACHPATH);
        String attachPathValue = ".";
        if (attachPath != null && !mediator.isPreservePayload()) {
            handleException("Wrong configuration for the iterate mediator :: if the iterator " +
                "should not preserve payload, then attachPath can not be present");
        } else if (attachPath != null) {
            attachPathValue = attachPath.getAttributeValue();
        }
       
        try {
            AXIOMXPath xp = new AXIOMXPath(attachPathValue);
            OMElementUtils.addNameSpaces(xp, elem, log);
            mediator.setAttachPath(xp);
        } catch (JaxenException e) {
            handleException("Unable to build the IterateMediator. Invalid XPATH " +
                attachPathValue, e);
        }

        OMElement targetElement = elem.getFirstChildWithName(TARGET_Q);
        if (targetElement != null) {
            mediator.setTarget(TargetFactory.createTarget(targetElement));
        } else {
            handleException("Target for an iterate mediator is required :: missing target");
        }

        return mediator;
View Full Code Here

        }
       
        OMElement itrElem = fac.createOMElement("iterate", synNS);
        saveTracingState(itrElem, m);

        IterateMediator itrMed = (IterateMediator) m;
        if (itrMed.isContinueParent()) {
            itrElem.addAttribute("continueParent", Boolean.toString(true), nullNS);
        }

        if (itrMed.isPreservePayload()) {
            itrElem.addAttribute("preservePayload", Boolean.toString(true), nullNS);
        }

        if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) {
            itrElem.addAttribute("attachPath", itrMed.getAttachPath().toString(), nullNS);
            serializeNamespaces(itrElem, itrMed.getAttachPath());
        }
       
        if (itrMed.getExpression() != null) {
            itrElem.addAttribute("expression", itrMed.getExpression().toString(), nullNS);
            serializeNamespaces(itrElem, itrMed.getExpression());
        } else {
            handleException("Missing expression of the IterateMediator which is required.");
        }

        itrElem.addChild(TargetSerializer.serializeTarget(itrMed.getTarget()));

        // attach the serialized element to the parent if specified
        if (parent != null) {
            parent.addChild(itrElem);
        }
View Full Code Here

TOP

Related Classes of org.apache.synapse.mediators.eip.splitter.IterateMediator

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.