Extension SDK 10.1.2

oracle.ide.runner
Class SimpleProcess

java.lang.Object
  extended byoracle.ide.runner.SimpleProcess
All Implemented Interfaces:
java.lang.Cloneable

public class SimpleProcess
extends java.lang.Object
implements java.lang.Cloneable

The SimpleProcess class contains methods to start a process and redirect the process's output to the log window.


Constructor Summary
SimpleProcess()
          Constructor.
SimpleProcess(SimpleProcess process)
          Copy constructor.
SimpleProcess(java.lang.String[] cmd)
          Creates an instance that can be used to start a subprocess.
 
Method Summary
 java.lang.Object clone()
          Creates a clone instance of the process configuration.
protected  java.lang.Object copyTo(java.lang.Object o)
           
 java.io.PipedInputStream duplicateErrorStream()
          Returns a PipedInputStream which duplicates the error (System.err) from the subprocess.
 java.io.PipedInputStream duplicateOutputStream()
          Returns a PipedInputStream which duplicates the output (System.out) from the subprocess.
 void exec()
          Executes a separate subprocess.
 int execAndWait()
          Executes a separate subprocess and waits for the subprocess to finish.
 java.lang.Exception getExecException()
          Gets the exception that occurred when starting the process.
 RunProcess getRunProcess()
          Gets the RunProcess instance used by this process configuration.
 void setAddToProcessesFolder(boolean addToProcessesFolder)
          Specifies whether to add the subprocess to the processes folder of the run manager.
 void setAddToTerminateMenu(boolean addToTerminateMenu)
          Specifies whether to list the subprocess in the Terminate submenu of the Run menu.
 void setAllowInput(boolean allowInput)
          Sets whether the subprocess will allow input, which will be read through some UI in the log window.
 void setCommand(java.lang.String[] cmd)
          Sets the command for the subprocess.
 void setCommandStringForLog(java.lang.String commandStringForLog)
          Specifies the command string that should be logged.
 void setEnvironmentParams(java.lang.String[] environmentParams)
          Sets the environment parameters for the subprocess.
 void setIcon(javax.swing.Icon icon)
          Sets the icon that will appear with the subprocess in the processes folder of the run manager.
 void setLabel(java.lang.String label)
          Sets the label that will appear with the subprocess in the processes folder of the run manager.
 void setLogCommandString(boolean logCommandString)
          Specifies whether to show the command string itself in the log window.
 void setLogPage(LogPage logPageOverride)
          Sets the log page where the subprocess's output will be displayed.
 void setLogStartDirectory(boolean logStartDirectory)
          Specifies whether to show the start directory in the log window.
 void setRunProcessListener(RunProcessListener runProcessListener)
          Specifies that a callback method should be called after the subprocess has finished executing and all of the subprocess's output has been sent to the log page.
 void setShowStartStatus(boolean showStartStatus)
          Specifies whether to show the start message in the status bar.
 void setUseLogPage(boolean useLogPage)
          Sets whether a log page will be used to print process information.
 void setWorkingDirectory(java.io.File dir)
          Sets the working directory for the subprocess.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleProcess

public SimpleProcess()
Constructor.


SimpleProcess

public SimpleProcess(SimpleProcess process)
Copy constructor.


SimpleProcess

public SimpleProcess(java.lang.String[] cmd)
Creates an instance that can be used to start a subprocess.

The subprocess inherits the working directory of the current process, unless overridden by the setWorkingDirectory(java.io.File) method.

The label that will appear with the subprocess in the processes folder of the run manager will be the zero-th argument of the command array passed to the exec() or execAndWait() method, unless overridden by the setLabel(java.lang.String) method.

The Swing default icon will appear with the subprocess in the processes folder of the run manager, unless overridden by the setIcon(javax.swing.Icon) method.

A new log page will be created to display the subprocess's output, unless overridden by the setLogPage(oracle.ide.log.LogPage) method.

The start directory will be logged, unless overridden by the setLogStartDirectory(boolean) method.

The command string itself will be logged, unless overridden by the setLogCommandString(boolean) method.

To adjust or manipulate the command string that is logged, use the setCommandStringForLog(java.lang.String) method.

A start message will be shown in the status bar, unless overridden by the setShowStartStatus(boolean) method.

The subprocess will be added to the processes folder of the run manager, unless overridden by the setAddToProcessesFolder(boolean) method.

