org.mule.module.xml.filters
Class JXPathFilter

java.lang.Object
  extended by org.mule.module.xml.filters.JXPathFilter
All Implemented Interfaces:
MuleContextAware, Initialisable, Filter

public class JXPathFilter
extends Object
implements Filter, MuleContextAware, Initialisable

JXPathFilter evaluates an XPath expression against a W3C Document, XML string, or Java bean and returns true if the result is as expected.


Field Summary
protected  Log logger
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Constructor Summary
JXPathFilter()
           
JXPathFilter(String pattern)
           
JXPathFilter(String pattern, String expectedValue)
           
 
Method Summary
 boolean accept(MuleMessage obj)
          Check a given message against this filter.
 boolean equals(Object obj)
           
 Map getContextProperties()
           
 String getExpectedValue()
           
 org.apache.commons.jxpath.AbstractFactory getFactory()
           
 Map<String,String> getNamespaces()
           
 String getPattern()
           
 String getValue()
          Deprecated. Use getExpectedValue().
 int hashCode()
           
 void initialise()
          Method used to perform any initialisation work.
protected  void initialise(org.apache.commons.jxpath.JXPathContext context)
          Initializes the JXPathContext based on any relevant properties set for the filter.
 boolean isLenient()
           
 void setContextProperties(Map contextProperties)
           
 void setExpectedValue(String expectedValue)
          Sets the expected result value of the XPath expression
 void setFactory(org.apache.commons.jxpath.AbstractFactory factory)
           
 void setLenient(boolean lenient)
           
 void setMuleContext(MuleContext context)
           
 void setNamespaces(Map<String,String> namespaces)
           
 void setPattern(String pattern)
           
 void setValue(String value)
          Deprecated. Use setExpectedValue(String expectedValue).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected transient Log logger
Constructor Detail

JXPathFilter

public JXPathFilter()

JXPathFilter

public JXPathFilter(String pattern)

JXPathFilter

public JXPathFilter(String pattern,
                    String expectedValue)
Method Detail

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

accept

public boolean accept(MuleMessage obj)
Description copied from interface: Filter
Check a given message against this filter.

Specified by:
accept in interface Filter
Parameters:
obj - a non null message to filter.
Returns:
true if the message matches the filter

initialise

protected void initialise(org.apache.commons.jxpath.JXPathContext context)
Initializes the JXPathContext based on any relevant properties set for the filter.

Parameters:
context - the JXPathContext to initialize

getPattern

public String getPattern()
Returns:
XPath expression

setPattern

public void setPattern(String pattern)
Parameters:
pattern - The XPath expression

getExpectedValue

public String getExpectedValue()
Returns:
The expected result value of the XPath expression

setExpectedValue

public void setExpectedValue(String expectedValue)
Sets the expected result value of the XPath expression


getValue

@Deprecated
public String getValue()
Deprecated. Use getExpectedValue().

Returns:
The expected result value of the XPath expression

setValue

@Deprecated
public void setValue(String value)
Deprecated. Use setExpectedValue(String expectedValue).

Sets the expected result value of the XPath expression


getNamespaces

public Map<String,String> getNamespaces()

setNamespaces

public void setNamespaces(Map<String,String> namespaces)

getContextProperties

public Map getContextProperties()

setContextProperties

public void setContextProperties(Map contextProperties)

getFactory

public org.apache.commons.jxpath.AbstractFactory getFactory()

setFactory

public void setFactory(org.apache.commons.jxpath.AbstractFactory factory)

isLenient

public boolean isLenient()

setLenient

public void setLenient(boolean lenient)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


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