Extension SDK

oracle.jdeveloper.runner
Class JRunProcess

java.lang.Object
  extended byoracle.ide.runner.RunProcess
      extended byoracle.jdeveloper.runner.JRunProcess
All Implemented Interfaces:
Data, Displayable, Element, Helpable

public abstract class JRunProcess
extends RunProcess

An abstract class that represents a Java process.


Field Summary
protected  boolean considerDefaultRunTarget
          Whether to consider the default run target when determining the target Node.
protected  RunConfiguration runConfiguration
          The RunConfiguration part of the project.
protected  long timeAfterCompile
          The time after compile finished.
 
Fields inherited from class oracle.ide.runner.RunProcess
addToProcessesFolder, addToTerminateMenu, allowInput, context, determineTargetAndStarterAlready, errors, labelOverride, logCommandString, logError, logExit, logOutput, runProcessListener, showStartStatus, starter, target, timeCreated
 
Constructor Summary
JRunProcess()
          Calls JRunProcess(Context) with a null Context.
JRunProcess(Context context)
          This constructor initializes fields, including runConfiguration.
 
Method Summary
abstract  boolean canRunInDatabase(Node node, Database db, java.util.List errors)
          This method should return true if the JRunProcess subclass supports running in a database.
abstract  boolean canRunJava(Node node, java.util.List errors)
          This method should return true if the JRunProcess subclass supports running Java commands.
protected  boolean checkStarter(Starter starter, java.util.List errors)
          Returns whether the given starter can really be used to start a process.
protected  boolean compile()
          Compiles the project (if appropriate).
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.
 java.lang.String getBootClassPath()
          This method should be overriden by a JRunProcess subclass if it needs to add items to the boot class path.
 java.lang.String getClassPath()
          This method should be overriden by a JRunProcess subclass if it needs to add items to the class path.
protected  java.lang.Object getConfigDataByName(java.lang.String dataKey)
          Returns a configuration from the project.
 java.lang.String[][] getDatabaseCommands()
          If the JRunProcess subclass supports running in a database, this method should return any database commands which should be issued before the database procedure is invoked.
 java.lang.String[] getFirstJavaCommandOptions()
          Returns the Java command options that are needed before other Java command options.
protected  JDK getJdkDefinition()
          Returns the JDK for the project.
 JProject getJProject()
          Returns the current JProject associated with the JRunProcess.
 java.lang.String[] getLastJavaCommandOptions()
          Returns the Java command options that are needed after other Java command options.
 RunConfiguration getRunConfiguration()
          Returns the current RunConfiguration associated with the JRunProcess.
 java.io.File getStartDirectory()
          Returns the directory that should be used as the working directory for the process.
 long getTimeAfterCompile()
          Returns the time after compile finished.
 void handleDatabaseError(java.lang.String[][] databaseCommands, int i, int j, int errorCode)
          If there was an errorcode returned while executing any of the database commands, this method will be called to handle the error.
 boolean isPlainRun()
          Returns true if this is a plain run.
 boolean isSameType(JRunProcess other)
          Returns true if this is the same type of run as the other JRunProcess.
 void start()
          Creates a new thread to compile the project.
protected  boolean startTarget()
          Clears the log page associated with this run process (if appropriate).
 boolean useDatabaseCall()
          This method should be overriden by a JRunProcess subclass if it cares about how the database command is executed.
 boolean waitForDatabase()
          This method should be overriden by a JRunProcess subclass if it needs to do something before the database procedure is invoked.
 
Methods inherited from class oracle.ide.runner.RunProcess
canGetStarterForTarget, canStart, canTerminate, doubleClicked, doUI, doUILater, finished, fixCommandStringForLog, getAttributes, getChildren, getContext, getContextDocumentForRun, getData, getHelpInfo, getIcon, getLogPage, getLongLabel, getProcessLabelPrefix, getProcessLayout, getProject, getShortLabel, getShortLabelWithPrefix, getStartCommand, getStarter, getStarterForTarget, getTarget, getTimeCreated, getToolTipText, getWorkspace, hasFinished, log, logCommandString, makeLogPage, mayHaveChildren, mustPrepareToStart, prepareToStart, redirectInput, redirectOutput, reuseLogPage, selected, setLabelOverride, showStartStatus, started, terminate, toString, unselected, waitForRedirectOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

considerDefaultRunTarget

protected boolean considerDefaultRunTarget
Whether to consider the default run target when determining the target Node. Usually this is true.


runConfiguration

protected RunConfiguration runConfiguration
The RunConfiguration part of the project.


timeAfterCompile

protected long timeAfterCompile
The time after compile finished.

Constructor Detail

JRunProcess

public JRunProcess()
Calls JRunProcess(Context) with a null Context.


JRunProcess

public JRunProcess(Context context)
This constructor initializes fields, including runConfiguration.

If the context is not null, then only the Document of the Context will be used as the target Node. The default run target in the RunConfiguration will not be used as the target.

Parameters:
context - the context for starting the process
Method Detail

getJProject

public JProject getJProject()
Returns the current JProject associated with the JRunProcess.


getRunConfiguration

public RunConfiguration getRunConfiguration()
Returns the current RunConfiguration associated with the JRunProcess.


