Examples of OMAttribute


Examples of org.apache.axiom.om.OMAttribute

    private static final QName DBREPORT_USE_TX = new QName("useTransaction");

    protected Mediator createSpecificMediator(OMElement elem, Properties properties) {
        DBReportMediator mediator = new DBReportMediator();

        OMAttribute useTx = elem.getAttribute(DBREPORT_USE_TX);
        if (useTx != null && useTx.getAttributeValue() != null) {
            String useTxValue = useTx.getAttributeValue();
            if (useTxValue.equals("true")) {
                mediator.setUseTransaction(true);
            } else {
                mediator.setUseTransaction(false);
            }
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

    protected Mediator createSpecificMediator(OMElement elem, Properties properties) {

        FaultMediator faultMediator = new FaultMediator();

        OMAttribute version = elem.getAttribute(ATT_VERSION_Q);
        if (version != null) {
            if (SOAP11.equals(version.getAttributeValue())) {
                faultMediator.setSoapVersion(FaultMediator.SOAP11);
            } else if (SOAP12.equals(version.getAttributeValue())) {
                faultMediator.setSoapVersion(FaultMediator.SOAP12);
            } else if (POX.equals(version.getAttributeValue())) {
                faultMediator.setSoapVersion(FaultMediator.POX);
            } else {
                handleException("Invalid SOAP version");
            }
        }

        OMAttribute response = elem.getAttribute(ATT_RESPONSE_Q);
        if (response != null) {
            if ("true".equals(response.getAttributeValue())) {
                faultMediator.setMarkAsResponse(true);
            } else if ("false".equals(response.getAttributeValue())) {
                faultMediator.setMarkAsResponse(false);
            } else {
                handleException("Invalid value '" + response.getAttributeValue()
                        + "' passed as response. Expected 'true' or 'false'");
            }
            faultMediator.setSerializeResponse(true);
        }

        OMElement code = elem.getFirstChildWithName(CODE_Q);
        if (code != null) {
            OMAttribute value = code.getAttribute(ATT_VALUE);
            OMAttribute expression = code.getAttribute(ATT_EXPRN);

            if (value != null) {
                String strValue = value.getAttributeValue();
                String prefix = null;
                String name = null;
                if (strValue.indexOf(":") != -1) {
                    prefix = strValue.substring(0, strValue.indexOf(":"));
                    name = strValue.substring(strValue.indexOf(":")+1);
                } else {
                    handleException("A QName is expected for fault code as prefix:name");
                }
                String namespaceURI = OMElementUtils.getNameSpaceWithPrefix(prefix, code);
                if (namespaceURI == null) {
                    handleException("Invalid namespace prefix '" + prefix + "' in code attribute");
                }
                faultMediator.setFaultCodeValue(new QName(namespaceURI, name, prefix));
            } else if (expression != null) {
                try {
                    faultMediator.setFaultCodeExpr(
                        SynapseXPathFactory.getSynapseXPath(code, ATT_EXPRN));
                } catch (JaxenException je) {
                    handleException("Invalid fault code expression : " + je.getMessage(), je);
                }
            } else {
                handleException("A 'value' or 'expression' attribute must specify the fault code");
            }

        } else if (faultMediator.getSoapVersion() != FaultMediator.POX) {
            handleException("The fault code is a required attribute for the " +
                    "makefault mediator unless it is a pox fault");
        }

        OMElement reason = elem.getFirstChildWithName(REASON_Q);
        if (reason != null) {
            OMAttribute value = reason.getAttribute(ATT_VALUE);
            OMAttribute expression = reason.getAttribute(ATT_EXPRN);

            if (value != null) {
                faultMediator.setFaultReasonValue(value.getAttributeValue());
            } else if (expression != null) {
                try {
                    faultMediator.setFaultReasonExpr(
                        SynapseXPathFactory.getSynapseXPath(reason, ATT_EXPRN));
                } catch (JaxenException je) {
                    handleException("Invalid fault reason expression : " + je.getMessage(), je);
                }
            } else {
                handleException("A 'value' or 'expression' attribute must specify the fault code");
            }

        } else if (faultMediator.getSoapVersion() != FaultMediator.POX) {
            handleException("The fault reason is a required attribute for the " +
                    "makefault mediator unless it is a pox fault");
        }

        // after successfully creating the mediator
        // set its common attributes such as tracing etc
        processAuditStatus(faultMediator,elem);

        OMElement node = elem.getFirstChildWithName(NODE_Q);
        if (node != null && node.getText() != null) {
            try {
                faultMediator.setFaultNode(new URI(node.getText()));
            } catch (URISyntaxException e) {
                handleException("Invalid URI specified for fault node : " + node.getText(), e);
            }
        }

        OMElement role = elem.getFirstChildWithName(ROLE_Q);
        if (role != null && role.getText() != null) {
            try {
                faultMediator.setFaultRole(new URI(role.getText()));
            } catch (URISyntaxException e) {
                handleException("Invalid URI specified for fault role : " + role.getText(), e);
            }
        }

        OMElement detail = elem.getFirstChildWithName(DETAIL_Q);
        if (detail != null) {
            OMAttribute detailExpr = detail.getAttribute(ATT_EXPRN);
            if (detailExpr != null && detailExpr.getAttributeValue() != null) {
                try {
                    faultMediator.setFaultDetailExpr(
                            SynapseXPathFactory.getSynapseXPath(detail, ATT_EXPRN));
                } catch (JaxenException e) {
                    handleException("Unable to build the XPath for fault detail " +
                            "from the expression : " + detailExpr.getAttributeValue(), e);
                }
            } else if (detail.getChildElements().hasNext()) {
                Iterator it = detail.getChildElements();
                while (it.hasNext()) {
                    OMElement child = (OMElement) it.next();
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

public abstract class TextProcessingEvaluatorFactory implements EvaluatorFactory {

    protected Log log = LogFactory.getLog(this.getClass());

    protected SourceTextRetriever getSourceTextRetriever(OMElement e) throws EvaluatorException {
        OMAttribute typeAttr = e.getAttribute(new QName(EvaluatorConstants.TYPE));
        OMAttribute sourceAttr = e.getAttribute(new QName(EvaluatorConstants.SOURCE));

        SourceTextRetriever textRetriever = null;
        if (typeAttr != null) {
            String value = typeAttr.getAttributeValue();
            if (value.equals(EvaluatorConstants.HEADER)) {
                if (sourceAttr != null) {
                    textRetriever = new HeaderTextRetriever(sourceAttr.getAttributeValue());
                } else {
                    handleException(EvaluatorConstants.SOURCE + " attribute is required");
                }
            } else if (value.equals(EvaluatorConstants.PARAM)) {
                if (sourceAttr != null) {
                    textRetriever = new ParameterTextRetriever(sourceAttr.getAttributeValue());
                } else {
                    handleException(EvaluatorConstants.SOURCE + " attribute is required");
                }
            } else if (value.equals(EvaluatorConstants.URL)) {
                textRetriever = new URLTextRetriever();
                if (sourceAttr != null) {
                    ((URLTextRetriever) textRetriever).setSource(sourceAttr.getAttributeValue());
                }
            } else if (value.equals(EvaluatorConstants.PROPERTY)) {
                if (sourceAttr != null) {
                    textRetriever = new PropertyTextRetriever(sourceAttr.getAttributeValue());
                } else {
                    handleException(EvaluatorConstants.SOURCE + " attribute is required");
                }
            } else if (value.equals(EvaluatorConstants.SOAP)) {
                if (sourceAttr != null) {
                    textRetriever = new SOAPEnvelopeTextRetriever(sourceAttr.getAttributeValue());
                } else {
                    handleException(EvaluatorConstants.SOURCE + " attribute is required");
                }
            } else {
                handleException("Unknown equal evaluator type: " + value);
            }

        } else {
            if (sourceAttr != null) {
                textRetriever = new HeaderTextRetriever(sourceAttr.getAttributeValue());
            } else {
                handleException(EvaluatorConstants.SOURCE + " attribute is required");
            }
        }
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

    private Log log = LogFactory.getLog(ConditionFactory.class);

    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();
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

    public static final QName QUEUE_ATT = new QName("executor");

    protected Mediator createSpecificMediator(OMElement elem, Properties properties) {
        EnqueueMediator mediator = new EnqueueMediator();

        OMAttribute seqAtt = elem.getAttribute(SEQUENCE_ATT);
        if (seqAtt != null && !"".equals(seqAtt.getAttributeValue())) {
            mediator.setSequenceName(seqAtt.getAttributeValue());
        } else {
            handleException("sequence is a required attribue");
        }

        OMAttribute priorityAtt = elem.getAttribute(PRIORITY_ATT);
        if (priorityAtt != null && !"".equals(priorityAtt.getAttributeValue())) {
            mediator.setPriority(Integer.parseInt(priorityAtt.getAttributeValue()));
        }

        OMAttribute queueAtt = elem.getAttribute(QUEUE_ATT);
        if (queueAtt != null && !"".equals(queueAtt.getAttributeValue())) {
            mediator.setExecutorName(queueAtt.getAttributeValue());
        } else {
            handleException("Queue is a required attribue");
        }

        return mediator;
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

                    SOAPHeaderBlock newSOAPHeader = soap12Factory.createSOAPHeaderBlock(
                        soapHeader.getLocalName(), soapHeader.getNamespace());
                    Iterator allAttributes = soapHeader.getAllAttributes();

                    while(allAttributes.hasNext()) {
                        OMAttribute attr = (OMAttribute) allAttributes.next();
                        if(attr.getNamespace() != null
                            && SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
                            attr.getNamespace().getNamespaceURI())) {
                            String attrName = attr.getLocalName();

                            if(SOAP_ATR_ACTOR.equals(attrName)) {
                                OMAttribute newAtr = omNode.getOMFactory().createOMAttribute(
                                    SOAP_ATR_ROLE, newEnvelope.getNamespace(),
                                    attr.getAttributeValue());
                                newSOAPHeader.addAttribute(newAtr);

                            } else if(SOAP_ATR_MUST_UNDERSTAND.equals(attrName)) {
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

    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) {
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

                        soapHeaderBlock.getLocalName(), soapHeaderBlock.getNamespace());

                    Iterator allAttributes = soapHeaderBlock.getAllAttributes();

                    while(allAttributes.hasNext()) {
                        OMAttribute attr = (OMAttribute) allAttributes.next();
                        if (attr.getNamespace() != null
                            && SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(
                            attr.getNamespace().getNamespaceURI())) {
                            String attrName = attr.getLocalName();

                            if (SOAP_ATR_ROLE.equals(attrName)) {
                                OMAttribute newAtr = omNode.getOMFactory().createOMAttribute(
                                    SOAP_ATR_ACTOR, newEnvelope.getNamespace(),
                                    attr.getAttributeValue());
                                newSOAPHeader.addAttribute(newAtr);

                            } else if(SOAP_ATR_MUST_UNDERSTAND.equals(attrName)) {
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

    public Evaluator create(OMElement e) throws EvaluatorException {
        MatchEvaluator equal = new MatchEvaluator();
        SourceTextRetriever textRetriever = getSourceTextRetriever(e);
        equal.setTextRetriever(textRetriever);

        OMAttribute regExAttr = e.getAttribute(new QName(EvaluatorConstants.REGEX));
        if (regExAttr == null) {
            handleException(EvaluatorConstants.REGEX + " attribute is required");
            return null;
        }

        equal.setRegex(Pattern.compile(regExAttr.getAttributeValue()));
        return equal;
    }
View Full Code Here

Examples of org.apache.axiom.om.OMAttribute

        }
        return null;
    }

    protected String getAttribute(OMElement elt, QName qName) {
        OMAttribute a = elt.getAttribute(qName);
        if (a != null) {
            return a.getAttributeValue();
        }
        return null;
    }
View Full Code Here
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.