Class AbstractMediator

    • Field Detail

      • log

        protected org.apache.commons.logging.Log log
        the standard log for mediators, will assign the logger for the actual subclass
      • trace

        protected static final org.apache.commons.logging.Log trace
        The runtime trace log for mediators
      • traceState

        protected int traceState
        State of tracing for this mediator
    • Constructor Detail

      • AbstractMediator

        protected AbstractMediator()
        A constructor that makes subclasses pick up the correct logger
    • Method Detail

      • divertMediationRoute

        public boolean divertMediationRoute​(MessageContext synCtx)
        This method is invoked when mediation happens in debug mode, branches execution to the Debug Manager, further behavior is governed by the Debug Manager.
        Returns:
        false if the mediation should be continued after this method call, true if mediation of current child mediator position should be skipped
      • getType

        public String getType()
        Returns the class name of the mediator
        Specified by:
        getType in interface Mediator
        Returns:
        the class name of the mediator
      • getTraceState

        public int getTraceState()
        Returns the tracing state
        Specified by:
        getTraceState in interface Mediator
        Returns:
        the tracing state for this mediator (see SynapseConstants)
      • setTraceState

        public void setTraceState​(int traceState)
        Set the tracing state variable
        Specified by:
        setTraceState in interface Mediator
        Parameters:
        traceState - the new tracing state for this mediator (see SynapseConstants)
      • setDescription

        public void setDescription​(String description)
        Set the description of the mediator
        Specified by:
        setDescription in interface SynapseArtifact
        Parameters:
        description - tobe set to the mediator
      • getDescription

        public String getDescription()
        Gives the description of the mediator
        Specified by:
        getDescription in interface SynapseArtifact
        Returns:
        description of the mediator
      • setShortDescription

        public void setShortDescription​(String shortDescription)
        Set the short description of the mediator
        Specified by:
        setShortDescription in interface Mediator
        Parameters:
        shortDescription - to be set to the mediator
      • getShortDescription

        public String getShortDescription()
        Gives the short description of the mediator
        Specified by:
        getShortDescription in interface Mediator
        Returns:
        short description of the mediator
      • setEffectiveTraceState

        public void setEffectiveTraceState​(MessageContext synCtx)
        This method is used to save previous tracing state and set next the tracing state for a child mediator
        Parameters:
        synCtx - current message
      • getLog

        protected SynapseLog getLog​(MessageContext synCtx)
        Get a SynapseLog instance appropriate for the given context.
        Parameters:
        synCtx - the current message context
        Returns:
        MediatorLog instance - an implementation of the SynapseLog
      • shouldTrace

        public boolean shouldTrace​(int parentTraceState)
        Should this mediator perform tracing? True if its explicitly asked to trace, or its parent has been asked to trace and it does not reject it
        Parameters:
        parentTraceState - parents trace state
        Returns:
        true if tracing should be performed
      • isTraceOn

        @Deprecated
        protected boolean isTraceOn​(MessageContext msgCtx)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Should this mediator perform tracing? True if its explicitly asked to trace, or its parent has been asked to trace and it does not reject it
        Parameters:
        msgCtx - the current message
        Returns:
        true if tracing should be performed
      • isTraceOrDebugOn

        @Deprecated
        protected boolean isTraceOrDebugOn​(boolean isTraceOn)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Is tracing or debug logging on?
        Parameters:
        isTraceOn - is tracing known to be on?
        Returns:
        true, if either tracing or debug logging is on
      • traceOrDebug

        @Deprecated
        protected void traceOrDebug​(boolean traceOn,
                                    String msg)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Perform Trace and Debug logging of a message @INFO (trace) and DEBUG (log)
        Parameters:
        traceOn - is runtime trace on for this message?
        msg - the message to log/trace
      • traceOrDebugWarn

        @Deprecated
        protected void traceOrDebugWarn​(boolean traceOn,
                                        String msg)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Perform Trace and Debug logging of a message @WARN
        Parameters:
        traceOn - is runtime trace on for this message?
        msg - the message to log/trace
      • auditLog

        @Deprecated
        protected void auditLog​(String msg,
                                MessageContext msgContext)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Perform an audit log message to all logs @ INFO. Writes to the general log, the service log and the trace log (of trace is on)
        Parameters:
        msg - the log message
        msgContext - the message context
      • handleException

        protected void handleException​(String msg,
                                       MessageContext msgContext)
        Perform an error log message to all logs @ ERROR. Writes to the general log, the service log and the trace log (of trace is on) and throws a SynapseException
        Parameters:
        msg - the log message
        msgContext - the message context
      • auditWarn

        @Deprecated
        protected void auditWarn​(String msg,
                                 MessageContext msgContext)
        Deprecated.
        This method will be removed in a future version of Synapse. Please use the SynapseLog instance returned by getLog(MessageContext) for all logging inside a mediator.
        Write an audit entry at WARN and trace and standard logs @WARN
        Parameters:
        msg - the message to log
        msgContext - message context
      • handleException

        protected void handleException​(String msg,
                                       Exception e,
                                       MessageContext msgContext)
        Perform an error log message to all logs @ ERROR. Writes to the general log, the service log and the trace log (of trace is on) and throws a SynapseException
        Parameters:
        msg - the log message
        e - an Exception encountered
        msgContext - the message context
      • isStatisticsEnable

        public boolean isStatisticsEnable()
      • disableStatistics

        public void disableStatistics()
      • enableStatistics

        public void enableStatistics()
      • isTracingEnabled

        public boolean isTracingEnabled()
      • disableTracing

        public void disableTracing()
      • enableTracing

        public void enableTracing()
      • configure

        public void configure​(AspectConfiguration aspectConfiguration)
        Configure aspects according to the given configuration
        Specified by:
        configure in interface AspectConfigurable
        Parameters:
        aspectConfiguration - AspectConfiguration instance
      • isContentAltering

        public boolean isContentAltering()
        Description copied from interface: Mediator
        This is used to indicate whether message payload get modified during mediation
        Specified by:
        isContentAltering in interface Mediator
        Returns:
        whether mediator modify the payload
      • getMediatorPosition

        public int getMediatorPosition()
        Description copied from interface: Mediator
        Get the position of the mediator in sequence flow.
        Specified by:
        getMediatorPosition in interface Mediator
        Returns:
        position of the mediator in sequence
      • setMediatorPosition

        public void setMediatorPosition​(int position)
        Description copied from interface: Mediator
        Set the position of the mediator in the sequence
        Specified by:
        setMediatorPosition in interface Mediator
        Parameters:
        position - position
      • getInputType

        public String getInputType()
      • getOutputType

        public String getOutputType()
      • getCommentsList

        public List<String> getCommentsList()
        Returns Comment List
        Returns:
        String List of comments
      • setCommentsList

        public void setCommentsList​(List<String> commentsList)
        Sets comment list for the mediator
        Parameters:
        commentsList - String List of comments
      • getMediatorName

        public String getMediatorName()
        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 interface Mediator
        Returns:
      • unregisterMediationFlowPoint

        public void unregisterMediationFlowPoint()
      • isBreakPoint

        public boolean isBreakPoint()
      • isSkipEnabled

        public boolean isSkipEnabled()
      • setBreakPoint

        public void setBreakPoint​(boolean isBreakPoint)
      • setSkipEnabled

        public void setSkipEnabled​(boolean isSkipEnabled)
      • shouldCaptureTracing

        protected boolean shouldCaptureTracing​(MessageContext synCtx)