org.eclipse.datatools.sqltools.editor.core.result
Class ResultSupportRunnable

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.jobs.InternalJob
          extended by org.eclipse.core.runtime.jobs.Job
              extended by org.eclipse.datatools.sqltools.editor.core.result.ResultSupportRunnable
All Implemented Interfaces:
java.lang.Comparable, java.lang.Runnable, org.eclipse.core.runtime.IAdaptable
Direct Known Subclasses:
CallableSQLResultRunnable, SimpleSQLResultRunnable

public abstract class ResultSupportRunnable
extends org.eclipse.core.runtime.jobs.Job
implements java.lang.Runnable

This is an utility class, that intended to be used by other parts of the system that want to utilize the result view to display their run information. Child class should override certain methods of this class. TODO add extension point for this class

Author:
Yang Liu

Field Summary
 
Fields inherited from class org.eclipse.core.runtime.jobs.Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
 
Constructor Summary
ResultSupportRunnable(java.lang.String name, org.eclipse.core.runtime.IProgressMonitor parentMonitor, org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
           
 
Method Summary
 int getActionType()
          Gets the action type for OperationCommand.
abstract  org.eclipse.debug.core.ILaunchConfiguration getConfiguration()
           
 java.lang.String getConsumerName()
          Gets the consumer name for OperationCommand.
 org.eclipse.datatools.sqltools.core.DatabaseIdentifier getDatabaseIdentifier()
           
 OperationCommand getOperationCommand()
          Creates the OperationCommand object which will be used for results view display.
 int getOperationStatus()
           
 OperationCommand getParentOperationCommand()
          Returns the parent operation command
 void loopThroughResults(java.sql.Statement cstmt, boolean moreResult)
          loop through the results (update count and result set), push the results into the result instance.
 void run()
           
 void setActionType(int type)
          Sets the action type for OperationCommand.
 void setConsumerName(java.lang.String name)
          Sets the consumer name for OperationCommand.
 void setNeedsInitConnection(boolean needInit)
           
 void setParentOperCommand(OperationCommand operCommand)
           
 void terminateExecution()
          When the job is canceled from UI, synchorinize the statement status and the job status.
 
Methods inherited from class org.eclipse.core.runtime.jobs.Job
addJobChangeListener, belongsTo, cancel, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, wakeUp, wakeUp
 
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
compareTo, toString
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

ResultSupportRunnable

public ResultSupportRunnable(java.lang.String name,
                             org.eclipse.core.runtime.IProgressMonitor parentMonitor,
                             org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
Parameters:
name -
Method Detail

setNeedsInitConnection

public void setNeedsInitConnection(boolean needInit)

run

public void run()
Specified by:
run in interface java.lang.Runnable

getOperationCommand

public OperationCommand getOperationCommand()
Creates the OperationCommand object which will be used for results view display.


getParentOperationCommand

public OperationCommand getParentOperationCommand()
Returns the parent operation command

Returns:

loopThroughResults

public void loopThroughResults(java.sql.Statement cstmt,
                               boolean moreResult)
                        throws java.sql.SQLException
loop through the results (update count and result set), push the results into the result instance. Here attention should be paid to the statement status, because the status of statement is different after running normal sql command such as select operation and after running stored procedure.

Parameters:
cstmt -
moreResult -
Throws:
java.sql.SQLException

terminateExecution

public void terminateExecution()
When the job is canceled from UI, synchorinize the statement status and the job status.


getConfiguration

public abstract org.eclipse.debug.core.ILaunchConfiguration getConfiguration()

getDatabaseIdentifier

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

getOperationStatus

public int getOperationStatus()

setParentOperCommand

public void setParentOperCommand(OperationCommand operCommand)

getActionType

public int getActionType()
Gets the action type for OperationCommand. The default value is OperationCommand.ACTION_EXECUTE.


setActionType

public void setActionType(int type)
Sets the action type for OperationCommand. The default value is OperationCommand.ACTION_EXECUTE.

Parameters:
type -
See Also:
OperationCommand

getConsumerName

public java.lang.String getConsumerName()
Gets the consumer name for OperationCommand. The default value is "SQL Editor".


setConsumerName

public void setConsumerName(java.lang.String name)
Sets the consumer name for OperationCommand. The default value is "SQL Editor".

Parameters:
type -
See Also:
OperationCommand