Extension SDK 10.1.2

oracle.ide.runner
Class Starter

java.lang.Object
  extended byoracle.ide.runner.Starter
Direct Known Subclasses:
JStarter

public class Starter
extends java.lang.Object

A class that represents a way of starting a process.


Field Summary
protected  java.lang.Process process
          The Process that has been started.
protected  RunProcess runProcess
          The RunProcess that will be or has been started by this Starter.
protected  java.lang.Exception startException
          Exception thrown from Runtime exec.
 
Constructor Summary
protected Starter(RunProcess runProcess)
          The constructor simply sets the runProcess field.
 
Method Summary
 boolean canStart(java.util.List errors)
          Returns true if the process can be started.
 boolean canTerminate()
          Tests whether this Starter can terminate the process.
 boolean canTerminateGracefully()
          Tests whether this Starter can terminate the process gracefully.
 void finished()
          This method is called when the process has finished.
 java.lang.Integer getExitCode()
          Returns the exit code for the process.
 java.lang.Process getProcess()
          Returns the process that was started.
 java.lang.String[] getStartCommand()
          Returns the command line that will be executed to start the process.
 java.io.File getStartDirectory()
          Returns the working directory that will be used to start the process.
 java.lang.String[] getStartEnvironmentParams()
          Returns the environment parameters that will be used in starting the process.
 java.lang.Exception getStartException()
           
 boolean mustPrepareToStart()
          If the starter needs to do some work before starting and that work should not be done on the event thread, then the starter should override this method.
 boolean prepareToStart()
          If the starter needs to do some work before starting and that work should not be done on the event thread, then the starter should override this method.
 java.lang.Boolean reuseLogPage(RunLogPage runLogPage)
          This method gives the starter a chance to control the behavior of reusing a RunLogPage.
 boolean start()
          Starts the process.
 void terminate()
          Terminates the process.
 void terminateGracefully()
          Terminates the process gracefully.
 int waitForProcess()
          Waits for the process to finish and returns the exit code for the process.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

runProcess

protected RunProcess runProcess
The RunProcess that will be or has been started by this Starter.


process

protected java.lang.Process process
The Process that has been started.


startException

protected java.lang.Exception startException
Exception thrown from Runtime exec.

Constructor Detail

Starter

protected Starter(RunProcess runProcess)
The constructor simply sets the runProcess field.

Method Detail

getStartEnvironmentParams

public java.lang.String[] getStartEnvironmentParams()
Returns the environment parameters that will be used in starting the process.

The default behavior is to call the RunProcess.getStartEnvironmentParams() method.

Returns:
array of strings, each element of which has environment variable settings in format name=value.

getStartDirectory

public java.io.File getStartDirectory()
Returns the working directory that will be used to start the process.

The default behavior is to call the RunProcess.getStartDirectory() method.

Returns:
the start directory

getStartCommand

public java.lang.String[] getStartCommand()
Returns the command line that will be executed to start the process.

The default behavior is to call the RunProcess.getStartCommand() method.

Returns:
the command line

reuseLogPage

public java.lang.Boolean reuseLogPage(RunLogPage runLogPage)
This method gives the starter a chance to control the behavior of reusing a RunLogPage. This method is called when a RunProcess needs a run log page. It is called with each existing run log page, until a reusable page is found. If no existing run log page is reusable, then a new run log page will be created. The implementation here, returning null, will let the RunProcess decide whether it should reuse the page or not. Some subclasses of Starter may decide to override this method. They should return

Parameters:
runLogPage - the run log page being considered for reuse
Returns:
whether to reuse, not reuse, or don't care.

canStart

public boolean canStart(java.util.List errors)
Returns true if the process can be started. If the process can not be started, this method should add appropriate error messages to the errors parameter.

Parameters:
errors - a list of error messages
Returns:
true if the process can be started.

mustPrepareToStart

public boolean mustPrepareToStart()
If the starter needs to do some work before starting and that work should not be done on the event thread, then the starter should override this method.


prepareToStart

public boolean prepareToStart()
If the starter needs to do some work before starting and that work should not be done on the event thread, then the starter should override this method.


start

public boolean start()
Starts the process.

After the process is started, it calls the RunProcess.redirectOutput(java.io.InputStream, java.io.InputStream) method with the standard output and error streams and the RunProcess.redirectInput(java.io.OutputStream) method with the standard input stream.

Returns:
true if the process was started.

waitForProcess

public int waitForProcess()
Waits for the process to finish and returns the exit code for the process.

Returns:
the exit code for the process.

getExitCode

public java.lang.Integer getExitCode()
Returns the exit code for the process. If the process has not finished, this method will return null;

Returns:
the exit code

getProcess

public java.lang.Process getProcess()
Returns the process that was started. If the process has not been started, this method will return null;

Returns:
the process that was started

getStartException

public java.lang.Exception getStartException()
Returns:
the exception thrown from Runtime exec, if any.

canTerminateGracefully

public boolean canTerminateGracefully()
Tests whether this Starter can terminate the process gracefully.

Returns:
true if this Starter can terminate the process gracefully.

terminateGracefully

public void terminateGracefully()
Terminates the process gracefully.


canTerminate

public boolean canTerminate()
Tests whether this Starter can terminate the process.

Returns:
true if this Starter can terminate the process.

terminate

public void terminate()
Terminates the process.


finished

public void finished()
This method is called when the process has finished.


Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.