org.apache.synapse.util.xpath
Class SourceXPathSupport

java.lang.Object
  extended by org.apache.synapse.util.xpath.SourceXPathSupport

public class SourceXPathSupport
extends Object

Support class for mediators operating on message parts selected by an XPath expression. It handles the default XPath expression s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1] without actually parsing or evaluating it.


Field Summary
static String DEFAULT_XPATH
           
 
Constructor Summary
SourceXPathSupport()
           
 
Method Summary
 SynapseXPath getXPath()
          Get the XPath expression.
 OMNode selectOMNode(MessageContext synCtx, SynapseLog synLog)
          Get the first node selected by the configured XPath expression.
 void setXPath(SynapseXPath xpath)
          Set the XPath expression.
 void setXPathString(String xpathString)
          Set the string representation of the XPath expression.
 String toString()
          Get a string representation of the XPath expression for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_XPATH

public static final String DEFAULT_XPATH
See Also:
Constant Field Values
Constructor Detail

SourceXPathSupport

public SourceXPathSupport()
Method Detail

getXPath

public SynapseXPath getXPath()
Get the XPath expression.

Returns:
the XPath expression

setXPath

public void setXPath(SynapseXPath xpath)
Set the XPath expression.

Parameters:
xpath - the XPath expression

setXPathString

public void setXPathString(String xpathString)
Set the string representation of the XPath expression. Note that this information is not mandatory and only used for debugging purposes. Setting the string representation explicitly may be useful to make sure that debugging messages contain the XPath expression in the exact form as specified by the user.

Parameters:
xpathString - a string representation of the XPath expression

selectOMNode

public OMNode selectOMNode(MessageContext synCtx,
                           SynapseLog synLog)
Get the first node selected by the configured XPath expression. If no XPath expression is set, the first child element of the SOAP body is returned, i.e. in this case the method behaves as if the XPath expression is s11:Body/child::*[position()=1] | s12:Body/child::*[position()=1].

Parameters:
synCtx - the message context
synLog -
Returns:
the first node selected by the XPath expression
Throws:
SynapseException - if the evaluation of the XPath expression failed or didn't result in an OMNode

toString

public String toString()
Get a string representation of the XPath expression for debugging purposes.

Overrides:
toString in class Object


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.