org.apache.servicemix.expression
Class JaxenXPathExpression

java.lang.Object
  extended by org.apache.servicemix.expression.JaxenXPathExpression
All Implemented Interfaces:
Expression, org.springframework.beans.factory.InitializingBean
Direct Known Subclasses:
JaxenStringXPathExpression

public class JaxenXPathExpression
extends java.lang.Object
implements Expression, org.springframework.beans.factory.InitializingBean

Evalutes an XPath expression on the given message using Jaxen

Version:
$Revision: 564900 $

Constructor Summary
JaxenXPathExpression()
           
JaxenXPathExpression(java.lang.String xpath)
          A helper constructor to make a fully created expression.
 
Method Summary
 void afterPropertiesSet()
           
protected  org.jaxen.XPath createXPath(java.lang.String xp)
           
 void enableContentRereadability(javax.jbi.messaging.NormalizedMessage message)
          Convert the given NormalizedMessage instance's content to a re-readable Source This allows the content to be read more than once (e.g.
 java.lang.Object evaluate(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
          Evaluates the expression on the given exchange and message.
protected  java.lang.Object evaluateXPath(java.lang.Object object)
           
protected  boolean evaluateXPathAsBoolean(java.lang.Object object)
           
 org.jaxen.FunctionContext getFunctionContext()
           
 org.jaxen.NamespaceContext getNamespaceContext()
           
 SourceTransformer getTransformer()
           
 JaxenVariableContext getVariableContext()
           
protected  java.lang.Object getXMLNode(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
           
 java.lang.String getXpath()
           
 org.jaxen.XPath getXpathObject()
           
 boolean isUseMessageContent()
           
 boolean matches(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
           
 void setFunctionContext(org.jaxen.FunctionContext functionContext)
           
 void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)
           
 void setTransformer(SourceTransformer transformer)
           
 void setUseMessageContent(boolean useMessageContent)
          Specifies whether or not the XPath expression uses the message content.
 void setVariableContext(JaxenVariableContext variableContext)
           
 void setXpath(java.lang.String xpath)
           
 void setXpathObject(org.jaxen.XPath xpathObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxenXPathExpression

public JaxenXPathExpression()

JaxenXPathExpression

public JaxenXPathExpression(java.lang.String xpath)
                     throws java.lang.Exception
A helper constructor to make a fully created expression. This constructor will call the afterPropertiesSet() method to ensure this POJO is properly constructed.

Throws:
java.lang.Exception
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

evaluate

public java.lang.Object evaluate(javax.jbi.messaging.MessageExchange exchange,
                                 javax.jbi.messaging.NormalizedMessage message)
                          throws javax.jbi.messaging.MessagingException
Description copied from interface: Expression
Evaluates the expression on the given exchange and message.

Specified by:
evaluate in interface Expression
Parameters:
exchange - the message exchange
message - the message, typically an inbound message
Returns:
the value of the expression
Throws:
javax.jbi.messaging.MessagingException

matches

public boolean matches(javax.jbi.messaging.MessageExchange exchange,
                       javax.jbi.messaging.NormalizedMessage message)
                throws javax.jbi.messaging.MessagingException
Throws:
javax.jbi.messaging.MessagingException

getXpathObject

public org.jaxen.XPath getXpathObject()

setXpathObject

public void setXpathObject(org.jaxen.XPath xpathObject)

getXpath

public java.lang.String getXpath()

setXpath

public void setXpath(java.lang.String xpath)

isUseMessageContent

public boolean isUseMessageContent()

setUseMessageContent

public void setUseMessageContent(boolean useMessageContent)
Specifies whether or not the XPath expression uses the message content. By default, this property is true, but you can set it to false to avoid that the message content is converted to StringSource

Parameters:
useMessageContent - specify false if this expression does not access the message content

getTransformer

public SourceTransformer getTransformer()

setTransformer

public void setTransformer(SourceTransformer transformer)

getVariableContext

public JaxenVariableContext getVariableContext()

setVariableContext

public void setVariableContext(JaxenVariableContext variableContext)

getNamespaceContext

public org.jaxen.NamespaceContext getNamespaceContext()

setNamespaceContext

public void setNamespaceContext(org.jaxen.NamespaceContext namespaceContext)

getFunctionContext

public org.jaxen.FunctionContext getFunctionContext()

setFunctionContext

public void setFunctionContext(org.jaxen.FunctionContext functionContext)

createXPath

protected final org.jaxen.XPath createXPath(java.lang.String xp)
                                     throws org.jaxen.JaxenException
Throws:
org.jaxen.JaxenException

evaluateXPath

protected java.lang.Object evaluateXPath(java.lang.Object object)
                                  throws org.jaxen.JaxenException
Throws:
org.jaxen.JaxenException

evaluateXPathAsBoolean

protected boolean evaluateXPathAsBoolean(java.lang.Object object)
                                  throws org.jaxen.JaxenException
Throws:
org.jaxen.JaxenException

getXMLNode

protected java.lang.Object getXMLNode(javax.jbi.messaging.MessageExchange exchange,
                                      javax.jbi.messaging.NormalizedMessage message)
                               throws javax.xml.transform.TransformerException,
                                      javax.jbi.messaging.MessagingException,
                                      javax.xml.parsers.ParserConfigurationException,
                                      java.io.IOException,
                                      org.xml.sax.SAXException
Throws:
javax.xml.transform.TransformerException
javax.jbi.messaging.MessagingException
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException

enableContentRereadability

public void enableContentRereadability(javax.jbi.messaging.NormalizedMessage message)
                                throws javax.jbi.messaging.MessagingException
Convert the given NormalizedMessage instance's content to a re-readable Source This allows the content to be read more than once (e.g. for XPath evaluation or auditing).

Parameters:
message - the NormalizedMessage to convert the content for
Throws:
javax.jbi.messaging.MessagingException


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