Package org.apache.synapse.debug
Class SynapseDebugManager
- java.lang.Object
-
- org.apache.synapse.debug.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 Summary
Fields Modifier and Type Field Description static SemaphoremediationFlowSem
-
Constructor Summary
Constructors Modifier Constructor Description protectedSynapseDebugManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacquireMediationFlowLock()Acquiring hold on this lock make sure that only one mediation flow is due inside mediation enginevoidacquireMediationFlowPointProperties(String propertyOrProperties, String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments)voidaddMediationFlowPointProperty(String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments, boolean isActionSet)voidadvertiseCommandResponse(String commandResponse)voidadvertiseDebugEvent(String event)voidadvertiseMediationFlowBreakPoint(MessageContext synCtx, SynapseMediationFlowPoint breakPoint)advertise a mediation breakpoint to the communication channelvoidadvertiseMediationFlowSkip(MessageContext synCtx, SynapseMediationFlowPoint skipPoint)advertise a mediation skip to the communication channelvoidadvertiseMediationFlowStartPoint(MessageContext synCtx)Related to advertising the point where mediation flow starts.voidadvertiseMediationFlowTerminatePoint(MessageContext synCtx)related to advertising mediation flow terminating point to the communication channelorg.codehaus.jettison.json.JSONObjectcreateDebugCommandResponse(boolean isPositive, String failedReason)org.codehaus.jettison.json.JSONObjectcreateDebugEvent(String eventString)org.codehaus.jettison.json.JSONObjectcreateDebugMediationFlowPointHitEvent(boolean isBreakpoint, SynapseMediationFlowPoint point)org.codehaus.jettison.json.JSONObjectcreateDebugMediationFlowPointJSONForWireLogs(SynapseMediationFlowPoint point)This method is to generate json string which can be used to identify mediator position for wire logsvoiddebugResume()protected org.codehaus.jettison.json.JSONObjectgetAxis2Properties()static SynapseDebugManagergetInstance()voidinit(SynapseConfiguration synCfg, SynapseDebugInterface debugInterface, SynapseEnvironment synEnv, boolean startListenAsynchronously)Initializes the debug manager single instance.protected StringlogMediatorPosition(SynapseMediationFlowPoint flowPoint)voidprocessDebugCommand(String debug_line)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 protocolvoidregisterMediationFlowPoint(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 setvoidreleaseMediationFlowLock()Releasing hold on this lock make sure that next mediation flow is started after completion of the previousvoidsetMessageContext(MessageContext synCtx)voidshutdownDebugManager()Shutdown debug manager instance and close communication channels for event and command.protected StringtoString(int[] position)voidtransitMediationFlowStateToActive()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 calledvoidtransitMediationFlowStateToSuspended()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 calledvoidupdate(Observable o, Object arg)
-
-
-
Field Detail
-
mediationFlowSem
public static volatile Semaphore mediationFlowSem
-
-
Method Detail
-
getInstance
public static SynapseDebugManager getInstance()
-
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 configurationdebugInterface- reference to interface which environment communicatessynEnv- reference to environmentstartListenAsynchronously- 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 flowsynCtx- 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 flowsynCtx- message context
-
logMediatorPosition
protected String logMediatorPosition(SynapseMediationFlowPoint flowPoint)
-
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 templatemed_component_arguments- defines mediation componentisBreakpoint- either breakpoint or skipregisterMode- 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.JSONExceptionIOException
-
addMediationFlowPointProperty
public void addMediationFlowPointProperty(String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments, boolean isActionSet)
-
update
public void update(Observable o, Object arg)
-
-