Class Axis2SynapseEnvironment

    • Constructor Detail

      • Axis2SynapseEnvironment

        public Axis2SynapseEnvironment​(org.apache.axis2.context.ConfigurationContext cfgCtx,
                                       SynapseConfiguration synapseConfig)
    • Method Detail

      • setSeverDebugMode

        public void setSeverDebugMode​(ServerContextInformation contextInformation)
        this method is to set the debug mode is enabled and initializes the debug manager debug mode is enabled is set for each time Synapse configuration is changed and Synapse environment initializes
      • injectMessage

        public boolean injectMessage​(MessageContext synCtx)
        Description copied from interface: SynapseEnvironment
        This method injects a new message into the Synapse engine. This is used by the underlying SOAP engine to inject messages into Synapse for mediation. e.g. The SynapseMessageReceiver used by Axis2 invokes this to inject new messages
        Specified by:
        injectMessage in interface SynapseEnvironment
        Parameters:
        synCtx - - Synapse MessageContext to be injected
        Returns:
        boolean true if the message processing should be continued and false if it should be aborted
      • injectAsync

        public void injectAsync​(MessageContext synCtx,
                                SequenceMediator seq)
        Description copied from interface: SynapseEnvironment
        This method injects a new message into the Synapse engine for the mediation by the specified sequence. This is used by custom mediation tasks like splitting message in EIP mediation. This method will do the mediation asynchronously using a separate thread from the environment thread pool
        Specified by:
        injectAsync in interface SynapseEnvironment
        Parameters:
        synCtx - - Synapse message context to be injected
        seq - - Sequence to be used for mediation
      • injectInbound

        public boolean injectInbound​(MessageContext synCtx,
                                     SequenceMediator seq,
                                     boolean sequential)
                              throws SynapseException
        Used by inbound polling endpoints to inject the message to synapse engine
        Specified by:
        injectInbound in interface SynapseEnvironment
        Parameters:
        synCtx - message context
        sequential - whether message should be injected in sequential manner without spawning new threads
        seq - - Sequence to be used for mediation
        Returns:
        Boolean - Indicate if were able to inject the message
        Throws:
        SynapseException - - in case error occured during the mediation
      • send

        public void send​(EndpointDefinition endpoint,
                         MessageContext synCtx)
        This will be used for sending the message provided, to the endpoint specified by the EndpointDefinition using the axis2 environment.
        Specified by:
        send in interface SynapseEnvironment
        Parameters:
        endpoint - - EndpointDefinition to be used to find the endpoint information and the properties of the sending process
        synCtx - - Synapse MessageContext to be sent
      • createMessageContext

        public MessageContext createMessageContext()
        This method will be used to create a new MessageContext in the Axis2 environment for Synapse. This will set all the relevant parts to the MessageContext, but for this message context to be useful creator has to fill in the data like envelope and operation context and so on. This will set a default envelope of type soap12 and a new messageID for the created message along with the ConfigurationContext is being set in to the message correctly.
        Specified by:
        createMessageContext in interface SynapseEnvironment
        Returns:
        Synapse MessageContext with the underlying axis2 message context set
      • createOverflowBlob

        public org.apache.axiom.util.blob.OverflowBlob createOverflowBlob()
        Factory method to create the TemporaryData object as per on the parameters specified in the synapse.properties file, so that the TemporaryData parameters like threshold chunk size can be customized by using the properties file. This can be extended to enforce further policies if required in the future.
        Specified by:
        createOverflowBlob in interface SynapseEnvironment
        Returns:
        created TemporaryData object as per in the synapse.properties file
      • getExecutorService

        public ExecutorService getExecutorService()
        This will give the access to the synapse thread pool for the advanced mediation tasks.
        Specified by:
        getExecutorService in interface SynapseEnvironment
        Returns:
        an ExecutorService to execute the tasks in a new thread from the pool
      • isInitialized

        public boolean isInitialized()
        Has this environment properly initialized?
        Specified by:
        isInitialized in interface SynapseEnvironment
        Returns:
        true if ready for processing
      • setInitialized

        public void setInitialized​(boolean state)
        Mark this environment as ready for processing
        Specified by:
        setInitialized in interface SynapseEnvironment
        Parameters:
        state - true means ready for processing
      • getTaskManager

        public org.apache.synapse.task.SynapseTaskManager getTaskManager()
        Retrieve the SynapseTaskManager from the environment.
        Specified by:
        getTaskManager in interface SynapseEnvironment
        Returns:
        SynapseTaskManager of this synapse environment
      • getAxis2ConfigurationContext

        public org.apache.axis2.context.ConfigurationContext getAxis2ConfigurationContext()
        Retrieves the ConfigurationContext associated with this axis2SynapseEnv
        Returns:
        configContext of the axis2 synapse environment
      • getTenantInfoInitiator

        public org.apache.synapse.commons.util.ext.TenantInfoInitiator getTenantInfoInitiator()
      • setTenantInfoInitiator

        public void setTenantInfoInitiator​(org.apache.synapse.commons.util.ext.TenantInfoInitiator initiator)
      • updateCallMediatorCount

        public void updateCallMediatorCount​(boolean isIncrement)
        Increment/Decrement the Call mediator count in the environment by 1. While Call Mediator count is updated, continuation is enabled/disabled based on the count. If Call Mediator count becomes 0 continuation is disabled. count cannot get negative values.
        Specified by:
        updateCallMediatorCount in interface SynapseEnvironment
        Parameters:
        isIncrement - whether to increment the count
      • isContinuationEnabled

        public boolean isContinuationEnabled()
        Whether continuation is enabled in the environment. ContinuationState stack operations are done only if continuation is enabled for the environment.
        Specified by:
        isContinuationEnabled in interface SynapseEnvironment
        Returns:
        whether continuation is enabled in the environment
      • addUnavailableArtifactRef

        public void addUnavailableArtifactRef​(String key)
        Add an artifact reference not available in the environment. This stored reference will get cleared when artifact becomes available
        Specified by:
        addUnavailableArtifactRef in interface SynapseEnvironment
        Parameters:
        key - artifact reference key
      • removeUnavailableArtifactRef

        public void removeUnavailableArtifactRef​(String key)
        Remove the artifact reference which is previously marked as unavailable in environment from the unavailable list
        Specified by:
        removeUnavailableArtifactRef in interface SynapseEnvironment
        Parameters:
        key - artifact reference key
      • clearUnavailabilityOfArtifact

        public void clearUnavailabilityOfArtifact​(String key)
        Clear unavailability of an artifact if it is previously marked as unavailable in the environment
        Specified by:
        clearUnavailabilityOfArtifact in interface SynapseEnvironment
        Parameters:
        key - artifact reference key
      • injectMessage

        public boolean injectMessage​(MessageContext smc,
                                     SequenceMediator seq)
        Description copied from interface: SynapseEnvironment
        Inject message to the sequence in synchronous manner
        Specified by:
        injectMessage in interface SynapseEnvironment
        Parameters:
        smc - - Synapse message context to be injected
        seq - - Sequence to be used for mediation
        Returns:
        boolean true if the message processing should be continued and false if it should be aborted
      • getSynapseDebugManager

        public SynapseDebugManager getSynapseDebugManager()
        method to get the reference to debug manager instance which manages debug capabilities in synapse kept in environment level, made available who ever has access to message context will be able to get access to the debug manager
        Specified by:
        getSynapseDebugManager in interface SynapseEnvironment
        Returns:
        debug manager instance
      • setSynapseDebugManager

        public void setSynapseDebugManager​(SynapseDebugManager synapseDebugManager)
        sets debug manager when synapse environment initializes if the server instance is started in debug mode
      • isDebuggerEnabled

        public boolean isDebuggerEnabled()
        Whether debugging is enabled in the environment.
        Specified by:
        isDebuggerEnabled in interface SynapseEnvironment
        Returns:
        whether debugging is enabled in the environment
      • isUnitTestEnabled

        public boolean isUnitTestEnabled()
        Whether unit test is enabled in the environment.
        Returns:
        whether debugging is enabled in the environment
      • setDebugEnabled

        public void setDebugEnabled​(boolean isDebugEnabled)
        set debugging enabled in the environment. * when this is enabled mediation flow can be debugged through a external client when this is disabled mediation flow happens normally
      • setUnitTestEnabled

        public void setUnitTestEnabled​(boolean isUnitTestEnabled)
        set unit test mode enabled in the environment.
        Parameters:
        isUnitTestEnabled - boolean value of unit test mode