org.apache.synapse.mediators.filters
Class FilterMediator

java.lang.Object
  extended by org.apache.synapse.mediators.AbstractMediator
      extended by org.apache.synapse.mediators.AbstractListMediator
          extended by org.apache.synapse.mediators.filters.FilterMediator
All Implemented Interfaces:
AspectConfigurable, ManagedLifecycle, Mediator, FilterMediator, ListMediator, SynapseArtifact

public class FilterMediator
extends AbstractListMediator
implements FilterMediator

The filter mediator combines the regex and xpath filtering functionality. If an xpath is set, it is evaluated; else the given regex is evaluated against the source xpath.


Field Summary
 
Fields inherited from class org.apache.synapse.mediators.AbstractListMediator
mediators
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
 
Constructor Summary
FilterMediator()
           
 
Method Summary
 void destroy()
          Destroy child mediators recursively
 String getElseKey()
           
 ListMediator getElseMediator()
           
 Pattern getRegex()
           
 SynapseXPath getSource()
           
 String getThenKey()
           
 SynapseXPath getXpath()
           
 void init(SynapseEnvironment se)
          Initialize child mediators recursively
 boolean isThenElementPresent()
           
 boolean mediate(MessageContext synCtx)
          Executes the list of sub/child mediators, if the filter condition is satisfied
 void setElseKey(String elseKey)
           
 void setElseMediator(ListMediator elseMediator)
           
 void setRegex(Pattern regex)
           
 void setSource(SynapseXPath source)
           
 void setThenElementPresent(boolean thenElementPresent)
           
 void setThenKey(String thenKey)
           
 void setXpath(SynapseXPath xpath)
           
 boolean test(MessageContext synCtx)
          Tests the supplied condition after evaluation against the given XPath or Regex (against a source XPath).
 
Methods inherited from class org.apache.synapse.mediators.AbstractListMediator
addAll, addChild, getChild, getList, removeChild, removeChild
 
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.synapse.mediators.ListMediator
addAll, addChild, getChild, getList, removeChild, removeChild
 
Methods inherited from interface org.apache.synapse.Mediator
getTraceState, getType, setTraceState
 
Methods inherited from interface org.apache.synapse.SynapseArtifact
getDescription, setDescription
 

Constructor Detail

FilterMediator

public FilterMediator()
Method Detail

init

public void init(SynapseEnvironment se)
Description copied from class: AbstractListMediator
Initialize child mediators recursively

Specified by:
init in interface ManagedLifecycle
Overrides:
init in class AbstractListMediator
Parameters:
se - synapse environment

destroy

public void destroy()
Description copied from class: AbstractListMediator
Destroy child mediators recursively

Specified by:
destroy in interface ManagedLifecycle
Overrides:
destroy in class AbstractListMediator

mediate

public boolean mediate(MessageContext synCtx)
Executes the list of sub/child mediators, if the filter condition is satisfied

Specified by:
mediate in interface Mediator
Overrides:
mediate in class AbstractListMediator
Parameters:
synCtx - the current message
Returns:
true if filter condition fails. else returns as per List mediator semantics

test

public boolean test(MessageContext synCtx)
Tests the supplied condition after evaluation against the given XPath or Regex (against a source XPath). When a regular expression is supplied the source XPath is evaluated into a String value, and matched against the given regex

Specified by:
test in interface FilterMediator
Parameters:
synCtx - the current message for evaluation of the test condition
Returns:
true if evaluation of the XPath/Regex results in true

getSource

public SynapseXPath getSource()

setSource

public void setSource(SynapseXPath source)

getRegex

public Pattern getRegex()

setRegex

public void setRegex(Pattern regex)

getXpath

public SynapseXPath getXpath()

setXpath

public void setXpath(SynapseXPath xpath)

getElseMediator

public ListMediator getElseMediator()

setElseMediator

public void setElseMediator(ListMediator elseMediator)

isThenElementPresent

public boolean isThenElementPresent()

setThenElementPresent

public void setThenElementPresent(boolean thenElementPresent)

getThenKey

public String getThenKey()

setThenKey

public void setThenKey(String thenKey)

getElseKey

public String getElseKey()

setElseKey

public void setElseKey(String elseKey)


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