Class SequenceMediator
- java.lang.Object
-
- org.apache.synapse.mediators.AbstractMediator
-
- org.apache.synapse.mediators.AbstractListMediator
-
- org.apache.synapse.mediators.base.SequenceMediator
-
- All Implemented Interfaces:
AspectConfigurable,ManagedLifecycle,Mediator,FlowContinuableMediator,ListMediator,Nameable,SynapseArtifact
public class SequenceMediator extends AbstractListMediator implements Nameable, FlowContinuableMediator
The Sequence mediator either refers to a named Sequence mediator instance or is a *Named* list/sequence of other (child) Mediators If this instance defines a sequence mediator, then the name is required, and an errorHandler sequence name optional. If this instance refers to another (defined) sequence mediator, the errorHandler will not have a meaning, and if an error in encountered in the referred sequence, its errorHandler would execute.
-
-
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 SequenceMediator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()Destroy child mediators recursivelyStringgetArtifactContainerName()StringgetAuditId()StringgetErrorHandler()StringgetFileName()ValuegetKey()To get the key which is used to pick the sequence definition from the local registryStringgetName()To get the name of the sequenceStringgetRegistryKey()Return the registry key used to load this sequence dynamicallyStringgetSequenceNameForStatistics()voidinit(SynapseEnvironment se)This method will ensure that each and every sequence wil only be initialized at most oncebooleanisContentAware()booleanisDynamic()Is this a dynamic sequence?booleanisEdited()booleanisInitialized()booleanmediate(MessageContext synCtx)If this mediator refers to another named Sequence, execute that.booleanmediate(MessageContext synCtx, ContinuationState continuationState)Mediate the message using a ContinuationState.voidreportCloseStatistics(MessageContext messageContext, Integer currentIndex)Report Close Statistic Event for the MediatorIntegerreportOpenStatistics(MessageContext messageContext, boolean isContentAltering)Report Open Statistic Event for the MediatorvoidsetArtifactContainerName(String name)voidsetComponentStatisticsId(ArtifactHolder holder)voidsetDynamic(boolean dynamic)Mark this as a dynamic sequencevoidsetErrorHandler(String errorHandler)voidsetFileName(String fileName)voidsetIsEdited(boolean isEdited)voidsetKey(Value key)To set the local registry key in order to pick the sequence definitionvoidsetName(String name)setting the name of the sequencevoidsetRegistryKey(String registryKey)To get the registry key used to load this sequence dynamicallyvoidsetSequenceType(SequenceType sequenceType)-
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, 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.Mediator
getMediatorName, getMediatorPosition, getShortDescription, getTraceState, getType, isContentAltering, setMediatorPosition, setShortDescription, setTraceState
-
Methods inherited from interface org.apache.synapse.SynapseArtifact
getDescription, setDescription
-
-
-
-
Method Detail
-
mediate
public boolean mediate(MessageContext synCtx)
If this mediator refers to another named Sequence, execute that. Else execute the list of mediators (children) contained within this. If a referenced named sequence mediator instance cannot be found at runtime, an exception is thrown. This may occur due to invalid configuration of an erroneous runtime change of the synapse configuration. It is the responsibility of the SynapseConfiguration builder to ensure that dead references are not present.- Specified by:
mediatein interfaceMediator- Overrides:
mediatein classAbstractListMediator- Parameters:
synCtx- the synapse message- Returns:
- as per standard mediator result
-
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
-
init
public void init(SynapseEnvironment se)
This method will ensure that each and every sequence wil only be initialized at most once- Specified by:
initin interfaceManagedLifecycle- Overrides:
initin classAbstractListMediator- Parameters:
se- - environment to be initialized
-
destroy
public void destroy()
Description copied from class:AbstractListMediatorDestroy child mediators recursively- Specified by:
destroyin interfaceManagedLifecycle- Overrides:
destroyin classAbstractListMediator
-
getName
public String getName()
To get the name of the sequence
-
setName
public void setName(String name)
setting the name of the sequence
-
getKey
public Value getKey()
To get the key which is used to pick the sequence definition from the local registry- Returns:
- return the key which is used to pick the sequence definition from the local registry
-
setKey
public void setKey(Value key)
To set the local registry key in order to pick the sequence definition- Parameters:
key- the local registry key
-
getErrorHandler
public String getErrorHandler()
- Returns:
- Returns the errorhandler sequence name
-
setErrorHandler
public void setErrorHandler(String errorHandler)
- Parameters:
errorHandler- to used handle error will appear during the mediation through this sequence
-
isDynamic
public boolean isDynamic()
Is this a dynamic sequence?- Returns:
- true if dynamic
-
setDynamic
public void setDynamic(boolean dynamic)
Mark this as a dynamic sequence- Parameters:
dynamic- true if this is a dynamic sequence
-
getRegistryKey
public String getRegistryKey()
Return the registry key used to load this sequence dynamically- Returns:
- registry key
-
setRegistryKey
public void setRegistryKey(String registryKey)
To get the registry key used to load this sequence dynamically- Parameters:
registryKey- returns the registry key which point to this sequence
-
getAuditId
public String getAuditId()
-
getFileName
public String getFileName()
-
setFileName
public void setFileName(String fileName)
-
isInitialized
public boolean isInitialized()
-
setArtifactContainerName
public void setArtifactContainerName(String name)
-
getArtifactContainerName
public String getArtifactContainerName()
-
isEdited
public boolean isEdited()
-
setIsEdited
public void setIsEdited(boolean isEdited)
-
isContentAware
public boolean isContentAware()
- Specified by:
isContentAwarein interfaceMediator- Overrides:
isContentAwarein classAbstractListMediator
-
setSequenceType
public void setSequenceType(SequenceType sequenceType)
-
getSequenceNameForStatistics
public String getSequenceNameForStatistics()
-
reportOpenStatistics
public Integer reportOpenStatistics(MessageContext messageContext, boolean isContentAltering)
Description copied from interface:MediatorReport Open Statistic Event for the Mediator- Specified by:
reportOpenStatisticsin interfaceMediator- Overrides:
reportOpenStatisticsin classAbstractMediator
-
reportCloseStatistics
public void reportCloseStatistics(MessageContext messageContext, Integer currentIndex)
Description copied from interface:MediatorReport Close Statistic Event for the Mediator- Specified by:
reportCloseStatisticsin interfaceMediator- Overrides:
reportCloseStatisticsin classAbstractMediator
-
setComponentStatisticsId
public void setComponentStatisticsId(ArtifactHolder holder)
- Specified by:
setComponentStatisticsIdin interfaceMediator- Overrides:
setComponentStatisticsIdin classAbstractMediator
-
-