Class PropertyMediator
- java.lang.Object
-
- org.apache.synapse.mediators.AbstractMediator
-
- org.apache.synapse.mediators.builtin.PropertyMediator
-
- All Implemented Interfaces:
AspectConfigurable
,Mediator
,SynapseArtifact
public class PropertyMediator extends AbstractMediator
The property mediator would save(or remove) a named property as a local property of the Synapse Message Context or as a property of the Axis2 Message Context or as a Transport Header. Properties set this way could be extracted through the XPath extension function "synapse:get-property(scope,prop-name)"
-
-
Field Summary
Fields Modifier and Type Field Description static int
ACTION_REMOVE
static int
ACTION_SET
The Action - set or removestatic String
CONTENT_TYPE
Define the Content type of the resource-
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
-
-
Constructor Summary
Constructors Constructor Description PropertyMediator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getAction()
SynapsePath
getExpression()
int
getGroup()
String
getMediatorName()
Returns the name of the class of respective mediator.String
getName()
Pattern
getPattern()
String
getScope()
String
getType()
Returns the class name of the mediatorObject
getValue()
org.apache.axiom.om.OMElement
getValueElement()
boolean
isContentAware()
boolean
mediate(MessageContext synCtx)
Sets a property into the current (local) Synapse Context or into the Axis Message Context or into Transports Header and removes above properties from the corresponding locations.void
reportCloseStatistics(MessageContext messageContext, Integer currentIndex)
Report Close Statistic Event for the Mediatorvoid
setAction(int action)
void
setDynamicNameValue(Value nameValue)
Setter for the Value of the Name attribute when it has a dynamic value.void
setExpression(SynapsePath expression)
void
setExpression(SynapsePath expression, String type)
void
setGroup(int group)
void
setName(String name)
void
setPattern(Pattern pattern)
void
setScope(String scope)
void
setValue(String value)
void
setValue(String value, String type)
Set the value to be set by this property mediator and the data type to be used when setting the value.void
setValueElement(org.apache.axiom.om.OMElement valueElement)
-
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, handleException, handleException, isBreakPoint, isContentAltering, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportOpenStatistics, setBreakPoint, setCommentsList, setComponentStatisticsId, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
-
-
-
-
Field Detail
-
ACTION_SET
public static final int ACTION_SET
The Action - set or remove- See Also:
- Constant Field Values
-
ACTION_REMOVE
public static final int ACTION_REMOVE
- See Also:
- Constant Field Values
-
CONTENT_TYPE
public static final String CONTENT_TYPE
Define the Content type of the resource- See Also:
- Constant Field Values
-
-
Method Detail
-
mediate
public boolean mediate(MessageContext synCtx)
Sets a property into the current (local) Synapse Context or into the Axis Message Context or into Transports Header and removes above properties from the corresponding locations.- Parameters:
synCtx
- the message context- Returns:
- true always
-
getName
public String getName()
-
setName
public void setName(String name)
-
getValue
public Object getValue()
-
setValue
public void setValue(String value)
-
setValue
public void setValue(String value, String type)
Set the value to be set by this property mediator and the data type to be used when setting the value. Accepted type names are defined in XMLConfigConstants.DATA_TYPES enumeration. Passing null as the type implies that 'STRING' type should be used.- Parameters:
value
- the value to be set as a stringtype
- the type name
-
getType
public String getType()
Description copied from class:AbstractMediator
Returns the class name of the mediator- Specified by:
getType
in interfaceMediator
- Overrides:
getType
in classAbstractMediator
- Returns:
- the class name of the mediator
-
getValueElement
public org.apache.axiom.om.OMElement getValueElement()
-
setValueElement
public void setValueElement(org.apache.axiom.om.OMElement valueElement)
-
getExpression
public SynapsePath getExpression()
-
setExpression
public void setExpression(SynapsePath expression)
-
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
-
setExpression
public void setExpression(SynapsePath expression, String type)
-
getScope
public String getScope()
-
setScope
public void setScope(String scope)
-
getAction
public int getAction()
-
setAction
public void setAction(int action)
-
getPattern
public Pattern getPattern()
-
setPattern
public void setPattern(Pattern pattern)
-
getGroup
public int getGroup()
-
setGroup
public void setGroup(int group)
-
isContentAware
public boolean isContentAware()
- Specified by:
isContentAware
in interfaceMediator
- Overrides:
isContentAware
in classAbstractMediator
-
getMediatorName
public String getMediatorName()
Description copied from class:AbstractMediator
Returns the name of the class of respective mediator. This was introduced to provide a unique way to get the mediator name because getType is implemented in different ways in different mediators (e.g. PayloadFactoryMediator)- Specified by:
getMediatorName
in interfaceMediator
- Overrides:
getMediatorName
in classAbstractMediator
- Returns:
- a String of the mediator class name
-
setDynamicNameValue
public void setDynamicNameValue(Value nameValue)
Setter for the Value of the Name attribute when it has a dynamic value.- Parameters:
nameValue
- Value of the dynamic name value
-
-