|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.util.externalprocess.CommandLauncher
The command launcher provides a way to comunicate with a external process
| Field Summary | |
protected java.lang.String[] |
commandArgs
Command and arguments |
protected static int |
counter
Counts how many comands are launched Also used for () identification |
protected static long |
DELAY
The number of milliseconds to pause between polling. |
protected java.lang.String |
name
The internal name of the external process |
protected java.lang.Process |
process
The process object representing the external process |
| Constructor Summary | |
CommandLauncher(java.lang.String name)
Creates a new launcher Fills in stderr and stdout output to the given streams. |
|
| Method Summary | |
protected java.lang.String[] |
constructCommandArray(java.lang.String command,
java.lang.String[] commandArgs)
Constructs a command array that will be passed to the process |
void |
execute(java.lang.String command)
Execute a command |
void |
execute(java.lang.String[] commandArgs)
Execute a command |
void |
execute(java.lang.String[] commandArgs,
java.lang.String[] env)
Execute a command |
void |
execute(java.lang.String[] commandArgs,
java.lang.String[] env,
java.lang.String changeToDirectory)
Execute a command |
void |
execute(java.lang.String commandPath,
java.lang.String[] args)
Execute a command |
void |
execute(java.lang.String commandPath,
java.lang.String[] args,
java.lang.String[] env)
Execute a command |
void |
execute(java.lang.String commandPath,
java.lang.String[] args,
java.lang.String[] env,
java.lang.String changeToDirectory)
Execute a command |
java.lang.String[] |
getCommandArgs()
get CommandArgs. |
void |
printCommandLine(java.lang.String[] commandArgs)
print Command Line. |
protected void |
processStreams(ProcessClosure closure,
java.io.OutputStream output,
java.io.PipedInputStream inputPipe,
java.io.OutputStream err,
java.io.PipedInputStream errInPipe,
IProgressMonitor monitor)
process the Streams.while the external process returns bytes. |
void |
waitAndRead(java.io.OutputStream out,
java.io.OutputStream err)
Reads output from the external process to the streams. |
void |
waitAndRead(java.io.OutputStream output,
java.io.OutputStream err,
IProgressMonitor monitor)
Reads output from the external process to the streams. |
void |
waitAndWrite(java.io.InputStream in,
java.io.OutputStream out,
java.io.OutputStream err)
Writes input to and reads output from the external process to the streams. |
void |
waitAndWrite(java.io.InputStream in,
java.io.OutputStream output,
java.io.OutputStream err,
IProgressMonitor monitor)
Writes input to and reads output from the external process to the streams. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected static final long DELAY
protected static int counter
protected java.lang.Process process
protected java.lang.String[] commandArgs
protected java.lang.String name
| Constructor Detail |
public CommandLauncher(java.lang.String name)
null, if output not required
name - internal name of the external process| Method Detail |
public java.lang.String[] getCommandArgs()
protected java.lang.String[] constructCommandArray(java.lang.String command,
java.lang.String[] commandArgs)
commandArgs - arguments after the command
public void execute(java.lang.String command)
throws ProcessException
command - command
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String[] commandArgs)
throws ProcessException
commandArgs - command and arguments
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String commandPath,
java.lang.String[] args)
throws ProcessException
commandPath - path of comandargs - arguments after the command
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String[] commandArgs,
java.lang.String[] env)
throws ProcessException
commandArgs - command and argumentsenv - environment name value pairs
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String commandPath,
java.lang.String[] args,
java.lang.String[] env)
throws ProcessException
commandPath - path of comandargs - arguments after the comandenv - environment name value pairs
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String[] commandArgs,
java.lang.String[] env,
java.lang.String changeToDirectory)
throws ProcessException
commandArgs - command and argumentsenv - environment name value pairschangeToDirectory - working directory
java.io.IOException - if an I/O error occurs
ProcessException
public void execute(java.lang.String commandPath,
java.lang.String[] args,
java.lang.String[] env,
java.lang.String changeToDirectory)
throws ProcessException
commandPath - path of comandargs - arguments after the comandenv - environment name value pairschangeToDirectory - working directory
java.io.IOException - if an I/O error occurs
ProcessException
public void waitAndRead(java.io.OutputStream out,
java.io.OutputStream err)
throws ProcessException
err - process stderr is written to this stream
ProcessException - if process not yet executed
public void waitAndRead(java.io.OutputStream output,
java.io.OutputStream err,
IProgressMonitor monitor)
throws ProcessException
output - process stdout is written to this streamerr - process stderr is written to this streammonitor - monitor monitor to receive progress info and to cancel
the external process
ProcessException - if process not yet executed or if process
cancelled
public void waitAndWrite(java.io.InputStream in,
java.io.OutputStream out,
java.io.OutputStream err)
throws ProcessException
in - process stdin is read from this streamerr - process stderr is written to this stream
ProcessException - if process not yet executed
public void waitAndWrite(java.io.InputStream in,
java.io.OutputStream output,
java.io.OutputStream err,
IProgressMonitor monitor)
throws ProcessException
in - process stdin is read from this streamoutput - process stdout is written to this streamerr - process stderr is written to this streammonitor - monitor monitor to receive progress info and to cancel
the external process
ProcessException - if process not yet executed or if process
cancelled
protected void processStreams(ProcessClosure closure,
java.io.OutputStream output,
java.io.PipedInputStream inputPipe,
java.io.OutputStream err,
java.io.PipedInputStream errInPipe,
IProgressMonitor monitor)
throws ProcessException
closure - process closure object which handles the interaction with
the external processoutput - process stdout is written to this streaminputPipe - piped stream to other thread for the stdouterr - process stderr is written to this streamerrInPipe - piped stream to other thread for the stderrmonitor - monitor to receive progress info and to cancel
the external process
ProcessException - if process cancelledpublic void printCommandLine(java.lang.String[] commandArgs)
commandArgs - array of comand and args
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||