/** * Create synapse xpath expression * {} type user input is used to create real xpath expression * * @param elem the element * @param key xpath expression with {} * @return SynapseXpath */ public SynapseXPath createSynXpath(OMElement elem, String key) { //derive XPath Expression from key String xpathExpr = key.trim().substring(1, key.length() - 1); SynapseXPath synapseXPath = null; try { synapseXPath = SynapseXPathFactory.getSynapseXPath(elem, xpathExpr); } catch (JaxenException e) { handleException("Can not create Synapse Xpath from given key"); } return synapseXPath; }
public static SynapseXPath getSynapseXPath(OMElement elem, String expression) throws JaxenException { if (expression == null) { handleException("XPath expression cannot be null"); } SynapseXPath xpath = new SynapseXPath(expression); OMElementUtils.addNameSpaces(xpath, elem, log); return xpath; }
/** * Create synapse xpath expression * {} type user input is used to create real xpath expression * * @param elem the element * @param key xpath expression with {} * @return SynapseXpath */ public SynapseXPath createSynXpath(OMElement elem, String key) { //derive XPath Expression from key String xpathExpr = key.trim().substring(1, key.length() - 1); SynapseXPath synapseXPath = null; try { synapseXPath = SynapseXPathFactory.getSynapseXPath(elem, xpathExpr); } catch (JaxenException e) { handleException("Can not create Synapse Xpath from given key"); } return synapseXPath; }
public static SynapseXPath getSynapseXPath(OMElement elem, String expression) throws JaxenException { if (expression == null) { handleException("XPath expression cannot be null"); } SynapseXPath xpath = new SynapseXPath(expression); OMElementUtils.addNameSpaces(xpath, elem, log); return xpath; }
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { ResolvingEndpoint resolvingEndpoint = new ResolvingEndpoint(); String name = epConfig.getAttributeValue(new QName("name")); if (name != null) { resolvingEndpoint.setName(name); } try { resolvingEndpoint.setKeyExpression( SynapseXPathFactory.getSynapseXPath(epConfig, ATTR_KEY_EXPRESSION)); } catch (JaxenException e) { handleException("Couldn't build the ResolvingEndpoint, unable to set " + "the key-expression XPath", e); } // process the parameters processProperties(resolvingEndpoint, epConfig); return resolvingEndpoint; } }
public static SynapseXPath getSynapseXPath(OMElement elem, QName attribName) throws JaxenException { SynapseXPath xpath = null; OMAttribute xpathAttrib = elem.getAttribute(attribName); if (xpathAttrib != null && xpathAttrib.getAttributeValue() != null) { xpath = new SynapseXPath(xpathAttrib.getAttributeValue()); OMElementUtils.addNameSpaces(xpath, elem, log); } else { handleException("Couldn't find the XPath attribute with the QName : " + attribName.toString() + " in the element : " + elem.toString()); } return xpath; }
private static Map<String, Object> getParameters(OMElement elem) { Iterator params = elem.getChildrenWithName(PARAMETER_Q); Map<String, Object> parameters = new HashMap<String, Object>(); while (params.hasNext()) { Object o = params.next(); if (o instanceof OMElement) { OMElement prop = (OMElement) o; OMAttribute paramName = prop.getAttribute(NAME_Q); String paramValue = prop.getText(); OMAttribute paramExpression = prop.getAttribute(EXPRESSION_Q); if (paramName != null) { if (paramExpression != null) { try { SynapseXPath expression = SynapseXPathFactory.getSynapseXPath(prop, paramExpression.getAttributeValue()); parameters.put(paramName.getAttributeValue(), expression); } catch (JaxenException e) { handleException("Error while creating expression " + e.getMessage()); } } else if (paramValue != null) { parameters.put(paramName.getAttributeValue(), paramValue); } else { handleException("Invalid MessageStore parameter - Parameter must have a value or an expression "); } } else { handleException("Invalid MessageStore parameter - Parameter must have a name "); } } } return parameters; }
public static SynapseXPath getSynapseXPath(OMElement elem, QName attribName) throws JaxenException { SynapseXPath xpath = null; OMAttribute xpathAttrib = elem.getAttribute(attribName); if (xpathAttrib != null && xpathAttrib.getAttributeValue() != null) { try { xpath = new SynapseXPath(xpathAttrib.getAttributeValue()); } catch (org.jaxen.XPathSyntaxException ex) { /* Try and see whether the expression can be compiled with XPath 2.0 * This will only be done if the failover DOM XPath 2.0 is enabled */ if (Boolean.parseBoolean(SynapsePropertiesLoader.loadSynapseProperties(). getProperty(SynapseConstants.FAIL_OVER_DOM_XPATH_PROCESSING))) { if (log.isDebugEnabled()) { log.debug("Trying to compile the expression in XPath 2.0:" + xpathAttrib.getAttributeValue()); } xpath = new SynapseXPath(xpathAttrib.getAttributeValue(), elem); } else { throw ex; } } OMElementUtils.addNameSpaces(xpath, elem, log); xpath.addNamespacesForFallbackProcessing(elem); } else { handleException("Couldn't find the XPath attribute with the QName : " + attribName.toString() + " in the element : " + elem.toString()); } return xpath; }
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) { ResolvingEndpoint resolvingEndpoint = new ResolvingEndpoint(); String name = epConfig.getAttributeValue(new QName("name")); if (name != null) { resolvingEndpoint.setName(name); } try { resolvingEndpoint.setKeyExpression( SynapseXPathFactory.getSynapseXPath(epConfig, ATTR_KEY_EXPRESSION)); } catch (JaxenException e) { handleException("Couldn't build the ResolvingEndpoint, unable to set " + "the key-expression XPath", e); } // process the parameters processProperties(resolvingEndpoint, epConfig); return resolvingEndpoint; } }
prop.setExpression(SynapseXPathFactory.getSynapseXPath( propEle, MediatorProperty.ATT_EXPR_Q));
if (xpath != null) { try { xp = SynapseXPathFactory.getSynapseXPath(paramElt, ATT_EXPRN);
if (targetValue != null && !"".equals(targetValue)) { try { xQueryMediator.setTarget(SynapseXPathFactory.getSynapseXPath(elem, ATT_TARGET)); } catch (JaxenException e) { handleException("Invalid XPath specified for the target attribute : " +
if (targetValue != null && !"".equals(targetValue)) { try { xQueryMediator.setTarget(SynapseXPathFactory.getSynapseXPath(elem, ATT_TARGET)); } catch (JaxenException e) { handleException("Invalid XPath specified for the target attribute : " +
validateMediator.setSource(SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE)); } catch (JaxenException e) { handleException("Invalid XPath expression specified for attribute 'source'", e);
if (xpath != null) { try { action.setXpath(SynapseXPathFactory.getSynapseXPath(actionElement, xpath_Q)); } catch (JaxenException e) { handleException("Error while parsing the XPath expression: " + xpath, e);
if (xpath != null) { try { action.setXpath(SynapseXPathFactory.getSynapseXPath(actionElement, xpath_Q)); } catch (JaxenException e) { handleException("Error while parsing the XPath expression: " + xpath, e);
if (xpath != null) { try { xp = SynapseXPathFactory.getSynapseXPath(paramElt, ATT_EXPRN);
} else { try { property.setExpression(SynapseXPathFactory.getSynapseXPath(element, ATT_EXPRN)); } catch (JaxenException e) { throw new SynapseException("Invalid expression attribute in " + element.getLocalName(), e);
try { switchMediator.setSource(SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE));
headerMediator.setExpression(SynapseXPathFactory.getSynapseXPath(elem, ATT_EXPRN)); } catch (JaxenException je) { handleException("Invalid XPath expression : " + exprn.getAttributeValue());