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 Semaphore
mediationFlowSem
-
Constructor Summary
Constructors Modifier Constructor Description protected
SynapseDebugManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
acquireMediationFlowLock()
Acquiring hold on this lock make sure that only one mediation flow is due inside mediation enginevoid
acquireMediationFlowPointProperties(String propertyOrProperties, String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments)
void
addMediationFlowPointProperty(String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments, boolean isActionSet)
void
advertiseCommandResponse(String commandResponse)
void
advertiseDebugEvent(String event)
void
advertiseMediationFlowBreakPoint(MessageContext synCtx, SynapseMediationFlowPoint breakPoint)
advertise a mediation breakpoint to the communication channelvoid
advertiseMediationFlowSkip(MessageContext synCtx, SynapseMediationFlowPoint skipPoint)
advertise a mediation skip to the communication channelvoid
advertiseMediationFlowStartPoint(MessageContext synCtx)
Related to advertising the point where mediation flow starts.void
advertiseMediationFlowTerminatePoint(MessageContext synCtx)
related to advertising mediation flow terminating point to the communication channelorg.codehaus.jettison.json.JSONObject
createDebugCommandResponse(boolean isPositive, String failedReason)
org.codehaus.jettison.json.JSONObject
createDebugEvent(String eventString)
org.codehaus.jettison.json.JSONObject
createDebugMediationFlowPointHitEvent(boolean isBreakpoint, SynapseMediationFlowPoint point)
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 logsvoid
debugResume()
protected org.codehaus.jettison.json.JSONObject
getAxis2Properties()
static SynapseDebugManager
getInstance()
void
init(SynapseConfiguration synCfg, SynapseDebugInterface debugInterface, SynapseEnvironment synEnv, boolean startListenAsynchronously)
Initializes the debug manager single instance.protected String
logMediatorPosition(SynapseMediationFlowPoint flowPoint)
void
processDebugCommand(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 protocolvoid
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 setvoid
releaseMediationFlowLock()
Releasing hold on this lock make sure that next mediation flow is started after completion of the previousvoid
setMessageContext(MessageContext synCtx)
void
shutdownDebugManager()
Shutdown debug manager instance and close communication channels for event and command.protected String
toString(int[] position)
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 calledvoid
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 calledvoid
update(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.JSONException
IOException
-
addMediationFlowPointProperty
public void addMediationFlowPointProperty(String propertyContext, org.codehaus.jettison.json.JSONObject property_arguments, boolean isActionSet)
-
update
public void update(Observable o, Object arg)
-
-