org.apache.synapse.core.axis2
Class Axis2MessageContext

java.lang.Object
  extended by org.apache.synapse.core.axis2.Axis2MessageContext
All Implemented Interfaces:
MessageContext

public class Axis2MessageContext
extends Object
implements MessageContext

This is the MessageContext implementation that synapse uses almost all the time because Synapse is implemented on top of the Axis2


Constructor Summary
Axis2MessageContext(MessageContext axisMsgCtx, SynapseConfiguration synCfg, SynapseEnvironment synEnv)
          Constructor for the Axis2MessageContext inside Synapse
 
Method Summary
 MessageContext getAxis2MessageContext()
           
 SynapseConfiguration getConfiguration()
          Get a reference to the current SynapseConfiguration
 Map<String,Object> getContextEntries()
          Return all the entries which are in the MessageContext.
 Endpoint getEndpoint(String key)
          Return the endpoint with the given key from the configuration, or the local message context.
 Object getEntry(String key)
          Get the value of a property set on the message instance, from the local registry or the remote registry - by cascading through
 SOAPEnvelope getEnvelope()
          Get the SOAP envelope of this message
 SynapseEnvironment getEnvironment()
          Returns a reference to the host Synapse Environment
 Mediator getFaultSequence()
          Return the fault sequence from the configuration, or the local message context This method looks up for the sequence named Constants.FAULT_SEQUENCE_KEY from the local message context to make this look up transactional - i.e.
 Stack<FaultHandler> getFaultStack()
           
 EndpointReference getFaultTo()
          Get the faultTo EPR if available
 EndpointReference getFrom()
          Get the from EPR if available
 Mediator getMainSequence()
          Return the main sequence from the configuration, or the local message context This method looks up for the sequence named Constants.MAIN_SEQUENCE_KEY from the local message context to make this look up transactional - i.e.
 String getMessageID()
          Get the message id if available
 Map<String,Object> getProperties()
          Get a read-only view of all the properties currently set on this message context
 Object getProperty(String key)
          Get the value of a custom (local) property set on the message instance
 Set getPropertyKeySet()
          Returns the Set of keys over the properties on this message context
 RelatesTo getRelatesTo()
          Get the relatesTo of this message
 EndpointReference getReplyTo()
          Get the replyTo EPR if available
 Mediator getSequence(String key)
          Return the sequence with the given key from the configuration, or the local message context.
 Mediator getSequenceTemplate(String key)
          Return the Sequence Template with the given key from the configuration, or the local message context.
 org.apache.commons.logging.Log getServiceLog()
          Return the service level Log for this message context or null
 String getSoapAction()
          Returns the SOAPAction of the message
 EndpointReference getTo()
          Get the To EPR
 int getTracingState()
          This is used to check whether the tracing should be enabled on the current mediator or not
 String getWSAAction()
          Returns the WSAAction
 String getWSAMessageID()
          Gets the message name
 boolean isDoingGET()
          Is this message over GET?
 boolean isDoingMTOM()
          If this message using MTOM?
 boolean isDoingPOX()
          Is this message over POX?
 boolean isDoingSWA()
          If this message using SWA?
 boolean isFaultResponse()
          Is this message a response to a fault message?
 boolean isPaused()
           
 boolean isResponse()
          Is this message a response to a synchronous message sent out through Synapse?
 boolean isServerSide()
           
 boolean isSOAP11()
          Is this message a SOAP 1.1 message?
 void pushFaultHandler(FaultHandler fault)
           
 void setAxis2MessageContext(MessageContext axisMsgCtx)
           
 void setConfiguration(SynapseConfiguration synCfg)
          Set or replace the Synapse Configuration instance to be used.
 void setContextEntries(Map<String,Object> entries)
          Sets the entries to the current context and not to the configuration.
 void setDoingGET(boolean b)
          Marks this message as over REST/GET
 void setDoingMTOM(boolean b)
          Marks as using MTOM
 void setDoingPOX(boolean b)
          Marks this message as over POX
 void setDoingSWA(boolean b)
          Marks as using SWA
 void setEnvelope(SOAPEnvelope envelope)
          Sets the given envelope as the current SOAPEnvelope for this message
 void setEnvironment(SynapseEnvironment synEnv)
          Sets the SynapseEnvironment reference to this context
 void setFaultResponse(boolean b)
          Marks this message as a fault response
 void setFaultTo(EndpointReference reference)
          Set the faultTo EPR
 void setFrom(EndpointReference reference)
          Set the from EPR
 void setMessageID(String string)
          Set the message id
 void setPaused(boolean value)
           
 void setProperty(String key, Object value)
          Set a custom (local) property with the given name on the message instance
 void setRelatesTo(RelatesTo[] reference)
          Sets the relatesTo references for this message
 void setReplyTo(EndpointReference reference)
          Set the replyTo EPR
 void setResponse(boolean b)
          Mark this message as a response or not.
 void setServerSide(boolean value)
           
 void setServiceLog(org.apache.commons.logging.Log serviceLog)
          Set the service log
 void setSoapAction(String string)
          Set the SOAPAction
 void setTo(EndpointReference reference)
          Set the To EPR
 void setTracingState(int tracingState)
          This is used to set the value of tracing enable variable
 void setWSAAction(String actionURI)
          Sets the WSAAction
 void setWSAMessageID(String messageID)
          Set the message
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Axis2MessageContext

