|
||||||||||
| 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 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 String |
name
The internal name of the external process |
protected Process |
process
The process object representing the external process |
| Constructor Summary | |
CommandLauncher(String name)
Creates a new launcher Fills in stderr and stdout output to the given streams. |
|
| Method Summary | |
protected String[] |
constructCommandArray(String command,
String[] commandArgs)
Constructs a command array that will be passed to the process |
void |
execute(String command)
Execute a command |
void |
execute(String[] commandArgs)
Execute a command |
void |
execute(String[] commandArgs,
String[] env)
Execute a command |
void |
execute(String[] commandArgs,
String[] env,
String changeToDirectory)
Execute a command |
void |
execute(String commandPath,
String[] args)
Execute a command |
void |
execute(String commandPath,
String[] args,
String[] env)
Execute a command |
void |
execute(String commandPath,
String[] args,
String[] env,
String changeToDirectory)
Execute a command |
String[] |
getCommandArgs()
get CommandArgs. |
void |
printCommandLine(String[] commandArgs)
print Command Line. |
protected void |
processStreams(ProcessClosure closure,
OutputStream output,
PipedInputStream inputPipe,
OutputStream err,
PipedInputStream errInPipe,
IProgressMonitor monitor)
process the Streams.while the external process returns bytes. |
void |
waitAndRead(OutputStream out,
OutputStream err)
Reads output from the external process to the streams. |
void |
waitAndRead(OutputStream output,
OutputStream err,
IProgressMonitor monitor)
Reads output from the external process to the streams. |
void |
waitAndWrite(InputStream in,
OutputStream out,
OutputStream err)
Writes input to and reads output from the external process to the streams. |
void |
waitAndWrite(InputStream in,
OutputStream output,
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 Process process
protected String[] commandArgs
protected String name
| Constructor Detail |
public CommandLauncher(String name)
null, if output not required
name - internal name of the external process| Method Detail |
public String[] getCommandArgs()
protected String[] constructCommandArray(String command,
String[] commandArgs)
command - path of comandcommandArgs - arguments after the command
public void execute(String command)
throws ProcessException
command - command
IOException - if an I/O error occurs
ProcessException
public void execute(String[] commandArgs)
throws ProcessException
commandArgs - command and arguments
IOException - if an I/O error occurs
ProcessException
public void execute(String commandPath,
String[] args)
throws ProcessException
commandPath - path of comandargs - arguments after the command
IOException - if an I/O error occurs
ProcessException
public void execute(String[] commandArgs,
String[] env)
throws ProcessException
commandArgs - command and argumentsenv - environment name value pairs
IOException - if an I/O error occurs
ProcessException
public void execute(String commandPath,
String[] args,
String[] env)
throws ProcessException
commandPath - path of comandargs - arguments after the comandenv - environment name value pairs
IOException - if an I/O error occurs
ProcessException
public void execute(String[] commandArgs,
String[] env,
String changeToDirectory)
throws ProcessException
commandArgs - command and argumentsenv - environment name value pairschangeToDirectory - working directory
IOException - if an I/O error occurs
ProcessException
public void execute(String commandPath,
String[] args,
String[] env,
String changeToDirectory)
throws ProcessException
commandPath - path of comandargs - arguments after the comandenv - environment name value pairschangeToDirectory - working directory
IOException - if an I/O error occurs
ProcessException
public void waitAndRead(OutputStream out,
OutputStream err)
throws ProcessException
out - process stdout is written to this streamerr - process stderr is written to this stream
ProcessException - if process not yet executed
public void waitAndRead(OutputStream output,
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(InputStream in,
OutputStream out,
OutputStream err)
throws ProcessException
in - process stdin is read from this streamout - process stdout is written to this streamerr - process stderr is written to this stream
ProcessException - if process not yet executed
public void waitAndWrite(InputStream in,
OutputStream output,
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,
OutputStream output,
PipedInputStream inputPipe,
OutputStream err,
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(String[] commandArgs)
commandArgs - array of comand and args
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||