|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object it.sauronsoftware.cron4j.Task it.sauronsoftware.cron4j.ProcessTask
public class ProcessTask
A built-in Task
implementation which can be used to run an external
process.
Constructor Summary | |
---|---|
ProcessTask(java.lang.String command)
Creates the task. |
|
ProcessTask(java.lang.String[] command)
Creates the task. |
|
ProcessTask(java.lang.String[] command,
java.lang.String[] envs)
Creates the task. |
|
ProcessTask(java.lang.String[] command,
java.lang.String[] envs,
java.io.File directory)
Creates the task. |
Method Summary | |
---|---|
boolean |
canBeStopped()
Returns true. |
void |
execute(TaskExecutionContext context)
Implements Task.execute(TaskExecutionContext) . |
java.lang.String[] |
getCommand()
Returns the command executed by this task. |
java.io.File |
getDirectory()
Resturns the working directory for the spawned process. |
java.lang.String[] |
getEnvs()
Returns the environment variables, in the name=value form, used by the task to run its process. |
java.io.File |
getStderrFile()
Returns the standard error file (optional). |
java.io.File |
getStdinFile()
Returns the standard input file (optional). |
java.io.File |
getStdoutFile()
Returns the standard output file (optional). |
void |
setCommand(java.lang.String[] command)
Sets the command executed by this task. |
void |
setDirectory(java.io.File directory)
Sets the working directory for the spawned process. |
void |
setEnvs(java.lang.String[] envs)
Sets the environment variables, in the name=value form, used by the task to run its process. |
void |
setStderrFile(java.io.File stderrFile)
Sets the standard error file (optional). |
void |
setStdinFile(java.io.File stdinFile)
Sets the standard input file (optional). |
void |
setStdoutFile(java.io.File stdoutFile)
Sets the standard output file (optional). |
java.lang.String |
toString()
Overrides Object.toString() . |
Methods inherited from class it.sauronsoftware.cron4j.Task |
---|
canBePaused, supportsCompletenessTracking, supportsStatusTracking |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ProcessTask(java.lang.String[] command, java.lang.String[] envs, java.io.File directory)
command
- The command to launch and its arguments.envs
- Environment variables for the spawned process, in the form
name=value. If null the process will inherit the
current JVM environment variables.directory
- Working directory for the spawned process. If null the process
will inherit the current JVM working directory.public ProcessTask(java.lang.String[] command, java.lang.String[] envs)
command
- The command to launch and its arguments.envs
- Environment variables for the spawned process, in the form
name=value. If null the process will inherit the
current JVM environment variables.public ProcessTask(java.lang.String[] command)
command
- The command to launch and its arguments.public ProcessTask(java.lang.String command)
command
- The command to launch.Method Detail |
---|
public boolean canBeStopped()
canBeStopped
in class Task
public java.lang.String[] getCommand()
public void setCommand(java.lang.String[] command)
command
- The command executed by this task.public java.lang.String[] getEnvs()
public void setEnvs(java.lang.String[] envs)
envs
- The environment variables, in the name=value form,
used by the task to run its process. If null the process will
inherit the current JVM environment variables.public java.io.File getDirectory()
public void setDirectory(java.io.File directory)
directory
- The working directory for the spawned process. If null the
process will inherit the current JVM working directory.public java.io.File getStdinFile()
public void setStdinFile(java.io.File stdinFile)
stdinFile
- The standard input file (optional).public void setStdoutFile(java.io.File stdoutFile)
stdoutFile
- The standard output file (optional).public java.io.File getStdoutFile()
public void setStderrFile(java.io.File stderrFile)
stderrFile
- The standard error file (optional).public java.io.File getStderrFile()
public void execute(TaskExecutionContext context) throws java.lang.RuntimeException
Task.execute(TaskExecutionContext)
. Runs the given
command as a separate process and waits for its end.
execute
in class Task
context
- The execution context.
java.lang.RuntimeException
- Task execution has somehow failed.public java.lang.String toString()
Object.toString()
.
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |