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 booleanm_Blockedwhether the GUI currently blocks the flow execution.protected AbstractBreakpoint[]m_Breakpointsthe breakpoints to use.protected ControlPanelm_ControlPanelcontrol panel.protected Actorm_Currentthe current actor.protected intm_Heightthe height of the dialog.protected AbstractScopeRestrictionm_ScopeRestrictionthe scope restriction to use.protected booleanm_StepByStepwhether to start in auto-progress mode.protected booleanm_Stoppedwhether the flow got stopped.protected View[]m_Viewsthe views to display automatically.protected BaseString[]m_Watchesthe watch expressions.protected ExpressionWatchPanel.ExpressionType[]m_WatchTypesthe watch expression types.protected intm_Widththe width of the dialog.static StringPREFIX_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 voidblockExecution()Blocks the flow execution.StringbreakpointsTipText()Returns the tip text for this property.protected voidbringToFront()Attempts to bring the flow editor to the front.voiddefineOptions()Adds options to the internal list of options.protected booleandisplayControlPanelIfNecessary()Instantiates/displays the control panel if necessary.AbstractBreakpoint[]getBreakpoints()Returns the breakpoints to use for suspending the flow execution.DimensiongetDefaultFrameSize()Returns the default size for the frame.protected intgetDefaultHeight()Returns the default height for the dialog.protected intgetDefaultWidth()Returns the default width for the dialog.booleangetDisposeOnFinish()Returns whether the frame should get disposed when the flow finishes.intgetHeight()Returns the currently set height of the dialog.StringgetListenerTitle()The title of this listener.AbstractScopeRestrictiongetScopeRestriction()Returns the restriction for the scope to use for suspending the flow execution.booleangetStepByStep()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.intgetWidth()Returns the currently set width of the dialog.StringglobalInfo()Returns a string describing the object.StringheightTipText()Returns the tip text for this property.booleanisBlocked()Returns whether the flow execution is currently blocked.booleanisStepMode()Returns whether step mode is used.BasePanelnewListenerPanel()Returns the panel to use.voidpostExecute(Actor actor)Gets called after the actor was executed.voidpostInput(Actor actor)Gets called after the actor received the token.voidpostOutput(Actor actor, Token token)Gets called after a token was acquired from the actor.voidpreExecute(Actor actor)Gets called before the actor gets executed.voidpreInput(Actor actor, Token token)Gets called before the actor receives the token.voidpreOutput(Actor actor)Gets called before a token gets obtained from the actor.voidrefreshGUI()Refreshes the control panel.voidremoveOneOffBreakpoints(AbstractBreakpoint toKeep)Removes all one-off breakpoints apart from the specified one.StringscopeRestrictionTipText()Returns the tip text for this property.voidsetBreakpoints(AbstractBreakpoint[] value)Sets the breakpoints to use for suspending the flow execution.voidsetHeight(int value)Sets the height of the dialog.voidsetScopeRestriction(AbstractScopeRestriction value)Sets the restriction for the scope to use for suspending the flow execution.voidsetStepByStep(boolean value)Sets whether to start in step-by-step mode or wait for first breakpoint.voidsetStepMode(boolean value)Sets whether step mode is used.voidsetViews(View[] value)Sets the views to display automatically.voidsetWatches(BaseString[] value)Sets the watch expressions for the watch dialog.voidsetWatchTypes(ExpressionWatchPanel.ExpressionType[] value)Sets the types of the watch expressions.voidsetWidth(int value)Sets the width of the dialog.voidstartListening()Gets called when the flow execution starts.StringstepByStepTipText()Returns the tip text for this property.voidstopExecution()Stops the execution.protected voidtriggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage)Suspends the flow execution.protected voidtriggered(AbstractBreakpoint point, Actor actor, ExecutionStage stage, Token token)Suspends the flow execution.voidunblockExecution()Unblocks the flow execution.protected voidupdateGUI()Closes the dialog.StringviewsTipText()Returns the tip text for this property.StringwatchesTipText()Returns the tip text for this property.StringwatchTypesTipText()Returns the tip text for this property.StringwidthTipText()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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getListenerTitlein interfaceGraphicalFlowExecutionListener- Returns:
- the title
-
startListening
public void startListening()
Gets called when the flow execution starts.- Specified by:
startListeningin interfaceFlowExecutionListener- Overrides:
startListeningin classAbstractFlowExecutionListener
-
newListenerPanel
public BasePanel newListenerPanel()
Returns the panel to use.- Specified by:
newListenerPanelin interfaceGraphicalFlowExecutionListener- Specified by:
newListenerPanelin classAbstractGraphicalFlowExecutionListener- Returns:
- the panel, null if none available
-
getDefaultFrameSize
public Dimension getDefaultFrameSize()
Returns the default size for the frame.- Specified by:
getDefaultFrameSizein interfaceGraphicalFlowExecutionListener- Overrides:
getDefaultFrameSizein classAbstractGraphicalFlowExecutionListener- Returns:
- the frame size
-
getDisposeOnFinish
public boolean getDisposeOnFinish()
Returns whether the frame should get disposed when the flow finishes.- Specified by:
getDisposeOnFinishin interfaceGraphicalFlowExecutionListener- Overrides:
getDisposeOnFinishin 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:
updateGUIin 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
-
bringToFront
protected void bringToFront()
Attempts to bring the flow editor to the front.
-
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:
preInputin interfaceFlowExecutionListener- Overrides:
preInputin 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:
postInputin interfaceFlowExecutionListener- Overrides:
postInputin classAbstractFlowExecutionListener- Parameters:
actor- the actor that received the token
-
preExecute
public void preExecute(Actor actor)
Gets called before the actor gets executed.- Specified by:
preExecutein interfaceFlowExecutionListener- Overrides:
preExecutein classAbstractFlowExecutionListener- Parameters:
actor- the actor that will get executed
-
postExecute
public void postExecute(Actor actor)
Gets called after the actor was executed.- Specified by:
postExecutein interfaceFlowExecutionListener- Overrides:
postExecutein 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:
preOutputin interfaceFlowExecutionListener- Overrides:
preOutputin 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:
postOutputin interfaceFlowExecutionListener- Overrides:
postOutputin 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:
stopExecutionin interfaceStoppable
-
-