Package mgui.pipelines
Class NativeProcess
java.lang.Object
mgui.pipelines.PipelineProcess
mgui.pipelines.NativeProcess
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,InterfaceObject,NamedObject,TreeObject,CleanableObject,XMLObject,IconObject
public class NativeProcess extends PipelineProcess
Represents a native process; i.e., one which runs from the OS command console.
Specified by the command, which is the native executable; and the
path, which is a path to the desired version (an empty string results
in the system default).
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringcommandprotected java.util.HashMap<java.lang.Long,java.lang.Process>current_system_processesprotected java.lang.Stringpathprotected java.lang.Stringset_operatorFields inherited from class mgui.pipelines.PipelineProcess
help_param, input_parameter, library, logger, name, output_parameter, parameters -
Constructor Summary
Constructors Constructor Description NativeProcess(java.lang.String name, java.lang.String command)NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger)NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path)NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path, java.lang.String set_operator)NativeProcess(PipelineProcess process) -
Method Summary
Modifier and Type Method Description java.lang.Objectclone()java.lang.StringgetCommand()Returns the native command for this process.protected java.lang.StringgetCommand(java.lang.String[] args)java.lang.StringgetFailureMessage()Returns the message to be displayed when this process has failed.java.lang.String[]getInputArgs(java.lang.String[] args, java.lang.String input_file)Alters an argument array to set an input file for this process, and returns the result.javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.java.lang.String[]getOutputArgs(java.lang.String[] args, java.lang.String output_file)Alters an argument array to set an output file for this process, and returns the result.java.lang.StringgetPath()Returns the path to the native binaries for this process.java.lang.StringgetSetOperator()Returns the set operator character for this process.java.lang.StringgetSuccessMessage()Returns the message to be displayed when this process has succeeded.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.booleaninterrupt(long uid)Interrupts an instance of this processbooleanrun(java.lang.String[] args, long uid)Runs an instance of this processvoidsetCommand(java.lang.String command)Sets the native command for this process.voidsetFromProcess(PipelineProcess process)voidsetPath(java.lang.String path)Sets the path to the native binaries for this process.voidsetSetOperator(java.lang.String set_operator)Sets the set operator character for this process.voidshowHelp()Attempt to display the associated help messagevoidwriteXML(int tab, java.io.Writer writer, ProgressUpdater progressBar)Writes the XML representation of this object to file, asXMLType.Normal.Methods inherited from class mgui.pipelines.PipelineProcess
addParameter, clean, destroy, getCompoundName, getDTD, getHelpParameter, getIcon, getInputParameter, getInstance, getLibrary, getLocalName, getLogger, getName, getOutputParameter, getParameter, getParameters, getShortXML, getTreeLabel, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, insertParameter, isDestroyed, issueTreeNode, removeParameter, setHelpParameter, setInputParameter, setLibrary, setLogger, setName, setOutputParameter, setParameters, setTreeNode, toString, updateLogger, writeXML, writeXMLMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
command
protected java.lang.String command -
path
protected java.lang.String path -
set_operator
protected java.lang.String set_operator -
current_system_processes
protected java.util.HashMap<java.lang.Long,java.lang.Process> current_system_processes
-
-
Constructor Details
-
NativeProcess
-
NativeProcess
public NativeProcess(java.lang.String name, java.lang.String command) -
NativeProcess
public NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger) -
NativeProcess
public NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path) -
NativeProcess
public NativeProcess(java.lang.String name, java.lang.String command, java.lang.String logger, java.lang.String path, java.lang.String set_operator)
-
-
Method Details
-
setFromProcess
- Overrides:
setFromProcessin classPipelineProcess
-
showHelp
public void showHelp()Description copied from class:PipelineProcessAttempt to display the associated help message- Specified by:
showHelpin classPipelineProcess
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Overrides:
getObjectIconin classPipelineProcess- Returns:
-
getCommand
public java.lang.String getCommand()Returns the native command for this process.- Returns:
-
setSetOperator
public void setSetOperator(java.lang.String set_operator)Sets the set operator character for this process. E.g., for a function expecting -param_name param_value, the character is a space (default). For -param_name=param_value, the character is "=".- Parameters:
command-
-
getSetOperator
public java.lang.String getSetOperator()Returns the set operator character for this process. E.g., for a function expecting -param_name param_value, the character is a space (default). For -param_name=param_value, the character is "=".- Returns:
-
setCommand
public void setCommand(java.lang.String command)Sets the native command for this process.- Parameters:
command-
-
getPath
public java.lang.String getPath()Returns the path to the native binaries for this process.- Returns:
-
setPath
public void setPath(java.lang.String path)Sets the path to the native binaries for this process.- Parameters:
command-
-
getInputArgs
public java.lang.String[] getInputArgs(java.lang.String[] args, java.lang.String input_file)Description copied from class:PipelineProcessAlters an argument array to set an input file for this process, and returns the result.- Specified by:
getInputArgsin classPipelineProcess- Returns:
-
getOutputArgs
public java.lang.String[] getOutputArgs(java.lang.String[] args, java.lang.String output_file)Description copied from class:PipelineProcessAlters an argument array to set an output file for this process, and returns the result.- Specified by:
getOutputArgsin classPipelineProcess- Returns:
-
getCommand
protected java.lang.String getCommand(java.lang.String[] args) -
run
Description copied from class:PipelineProcessRuns an instance of this process- Specified by:
runin classPipelineProcess- Parameters:
args- Arguments for the process- Returns:
- Throws:
PipelineException
-
interrupt
Description copied from class:PipelineProcessInterrupts an instance of this process- Specified by:
interruptin classPipelineProcess- Parameters:
uid- The unique identifier of the process instance to interrupt- Returns:
- Throws:
PipelineException
-
getFailureMessage
public java.lang.String getFailureMessage()Description copied from class:PipelineProcessReturns the message to be displayed when this process has failed.- Specified by:
getFailureMessagein classPipelineProcess- Returns:
-
getSuccessMessage
public java.lang.String getSuccessMessage()Description copied from class:PipelineProcessReturns the message to be displayed when this process has succeeded.- Specified by:
getSuccessMessagein classPipelineProcess- Returns:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, ProgressUpdater progressBar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites the XML representation of this object to file, asXMLType.Normal. The default format ofXMLFormat.Asciiwill be used. The basic contract for this method is that it should not write a newline character at its start or end.- Specified by:
writeXMLin interfaceXMLObject- Overrides:
writeXMLin classPipelineProcess- Parameters:
tab- The number of tabs to place before the XML textwriter- The writerprogressBar- Optional progress updater (may benull)- Throws:
java.io.IOException
-
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObjectReturns this object's XML representation as a single string. NOTE: this is not feasible for larger objects and containers, thus may not be implemented for these objects. Use theXMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater)functions to write larger objects to file.- Specified by:
getXMLin interfaceXMLObject- Overrides:
getXMLin classPipelineProcess- Parameters:
tab- The number of tabs to place before the opening XML wrapper- Returns:
-
clone
public java.lang.Object clone()- Specified by:
clonein classPipelineProcess
-