getTimeAfterCompile

public long getTimeAfterCompile()
Returns the time after compile finished.


determineTargetAndStarter

protected void determineTargetAndStarter()
Determines what should be the target and starter for this process.

Checks to see if the target is runnable.

Overrides:
determineTargetAndStarter in class RunProcess

determineTargetAndStarter

protected void determineTargetAndStarter(java.lang.Class starterFactorySubClass)
Determines what should be the target and starter for this process. First, if appropriate, the super class checks to see if the context document is runnable.
If that fails, we look at the project's default run target.

Overrides:
determineTargetAndStarter in class RunProcess
Parameters:
starterFactorySubClass - the chosen StarterFactory must extend this class
Returns:
the true if the target and starter were determined.

checkStarter

protected boolean checkStarter(Starter starter,
                               java.util.List errors)
Returns whether the given starter can really be used to start a process. Checks that the starter is an instance of JStarter.

Overrides:
checkStarter in class RunProcess

getStartDirectory

public java.io.File getStartDirectory()
Returns the directory that should be used as the working directory for the process.

Overrides:
getStartDirectory in class RunProcess
Returns:
the working directory

start

public final void start()
Creates a new thread to compile the project. When the compile is finished, SwingUtilities.invokeLater(java.lang.Runnable) is used to call the super.start method.

Overrides:
start in class RunProcess

compile

protected boolean compile()
Compiles the project (if appropriate).

This method is called on a non-event thread.

Returns:
true if there are no compiler errors

startTarget

protected boolean startTarget()
Clears the log page associated with this run process (if appropriate).

Calls the super.startTarget method.

Overrides:
startTarget in class RunProcess
Returns:
true if the process was started

canRunInDatabase

public abstract boolean canRunInDatabase(Node node,
                                         Database db,
                                         java.util.List errors)
This method should return true if the JRunProcess subclass supports running in a database.

Examples: The runner supports running in a database. The debugger supports debugging in some databases. The profiler and code coach do not support running in any database.

If the JRunProcess subclass does not support running in a database, a message should be added to the errors list.

Parameters:
node - the target node for this JRunProcess
db - the database
errors - the list of errors

getDatabaseCommands

public java.lang.String[][] getDatabaseCommands()
If the JRunProcess subclass supports running in a database, this method should return any database commands which should be issued before the database procedure is invoked. Examples: The debugger returns a command which causes the database to connect to the debugger at a specific host/port.


handleDatabaseError

public void handleDatabaseError(java.lang.String[][] databaseCommands,
                                int i,
                                int j,
                                int errorCode)
If there was an errorcode returned while executing any of the database commands, this method will be called to handle the error. Examples: The debugger logs a special error message for insufficient privileges.

Parameters:
databaseCommands - the database commands being executed
i - the first index into databaseCommands
j - the second index into databaseCommands
errorCode - the errorcode return while executing the command

waitForDatabase

public boolean waitForDatabase()
This method should be overriden by a JRunProcess subclass if it needs to do something before the database procedure is invoked. If, for some reason, the database procedure should not be invoked, this method should return false.


useDatabaseCall

public boolean useDatabaseCall()
This method should be overriden by a JRunProcess subclass if it cares about how the database command is executed. For example, for DBMS_DEBUG debugging, we must use a begin end structure, not a call.


canRunJava

public abstract boolean canRunJava(Node node,
                                   java.util.List errors)
This method should return true if the JRunProcess subclass supports running Java commands. Examples: The runner, debugger, profiler, and code coach all support running Java commands.

Parameters:
node - the target node for this JRunProcess
errors - the list of errors

getFirstJavaCommandOptions

public java.lang.String[] getFirstJavaCommandOptions()
Returns the Java command options that are needed before other Java command options.

The JStarter that executes the Java process using the Runtime.exec method, will call this method when building the command line.

For example, if this method returns "-XXdebug", then the Starter would insert that in the Java command line it was to execute.

Returns:
the Java command options

getClassPath

public java.lang.String getClassPath()
This method should be overriden by a JRunProcess subclass if it needs to add items to the class path.


getBootClassPath

public java.lang.String getBootClassPath()
This method should be overriden by a JRunProcess subclass if it needs to add items to the boot class path.


getLastJavaCommandOptions

public java.lang.String[] getLastJavaCommandOptions()
Returns the Java command options that are needed after other Java command options.

The JStarter that executes the Java process using the Runtime.exec method, will call this method when building the command line.

Returns:
the Java command options

getConfigDataByName

protected java.lang.Object getConfigDataByName(java.lang.String dataKey)
Returns a configuration from the project.

For example getConfigDataByName(RunConfiguration.DATA_KEY) returns the RunConfiguration.

Parameters:
dataKey - the configuration key

getJdkDefinition

protected JDK getJdkDefinition()
Returns the JDK for the project.


isPlainRun

public boolean isPlainRun()
Returns true if this is a plain run. A run is considered a plain run if both getFirstJavaCommandOptions() and getLastJavaCommandOptions() return null or empty array.


isSameType

public boolean isSameType(JRunProcess other)
Returns true if this is the same type of run as the other JRunProcess.


Extension SDK

 

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