com.borland.jbuilder.runtime
Class JavaProcess

java.lang.Object
  |
  +--com.borland.jbuilder.runtime.JavaProcess
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public abstract class JavaProcess
extends java.lang.Object
implements java.awt.event.ActionListener


Field Summary
static GlobalBooleanProperty ESCAPE_QUOTE
          Hidden escapeQuote property, set this to true if OS need to add \ for " character.
static GlobalProperty FIRST_VM_PARAMETERS
          if new must-be first VM parameters are added, user.properties file can be modified to support these parameters.
static int STILL_RUNNING
           
static int UPDATE_INTERVAL
           
 
Constructor Summary
JavaProcess()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Periodically checks the progress of a running application.
 void addJavaProcessListener(JavaProcessListener listener)
          Adds a listener to the list of listeners that receive events.
 void fireJavaProcessPaused()
          Notifies all registered listeners that...
 void fireJavaProcessResumed()
          Notifies all registered listeners that the process this object represents has resumed execution after being paused.
 void fireJavaProcessSent(java.lang.String text, boolean error)
          Notifies all registered listeners that the process this object represents has produced output.
 void fireJavaProcessStarted()
          Notifies all registered listeners that the process this object represents has just begun execution.
 void fireJavaProcessStopped(int exitCode)
          Notifies all registered listeners that the process this object represents is no longer running.
 java.lang.String formatClasspath(java.lang.String path)
           
 java.lang.String getCommandLine()
           
static java.lang.String getJavaLauncher()
           
 int getOutputUpdateInterval()
           
abstract  int getProcessExitCode()
           
 int getProcessUpdateInterval()
           
static java.lang.String insertAfterMustBeFirstVMParameters(java.lang.String vmParams, java.lang.String addedVMOption)
          Insert a new vmOption into the given vmParams.
 java.lang.Thread monitorOutput()
           
 void readOutput()
          Uses sendOutput to report output to both stderr and stdout to listeners.
 void refreshOutputUpdateInterval()
           
 void refreshProcessUpdateInterval()
           
 void removeJavaProcessListener(JavaProcessListener listener)
          Removes a listener from the list of listeners that receive events.
 void restart()
           
 void sendInput(java.lang.String value)
           
 void setCommandLine(java.lang.String commandLine)
           
 void start(java.io.File jdkHome, java.lang.String className, java.lang.String classPath, java.lang.String vmParams, java.lang.String params, java.io.File workingDir)
           
abstract  java.lang.Process startJavaProcess(java.io.File jdkHome, java.lang.String className, java.lang.String classPath, java.lang.String vmParams, java.lang.String params, java.io.File workingDir)
           
 void stop()
           
abstract  void stopJavaProcess()
           
 java.lang.String[] tokenizeCommand(java.lang.String cmdLine)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STILL_RUNNING

public static final int STILL_RUNNING

UPDATE_INTERVAL

public static final int UPDATE_INTERVAL

ESCAPE_QUOTE

public static final GlobalBooleanProperty ESCAPE_QUOTE
Hidden escapeQuote property, set this to true if OS need to add \ for " character. in NT, "abc\"d" should be parsed as abc\"d, in Linux, it should be parsed as abc"d. No UI for this -- needs to be added manually to user.properties -- default is false.

FIRST_VM_PARAMETERS

public static final GlobalProperty FIRST_VM_PARAMETERS
if new must-be first VM parameters are added, user.properties file can be modified to support these parameters. runtime;firstVMParameters=-newParam1 -newParam2
Constructor Detail

JavaProcess

public JavaProcess()
Method Detail

startJavaProcess

public abstract java.lang.Process startJavaProcess(java.io.File jdkHome,
                                                   java.lang.String className,
                                                   java.lang.String classPath,
                                                   java.lang.String vmParams,
                                                   java.lang.String params,
                                                   java.io.File workingDir)

stopJavaProcess

public abstract void stopJavaProcess()

getProcessExitCode

public abstract int getProcessExitCode()

start

public void start(java.io.File jdkHome,
                  java.lang.String className,
                  java.lang.String classPath,
                  java.lang.String vmParams,
                  java.lang.String params,
                  java.io.File workingDir)

restart

public void restart()

stop

public void stop()

sendInput

public void sendInput(java.lang.String value)

readOutput

public void readOutput()
Uses sendOutput to report output to both stderr and stdout to listeners.

getOutputUpdateInterval

public int getOutputUpdateInterval()

refreshOutputUpdateInterval

public void refreshOutputUpdateInterval()

getProcessUpdateInterval

public int getProcessUpdateInterval()

refreshProcessUpdateInterval

public void refreshProcessUpdateInterval()

getJavaLauncher

public static java.lang.String getJavaLauncher()

getCommandLine

public java.lang.String getCommandLine()

setCommandLine

public void setCommandLine(java.lang.String commandLine)

formatClasspath

public java.lang.String formatClasspath(java.lang.String path)

tokenizeCommand

public java.lang.String[] tokenizeCommand(java.lang.String cmdLine)

insertAfterMustBeFirstVMParameters

public static java.lang.String insertAfterMustBeFirstVMParameters(java.lang.String vmParams,
                                                                  java.lang.String addedVMOption)
Insert a new vmOption into the given vmParams. It is inserted on the left of the list after "-classic" "-green" "-native" and anything else listed in user.properties

addJavaProcessListener

public void addJavaProcessListener(JavaProcessListener listener)
Adds a listener to the list of listeners that receive events.
Parameters:
listener - The listener.

removeJavaProcessListener

public void removeJavaProcessListener(JavaProcessListener listener)
Removes a listener from the list of listeners that receive events.
Parameters:
listener - The listener.

fireJavaProcessStarted

public void fireJavaProcessStarted()
Notifies all registered listeners that the process this object represents has just begun execution.
Parameters:
exitCode - The exit code returned by the process when it was stopped.

fireJavaProcessStopped

public void fireJavaProcessStopped(int exitCode)
Notifies all registered listeners that the process this object represents is no longer running.
Parameters:
exitCode - The exit code returned by the process when it was stopped.

fireJavaProcessPaused

public void fireJavaProcessPaused()
Notifies all registered listeners that...

fireJavaProcessSent

public void fireJavaProcessSent(java.lang.String text,
                                boolean error)
Notifies all registered listeners that the process this object represents has produced output.
Parameters:
text - A string of characters emitted by the process, including end of line characters as appropriate.
error - True if the text was sent to stderr, false if it was sent to stdout.

fireJavaProcessResumed

public void fireJavaProcessResumed()
Notifies all registered listeners that the process this object represents has resumed execution after being paused.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Periodically checks the progress of a running application. Transfers any information sent to stdout and stderr to the appropriate view, and deals with the termination of the process when it occurs.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - Ignored.

monitorOutput

public java.lang.Thread monitorOutput()