Package mgui.pipelines
Class PipelineProcessInstance
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.pipelines.PipelineTask
mgui.pipelines.PipelineProcessInstance
- All Implemented Interfaces:
java.awt.datatransfer.Transferable,java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<PipelineTask>,InterfaceObject,NamedObject,TaskTreeNodeListener,TreeObject,CleanableObject,XMLObject,IconObject
public class PipelineProcessInstance extends PipelineTask
Represents a specific instance of a Java process.
- Since:
- 1.0
- Version:
- 1.0
- Author:
- Andrew Reid
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class mgui.pipelines.PipelineTask
PipelineTask.StatusNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected static java.awt.datatransfer.DataFlavordata_flavorprotected booleanhas_inputprotected java.lang.Stringinput_fileprotected intinstanceprotected java.lang.Stringloggerprotected java.lang.Stringoutput_fileprotected java.util.HashMap<java.lang.String,TaskParameterInstance>parametersprotected InterfacePipelinepipelineprotected booleanprepend_instance_inputprotected booleanprepend_instance_outputprotected PipelineProcessprocessprotected longuidFields inherited from class mgui.pipelines.PipelineTask
attributes, current, startFields inherited from class mgui.interfaces.AbstractInterfaceObject
isDestroyed, tree_nodes -
Constructor Summary
Constructors Constructor Description PipelineProcessInstance()PipelineProcessInstance(PipelineProcessInstance process_instance)PipelineProcessInstance(PipelineProcess process, int instance) -
Method Summary
Modifier and Type Method Description java.lang.Objectclone()java.lang.String[]getArguments(java.lang.String instance, InterfaceProject project, PipelineState state)Returns the parameters of this process instance as an array ofStringvalues, for the specific instance and project.java.lang.String[]getArguments(java.lang.String instance, PipelineState state)Returns the parameters of this process instance as an array ofStringvalues, for the specific instance and root directory.java.lang.String[]getArguments(PipelineState state)Returns the parameters of this process instance as an array ofStringvalues.java.awt.datatransfer.DataFlavorgetDataFlavor()java.lang.StringgetFailureMessage()Message to display if this task failedjava.lang.StringgetInputFile()Returns the path of the input file associated with this process.java.lang.StringgetInputString()Returns the path of the input file associated with this process.intgetInstance()java.lang.StringgetLocalName()Returns the local name associated with this XML object.java.lang.StringgetLogger()java.lang.StringgetName()Gets the name for this object.javax.swing.IcongetObjectIcon()Returns theIconassociated with this object.java.lang.StringgetOutputFile()Returns the path of the output file associated with this process.java.lang.StringgetOutputString()Returns the path of the output file associated with this process.TaskParameterInstancegetParameter(java.lang.String name)Returns the parameter instance for the specified name.java.util.HashMap<java.lang.String,TaskParameterInstance>getParameters()InterfacePipelinegetPipeline()java.lang.StringgetPipelineTreeLabel()PipelineProcessgetProcess()Returns the process of which this is an instance.java.lang.StringgetShortXML(int tab)Returns a short XML representation of this object.java.lang.StringgetSuccessMessage()Message to display if this task terminated successfullyjava.lang.StringgetTreeLabel()Returns the label text to appear in a tree node.java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.booleanhasInput()protected voidinitParameters()booleaninterrupt()Attempts to terminate the execution of this task, if it is started, and sets its status toTerminated.booleanisPrependSubjectInput()booleanisPrependSubjectOutput()booleanlaunch()Launches this taskbooleanlaunch(boolean blocking)Launches this taskbooleanlaunch(java.lang.String instance, java.lang.String root)Launches this task with the given project instance and root directorybooleanlaunch(java.lang.String instance, java.lang.String root, boolean blocking)Launches this task with the given project instance and root directorybooleanlaunch(java.lang.String instance, InterfaceProject project, boolean blocking)booleanprocessingFinished(boolean success, PipelineState state)Called when a process worker thread finishes execution or terminates unexpectedly.voidsetFromProcessInstance(PipelineProcessInstance process_instance)voidsetHasInput(boolean hasInput)voidsetInputFile(java.lang.String file)Sets the path of the output file associated with this process.voidsetInstance(int instance)voidsetLogger(java.lang.String logger)voidsetOutputFile(java.lang.String file)Sets the path of the output file associated with this process.booleansetParameter(java.lang.String name, java.lang.String value)Sets the value of the specified parameter.booleansetParameter(java.lang.String name, java.lang.String value, boolean apply)Sets the value of the specified parameter, and whether it should be applied.voidsetParameters(java.util.HashMap<java.lang.String,TaskParameterInstance> parameters)Sets the parameters for this process.voidsetPipeline(InterfacePipeline pipeline)voidsetPrependSubjectInput(boolean prependSubjectInput)voidsetPrependSubjectOutput(boolean prependSubjectOutput)voidsetProcess(PipelineProcess process)Sets the process defining this instance.voidsetTreeNode(InterfaceTreeNode node)Sets the children for this node'sInterfaceTreeNode.java.lang.StringtoString()Methods inherited from class mgui.pipelines.PipelineTask
addListener, compareTo, fireStatusChanged, getDTD, getElapsedTime, getStatus, getStatusStr, getTransferData, getTransferDataFlavors, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, isDataFlavorSupported, issueTreeNode, launch, removeListener, reset, setName, setStatus, treeNodeDetached, updateListeners, writeXML, writeXML, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, isDestroyed, updateTreeNodesMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
pipeline
-
process
-
uid
protected long uid -
instance
protected int instance -
has_input
protected boolean has_input -
output_file
protected java.lang.String output_file -
input_file
protected java.lang.String input_file -
prepend_instance_input
protected boolean prepend_instance_input -
prepend_instance_output
protected boolean prepend_instance_output -
logger
protected java.lang.String logger -
parameters
-
data_flavor
protected static java.awt.datatransfer.DataFlavor data_flavor
-
-
Constructor Details
-
PipelineProcessInstance
public PipelineProcessInstance() -
PipelineProcessInstance
-
PipelineProcessInstance
-
-
Method Details
-
setFromProcessInstance
-
setPipeline
- Specified by:
setPipelinein classPipelineTask
-
getPipeline
- Specified by:
getPipelinein classPipelineTask
-
getDataFlavor
public java.awt.datatransfer.DataFlavor getDataFlavor()- Specified by:
getDataFlavorin classPipelineTask
-
initParameters
protected void initParameters() -
getParameter
Returns the parameter instance for the specified name.- Parameters:
name-- Returns:
-
getProcess
Returns the process of which this is an instance.- Returns:
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getName
public java.lang.String getName()Description copied from interface:NamedObjectGets the name for this object.- Specified by:
getNamein interfaceNamedObject- Overrides:
getNamein classPipelineTask- Returns:
-
launch
Description copied from class:PipelineTaskLaunches this task- Specified by:
launchin classPipelineTask- Returns:
true, if this launch was successful- Throws:
PipelineException- If some exception was encountered during execution
-
launch
Description copied from class:PipelineTaskLaunches this task- Specified by:
launchin classPipelineTask- Parameters:
blocking- Indicates whether this task should block or return immediately- Returns:
true, if this launch was successful- Throws:
PipelineException- If some exception was encountered during execution
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classPipelineTask- Throws:
java.lang.CloneNotSupportedException
-
launch
Description copied from class:PipelineTaskLaunches this task with the given project instance and root directory- Specified by:
launchin classPipelineTask- Parameters:
instance- The project instance for which to launch this taskroot- The project root directory- Returns:
true, if this launch was successful- Throws:
PipelineException- If some exception was encountered during execution
-
launch
public boolean launch(java.lang.String instance, java.lang.String root, boolean blocking) throws PipelineExceptionDescription copied from class:PipelineTaskLaunches this task with the given project instance and root directory- Specified by:
launchin classPipelineTask- Parameters:
instance- The project instance for which to launch this taskroot- The project root directoryblocking- Indicates whether this task should block or return immediately- Returns:
true, if this launch was successful- Throws:
PipelineException- If some exception was encountered during execution
-
launch
public boolean launch(java.lang.String instance, InterfaceProject project, boolean blocking) throws PipelineException- Specified by:
launchin classPipelineTask- Throws:
PipelineException
-
processingFinished
Called when a process worker thread finishes execution or terminates unexpectedly.- Parameters:
success- Whether process returned successfullystate- The state of the pipeline which launched this process instance- Returns:
-
interrupt
Description copied from class:PipelineTaskAttempts to terminate the execution of this task, if it is started, and sets its status toTerminated.- Overrides:
interruptin classPipelineTask- Throws:
PipelineException
-
getArguments
Returns the parameters of this process instance as an array ofStringvalues.- Returns:
-
getArguments
Returns the parameters of this process instance as an array ofStringvalues, for the specific instance and root directory.- Parameters:
instance-shapes_dir-- Returns:
-
getArguments
public java.lang.String[] getArguments(java.lang.String instance, InterfaceProject project, PipelineState state)Returns the parameters of this process instance as an array ofStringvalues, for the specific instance and project.- Parameters:
instance-project-- Returns:
-
getSuccessMessage
public java.lang.String getSuccessMessage()Description copied from class:PipelineTaskMessage to display if this task terminated successfully- Specified by:
getSuccessMessagein classPipelineTask- Returns:
-
getFailureMessage
public java.lang.String getFailureMessage()Description copied from class:PipelineTaskMessage to display if this task failed- Specified by:
getFailureMessagein classPipelineTask- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Returns:
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObjectReturns the label text to appear in a tree node.- Specified by:
getTreeLabelin interfaceTreeObject- Overrides:
getTreeLabelin classAbstractInterfaceObject- Returns:
-
getPipelineTreeLabel
public java.lang.String getPipelineTreeLabel()- Overrides:
getPipelineTreeLabelin classPipelineTask
-
setParameter
public boolean setParameter(java.lang.String name, java.lang.String value, boolean apply)Sets the value of the specified parameter, and whether it should be applied.- Parameters:
name-value-apply-- Returns:
-
setParameter
public boolean setParameter(java.lang.String name, java.lang.String value)Sets the value of the specified parameter.- Parameters:
name-value-apply-- Returns:
-
setTreeNode
Description copied from interface:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein classAbstractInterfaceObject
-
getOutputFile
public java.lang.String getOutputFile()Returns the path of the output file associated with this process.- Returns:
-
setOutputFile
public void setOutputFile(java.lang.String file)Sets the path of the output file associated with this process. -
getInputFile
public java.lang.String getInputFile()Returns the path of the input file associated with this process.- Returns:
-
setInputFile
public void setInputFile(java.lang.String file)Sets the path of the output file associated with this process. -
getOutputString
public java.lang.String getOutputString()Returns the path of the output file associated with this process. If no output file is set, returns "none".- Returns:
-
getInputString
public java.lang.String getInputString()Returns the path of the input file associated with this process. If this process has no input, returns "none". If it is set to receive input from the previous process, returns "previous".- Returns:
-
getLocalName
public java.lang.String getLocalName()Description copied from interface:XMLObjectReturns the local name associated with this XML object.- Specified by:
getLocalNamein interfaceXMLObject- Overrides:
getLocalNamein classPipelineTask- Returns:
-
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObjectReturns a short XML representation of this object.- Specified by:
getShortXMLin interfaceXMLObject- Overrides:
getShortXMLin classPipelineTask- Returns:
-
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 classPipelineTask- Parameters:
tab- The number of tabs to place before the opening XML wrapper- Returns:
-
getInstance
public int getInstance() -
setInstance
public void setInstance(int instance) -
hasInput
public boolean hasInput() -
setHasInput
public void setHasInput(boolean hasInput) -
getLogger
public java.lang.String getLogger() -
setLogger
public void setLogger(java.lang.String logger) -
getParameters
-
setParameters
Sets the parameters for this process.- Parameters:
process_instance-
-
setProcess
Sets the process defining this instance.- Parameters:
process-
-
isPrependSubjectInput
public boolean isPrependSubjectInput() -
setPrependSubjectInput
public void setPrependSubjectInput(boolean prependSubjectInput) -
isPrependSubjectOutput
public boolean isPrependSubjectOutput() -
setPrependSubjectOutput
public void setPrependSubjectOutput(boolean prependSubjectOutput)
-