|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.ide.runner.RunProcess
public abstract class RunProcess
An abstract class that represents a process that can be run in some way.
Field Summary | |
---|---|
protected boolean |
addToProcessesFolder
Whether this process should be added to the Run Manager's process folder |
protected boolean |
addToTerminateMenu
Whether a terminate menu for this process should be add to the Run Terminate menu. |
protected boolean |
allowInput
Whether the user wants to allow input to be sent to the process. |
protected RunProcess |
container
The container of this RunProcess. |
protected Context |
context
The Context that is associated with this process. |
protected boolean |
determineTargetAndStarterAlready
Whether the target Node and Starter have already
been determined. |
protected java.util.List |
errors
The list of errors that occurred when trying to start the process. |
protected boolean |
hideTerminateAction
Whether the terminate action should be left out of the log page. |
protected javax.swing.Icon |
iconOverride
The icon to use instead of the normal icon. |
protected boolean |
isPreparingLabel
Used to avoid StackOverflowError from bad behaved runners/runnerfactories. |
protected java.lang.String |
labelOverride
The label to use instead of the normal label. |
protected java.lang.String |
labelPrefixOverride
The label prefix to use instead of the normal label. |
protected boolean |
logCommandString
Whether the command string should be logged. |
protected boolean |
logError
Whether standard error from the process should be logged. |
protected boolean |
logExit
Whether to log a message when the process exits. |
protected boolean |
logOutput
Whether standard output from the process should be logged. |
protected LogPage |
logPageOverride
The log page to be used instead of the normal log page. |
protected boolean |
logStartDirectory
Whether the start directory should be logged. |
static java.lang.String |
RUN_PROCESS_DO_NOT_CONSIDER_DEFAULT
|
static java.lang.String |
RUN_PROCESS_USE_NODE_FROM_CONTEXT
|
protected RunProcessListener |
runProcessListener
The RunProcessListener for this process. |
protected boolean |
showStartStatus
Whether to show a start status message in the status bar. |
protected Starter |
starter
The starter for this RunProcess. |
protected Node |
target
The target for this RunProcess. |
protected long |
timeCreated
The time this RunProcess was created. |
protected boolean |
useContainerLogPage
Whether this RunProcess uses its container's LogPage. |
protected boolean |
useLogPage
Whether a log page should be used to print process information. |
protected boolean |
userCanceled
|
Constructor Summary | |
---|---|
RunProcess(Context context)
The constructor simply initializes the fields of this RunProcess. |
Method Summary | |
---|---|
boolean |
canContainRunProcesses()
Checks whether this RunProcess can have contained RunProcess. |
boolean |
canGarbageCollect()
|
java.lang.String |
canGetStarterForTarget(Node node,
java.lang.Class starterFactorySubClass,
java.util.List errors)
Tests whether the given node is runnable. |
boolean |
canRun(java.lang.String runType,
java.lang.Object cookie,
Node node,
java.util.List errors)
canRun should be called by the StarterFactory's canStart method. |
boolean |
canStart()
Tests whether this process can be started. |
boolean |
canStopInChrome()
|
boolean |
canStopOnDebuggerStatement()
|
boolean |
canStopOnError()
|
boolean |
canStopOnException()
|
boolean |
canTerminate()
Tests whether this RunProcess can be terminated. |
boolean |
canTransferErrors()
|
protected boolean |
checkStarter(Starter starter,
java.util.List errors)
Returns whether the given starter can really be used to start a process. |
protected java.lang.Object |
copyTo(java.lang.Object o)
|
protected void |
determineTargetAndStarter()
Determines what should be the target and starter for this process. |
protected void |
determineTargetAndStarter(java.lang.Class starterFactorySubClass)
Determines what should be the target and starter for this process. |
void |
doGarbageCollection()
|
void |
doubleClicked()
This method is called when this process is double clicked in the run manager navigator. |
protected void |
doUI(java.lang.Runnable r)
Uses either SwingUtilities.invokeLater(java.lang.Runnable) or
SwingUtilities.invokeAndWait(java.lang.Runnable) to invoke the
Runnable . |
boolean |
doUILater()
Returns whether SwingUtilities.invokeLater(java.lang.Runnable) should be used to do
UI, instead of SwingUtilities.invokeAndWait(java.lang.Runnable) . |
java.io.PipedInputStream |
duplicateErrorStream()
Returns a PipedInputStream which duplicates the error (System.err) from this process. |
java.io.PipedInputStream |
duplicateOutputStream()
Returns a PipedInputStream which duplicates the output (System.out) from this process. |
void |
finished()
This method will be called by the Starter, when this process finishes. |
protected void |
fireFinished(RunProcessLifecycleEvent event)
|
protected void |
fireStarted(RunProcessLifecycleEvent event,
boolean userCanTerminate)
|
protected java.lang.String |
fixCommandStringForLog(java.lang.String[] command)
Returns a the command string for display purposes. |
Attributes |
getAttributes()
Returns a this Element 's Attributes . |
java.util.Iterator |
getChildren()
Gets the children of this RunProcess element. |
RunProcess |
getContainer()
Returns the container RunProcess of this RunProcess |
Context |
getContext()
Returns the Context that is associated with this RunProcess. |
static Node |
getContextNodeForRun(Context context)
Returns the Node for the given Context. |
java.lang.Object |
getData()
Gets the data object that implements this interface. |
HelpInfo |
getHelpInfo()
Returns the help info to be used when the user presses F1 in the log page for this run process. |
javax.swing.Icon |
getIcon()
Gets the Icon for this RunProcess element. |
LogPage |
getLogPage()
Returns the LogPage for this process. |
LogPage |
getLogPage(boolean create)
|
java.lang.String |
getLongLabel()
Gets a fully qualified label for display purpose. |
abstract java.lang.String |
getProcessLabelPrefix()
Returns the prefix that will be used in the short and long labels for this RunProcess. |
IdeLayout |
getProcessLayout()
Returns the layout that should be shown when this process is selected in the run manager navigator. |
Project |
getProject()
Returns the Project associated with the RunProcess. |
static Project |
getProject(Context context)
|
RunnableItem[] |
getRunnableItems()
|
protected RunnableItem[] |
getRunnableItemsForTarget(Node node,
java.lang.Class starterFactorySubClass)
|
java.lang.String |
getShortLabel()
Gets a short label for display purpose. |
java.lang.String |
getShortLabelWithPrefix()
Returns a short label containing the process label prefix, for display purposes. |
java.lang.String[] |
getStartCommand()
Returns the command line that will be executed to start the process. |
java.io.File |
getStartDirectory()
Returns the directory that should be used as the working directory of this process, or null if this process should inherit the working directory of the current process. |
java.lang.String[] |
getStartEnvironmentParams()
Returns the environment parameters that are defined for this process. |
Starter |
getStarter()
Returns the Starter that will be used to start this
process. |
Starter |
getStarter(boolean determineTargetAndStarter)
Returns the Starter that will be used to start this
process. |
protected java.lang.Class |
getStarterFactorySubClass()
|
protected Starter |
getStarterForTarget(Node node,
java.lang.Class starterFactorySubClass)
Tests whether the given node is runnable and returns the starter that can start the process. |
boolean |
getStopInChrome()
|
boolean |
getStopOnDebuggerStatement()
Whether the VM should stop on an debugger statement. |
boolean |
getStopOnError()
Whether the VM should stop on an error. |
boolean |
getStopOnException()
Whether the VM should stop on an execrption. |
static javax.swing.text.SimpleAttributeSet |
getSystemErrAttributeSet()
|
static javax.swing.text.SimpleAttributeSet |
getSystemOutAttributeSet()
|
Node |
getTarget()
Returns the target. |
Node |
getTarget(boolean determineTargetAndStarter)
Returns the target. |
java.lang.String[] |
getTerminateCommand()
Returns the command line that will be executed to terminate the process. |
long |
getTimeCreated()
Returns the time this RunProcess was created. |
java.lang.String |
getToolTipText()
Gets the tool tip for this RunProcess element |
boolean |
getTransferErrors()
Whether the VM should transfer errors to debugger. |
protected boolean |
getUseContainerLogPage()
Returns whether the log page of the parent process, if any, will be used to print process information. |
protected boolean |
getUseLogPage()
Returns whether a log page will be used to print process information. |
java.lang.Object |
getValue(java.lang.String runType,
java.lang.Object cookie,
java.lang.String key)
getValue should be called by a StarterFactory or Starter if it needs some value provided by the RunProcess subclass. |
Workspace |
getWorkspace()
Returns the Workspace associated with the RunProcess. |
boolean |
hasFinished()
Tests whether this process has finished. |
boolean |
inheritLogPage(RunProcess rp)
Inherit the logPage of a previous RunProcess unconditionally, except if the current RunProcess already has a logPage. |
protected boolean |
isStartOnly()
Checks whether the Starter wants to bypass the RunProcess mode (run, debug, profile) and just launch the Starter. |
void |
log(java.lang.Object msg)
Display the specified msg in the log window. |
void |
logCommandString(java.lang.String[] command)
If logCommandString is true , the command
string is displayed in the log window. |
void |
logStartDirectory()
If logStartDirectory is true , the start
directory is displayed in the log window. |
protected void |
logStartErrors()
|
protected LogPage |
makeLogPage(boolean create)
Creates the RunLogPage for this process. |
boolean |
mayHaveChildren()
Tests if this RunProcess element may contain children. |
protected boolean |
mustPrepareToStart()
Calls the Starter.mustPrepareToStart() method. |
protected boolean |
prepareToStart()
Calls the Starter.prepareToStart() method. |
void |
redirectInput(java.io.OutputStream input)
This method will be called by the Starter, if the Starter captured standard input for this process. |
void |
redirectOutput(java.io.InputStream systemOutStream,
java.io.InputStream systemErrStream)
This method will be called by the Starter, if the Starter captured standard output/error for this process. |
protected boolean |
reuseLogPage(RunLogPage runLogPage)
Returns true if the specified RunLogPage should be reused
for this RunProcess. |
void |
selected()
This method is called when this process is selected in the run manager navigator. |
void |
setContainer(RunProcess container)
|
void |
setHideTerminateAction(boolean hideTerminateAction)
Sets whether the terminate action is to be hidden from the log page. |
void |
setIconOverride(javax.swing.Icon iconOverride)
Explicitly sets the string to be shown as the display name of the running process in the run manager. |
void |
setLabelOverride(java.lang.String labelOverride)
Explicitly sets the string to be shown as the display name of the running process in the run manager. |
void |
setLabelPrefixOverride(java.lang.String labelPrefixOverride)
Explicitly sets the string to be shown as the display name of the running process in the run manager. |
void |
setLogError(boolean logError)
|
void |
setLogExit(boolean logExit)
Explicitly sets the logging of process exit behavior. |
void |
setLogOutput(boolean logOutput)
|
void |
setLogPageOverride(LogPage logPageOverride)
Explicitly sets the LogPage to be used for all logging. |
void |
setStopInChrome(boolean b)
|
void |
setStopOnDebuggerStatement(boolean b)
Whether the VM should stop on an debugger statement. |
void |
setStopOnError(boolean b)
Whether the VM should stop on an error. |
void |
setStopOnException(boolean b)
Whether the VM should stop on an execrption. |
void |
setTransferErrors(boolean b)
Whether the VM should transfer errors to debugger. |
void |
setUseContainerLogPage(boolean useContainerLogPage)
|
void |
setUseLogPage(boolean useLogPage)
|
boolean |
showStartStatus()
Returns whether a start message should be shown in the status bar. |
void |
start()
Causes this process to begin execution. |
void |
start(Node node,
AbstractStarterFactory abstractStarterFactory,
java.lang.Object cookie)
|
void |
started()
This method will be called by the start method, when this process has been started. |
protected boolean |
startTarget()
Determines the target Node and Starter for this
RunProcess and if successful, calls the Starter.start()
method. |
boolean |
suppressDirectoryDefault()
Returns whether the defaulting behavior to the context project directory is suppressed. |
void |
terminate()
Terminates this process. |
java.lang.String |
toString()
Returns the short label for this RunProcess. |
void |
unselected()
This method is called when this process is unselected in the run manager navigator. |
void |
waitForRedirectOutput()
This call waits until the threads that are redirecting output (System.out and System.err) have processed all output available so far. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String RUN_PROCESS_USE_NODE_FROM_CONTEXT
public static java.lang.String RUN_PROCESS_DO_NOT_CONSIDER_DEFAULT
protected long timeCreated
protected Context context
protected boolean logStartDirectory
protected boolean logCommandString
protected boolean logOutput
protected boolean allowInput
protected boolean logError
protected boolean logExit
protected boolean showStartStatus
protected boolean addToProcessesFolder
protected boolean addToTerminateMenu
protected boolean hideTerminateAction
protected boolean useLogPage
protected LogPage logPageOverride
protected RunProcessListener runProcessListener
RunProcessListener
for this process.
The runProcessListener can be null.
protected boolean userCanceled
protected java.util.List errors
Each StarterFactory
can add errors to the list.
If we are not able to start the process, the errors are displayed
in the log window.
If we are able to start the process, the errors are not displayed.
protected boolean determineTargetAndStarterAlready
Node
and Starter
have already
been determined.
protected java.lang.String labelOverride
protected java.lang.String labelPrefixOverride
protected javax.swing.Icon iconOverride
protected Node target
protected Starter starter
protected RunProcess container
protected boolean useContainerLogPage
protected boolean isPreparingLabel
Constructor Detail |
---|
public RunProcess(Context context)
context
- the context to be associated with this RunProcessMethod Detail |
---|
protected java.lang.Object copyTo(java.lang.Object o)
public final void setLogOutput(boolean logOutput)
public final void setLogError(boolean logError)
public java.io.PipedInputStream duplicateOutputStream()
public java.io.PipedInputStream duplicateErrorStream()
protected java.lang.Class getStarterFactorySubClass()
protected void determineTargetAndStarter()
Checks to see if the context Node is runnable.
public static Node getContextNodeForRun(Context context)
protected void determineTargetAndStarter(java.lang.Class starterFactorySubClass)
Checks to see if the context Node is runnable.
starterFactorySubClass
- the chosen StarterFactory
must extend this classprotected Starter getStarterForTarget(Node node, java.lang.Class starterFactorySubClass)
If any registered starters claim that they can start this process with the given node as the target, then this method returns the starter.
node
- the targetstarterFactorySubClass
- the chosen StarterFactory
must extend this class
Starter
if the node is runnable, null otherwisepublic RunnableItem[] getRunnableItems()
protected RunnableItem[] getRunnableItemsForTarget(Node node, java.lang.Class starterFactorySubClass)
public java.lang.String canGetStarterForTarget(Node node, java.lang.Class starterFactorySubClass, java.util.List errors)
If any registered starter factory claims that it can start this process with the given node as the target, then this method returns the name of that starter factory.
node
- the targetstarterFactorySubClass
- the chosen StarterFactory
must extend this class
¶m errors the list of errors showing why the node may not be runnable
protected boolean checkStarter(Starter starter, java.util.List errors)
public long getTimeCreated()
public Context getContext()
Context
that is associated with this RunProcess.
public Workspace getWorkspace()
Workspace
associated with the RunProcess.
public Project getProject()
Project
associated with the RunProcess.
public static Project getProject(Context context)
public boolean canRun(java.lang.String runType, java.lang.Object cookie, Node node, java.util.List errors)
RunProcess subclasses that can run the specified runType should override this method and return true.
RunProcess subclasses that can not run the specified runType should override this method and add an error message to the errors list before returning false.
public java.lang.Object getValue(java.lang.String runType, java.lang.Object cookie, java.lang.String key)
RunProcess subclasses that can provide necessary values should override this method.
For example, a Starter would need to get the debugging options from the debugger's RunProcess.
public final Node getTarget()
public final Node getTarget(boolean determineTargetAndStarter)
public final Starter getStarter()
Starter
that will be used to start this
process.
public final Starter getStarter(boolean determineTargetAndStarter)
Starter
that will be used to start this
process.
public boolean canStart()
true
if the process can be startedprotected boolean isStartOnly()
public boolean canContainRunProcesses()
public void start(Node node, AbstractStarterFactory abstractStarterFactory, java.lang.Object cookie)
public void start()
If the process can not be started, error messages will be logged.
protected boolean mustPrepareToStart()
Starter.mustPrepareToStart()
method.
This method is called on the event thread.
protected boolean prepareToStart()
Starter.prepareToStart()
method.
This method is called on a non-event thread.
protected boolean startTarget()
Node
and Starter
for this
RunProcess and if successful, calls the Starter.start()
method.
If the Starter
can not be determined, all errors in the
errors
list are displayed in the log window.
true
if the process was startedprotected void logStartErrors()
public void started()
If the start method was not used to start the process, then this method should be called when the process has been started.
This method adds the process to the processes folder in the run manager navigator and if this process can be terminated, it adds a terminate menu item to the Run Terminate submenu.
protected void fireStarted(RunProcessLifecycleEvent event, boolean userCanTerminate)
protected void fireFinished(RunProcessLifecycleEvent event)
public void redirectOutput(java.io.InputStream systemOutStream, java.io.InputStream systemErrStream)
This method will create two LogOutputThread threads to redirect System.out and System.err to the log page.
redirect
- the System.out and System.errpublic static javax.swing.text.SimpleAttributeSet getSystemOutAttributeSet()
public static javax.swing.text.SimpleAttributeSet getSystemErrAttributeSet()
public void redirectInput(java.io.OutputStream input)
input
- the standard inputpublic void waitForRedirectOutput()
If this method is called on the AWT event dispatching thread, it does nothing.
public java.lang.String[] getStartEnvironmentParams()
The default implementation returns null.
public java.io.File getStartDirectory()
The default implementation returns null.
public void logStartDirectory()
logStartDirectory
is true
, the start
directory is displayed in the log window.
public java.lang.String[] getStartCommand()
The default implementation returns null. Subclasses should
either override this method or ensure that the
Starter.getStartCommand()
method is
overridden.
public void logCommandString(java.lang.String[] command)
logCommandString
is true
, the command
string is displayed in the log window.
protected java.lang.String fixCommandStringForLog(java.lang.String[] command)
public boolean showStartStatus()
true
if the message should be shown.protected boolean getUseLogPage()
true
if a log page will be used.public void setUseLogPage(boolean useLogPage)
protected boolean getUseContainerLogPage()
true
if the parent log page will be used.public void setUseContainerLogPage(boolean useContainerLogPage)
public LogPage getLogPage()
Creates the LogPage if necessary.
public LogPage getLogPage(boolean create)
protected LogPage makeLogPage(boolean create)
RunLogPage
for this process.
protected boolean reuseLogPage(RunLogPage runLogPage)
RunLogPage
should be reused
for this RunProcess.
First, the Starter.reuseLogPage(oracle.ide.runner.RunLogPage)
is called,
in case the Starter wants to overide the default behavior.
The default behavior is to reuse the page if the previous process is not still alive, and the name, workspace, project, icon, tooltip, titleName, and helpInfo match.
public boolean inheritLogPage(RunProcess rp)
rp
- Previous logPage
public void log(java.lang.Object msg)
msg
in the log window.
msg
- the message to display.public boolean doUILater()
SwingUtilities.invokeLater(java.lang.Runnable)
should be used to do
UI, instead of SwingUtilities.invokeAndWait(java.lang.Runnable)
.
protected void doUI(java.lang.Runnable r)
SwingUtilities.invokeLater(java.lang.Runnable)
or
SwingUtilities.invokeAndWait(java.lang.Runnable)
to invoke the
Runnable
.
public boolean suppressDirectoryDefault()
public abstract java.lang.String getProcessLabelPrefix()
public IdeLayout getProcessLayout()
public void selected()
The implementation of this method should not change layouts. Changing layouts based on what process is selected in the run manager navigator should be accomplished by returning the appropriate layout from the getProcessLayout method.
public void doubleClicked()
public void unselected()
public java.lang.String[] getTerminateCommand()
The default implementation returns null. Subclasses should
either override this method or ensure that the
Starter.getTerminateCommand()
method is
overridden.
public boolean canTerminate()
true
if this RunProcess can be
terminated.public void terminate()
public boolean hasFinished()
true
if this process has finishedpublic void finished()
If the start method was not used to start the process, then this method should be called when the process finishes.
This method removes the process from the processes folder in the run manager navigator and removes the terminate menu, if a terminate menu item was added to the Run Terminate submenu for this process.
public void setHideTerminateAction(boolean hideTerminateAction)
public void setLogPageOverride(LogPage logPageOverride)
public void setLabelOverride(java.lang.String labelOverride)
public void setLabelPrefixOverride(java.lang.String labelPrefixOverride)
public void setIconOverride(javax.swing.Icon iconOverride)
public void setLogExit(boolean logExit)
public java.lang.String getShortLabelWithPrefix()
public RunProcess getContainer()
true
if the container log page will be used.public void setContainer(RunProcess container)
public java.lang.String getShortLabel()
getShortLabel
in interface Displayable
public java.lang.String getLongLabel()
getLongLabel
in interface Displayable
public java.lang.Object getData()
getData
in interface Element
public javax.swing.Icon getIcon()
getIcon
in interface Displayable
public java.lang.String getToolTipText()
The default implementation returns the long label.
getToolTipText
in interface Displayable
public boolean mayHaveChildren()
The implementation of this method returns false; a RunProcess may not have children.
mayHaveChildren
in interface Element
public java.util.Iterator getChildren()
The implementation of this method returns null; a RunProcess element may not have children.
getChildren
in interface Element
public Attributes getAttributes()
Element
's Attributes
. This class does not
define any attributes.
getAttributes
in interface Element
public HelpInfo getHelpInfo()
getHelpInfo
in interface Helpable
public java.lang.String toString()
toString
in interface Displayable
toString
in class java.lang.Object
Object.toString()
,
Displayable.getShortLabel()
public boolean canStopOnException()
public boolean canStopOnError()
public boolean canStopOnDebuggerStatement()
public boolean canTransferErrors()
public boolean getStopOnException()
public boolean getStopOnError()
public boolean getStopOnDebuggerStatement()
public boolean getTransferErrors()
public void setStopOnException(boolean b)
b
- true if should stop. Otherwise false.public void setStopOnError(boolean b)
b
- true if should stop. Otherwise false.public void setStopOnDebuggerStatement(boolean b)
b
- true if should stop. Otherwise false.public void setTransferErrors(boolean b)
b
- true if should transfer. Otherwise false.public boolean getStopInChrome()
public void doGarbageCollection()
public void setStopInChrome(boolean b)
public boolean canStopInChrome()
public boolean canGarbageCollect()
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1) E13403-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |