public class ExecJob extends ExecBase
Processes may behave differently on different operating systems - for instance stop doesn't always kill the process. Please see http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4109888 for additional information.
<exec name="Batch Example"> cmd /C "${oddjob.dir}\bin\greeting.bat" Hello </exec>Oddjob will treat arguments in quotes as single program argument and allows them to be escaped with backslash. If this is too confusing it is sometimes easier to specify the command as individual arguments. The above is equivalent to:
<exec name="Batch Example"> <args> <list> <values> <value value="cmd"/> <value value="/C"/> <value value="${oddjob.dir}\bin\greeting.bat"/> <value value="Hello"/> </values> </list> </args> </exec>
<oddjob> <job> <exec name="Example With Environment" id="exec"> <environment> <value key="ODDJOB_FILE" value="myfile.txt"/> </environment> ${platform.set.command} </exec> </job> </oddjob>
<oddjob id="this"> <job> <exec id="exec" redirectStderr="true"> <stdout> <file file="${work.dir}/ExecOutput.log"/> </stdout> java -jar "${oddjob.test.run.jar}" -h </exec> </job> </oddjob>
<oddjob id="this"> <job> <exec> <stdout> <logout level="INFO"/> </stdout> <stderr> <logout level="WARN"/> </stderr> java -jar ${oddjob.test.run.jar} -f Missing.xml ${logConfigArgs}/ </exec> </job> </oddjob>
<oddjob id="this"> <job> <sequential> <jobs> <variables id="vars"> <ourBuffer> <buffer/> </ourBuffer> </variables> <exec> <stdin> <buffer>apples oranges pears </buffer> </stdin> <stdout> <value value="${vars.ourBuffer}"/> </stdout> java -jar "${oddjob.test.run.jar}" -f "${this.dir}/OddjobCat.xml" ${logConfigArgs} </exec> <exec id="exec"> <stdin> <value value="${vars.ourBuffer}"/> </stdin> <stdout> <stdout/> </stdout> java -jar "${oddjob.test.run.jar}" -f "${this.dir}/OddjobCat.xml" ${logConfigArgs} </exec> </jobs> </sequential> </job> </oddjob>
Constructor and Description |
---|
ExecJob() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getCommand()
Get the command.
|
protected java.lang.String[] |
provideArgs() |
void |
setArgs(java.lang.String[] args)
Add an argument.
|
void |
setCommand(java.lang.String command)
Set the command to run.
|
commandTokenizer, consoleLog, execute, getDir, getEnvironment, getExitValue, getStderr, getStdin, getStdout, isNewEnvironment, isRedirectStderr, isStopForcibly, onStop, setDir, setEnvironment, setNewEnvironment, setRedirectStderr, setStderr, setStdin, setStdout, setStopForcibly
fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onReset, run, sleep, softReset, stateHandler, stop
configure, getName, logger, logger, loggerName, save, setName, toString
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSession
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addStateListener, lastStateEvent, removeStateListener
public void setArgs(java.lang.String[] args)
args
- The arguments.public void setCommand(java.lang.String command)
command
- The command.public java.lang.String getCommand()
protected java.lang.String[] provideArgs() throws java.lang.Exception
provideArgs
in class ExecBase
java.lang.Exception