Package adams.flow.execution
Class Debug
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<FlowExecutionListener>
,SizeOfHandler
,Stoppable
,FlowExecutionListener
,GraphicalFlowExecutionListener
,Serializable
,Comparable
public class Debug extends AbstractGraphicalFlowExecutionListener implements Stoppable
Allows the user to define breakpoints that suspend the execution of the flow, allowing the inspection of the current flow state.
Tokens can only inspected during 'preInput', 'preExecute' and 'postOutput' of Breakpoint control actors. Step-wise debugging stops in 'preExecute', which should be able to access the current token in case of input consumers (ie transformers and sinks).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-width <int> (property: width) The width of the dialog. default: 800 minimum: -1
-height <int> (property: height) The height of the dialog. default: 600 minimum: -1
-breakpoint <adams.flow.execution.debug.AbstractBreakpoint> [-breakpoint ...] (property: breakpoints) The breakpoints to use for suspending the flow execution. default:
-watch <adams.core.base.BaseString> [-watch ...] (property: watches) The expression to display initially in the watch dialog; the type of the watch needs to be specified as well. default:
-watch-type <VARIABLE|BOOLEAN|NUMERIC|STRING> [-watch-type ...] (property: watchTypes) The types of the watch expressions; determines how the expressions get evaluated and displayed. default:
-view <SOURCE|EXPRESSIONS|VARIABLES|STORAGE|INSPECT_TOKEN|BREAKPOINTS> [-view ...] (property: views) The views to display automatically when the breakpoint is reached. default:
-step-by-step <boolean> (property: stepByStep) Whether to start in step-by-step mode or wait for first breakpoint. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Blocked
whether the GUI currently blocks the flow execution.protected AbstractBreakpoint[]
m_Breakpoints
the breakpoints to use.protected ControlPanel
m_ControlPanel
control panel.protected Actor
m_Current
the current actor.protected int
m_Height
the height of the dialog.protected AbstractScopeRestriction
m_ScopeRestriction
the scope restriction to use.protected boolean
m_StepByStep
whether to start in auto-progress mode.protected boolean
m_Stopped
whether the flow got stopped.protected View[]
m_Views
the views to display automatically.protected BaseString[]
m_Watches
the watch expressions.protected ExpressionWatchPanel.ExpressionType[]
m_WatchTypes
the watch expression types.protected int
m_Width
the width of the dialog.static String
PREFIX_DEBUG
-
Fields inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
m_ListenerPanel
-
Fields inherited from class adams.flow.execution.AbstractFlowExecutionListener
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Debug()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
blockExecution()
Blocks the flow execution.String
breakpointsTipText()
Returns the tip text for this property.void
defineOptions()
Adds options to the internal list of options.protected boolean
displayControlPanelIfNecessary()
Instantiates/displays the control panel if necessary.AbstractBreakpoint[]
getBreakpoints()
Returns the breakpoints to use for suspending the flow execution.Dimension
getDefaultFrameSize()
Returns the default size for the frame.protected int
getDefaultHeight()
Returns the default height for the dialog.protected int
getDefaultWidth()
Returns the default width for the dialog.boolean
getDisposeOnFinish()
Returns whether the frame should get disposed when the flow finishes.int
getHeight()
Returns the currently set height of the dialog.String
getListenerTitle()
The title of this listener.AbstractScopeRestriction
getScopeRestriction()
Returns the restriction for the scope to use for suspending the flow execution.boolean
getStepByStep()
Returns whether to start in step-by-step mode or wait for first breakpoint.View[]
getViews()
Returns the views to display automatically.BaseString[]
getWatches()
Returns the watch expressions for the watch dialog.ExpressionWatchPanel.ExpressionType[]
getWatchTypes()
Returns the types of the watch expressions.int
getWidth()
Returns the currently set width of the dialog.String
globalInfo()
Returns a string describing the object.String
heightTipText()
Returns the tip text for this property.boolean
isBlocked()
Returns whether the flow execution is currently blocked.boolean
isStepMode()
Returns whether step mode is used.BasePanel
newListenerPanel()
Returns the panel to use.void
postExecute(Actor actor)
Gets called after the actor was executed.void
postInput(Actor actor)
Gets called after the actor received the token.void
postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.void
preExecute(Actor actor)
Gets called before the actor gets executed.void
preInput(Actor actor, Token token)
Gets called before the actor receives the token.void
preOutput(Actor actor)
Gets called before a token gets obtained from the actor.void
refreshGUI()
Refreshes the control panel.void
removeOneOffBreakpoints(AbstractBreakpoint toKeep)
Removes all one-off breakpoints apart from the specified one.String
scopeRestrictionTipText()
Returns the tip text for this property.void
setBreakpoints(AbstractBreakpoint[] value)
Sets the breakpoints to use for suspending the flow execution.void
setHeight(int value)
Sets the height of the dialog.void
setScopeRestriction(AbstractScopeRestriction value)
Sets the restriction for the scope to use for suspending the flow execution.void
setStepByStep(boolean value)
Sets whether to start in step-by-step mode or wait for first breakpoint.void
setStepMode(boolean value)
Sets whether step mode is used.void
setViews(View[] value)
Sets the views to display automatically.void
setWatches(BaseString[] value)
Sets the watch expressions for the watch dialog.void
setWatchTypes(ExpressionWatchPanel.ExpressionType[] value)
Sets the types of the watch expressions.void
setWidth(int value)
Sets the width of the dialog.void
startListening()
Gets called when the flow execution starts.String
stepByStepTipText()
Returns the tip text for this property.void
stopExecution()
Stops the execution.protected void
triggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage)
Suspends the flow execution.protected void
triggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage, Token token)
Suspends the flow execution.void
unblockExecution()
Unblocks the flow execution.protected void
updateGUI()
Closes the dialog.String
viewsTipText()
Returns the tip text for this property.String
watchesTipText()
Returns the tip text for this property.String
watchTypesTipText()
Returns the tip text for this property.String
widthTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.execution.AbstractGraphicalFlowExecutionListener
finishListening, newListenerPanelIfNecessary
-
Methods inherited from class adams.flow.execution.AbstractFlowExecutionListener
cleanUp, compareTo, equals, getListeners, getOwner, setOwner, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.flow.execution.FlowExecutionListener
getOwner, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
PREFIX_DEBUG
public static final String PREFIX_DEBUG
- See Also:
- Constant Field Values
-
m_Width
protected int m_Width
the width of the dialog.
-
m_Height
protected int m_Height
the height of the dialog.
-
m_Breakpoints
protected AbstractBreakpoint[] m_Breakpoints
the breakpoints to use.
-
m_ScopeRestriction
protected AbstractScopeRestriction m_ScopeRestriction
the scope restriction to use.
-
m_Views
protected View[] m_Views
the views to display automatically.
-
m_Watches
protected BaseString[] m_Watches
the watch expressions.
-
m_WatchTypes
protected ExpressionWatchPanel.ExpressionType[] m_WatchTypes
the watch expression types.
-
m_StepByStep
protected boolean m_StepByStep
whether to start in auto-progress mode.
-
m_ControlPanel
protected transient ControlPanel m_ControlPanel
control panel.
-
m_Blocked
protected boolean m_Blocked
whether the GUI currently blocks the flow execution.
-
m_Current
protected transient Actor m_Current
the current actor.
-
m_Stopped
protected boolean m_Stopped
whether the flow got stopped.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultWidth
protected int getDefaultWidth()
Returns the default width for the dialog.- Returns:
- the default width
-
setWidth
public void setWidth(int value)
Sets the width of the dialog.- Parameters:
value
- the width
-
getWidth
public int getWidth()
Returns the currently set width of the dialog.- Returns:
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultHeight
protected int getDefaultHeight()
Returns the default height for the dialog.- Returns:
- the default height
-
setHeight
public void setHeight(int value)
Sets the height of the dialog.- Parameters:
value
- the height
-
getHeight
public int getHeight()
Returns the currently set height of the dialog.- Returns:
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBreakpoints
public void setBreakpoints(AbstractBreakpoint[] value)
Sets the breakpoints to use for suspending the flow execution.- Parameters:
value
- the breakpoints
-
getBreakpoints
public AbstractBreakpoint[] getBreakpoints()
Returns the breakpoints to use for suspending the flow execution.- Returns:
- the breakpoints
-
breakpointsTipText
public String breakpointsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setScopeRestriction
public void setScopeRestriction(AbstractScopeRestriction value)
Sets the restriction for the scope to use for suspending the flow execution.- Parameters:
value
- the restriction
-
getScopeRestriction
public AbstractScopeRestriction getScopeRestriction()
Returns the restriction for the scope to use for suspending the flow execution.- Returns:
- the restriction
-
scopeRestrictionTipText
public String scopeRestrictionTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWatches
public void setWatches(BaseString[] value)
Sets the watch expressions for the watch dialog.- Parameters:
value
- the expressions
-
getWatches
public BaseString[] getWatches()
Returns the watch expressions for the watch dialog.- Returns:
- the expressions
-
watchesTipText
public String watchesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWatchTypes
public void setWatchTypes(ExpressionWatchPanel.ExpressionType[] value)
Sets the types of the watch expressions.- Parameters:
value
- the types
-
getWatchTypes
public ExpressionWatchPanel.ExpressionType[] getWatchTypes()
Returns the types of the watch expressions.- Returns:
- the types
-
watchTypesTipText
public String watchTypesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setViews
public void setViews(View[] value)
Sets the views to display automatically.- Parameters:
value
- the views
-
getViews
public View[] getViews()
Returns the views to display automatically.- Returns:
- the views
-
viewsTipText
public String viewsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setStepByStep
public void setStepByStep(boolean value)
Sets whether to start in step-by-step mode or wait for first breakpoint.- Parameters:
value
- true if to start in step-by-step mode
-
getStepByStep
public boolean getStepByStep()
Returns whether to start in step-by-step mode or wait for first breakpoint.- Returns:
- true if to start in step-by-step mode
-
stepByStepTipText
public String stepByStepTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setStepMode
public void setStepMode(boolean value)
Sets whether step mode is used.- Parameters:
value
- true if step mode
-
isStepMode
public boolean isStepMode()
Returns whether step mode is used.- Returns:
- true if step mode
-
getListenerTitle
public String getListenerTitle()
The title of this listener.- Specified by:
getListenerTitle
in interfaceGraphicalFlowExecutionListener
- Returns:
- the title
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListening
in interfaceFlowExecutionListener
- Overrides:
startListening
in classAbstractFlowExecutionListener
-
newListenerPanel
public BasePanel newListenerPanel()
Returns the panel to use.- Specified by:
newListenerPanel
in interfaceGraphicalFlowExecutionListener
- Specified by:
newListenerPanel
in classAbstractGraphicalFlowExecutionListener
- Returns:
- the panel, null if none available
-
getDefaultFrameSize
public Dimension getDefaultFrameSize()
Returns the default size for the frame.- Specified by:
getDefaultFrameSize
in interfaceGraphicalFlowExecutionListener
- Overrides:
getDefaultFrameSize
in classAbstractGraphicalFlowExecutionListener
- Returns:
- the frame size
-
getDisposeOnFinish
public boolean getDisposeOnFinish()
Returns whether the frame should get disposed when the flow finishes.- Specified by:
getDisposeOnFinish
in interfaceGraphicalFlowExecutionListener
- Overrides:
getDisposeOnFinish
in classAbstractGraphicalFlowExecutionListener
- Returns:
- true if to dispose when flow finishes
-
refreshGUI
public void refreshGUI()
Refreshes the control panel.
-
updateGUI
protected void updateGUI()
Closes the dialog.- Specified by:
updateGUI
in classAbstractGraphicalFlowExecutionListener
-
isBlocked
public boolean isBlocked()
Returns whether the flow execution is currently blocked.
-
blockExecution
public void blockExecution()
Blocks the flow execution.
-
removeOneOffBreakpoints
public void removeOneOffBreakpoints(AbstractBreakpoint toKeep)
Removes all one-off breakpoints apart from the specified one.- Parameters:
toKeep
- the breakpoint to keep
-
unblockExecution
public void unblockExecution()
Unblocks the flow execution.
-
displayControlPanelIfNecessary
protected boolean displayControlPanelIfNecessary()
Instantiates/displays the control panel if necessary.- Returns:
- true if either already present or successfully displayed
-
triggered
protected void triggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage)
Suspends the flow execution.- Parameters:
point
- the breakpoint that triggered the suspendactor
- the current actorstage
- the hook method (eg preInput)
-
triggered
protected void triggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage, Token token)
Suspends the flow execution.- Parameters:
point
- the breakpoint that triggered the suspendactor
- the current actorstage
- the hook method (eg preInput)token
- the current token
-
preInput
public void preInput(Actor actor, Token token)
Gets called before the actor receives the token.- Specified by:
preInput
in interfaceFlowExecutionListener
- Overrides:
preInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will receive the tokentoken
- the token that the actor will receive
-
postInput
public void postInput(Actor actor)
Gets called after the actor received the token.- Specified by:
postInput
in interfaceFlowExecutionListener
- Overrides:
postInput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that received the token
-
preExecute
public void preExecute(Actor actor)
Gets called before the actor gets executed.- Specified by:
preExecute
in interfaceFlowExecutionListener
- Overrides:
preExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that will get executed
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecute
in interfaceFlowExecutionListener
- Overrides:
postExecute
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that was executed
-
preOutput
public void preOutput(Actor actor)
Gets called before a token gets obtained from the actor.- Specified by:
preOutput
in interfaceFlowExecutionListener
- Overrides:
preOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor the token gets obtained from
-
postOutput
public void postOutput(Actor actor, Token token)
Gets called after a token was acquired from the actor.- Specified by:
postOutput
in interfaceFlowExecutionListener
- Overrides:
postOutput
in classAbstractFlowExecutionListener
- Parameters:
actor
- the actor that the token was acquired fromtoken
- the token that was acquired from the actor
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceStoppable
-
-