The subprocess will be listed in the Terminate submenu of the Run menu, unless overridden by the setAddToTerminateMenu(boolean) method.

Parameters:
cmd - array containing the command to call and its arguments.
Method Detail

copyTo

protected java.lang.Object copyTo(java.lang.Object o)

getRunProcess

public RunProcess getRunProcess()
Gets the RunProcess instance used by this process configuration.

Returns:
the RunProcess.

setCommand

public void setCommand(java.lang.String[] cmd)
Sets the command for the subprocess.

Parameters:
cmd - the command array.

setEnvironmentParams

public void setEnvironmentParams(java.lang.String[] environmentParams)
Sets the environment parameters for the subprocess.

Parameters:
environmentParams - an array of strings, each element of which has environment variable settings in format name=value, or null if the subprocess should inherit the environment settings of the current process.

setUseLogPage

public void setUseLogPage(boolean useLogPage)
Sets whether a log page will be used to print process information.

Parameters:
useLogPage - if true, a log page will be used.

setAllowInput

public void setAllowInput(boolean allowInput)
Sets whether the subprocess will allow input, which will be read through some UI in the log window.

Parameters:
allowInput - if true, input will be read, otherwise, input will not be read. Default value is false.

setWorkingDirectory

public void setWorkingDirectory(java.io.File dir)
Sets the working directory for the subprocess.

Parameters:
dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.

setLabel

public void setLabel(java.lang.String label)
Sets the label that will appear with the subprocess in the processes folder of the run manager. The label will also appear on the log page, unless the log page is overridden using the setLogPage(oracle.ide.log.LogPage) method.

Parameters:
label - the label

setIcon

public void setIcon(javax.swing.Icon icon)
Sets the icon that will appear with the subprocess in the processes folder of the run manager. The icon will also appear on the tab of the log page, unless the log page is overridden using the setLogPage(oracle.ide.log.LogPage) method.

Parameters:
icon - the icon

setLogPage

public void setLogPage(LogPage logPageOverride)
Sets the log page where the subprocess's output will be displayed.


setLogStartDirectory

public void setLogStartDirectory(boolean logStartDirectory)
Specifies whether to show the start directory in the log window.


setLogCommandString

public void setLogCommandString(boolean logCommandString)
Specifies whether to show the command string itself in the log window.


setCommandStringForLog

public void setCommandStringForLog(java.lang.String commandStringForLog)
Specifies the command string that should be logged.


setShowStartStatus

public void setShowStartStatus(boolean showStartStatus)
Specifies whether to show the start message in the status bar.


setAddToProcessesFolder

public void setAddToProcessesFolder(boolean addToProcessesFolder)
Specifies whether to add the subprocess to the processes folder of the run manager.


setAddToTerminateMenu

public void setAddToTerminateMenu(boolean addToTerminateMenu)
Specifies whether to list the subprocess in the Terminate submenu of the Run menu.


setRunProcessListener

public void setRunProcessListener(RunProcessListener runProcessListener)
Specifies that a callback method should be called after the subprocess has finished executing and all of the subprocess's output has been sent to the log page.

Parameters:
runProcessListener - the run process listener

duplicateOutputStream

public java.io.PipedInputStream duplicateOutputStream()
Returns a PipedInputStream which duplicates the output (System.out) from the subprocess. This method will work only if it is called before the process is started. This method returns a PipedInputStream that will not be connected to a PipedOutputStream until the process is started. Attempting to read from the PipedInputStream before it has been connected will cause an IOException to be thrown.


duplicateErrorStream

public java.io.PipedInputStream duplicateErrorStream()
Returns a PipedInputStream which duplicates the error (System.err) from the subprocess. This method will work only if it is called before the process is started. This method returns a PipedInputStream that will not be connected to a PipedOutputStream until the process is started. Attempting to read from the PipedInputStream before it has been connected will cause an IOException to be thrown.


exec

public void exec()
Executes a separate subprocess.

The standard output and error output streams are redirected to a page in the log window.


execAndWait

public int execAndWait()
Executes a separate subprocess and waits for the subprocess to finish.

The standard output and error output streams are redirected to a page in the log window.

Returns:
the exit value of the subprocess. By convention, 0 indicates normal termination.

clone

public java.lang.Object clone()
Creates a clone instance of the process configuration.

Returns:
the clone instance.

getExecException

public java.lang.Exception getExecException()
Gets the exception that occurred when starting the process.

Returns:
the exception, or null if no exception was thrown.

Extension SDK

 

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