Package org.oddjob.jobs
Class ExecBase
- All Implemented Interfaces:
Serializable,Runnable,ArooaContextAware,ArooaSessionAware,Forceable,PropertyChangeNotifier,Iconic,ConsoleOwner,LogEnabled,Resettable,Stateful,Stoppable
Base class for Jobs that create an external process.
- Author:
- Rob Gordon.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionProvide theArooaTokenizerto use for parsing commands.Provide the console archive.protected intexecute()Execute this job.getDir()getEnvironment(String name) intGet the output stream for stderr.getStdin()Get the input stream for stdin.Get the output stream for stdout.booleanbooleanbooleanvoidonStop()Allow sub classes to do something on stop.protected abstract String[]voidSet the working directory.voidsetEnvironment(String name, String value) Add an environment variable.voidsetNewEnvironment(boolean explicitEnvironment) voidsetRedirectStderr(boolean redirectErrorStream) voidsetStderr(OutputStream stderr) Set the output stream stderr from the process will be directed to.voidsetStdin(InputStream stdin) Set the input stream stdin for the process will be read from.voidsetStdout(OutputStream stdout) Set the output stream stdout from the process will be directed to.voidsetStopForcibly(boolean stopForcibly) Methods inherited from class org.oddjob.framework.extend.SimpleJob
fireDestroyedState, force, getStateChanger, hardReset, iconHelper, isStop, onDestroy, onReset, run, sleep, softReset, stateHandler, stopMethods inherited from class org.oddjob.framework.extend.BasePrimary
configure, getName, logger, logger, loggerName, save, setName, toStringMethods inherited from class org.oddjob.framework.extend.BaseComponent
addIconListener, addPropertyChangeListener, addStateListener, configure, destroy, firePropertyChange, getArooaSession, iconForId, initialise, lastStateEvent, onConfigured, onInitialised, removeIconListener, removePropertyChangeListener, removeStateListener, save, setArooaContext, setArooaSessionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.oddjob.Stateful
addStateListener, lastStateEvent, removeStateListener
-
Constructor Details
-
ExecBase
public ExecBase()
-
-
Method Details
-
setDir
Set the working directory.- Parameters:
dir- The working directory.
-
setNewEnvironment
public void setNewEnvironment(boolean explicitEnvironment) - Reference Property:
- newEnvironment
- Required:
- No.
Description
Create a fresh/clean environment. -
isNewEnvironment
public boolean isNewEnvironment() -
setEnvironment
Add an environment variable.- Parameters:
name- The of the environment variable.value- The value of the environment variable.
-
getEnvironment
-
setRedirectStderr
public void setRedirectStderr(boolean redirectErrorStream) - Reference Property:
- redirectStderr
- Required:
- No.
Description
Redirect the standard error stream in standard output. -
isRedirectStderr
public boolean isRedirectStderr() -
setStdin
Set the input stream stdin for the process will be read from.- Parameters:
stdin- An InputStream.
-
getStdin
Get the input stream for stdin. This will be null unless one has been provided.- Returns:
- An InputStream or null.
-
setStdout
Set the output stream stdout from the process will be directed to.- Parameters:
stdout- The output stream.
-
getStdout
Get the output stream for stdout. This will be null unless one has been provided.- Returns:
- An OutputStream or null.
-
setStderr
Set the output stream stderr from the process will be directed to.- Parameters:
stderr- The error stream.
-
getStderr
Get the output stream for stderr. This will be null unless one has been provided.- Returns:
- An OutputStream or null.
-
isStopForcibly
public boolean isStopForcibly() -
setStopForcibly
public void setStopForcibly(boolean stopForcibly) -
commandTokenizer
Provide theArooaTokenizerto use for parsing commands.- Returns:
- A tokenizer, never null.
-
provideArgs
- Throws:
Exception
-
execute
Description copied from class:SimpleJobExecute this job. -
onStop
public void onStop()Description copied from class:SimpleJobAllow sub classes to do something on stop. -
getDir
- Returns:
- Returns the dir.
-
getExitValue
public int getExitValue() -
consoleLog
Description copied from interface:ConsoleOwnerProvide the console archive.- Specified by:
consoleLogin interfaceConsoleOwner- Returns:
- The archive. Must not be null.
-