public Axis2MessageContext(MessageContext axisMsgCtx,
                           SynapseConfiguration synCfg,
                           SynapseEnvironment synEnv)
Constructor for the Axis2MessageContext inside Synapse

Parameters:
axisMsgCtx - MessageContext representing the relevant Axis MC
synCfg - SynapseConfiguraion describing Synapse
synEnv - SynapseEnvironment describing the environment of Synapse
Method Detail

getConfiguration

public SynapseConfiguration getConfiguration()
Description copied from interface: MessageContext
Get a reference to the current SynapseConfiguration

Specified by:
getConfiguration in interface MessageContext
Returns:
the current synapse configuration

setConfiguration

public void setConfiguration(SynapseConfiguration synCfg)
Description copied from interface: MessageContext
Set or replace the Synapse Configuration instance to be used. May be used to programatically change the configuration at runtime etc.

Specified by:
setConfiguration in interface MessageContext
Parameters:
synCfg - The new synapse configuration instance

getEnvironment

public SynapseEnvironment getEnvironment()
Description copied from interface: MessageContext
Returns a reference to the host Synapse Environment

Specified by:
getEnvironment in interface MessageContext
Returns:
the Synapse Environment

setEnvironment

public void setEnvironment(SynapseEnvironment synEnv)
Description copied from interface: MessageContext
Sets the SynapseEnvironment reference to this context

Specified by:
setEnvironment in interface MessageContext
Parameters:
synEnv - the reference to the Synapse Environment

getContextEntries

public Map<String,Object> getContextEntries()
Description copied from interface: MessageContext
Return all the entries which are in the MessageContext. This does not represent all the declared entries in the configuration, rather only the entries that the context has already used. This will not lookup for the entries in the Configuration.

Specified by:
getContextEntries in interface MessageContext
Returns:
the set of local entries in the context

setContextEntries

public void setContextEntries(Map<String,Object> entries)
Description copied from interface: MessageContext
Sets the entries to the current context and not to the configuration. This can be used to forcibly override an existing set of resources in the configuration, because the resource lookup will look for the context first. But this only sets the entries to the current context

Specified by:
setContextEntries in interface MessageContext
Parameters:
entries - the set of local entries to be set

getMainSequence

public Mediator getMainSequence()
Description copied from interface: MessageContext
Return the main sequence from the configuration, or the local message context This method looks up for the sequence named Constants.MAIN_SEQUENCE_KEY from the local message context to make this look up transactional - i.e. a request and response message pair will not see a difference in the main sequence if the main sequence was dynamic and changed in between at the registry

