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 void
destroy()
Destroy child mediators recursivelyString
getArtifactContainerName()
String
getAuditId()
String
getErrorHandler()
String
getFileName()
Value
getKey()
To get the key which is used to pick the sequence definition from the local registryString
getName()
To get the name of the sequenceString
getRegistryKey()
Return the registry key used to load this sequence dynamicallyString
getSequenceNameForStatistics()
void
init(SynapseEnvironment se)
This method will ensure that each and every sequence wil only be initialized at most onceboolean
isContentAware()
boolean
isDynamic()
Is this a dynamic sequence?boolean
isEdited()
boolean
isInitialized()
boolean
mediate(MessageContext synCtx)
If this mediator refers to another named Sequence, execute that.boolean
mediate(MessageContext synCtx, ContinuationState continuationState)
Mediate the message using a ContinuationState.void
reportCloseStatistics(MessageContext messageContext, Integer currentIndex)
Report Close Statistic Event for the MediatorInteger
reportOpenStatistics(MessageContext messageContext, boolean isContentAltering)
Report Open Statistic Event for the Mediatorvoid
setArtifactContainerName(String name)
void
setComponentStatisticsId(ArtifactHolder holder)
void
setDynamic(boolean dynamic)
Mark this as a dynamic sequencevoid
setErrorHandler(String errorHandler)
void
setFileName(String fileName)
void
setIsEdited(boolean isEdited)
void
setKey(Value key)
To set the local registry key in order to pick the sequence definitionvoid
setName(String name)
setting the name of the sequencevoid
setRegistryKey(String registryKey)
To get the registry key used to load this sequence dynamicallyvoid
setSequenceType(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:
mediate
in interfaceMediator
- Overrides:
mediate
in classAbstractListMediator
- Parameters:
synCtx
- the synapse message- Returns:
- as per standard mediator result
-
mediate
public boolean mediate(MessageContext synCtx, ContinuationState continuationState)
Description copied from interface:FlowContinuableMediator
Mediate the message using a ContinuationState. This is used when mediating the response message when service is invoked using a Call Mediator.- Specified by:
mediate
in 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:
init
in interfaceManagedLifecycle
- Overrides:
init
in classAbstractListMediator
- Parameters:
se
- - environment to be initialized
-
destroy
public void destroy()
Description copied from class:AbstractListMediator
Destroy child mediators recursively- Specified by:
destroy
in interfaceManagedLifecycle
- Overrides:
destroy
in 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:
isContentAware
in interfaceMediator
- Overrides:
isContentAware
in classAbstractListMediator
-
setSequenceType
public void setSequenceType(SequenceType sequenceType)
-
getSequenceNameForStatistics
public String getSequenceNameForStatistics()
-
reportOpenStatistics
public Integer reportOpenStatistics(MessageContext messageContext, boolean isContentAltering)
Description copied from interface:Mediator
Report Open Statistic Event for the Mediator- Specified by:
reportOpenStatistics
in interfaceMediator
- Overrides:
reportOpenStatistics
in classAbstractMediator
-
reportCloseStatistics
public void reportCloseStatistics(MessageContext messageContext, Integer currentIndex)
Description copied from interface:Mediator
Report Close Statistic Event for the Mediator- Specified by:
reportCloseStatistics
in interfaceMediator
- Overrides:
reportCloseStatistics
in classAbstractMediator
-
setComponentStatisticsId
public void setComponentStatisticsId(ArtifactHolder holder)
- Specified by:
setComponentStatisticsId
in interfaceMediator
- Overrides:
setComponentStatisticsId
in classAbstractMediator
-
-