/** * Get a string representation of the XPath expression for debugging purposes. */ @Override public String toString() { if (xpathString != null) { return xpathString; } else if (xpath == null) { return DEFAULT_XPATH; } else { return xpath.toString(); } } }
/** * Get a string representation of the XPath expression for debugging purposes. */ @Override public String toString() { if (xpathString != null) { return xpathString; } else if (xpath == null) { return DEFAULT_XPATH; } else { return xpath.toString(); } } }
handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", je);
/** * Specialized form of xpath evaluation function.An xpath evaluate() will be performed using two contexts * (ie:-soap-envelope and on Synapse Message Context). This is useful for evaluating xpath on a * nodeset for function contexts (we need both nodeset and synapse ctxts for evaluating function * scope expressions) * @param primaryContext a context object ie:- a soap envelope * @param secondaryContext a context object ie:-synapse message ctxt * @return result */ public Object evaluate(Object primaryContext, MessageContext secondaryContext) { Object result = null; //if result is still not found use second ctxt ie:-syn-ctxt with a wrapper to evaluate if (secondaryContext != null) { try { //wrapper Context is used to evaluate 'dynamic' function scope objects result = evaluate(new ContextWrapper((SOAPEnvelope) primaryContext,secondaryContext)); } catch (Exception e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } else { try { result = evaluate(primaryContext); } catch (JaxenException e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } return result; }
private OMElement getRequestPayload(MessageContext synCtx) throws AxisFault { if (requestKey != null) { Object request = synCtx.getProperty(requestKey); if (request == null) { request = synCtx.getEntry(requestKey); } if (request != null && request instanceof OMElement) { return (OMElement) request; } else { handleException("The property : " + requestKey + " is not an OMElement", synCtx); } } else if (requestXPath != null) { try { Object o = requestXPath.evaluate(MessageHelper.cloneMessageContext(synCtx)); if (o instanceof OMElement) { return (OMElement) o; } else if (o instanceof List && !((List) o).isEmpty()) { return (OMElement) ((List) o).get(0); // Always fetches *only* the first } else { handleException("The evaluation of the XPath expression : " + requestXPath.toString() + " did not result in an OMElement", synCtx); } } catch (JaxenException e) { handleException("Error evaluating XPath expression : " + requestXPath.toString(), e, synCtx); } } return null; }
/** * Specialized form of xpath evaluation function.An xpath evaluate() will be performed using two contexts * (ie:-soap-envelope and on Synapse Message Context). This is useful for evaluating xpath on a * nodeset for function contexts (we need both nodeset and synapse ctxts for evaluating function * scope expressions) * @param primaryContext a context object ie:- a soap envelope * @param secondaryContext a context object ie:-synapse message ctxt * @return result */ public Object evaluate(Object primaryContext, MessageContext secondaryContext) { Object result = null; //if result is still not found use second ctxt ie:-syn-ctxt with a wrapper to evaluate if (secondaryContext != null) { try { //wrapper Context is used to evaluate 'dynamic' function scope objects result = evaluate(new ContextWrapper((SOAPEnvelope) primaryContext,secondaryContext)); } catch (Exception e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } else { try { result = evaluate(primaryContext); } catch (JaxenException e) { handleException("Evaluation of the XPath expression " + this.toString() + " resulted in an error", e); } } return result; }
private OMElement getRequestPayload(MessageContext synCtx) throws AxisFault { if (requestKey != null) { Object request = synCtx.getProperty(requestKey); if (request == null) { request = synCtx.getEntry(requestKey); } if (request != null && request instanceof OMElement) { return (OMElement) request; } else { handleException("The property : " + requestKey + " is not an OMElement", synCtx); } } else if (requestXPath != null) { try { Object o = requestXPath.evaluate(MessageHelper.cloneMessageContext(synCtx)); if (o instanceof OMElement) { return (OMElement) o; } else if (o instanceof List && !((List) o).isEmpty()) { return (OMElement) ((List) o).get(0); // Always fetches *only* the first } else { handleException("The evaluation of the XPath expression : " + requestXPath.toString() + " did not result in an OMElement", synCtx); } } catch (JaxenException e) { handleException("Error evaluating XPath expression : " + requestXPath.toString(), e, synCtx); } } return null; }
aggregationExpression.toString(), e, synCtx);
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, xpath.toString())); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, xpath.toString())); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
!correlateExpression.toString().equals(aggregate.getCorrelation())) || correlateExpression == null) {
Object o = synCtx.getEntry(this.regKey); if (o != null) { if (!SourceXPathSupport.DEFAULT_XPATH.equals(expression.toString())) { this.value = evaluate(o); } else {
Object o = synCtx.getEntry(this.regKey); if (o != null) { if (!SourceXPathSupport.DEFAULT_XPATH.equals(expression.toString())) { this.value = evaluate(o); } else {
/** * Serialize the Value object to an OMElement representing the entry * * @param key Value to serialize * @param elem OMElement * @return OMElement */ public OMElement serializeValue(Value key, String name, OMElement elem) { if (key != null) { if (key.getExpression() == null) { //static key elem.addAttribute(fac.createOMAttribute(name, nullNS, key.getKeyValue())); } else { String startChar = "{" , endChar = "}"; //if this is an expr type key we add an additional opening and closing brace if(key.hasExprTypeKey()){ startChar = startChar + "{"; endChar = endChar + "}"; } //dynamic key SynapseXPathSerializer.serializeXPath(key.getExpression(), startChar + key.getExpression().toString() + endChar, elem, name); } } return elem; }
if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) { SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath");
if (itrMed.getAttachPath() != null && !".".equals(itrMed.getAttachPath().toString())) { SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath");
} else { handleException("Evaluation of target XPath expression : " + getTargetXPath().toString() + " did not yeild an OMNode", synCtx);
} else { handleException("Evaluation of target XPath expression : " + targetXPath.toString() + " did not yeild an OMNode", synCtx);
synLog.traceOrDebug("ForEach expression : " + expression.toString());