Class FilterMediator
- java.lang.Object
-
- org.apache.synapse.mediators.AbstractMediator
-
- org.apache.synapse.mediators.AbstractListMediator
-
- org.apache.synapse.mediators.filters.FilterMediator
-
- All Implemented Interfaces:
AspectConfigurable,ManagedLifecycle,Mediator,FilterMediator,FlowContinuableMediator,ListMediator,SynapseArtifact
public class FilterMediator extends AbstractListMediator implements FilterMediator, FlowContinuableMediator
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, msgBuildFailureExpattern
-
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
-
-
Constructor Summary
Constructors Constructor Description FilterMediator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy child mediators recursivelyStringgetElseKey()ListMediatorgetElseMediator()PatterngetRegex()SynapsePathgetSource()StringgetThenKey()SynapsePathgetXpath()voidinit(SynapseEnvironment se)Initialize child mediators recursivelybooleanisContentAware()booleanisThenElementPresent()booleanmediate(MessageContext synCtx)Executes the list of sub/child mediators, if the filter condition is satisfiedbooleanmediate(MessageContext synCtx, ContinuationState continuationState)Mediate the message using a ContinuationState.voidsetComponentStatisticsId(ArtifactHolder holder)voidsetElseKey(String elseKey)voidsetElseMediator(AnonymousListMediator elseMediator)voidsetRegex(Pattern regex)voidsetSource(SynapsePath source)voidsetThenElementPresent(boolean thenElementPresent)voidsetThenKey(String thenKey)voidsetXpath(SynapsePath xpath)booleantest(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, addChild, getChild, getList, mediate, removeChild, removeChild, setStatisticIdForMediators
-
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAltering, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportOpenStatistics, setBreakPoint, setCommentsList, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
-
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
getMediatorName, getMediatorPosition, getShortDescription, getTraceState, getType, isContentAltering, reportCloseStatistics, reportOpenStatistics, setMediatorPosition, setShortDescription, setTraceState
-
Methods inherited from interface org.apache.synapse.SynapseArtifact
getDescription, setDescription
-
-
-
-
Method Detail
-
init
public void init(SynapseEnvironment se)
Description copied from class:AbstractListMediatorInitialize child mediators recursively- Specified by:
initin interfaceManagedLifecycle- Overrides:
initin classAbstractListMediator- Parameters:
se- synapse environment
-
destroy
public void destroy()
Description copied from class:AbstractListMediatorDestroy child mediators recursively- Specified by:
destroyin interfaceManagedLifecycle- Overrides:
destroyin classAbstractListMediator
-
mediate
public boolean mediate(MessageContext synCtx)
Executes the list of sub/child mediators, if the filter condition is satisfied- Specified by:
mediatein interfaceMediator- Overrides:
mediatein classAbstractListMediator- Parameters:
synCtx- the current message- Returns:
- true if filter condition fails. else returns as per List mediator semantics
-
mediate
public boolean mediate(MessageContext synCtx, ContinuationState continuationState)
Description copied from interface:FlowContinuableMediatorMediate the message using a ContinuationState. This is used when mediating the response message when service is invoked using a Call Mediator.- Specified by:
mediatein interfaceFlowContinuableMediator- Parameters:
synCtx- MessageContextcontinuationState- ContinuationState- Returns:
- whether mediation flow is completed
-
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:
testin interfaceFilterMediator- Parameters:
synCtx- the current message for evaluation of the test condition- Returns:
- true if evaluation of the XPath/Regex results in true
-
getSource
public SynapsePath getSource()
-
setSource
public void setSource(SynapsePath source)
-
getRegex
public Pattern getRegex()
-
setRegex
public void setRegex(Pattern regex)
-
getXpath
public SynapsePath getXpath()
-
setXpath
public void setXpath(SynapsePath xpath)
-
getElseMediator
public ListMediator getElseMediator()
-
setElseMediator
public void setElseMediator(AnonymousListMediator 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)
-
isContentAware
public boolean isContentAware()
- Specified by:
isContentAwarein interfaceMediator- Overrides:
isContentAwarein classAbstractListMediator
-
setComponentStatisticsId
public void setComponentStatisticsId(ArtifactHolder holder)
- Specified by:
setComponentStatisticsIdin interfaceMediator- Overrides:
setComponentStatisticsIdin classAbstractMediator
-
-