org.mule.module.xml.expression
Class JaxpXPathExpressionEvaluator

java.lang.Object
  extended by org.mule.module.xml.expression.JaxpXPathExpressionEvaluator
All Implemented Interfaces:
MuleContextAware, ExpressionEvaluator, Disposable, Initialisable, NamedObject

public class JaxpXPathExpressionEvaluator
extends Object
implements ExpressionEvaluator, Initialisable, Disposable, MuleContextAware

Uses JAXP XPath processing to evaluate xpath expressions against Xml fragments and documents

Note that the JAXP Expression evaluator differs from the Mule XPATH evaluator slightly since you can set the JAXP return type as a prefix to the expression i.e. xpath2:[type]/foo/bar

Where the type can either be boolean, string, number, node or nodeset.


Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
JaxpXPathExpressionEvaluator()
           
 
Method Summary
protected  XPathExpression createXPath(String expression)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
 Object evaluate(String expression, MuleMessage message)
          Extracts a single property from the message
 MuleContext getMuleContext()
           
 String getName()
          Gets the name of the object
 NamespaceManager getNamespaceManager()
           
 QName getReturnType()
           
protected  XPathExpression getXPath(String expression)
           
 void initialise()
          Method used to perform any initialisation work.
 void setMuleContext(MuleContext context)
           
 void setNamespaceManager(NamespaceManager namespaceManager)
           
 void setReturnType(QName returnType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JaxpXPathExpressionEvaluator

public JaxpXPathExpressionEvaluator()
Method Detail

getName

public String getName()
Description copied from interface: NamedObject
Gets the name of the object

Specified by:
getName in interface NamedObject
Returns:
the name of the object

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

evaluate

public Object evaluate(String expression,
                       MuleMessage message)
Extracts a single property from the message

Specified by:
evaluate in interface ExpressionEvaluator
Parameters:
expression - the property expression or expression
message - the message to extract from
Returns:
the result of the extraction or null if the property was not found

getXPath

protected XPathExpression getXPath(String expression)
                            throws XPathExpressionException
Throws:
XPathExpressionException

createXPath

protected XPathExpression createXPath(String expression)
                               throws XPathExpressionException
Throws:
XPathExpressionException

dispose

public void dispose()
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

getNamespaceManager

public NamespaceManager getNamespaceManager()

setNamespaceManager

public void setNamespaceManager(NamespaceManager namespaceManager)

getMuleContext

public MuleContext getMuleContext()

getReturnType

public QName getReturnType()

setReturnType

public void setReturnType(QName returnType)


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.