Class SynapseDebugManager

  • All Implemented Interfaces:
    Observer

    public class SynapseDebugManager
    extends Object
    implements Observer
    Main class that integrates mediation debugging capabilities to Synapse Engine, Debug Manager single instance is created to handle debugging centrally, by either persisting or retrieving debug related information in the mediator level. Relies on SynapseDebugInterface to communicate over TCP channels for commands and events.
    • Field Detail

      • mediationFlowSem

        public static volatile Semaphore mediationFlowSem
    • Constructor Detail

      • SynapseDebugManager

        protected SynapseDebugManager()
    • Method Detail

      • setMessageContext

        public void setMessageContext​(MessageContext synCtx)
      • init

        public void init​(SynapseConfiguration synCfg,
                         SynapseDebugInterface debugInterface,
                         SynapseEnvironment synEnv,
                         boolean startListenAsynchronously)
        Initializes the debug manager single instance.
        Parameters:
        synCfg - reference to Synapse configuration
        debugInterface - reference to interface which environment communicates
        synEnv - reference to environment
        startListenAsynchronously - start interacting with interface asynchronously
      • acquireMediationFlowLock

        public void acquireMediationFlowLock()
        Acquiring hold on this lock make sure that only one mediation flow is due inside mediation engine
      • releaseMediationFlowLock

        public void releaseMediationFlowLock()
        Releasing hold on this lock make sure that next mediation flow is started after completion of the previous
      • shutdownDebugManager

        public void shutdownDebugManager()
        Shutdown debug manager instance and close communication channels for event and command.
      • transitMediationFlowStateToSuspended

        public void transitMediationFlowStateToSuspended()
        Transit the mediation flow state to the SUSPENDED from previous UNKNOWN state Transiting to SUSPENDED state will put the calling thread to sleep as sem.down() is called
      • transitMediationFlowStateToActive

        public void transitMediationFlowStateToActive()
        Transit the mediation flow state to the ACTIVE from previous UNKNOWN state Transiting to ACTIVE state will put the calling thread awakes as sem.up() is called
      • advertiseMediationFlowStartPoint

        public void advertiseMediationFlowStartPoint​(MessageContext synCtx)
        Related to advertising the point where mediation flow starts.
        Parameters:
        synCtx - message context
      • advertiseMediationFlowTerminatePoint

        public void advertiseMediationFlowTerminatePoint​(MessageContext synCtx)
        related to advertising mediation flow terminating point to the communication channel
        Parameters:
        synCtx - message context
      • advertiseMediationFlowSkip

        public void advertiseMediationFlowSkip​(MessageContext synCtx,
                                               SynapseMediationFlowPoint skipPoint)
        advertise a mediation skip to the communication channel
        Parameters:
        skipPoint - describes a unique point in the mediation flow
        synCtx - message context
      • advertiseMediationFlowBreakPoint

        public void advertiseMediationFlowBreakPoint​(MessageContext synCtx,
                                                     SynapseMediationFlowPoint breakPoint)
        advertise a mediation breakpoint to the communication channel
        Parameters:
        breakPoint - describes a unique point in the mediation flow
        synCtx - message context
      • processDebugCommand

        public void processDebugCommand​(String debug_line)
                                 throws IOException
        handles main command processing in using line of string received from the command channel registering/un registering breakpoints and skips as well as mediation level data acquire or set strings are expected to be JSON over defined protocol
        Parameters:
        debug_line - string in JSON format which is communicated via command channel
        Throws:
        IOException
      • registerMediationFlowPoint

        public void registerMediationFlowPoint​(String mediation_component,
                                               org.codehaus.jettison.json.JSONObject med_component_arguments,
                                               boolean isBreakpoint,
                                               boolean registerMode)
        handles registering/un registering breakpoints and skips as well as mediation level data acquire or set
        Parameters:
        mediation_component - sequence connector or either template
        med_component_arguments - defines mediation component
        isBreakpoint - either breakpoint or skip
        registerMode - either register or un register
      • advertiseCommandResponse

        public void advertiseCommandResponse​(String commandResponse)
      • advertiseDebugEvent

        public void advertiseDebugEvent​(String event)
      • debugResume

        public void debugResume()
      • createDebugCommandResponse

        public org.codehaus.jettison.json.JSONObject createDebugCommandResponse​(boolean isPositive,
                                                                                String failedReason)
      • createDebugMediationFlowPointHitEvent

        public org.codehaus.jettison.json.JSONObject createDebugMediationFlowPointHitEvent​(boolean isBreakpoint,
                                                                                           SynapseMediationFlowPoint point)
      • createDebugMediationFlowPointJSONForWireLogs

        public org.codehaus.jettison.json.JSONObject createDebugMediationFlowPointJSONForWireLogs​(SynapseMediationFlowPoint point)
        This method is to generate json string which can be used to identify mediator position for wire logs
        Parameters:
        point -
        Returns:
      • createDebugEvent

        public org.codehaus.jettison.json.JSONObject createDebugEvent​(String eventString)
      • toString

        protected String toString​(int[] position)
      • acquireMediationFlowPointProperties

        public void acquireMediationFlowPointProperties​(String propertyOrProperties,
                                                        String propertyContext,
                                                        org.codehaus.jettison.json.JSONObject property_arguments)
                                                 throws IOException
        Throws:
        IOException
      • getAxis2Properties

        protected org.codehaus.jettison.json.JSONObject getAxis2Properties()
                                                                    throws org.codehaus.jettison.json.JSONException,
                                                                           IOException
        Throws:
        org.codehaus.jettison.json.JSONException
        IOException
      • addMediationFlowPointProperty

        public void addMediationFlowPointProperty​(String propertyContext,
                                                  org.codehaus.jettison.json.JSONObject property_arguments,
                                                  boolean isActionSet)