Class 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 Detail

      • Axis2MessageContext

        public Axis2MessageContext​(org.apache.axis2.context.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

      • 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
      • 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
      • getDefaultConfiguration

        public Mediator getDefaultConfiguration​(String key)
        Description copied from interface: MessageContext
        Returns the InvokeMediator (which is wrapped with connector default configuration)
        Specified by:
        getDefaultConfiguration in interface MessageContext
        Parameters:
        key - the default configuration ref to be looked up
        Returns:
        the sequence mediator mapped to the key
      • getFormat

        public org.apache.axiom.om.OMElement getFormat​(String key)
        Description copied from interface: MessageContext
        Return the format with the given key from the configuration.
        Specified by:
        getFormat in interface MessageContext
        Returns:
        the format mapped with 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
      • getLocalEntry

        public Object getLocalEntry​(String key)
        Description copied from interface: MessageContext
        Get the value of a property set on the message instance or from the local registry
        Specified by:
        getLocalEntry 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 org.apache.axis2.addressing.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​(org.apache.axis2.addressing.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 org.apache.axis2.addressing.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​(org.apache.axis2.addressing.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 org.apache.axiom.soap.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​(org.apache.axiom.soap.SOAPEnvelope envelope)
                         throws org.apache.axis2.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:
        org.apache.axis2.AxisFault - on exception
      • getRelatesTo

        public org.apache.axis2.addressing.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​(org.apache.axis2.addressing.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 org.apache.axis2.addressing.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​(org.apache.axis2.addressing.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 org.apache.axis2.addressing.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​(org.apache.axis2.addressing.EndpointReference reference)
        Description copied from interface: MessageContext
        Set the To EPR
        Specified by:
        setTo in interface MessageContext
        Parameters:
        reference - the To EPR
      • 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
      • 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
      • 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
      • 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 org.apache.axis2.context.MessageContext getAxis2MessageContext()
      • setAxis2MessageContext

        public void setAxis2MessageContext​(org.apache.axis2.context.MessageContext axisMsgCtx)
      • setPaused

        public void setPaused​(boolean value)
      • isPaused

        public boolean isPaused()
      • isServerSide

        public boolean isServerSide()
      • setServerSide

        public void setServerSide​(boolean value)
      • isContinuationEnabled

        public boolean isContinuationEnabled()
        Description copied from interface: MessageContext
        is ContinuationStateStack stack Operations enabled
        Specified by:
        isContinuationEnabled in interface MessageContext
        Returns:
        whether ContinuationStateStack operations are enabled
      • setContinuationEnabled

        public void setContinuationEnabled​(boolean continuationEnabled)
        Description copied from interface: MessageContext
        Enable/disable ContinuationStateStack operations
        Specified by:
        setContinuationEnabled in interface MessageContext
      • setMediatorPosition

        public void setMediatorPosition​(int mediatorPosition)
      • getMediatorPosition

        public int getMediatorPosition()
      • getMessageString

        public String getMessageString()
        Description copied from interface: MessageContext
        Get Message properties as a String
        Specified by:
        getMessageString in interface MessageContext
        Returns:
        String with message property information
      • getMessageFlowTracingState

        public int getMessageFlowTracingState()
        Description copied from interface: MessageContext
        This is used to check whether the message flow tracing enabled for current message context
        Specified by:
        getMessageFlowTracingState in interface MessageContext
        Returns:
        indicate whether message flow tracing is on, off or unset
      • setMessageFlowTracingState

        public void setMessageFlowTracingState​(int messageFlowTracingState)
        Description copied from interface: MessageContext
        This is used to set the value of message flow tracing enable for a particular message
        Specified by:
        setMessageFlowTracingState in interface MessageContext
        Parameters:
        messageFlowTracingState - Set whether the message flowtracing is enabled or not
      • setAnalyticsMetadata

        public void setAnalyticsMetadata​(String key,
                                         Object value)
        Stores the value provided in the message context which will be published with analytics
        Parameters:
        key - key for the analytic
        value - analytic value
      • removeAnalyticsMetadata

        public void removeAnalyticsMetadata​(String key)