Specified by:
getMainSequence in interface MessageContext
Returns:
the main sequence to be used for mediation

getFaultSequence

public Mediator getFaultSequence()
Description copied from interface: MessageContext
Return the fault sequence from the configuration, or the local message context This method looks up for the sequence named Constants.FAULT_SEQUENCE_KEY from the local message context to make this look up transactional - i.e. a request and response message pair will not see a difference in the fault sequence if the fault sequence was dynamic and changed in between at the registry

Specified by:
getFaultSequence in interface MessageContext
Returns:
the fault sequence to be used for mediation

getSequence

public Mediator getSequence(String key)
Description copied from interface: MessageContext
Return the sequence with the given key from the configuration, or the local message context. This method looks up for the sequence with the given key from the local message context to make this look up transactional - i.e. a request and response message pair will not see a difference in the said sequence if it was dynamic and changed in between at the registry

Specified by:
getSequence in interface MessageContext
Parameters:
key - the sequence key to be looked up
Returns:
the sequence mediator mapped to the key

getSequenceTemplate

public Mediator getSequenceTemplate(String key)
Description copied from interface: MessageContext
Return the Sequence Template with the given key from the configuration, or the local message context. This method looks up for the Template with the given key from the local message context to make this look up transactional - i.e. a request and response message pair will not see a difference in the said sequence if it was dynamic and changed in between at the registry

Specified by:
getSequenceTemplate in interface MessageContext
Parameters:
key - the sequence key to be looked up
Returns:
the Template mediator mapped to the key

getEndpoint

public Endpoint getEndpoint(String key)
Description copied from interface: MessageContext
Return the endpoint with the given key from the configuration, or the local message context. This method looks up for the endpoint with the given key from the local message context to make this look up transactional - i.e. a request and response message pair will not see a difference in the said endpoint if it was dynamic and changed in between at the registry

Specified by:
getEndpoint in interface MessageContext
Parameters:
key - the endpoint key to be looked up
Returns:
the endpoint mapped to the key

getEntry

public Object getEntry(String key)
Description copied from interface: MessageContext
Get the value of a property set on the message instance, from the local registry or the remote registry - by cascading through

Specified by:
getEntry in interface MessageContext
Parameters:
key - key to look up property
Returns:
value for the given key

getProperties

public Map<String,Object> getProperties()
Get a read-only view of all the properties currently set on this message context

Returns:
an unmodifiable map of message context properties

getProperty

public Object getProperty(String key)
Description copied from interface: MessageContext
Get the value of a custom (local) property set on the message instance

Specified by:
getProperty in interface MessageContext
Parameters:
key - key to look up property
Returns:
value for the given key

setProperty

public void setProperty(String key,
                        Object value)
Description copied from interface: MessageContext
Set a custom (local) property with the given name on the message instance

Specified by:
setProperty in interface MessageContext
Parameters:
key - key to be used
value - value to be saved

getPropertyKeySet

public Set getPropertyKeySet()
Description copied from interface: MessageContext
Returns the Set of keys over the properties on this message context

Specified by:
getPropertyKeySet in interface MessageContext
Returns:
a Set of keys over message properties

getFaultTo

public EndpointReference getFaultTo()
Description copied from interface: MessageContext
Get the faultTo EPR if available

Specified by:
getFaultTo in interface MessageContext
Returns:
FaultTo epr if available

setFaultTo

public void setFaultTo(EndpointReference reference)
Description copied from interface: MessageContext
Set the faultTo EPR

Specified by:
setFaultTo in interface MessageContext
Parameters:
reference - epr representing the FaultTo address

getFrom

public EndpointReference getFrom()
Description copied from interface: MessageContext
Get the from EPR if available

Specified by:
getFrom in interface MessageContext
Returns:
From epr if available

setFrom

public void setFrom(EndpointReference reference)
Description copied from interface: MessageContext
Set the from EPR

