org.eclipse.datatools.sqltools.debugger.model
Class SPThread

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.datatools.sqltools.debugger.model.SPDebugElement
          extended by org.eclipse.datatools.sqltools.debugger.model.SPThread
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, IConnectionTracker, org.eclipse.debug.core.model.IDebugElement, org.eclipse.debug.core.model.IStep, org.eclipse.debug.core.model.ISuspendResume, org.eclipse.debug.core.model.ITerminate, org.eclipse.debug.core.model.IThread

public abstract class SPThread
extends SPDebugElement
implements org.eclipse.debug.core.model.IThread, IConnectionTracker

This is the super class for stored procedure thread. Different SQL server type may implement different SPThread.

Author:
Yang Liu

Field Summary
static org.eclipse.debug.core.model.IBreakpoint[] EMPTY_BREAKPOINTS
          A convenience field for methods to return empty breakpoints
 
Constructor Summary
SPThread(SPDebugTarget target, org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
           
 
Method Summary
 void breakpointHit()
          Called when an breakpoint is hit.
 boolean canDisconnect()
           
 boolean canResume()
           
 boolean canStepInto()
           
 boolean canStepOver()
           
 boolean canStepReturn()
           
 boolean canSuspend()
           
 void connectionAboutToBeClosed()
          Default implementation does nothing
 void connectionClosed()
          Called by event handler when connection is closed.
abstract  void disconnect()
           
 SPValue evaluateExpression(java.lang.String expression)
          Evaluates the given expression.
 org.eclipse.debug.core.model.IStackFrame getBottomStackFrame()
           
 org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()
           
abstract  java.sql.Connection getDebuggerConnection()
           
 org.eclipse.debug.core.model.IVariable[] getGlobalVariables()
          Gets global variables.
 int getPriority()
           
 org.eclipse.debug.core.model.IStackFrame[] getStackFrames()
           
 java.util.List getStackFramesAsList()
          Returns the stack frame list.
 org.eclipse.debug.core.model.IStackFrame getTopStackFrame()
           
 boolean hasStackFrames()
           
 void interrupted()
          Called when the connection is interrupted.
 boolean isStepping()
           
 boolean isSuspended()
           
 boolean isTerminated()
           
 void singleStepped()
          Called when the connection suspended because a step end.
 boolean supportEvaluateExpression()
          Returns whether supports evaluate expresion.
 boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)
           
 
Methods inherited from class org.eclipse.datatools.sqltools.debugger.model.SPDebugElement
fireChangeEvent, fireResumeEvent, fireSuspendEvent, getAdapter, getDebugTarget, getLaunch, getModelIdentifier, getSPDebugTarget, notSupported
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.debug.core.model.IThread
getBreakpoints, getName
 
Methods inherited from interface org.eclipse.debug.core.model.IDebugElement
getDebugTarget, getLaunch, getModelIdentifier
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 
Methods inherited from interface org.eclipse.debug.core.model.ISuspendResume
resume, suspend
 
Methods inherited from interface org.eclipse.debug.core.model.IStep
stepInto, stepOver, stepReturn
 
Methods inherited from interface org.eclipse.debug.core.model.ITerminate
canTerminate, terminate
 

Field Detail

EMPTY_BREAKPOINTS

public static final org.eclipse.debug.core.model.IBreakpoint[] EMPTY_BREAKPOINTS
A convenience field for methods to return empty breakpoints

Constructor Detail

SPThread

public SPThread(SPDebugTarget target,
                org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
Parameters:
target -
Method Detail

getDatabaseIdentifier

public org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()

getStackFramesAsList

public java.util.List getStackFramesAsList()
                                    throws org.eclipse.debug.core.DebugException
Returns the stack frame list. The caller should not change the returned list, it should be considered readonly. It is almost same as getStackFrames, just don't convert into array, so more efficient.

Returns:
Throws:
org.eclipse.debug.core.DebugException

getStackFrames

public org.eclipse.debug.core.model.IStackFrame[] getStackFrames()
                                                          throws org.eclipse.debug.core.DebugException
Specified by:
getStackFrames in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

hasStackFrames

public boolean hasStackFrames()
                       throws org.eclipse.debug.core.DebugException
Specified by:
hasStackFrames in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getPriority

public int getPriority()
                throws org.eclipse.debug.core.DebugException
Specified by:
getPriority in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getTopStackFrame

public org.eclipse.debug.core.model.IStackFrame getTopStackFrame()
                                                          throws org.eclipse.debug.core.DebugException
Specified by:
getTopStackFrame in interface org.eclipse.debug.core.model.IThread
Throws:
org.eclipse.debug.core.DebugException

getBottomStackFrame

public org.eclipse.debug.core.model.IStackFrame getBottomStackFrame()
                                                             throws org.eclipse.debug.core.DebugException
Throws:
org.eclipse.debug.core.DebugException

getGlobalVariables

public org.eclipse.debug.core.model.IVariable[] getGlobalVariables()
                                                            throws org.eclipse.debug.core.DebugException
Gets global variables. If is suspended, will return empty array.

Returns:
will never be null
Throws:
org.eclipse.debug.core.DebugException

supportsBreakpoint

public boolean supportsBreakpoint(org.eclipse.debug.core.model.IBreakpoint breakpoint)

canResume

public boolean canResume()
Specified by:
canResume in interface org.eclipse.debug.core.model.ISuspendResume

canSuspend

public boolean canSuspend()
Specified by:
canSuspend in interface org.eclipse.debug.core.model.ISuspendResume

isSuspended

public boolean isSuspended()
Specified by:
isSuspended in interface org.eclipse.debug.core.model.ISuspendResume

canStepInto

public boolean canStepInto()
Specified by:
canStepInto in interface org.eclipse.debug.core.model.IStep

canStepOver

public boolean canStepOver()
Specified by:
canStepOver in interface org.eclipse.debug.core.model.IStep

canStepReturn

public boolean canStepReturn()
Specified by:
canStepReturn in interface org.eclipse.debug.core.model.IStep

isStepping

public boolean isStepping()
Specified by:
isStepping in interface org.eclipse.debug.core.model.IStep

isTerminated

public boolean isTerminated()
Specified by:
isTerminated in interface org.eclipse.debug.core.model.ITerminate

canDisconnect

public boolean canDisconnect()

breakpointHit

public final void breakpointHit()
Called when an breakpoint is hit.


interrupted

public final void interrupted()
Called when the connection is interrupted.


singleStepped

public final void singleStepped()
Called when the connection suspended because a step end.


connectionClosed

public void connectionClosed()
Called by event handler when connection is closed. Or when the client thread noticed that the client connection is closed.

Specified by:
connectionClosed in interface IConnectionTracker

disconnect

public abstract void disconnect()
                         throws org.eclipse.debug.core.DebugException
Throws:
org.eclipse.debug.core.DebugException

supportEvaluateExpression

public boolean supportEvaluateExpression()
Returns whether supports evaluate expresion. Child classes can override this and implement evaluateExpression if expression evaluation is required.

Returns:
false by default

evaluateExpression

public SPValue evaluateExpression(java.lang.String expression)
                           throws org.eclipse.debug.core.DebugException
Evaluates the given expression. The default implementation throws DebugException

Parameters:
expression -
Returns:
Throws:
org.eclipse.debug.core.DebugException

getDebuggerConnection

public abstract java.sql.Connection getDebuggerConnection()

connectionAboutToBeClosed

public void connectionAboutToBeClosed()
Default implementation does nothing

Specified by:
connectionAboutToBeClosed in interface IConnectionTracker