org.apache.synapse.mediators
Class AbstractListMediator

java.lang.Object
  extended by org.apache.synapse.mediators.AbstractMediator
      extended by org.apache.synapse.mediators.AbstractListMediator
All Implemented Interfaces:
AspectConfigurable, ManagedLifecycle, Mediator, ListMediator, SynapseArtifact
Direct Known Subclasses:
AnonymousListMediator, FilterMediator, InMediator, OutMediator, SequenceMediator, SynapseMediator, TemplateMediator, ValidateMediator

public abstract class AbstractListMediator
extends AbstractMediator
implements ListMediator

This is the base class for all List mediators

See Also:
ListMediator

Field Summary
protected  List<Mediator> mediators
          the list of child mediators held.
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
 
Constructor Summary
AbstractListMediator()
           
 
Method Summary
 boolean addAll(List<Mediator> c)
          Appends all of the mediators in the specified collection to the end of this mediator's (children) list, in the order that they are returned by the specified collection's iterator
 boolean addChild(Mediator m)
          Appends the specified mediator to the end of this mediator's (children) list
 void destroy()
          Destroy child mediators recursively
 Mediator getChild(int pos)
          Returns the mediator at the specified position
 List<Mediator> getList()
          Return the list of mediators of this List mediator instance
 void init(SynapseEnvironment se)
          Initialize child mediators recursively
 boolean mediate(MessageContext synCtx)
          Invokes the mediator passing the current message for mediation.
 Mediator removeChild(int pos)
          Removes the mediator at the specified position in this list
 boolean removeChild(Mediator m)
          Removes the first occurrence in this list of the specified mediator
 
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.Mediator
getTraceState, getType, setTraceState
 
Methods inherited from interface org.apache.synapse.SynapseArtifact
getDescription, setDescription
 

Field Detail

mediators

protected final List<Mediator> mediators
the list of child mediators held. These are executed sequentially

Constructor Detail

AbstractListMediator

public AbstractListMediator()
Method Detail

mediate

public boolean mediate(MessageContext synCtx)
Description copied from interface: Mediator
Invokes the mediator passing the current message for mediation. Each mediator performs its mediation action, and returns true if mediation should continue, or false if further mediation should be aborted.

Specified by:
mediate in interface Mediator
Parameters:
synCtx - the current message for mediation
Returns:
true if further mediation should continue

getList

public List<Mediator> getList()
Description copied from interface: ListMediator
Return the list of mediators of this List mediator instance

Specified by:
getList in interface ListMediator
Returns:
the child/sub mediator list

addChild

public boolean addChild(Mediator m)
Description copied from interface: ListMediator
Appends the specified mediator to the end of this mediator's (children) list

Specified by:
addChild in interface ListMediator
Parameters:
m - the mediator to be added
Returns:
true (as per the general contract of the Collection.add method)

addAll

public boolean addAll(List<Mediator> c)
Description copied from interface: ListMediator
Appends all of the mediators in the specified collection to the end of this mediator's (children) list, in the order that they are returned by the specified collection's iterator

Specified by:
addAll in interface ListMediator
Parameters:
c - the list of mediators to be added
Returns:
true if this list changed as a result of the call

getChild

public Mediator getChild(int pos)
Description copied from interface: ListMediator
Returns the mediator at the specified position

Specified by:
getChild in interface ListMediator
Parameters:
pos - index of mediator to return
Returns:
the mediator at the specified position in this list

removeChild

public boolean removeChild(Mediator m)
Description copied from interface: ListMediator
Removes the first occurrence in this list of the specified mediator

Specified by:
removeChild in interface ListMediator
Parameters:
m - mediator to be removed from this list, if present
Returns:
true if this list contained the specified mediator

removeChild

public Mediator removeChild(int pos)
Description copied from interface: ListMediator
Removes the mediator at the specified position in this list

Specified by:
removeChild in interface ListMediator
Parameters:
pos - the index of the mediator to remove
Returns:
the mediator previously at the specified position

init

public void init(SynapseEnvironment se)
Initialize child mediators recursively

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

destroy

public void destroy()
Destroy child mediators recursively

Specified by:
destroy in interface ManagedLifecycle


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