Specified by:
setFrom in interface MessageContext
Parameters:
reference - epr representing the From address

getEnvelope

public SOAPEnvelope getEnvelope()
Description copied from interface: MessageContext
Get the SOAP envelope of this message

Specified by:
getEnvelope in interface MessageContext
Returns:
the SOAP envelope of the message

setEnvelope

public void setEnvelope(SOAPEnvelope envelope)
                 throws AxisFault
Description copied from interface: MessageContext
Sets the given envelope as the current SOAPEnvelope for this message

Specified by:
setEnvelope in interface MessageContext
Parameters:
envelope - the envelope to be set
Throws:
AxisFault - on exception

getMessageID

public String getMessageID()
Description copied from interface: MessageContext
Get the message id if available

Specified by:
getMessageID in interface MessageContext
Returns:
message id if available

setMessageID

public void setMessageID(String string)
Description copied from interface: MessageContext
Set the message id

Specified by:
setMessageID in interface MessageContext
Parameters:
string - message id to be set

getRelatesTo

public RelatesTo getRelatesTo()
Description copied from interface: MessageContext
Get the relatesTo of this message

Specified by:
getRelatesTo in interface MessageContext
Returns:
RelatesTo of the message if available

setRelatesTo

public void setRelatesTo(RelatesTo[] reference)
Description copied from interface: MessageContext
Sets the relatesTo references for this message

Specified by:
setRelatesTo in interface MessageContext
Parameters:
reference - the relatesTo references array

getReplyTo

public EndpointReference getReplyTo()
Description copied from interface: MessageContext
Get the replyTo EPR if available

Specified by:
getReplyTo in interface MessageContext
Returns:
ReplyTo epr of the message if available

setReplyTo

public void setReplyTo(EndpointReference reference)
Description copied from interface: MessageContext
Set the replyTo EPR

Specified by:
setReplyTo in interface MessageContext
Parameters:
reference - epr representing the ReplyTo address

getTo

public EndpointReference getTo()
Description copied from interface: MessageContext
Get the To EPR

Specified by:
getTo in interface MessageContext
Returns:
To epr of the message if available

setTo

public void setTo(EndpointReference reference)
Description copied from interface: MessageContext
Set the To EPR

Specified by:
setTo in interface MessageContext
Parameters:
reference - the To EPR

setWSAAction

public void setWSAAction(String actionURI)
Description copied from interface: MessageContext
Sets the WSAAction

Specified by:
setWSAAction in interface MessageContext
Parameters:
actionURI - the WSAAction

getWSAAction

public String getWSAAction()
Description copied from interface: MessageContext
Returns the WSAAction

Specified by:
getWSAAction in interface MessageContext
Returns:
the WSAAction

setWSAMessageID

public void setWSAMessageID(String messageID)
Description copied from interface: MessageContext
Set the message

Specified by:
setWSAMessageID in interface MessageContext
Parameters:
messageID - message id to be set

getWSAMessageID

public String getWSAMessageID()
Description copied from interface: MessageContext
Gets the message name

Specified by:
getWSAMessageID in interface MessageContext
Returns:
the WSA MessageID

getSoapAction

public String getSoapAction()
Description copied from interface: MessageContext
Returns the SOAPAction of the message

Specified by:
getSoapAction in interface MessageContext
Returns:
the SOAPAction

setSoapAction

public void setSoapAction(String string)
Description copied from interface: MessageContext
Set the SOAPAction

Specified by:
setSoapAction in interface MessageContext
Parameters:
string - the SOAP Action

isDoingMTOM

public boolean isDoingMTOM()
Description copied from interface: MessageContext
If this message using MTOM?

Specified by:
isDoingMTOM in interface MessageContext
Returns:
true if using MTOM

isDoingSWA

public boolean isDoingSWA()
Description copied from interface: MessageContext
If this message using SWA?

Specified by:
isDoingSWA in interface MessageContext
Returns:
true if using SWA

setDoingMTOM

