org.astrogrid.applications.commandline
Class CommandLineApplication
java.lang.Object
java.util.Observable
org.astrogrid.applications.AbstractApplication
org.astrogrid.applications.commandline.CommandLineApplication
- All Implemented Interfaces:
- Application, java.lang.Runnable
- Direct Known Subclasses:
- Dft, HyperZ, SExtractor
- public class CommandLineApplication
- extends AbstractApplication
- implements java.lang.Runnable
A generic model for a command line application. This generally assumes that the application can be run from a command line obtaining all of its parameters from commandline arguments and possibly standard in.
The application can interact with the filesystem.
This is achieved with the Runtime.exec(java.lang.String[], java.lang.String[], java.io.File)call,
It was programmed/tested under unix, but I think that the code would work with windows based systems with very little alteration.
- Since:
- iteration4
- Version:
- $Name: HEAD $
- Author:
- Paul Harrison (pah@jb.man.ac.uk)
| Methods inherited from class org.astrogrid.applications.AbstractApplication |
attemptAbort, checkParameterValues, createAdapters, createTemplateMessage, findInputParameter, findInputParameterAdapter, findOutputParameter, findOutputParameterAdapter, findParameter, findParameterAdapter, getApplicationDescription, getApplicationInterface, getID, getInputParameters, getJobStepID, getResult, getStatus, getTool, getUser, inputParameterAdapters, inputParameterValues, outputParameterAdapters, outputParameterValues, parameterAdapters, parameterValues, reportError, reportError, reportMessage, reportWarning, reportWarning, setStatus, toString |
| Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
argvals
protected final java.util.List argvals
envp
protected java.lang.String[] envp
runtime
protected final java.lang.Runtime runtime
process
protected java.lang.Process process
exitStatus
protected int exitStatus
applicationEnvironment
protected final CommandLineApplicationEnvironment applicationEnvironment
CommandLineApplication
public CommandLineApplication(java.lang.String jobStepId,
Tool t,
ApplicationInterface interf,
CommandLineApplicationEnvironment env,
ProtocolLibrary lib)
execute
public boolean execute()
throws CeaException
- Specified by:
execute in interface Application
- Throws:
CeaException
createExecutionTask
public java.lang.Runnable createExecutionTask()
throws CeaException
- Specified by:
createExecutionTask in interface Application
- Throws:
CeaException
instantiateAdapter
protected ParameterAdapter instantiateAdapter(ParameterValue pval,
ParameterDescription desr,
ExternalValue indirectVal)
- override so that commandline parameters are returned
- See Also:
org.astrogrid.applications.AbstractApplication#instantiateAdapter(org.astrogrid.applications.beans.v1.parameters.ParameterValue, org.astrogrid.applications.description.ParameterDescription, org.astrogrid.applications.parameter.indirect.IndirectParameterValue)
setupParameters
protected void setupParameters()
throws CeaException
- Throws:
CeaException
run
public void run()
- run a thread runs and waits for the application.
- Specified by:
run in interface java.lang.Runnable
preRunHook
protected void preRunHook()
- Hook to allow for manipulation of the environment before the application gets run. Occurs when the command line has been built for the application. This does nothing in the default implementation.
postParamSetupHook
protected void postParamSetupHook()
- Hook to allow special parameter processing. This occurs after the parameters have had their default treatment. This does nothing in the default implementation.
preWritebackHook
protected void preWritebackHook()
- Hook to allow the manipulation of results before they are written back to the caller. This does nothing in the default implementation.
getApplicationEnvironment
public CommandLineApplicationEnvironment getApplicationEnvironment()
- Returns:
Copyright © 2002-2006 AstroGrid. All Rights Reserved.