public void setDoingMTOM(boolean b)
Description copied from interface: MessageContext
Marks as using MTOM

Specified by:
setDoingMTOM in interface MessageContext
Parameters:
b - true to mark as using MTOM

setDoingSWA

public void setDoingSWA(boolean b)
Description copied from interface: MessageContext
Marks as using SWA

Specified by:
setDoingSWA in interface MessageContext
Parameters:
b - true to mark as using SWA

isDoingPOX

public boolean isDoingPOX()
Description copied from interface: MessageContext
Is this message over POX?

Specified by:
isDoingPOX in interface MessageContext
Returns:
true if over POX

setDoingPOX

public void setDoingPOX(boolean b)
Description copied from interface: MessageContext
Marks this message as over POX

Specified by:
setDoingPOX in interface MessageContext
Parameters:
b - true to mark as POX

isDoingGET

public boolean isDoingGET()
Description copied from interface: MessageContext
Is this message over GET?

Specified by:
isDoingGET in interface MessageContext
Returns:
true if over GET

setDoingGET

public void setDoingGET(boolean b)
Description copied from interface: MessageContext
Marks this message as over REST/GET

Specified by:
setDoingGET in interface MessageContext
Parameters:
b - true to mark as REST/GET

isSOAP11

public boolean isSOAP11()
Description copied from interface: MessageContext
Is this message a SOAP 1.1 message?

Specified by:
isSOAP11 in interface MessageContext
Returns:
true if this is a SOAP 1.1 message

setResponse

public void setResponse(boolean b)
Description copied from interface: MessageContext
Mark this message as a response or not.

Specified by:
setResponse in interface MessageContext
Parameters:
b - true to set this as a response
See Also:
MessageContext.isResponse()

isResponse

public boolean isResponse()
Description copied from interface: MessageContext
Is this message a response to a synchronous message sent out through Synapse?

Specified by:
isResponse in interface MessageContext
Returns:
true if this message is a response message

setFaultResponse

public void setFaultResponse(boolean b)
Description copied from interface: MessageContext
Marks this message as a fault response

Specified by:
setFaultResponse in interface MessageContext
Parameters:
b - true to mark this as a fault response
See Also:
MessageContext.isFaultResponse()

isFaultResponse

public boolean isFaultResponse()
Description copied from interface: MessageContext
Is this message a response to a fault message?

Specified by:
isFaultResponse in interface MessageContext
Returns:
true if this is a response to a fault message

getTracingState

public int getTracingState()
Description copied from interface: MessageContext
This is used to check whether the tracing should be enabled on the current mediator or not

Specified by:
getTracingState in interface MessageContext
Returns:
indicate whether tracing is on, off or unset

setTracingState

public void setTracingState(int tracingState)
Description copied from interface: MessageContext
This is used to set the value of tracing enable variable

Specified by:
setTracingState in interface MessageContext
Parameters:
tracingState - Set whether the tracing is enabled or not

getFaultStack

public Stack<FaultHandler> getFaultStack()
Specified by:
getFaultStack in interface MessageContext

pushFaultHandler

public void pushFaultHandler(FaultHandler fault)
Specified by:
pushFaultHandler in interface MessageContext

getServiceLog

public org.apache.commons.logging.Log getServiceLog()
Return the service level Log for this message context or null

Specified by:
getServiceLog in interface MessageContext
Returns:
the service level Log for the message

setServiceLog

public void setServiceLog(org.apache.commons.logging.Log serviceLog)
Set the service log

Parameters:
serviceLog - log to be used on a per-service basis

getAxis2MessageContext

public MessageContext getAxis2MessageContext()

setAxis2MessageContext

public void setAxis2MessageContext(MessageContext axisMsgCtx)

setPaused

public void setPaused(boolean value)

isPaused

public boolean isPaused()

isServerSide

public boolean isServerSide()

setServerSide

public void setServerSide(boolean value)

toString

public String toString()
Overrides:
toString in class Object


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