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.Status
Nested 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.DataFlavor
data_flavor
protected boolean
has_input
protected java.lang.String
input_file
protected int
instance
protected java.lang.String
logger
protected java.lang.String
output_file
protected java.util.HashMap<java.lang.String,TaskParameterInstance>
parameters
protected InterfacePipeline
pipeline
protected boolean
prepend_instance_input
protected boolean
prepend_instance_output
protected PipelineProcess
process
protected long
uid
Fields inherited from class mgui.pipelines.PipelineTask
attributes, current, start
Fields 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.Object
clone()
java.lang.String[]
getArguments(java.lang.String instance, InterfaceProject project, PipelineState state)
Returns the parameters of this process instance as an array ofString
values, 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 ofString
values, for the specific instance and root directory.java.lang.String[]
getArguments(PipelineState state)
Returns the parameters of this process instance as an array ofString
values.java.awt.datatransfer.DataFlavor
getDataFlavor()
java.lang.String
getFailureMessage()
Message to display if this task failedjava.lang.String
getInputFile()
Returns the path of the input file associated with this process.java.lang.String
getInputString()
Returns the path of the input file associated with this process.int
getInstance()
java.lang.String
getLocalName()
Returns the local name associated with this XML object.java.lang.String
getLogger()
java.lang.String
getName()
Gets the name for this object.javax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.java.lang.String
getOutputFile()
Returns the path of the output file associated with this process.java.lang.String
getOutputString()
Returns the path of the output file associated with this process.TaskParameterInstance
getParameter(java.lang.String name)
Returns the parameter instance for the specified name.java.util.HashMap<java.lang.String,TaskParameterInstance>
getParameters()
InterfacePipeline
getPipeline()
java.lang.String
getPipelineTreeLabel()
PipelineProcess
getProcess()
Returns the process of which this is an instance.java.lang.String
getShortXML(int tab)
Returns a short XML representation of this object.java.lang.String
getSuccessMessage()
Message to display if this task terminated successfullyjava.lang.String
getTreeLabel()
Returns the label text to appear in a tree node.java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.boolean
hasInput()
protected void
initParameters()
boolean
interrupt()
Attempts to terminate the execution of this task, if it is started, and sets its status toTerminated
.boolean
isPrependSubjectInput()
boolean
isPrependSubjectOutput()
boolean
launch()
Launches this taskboolean
launch(boolean blocking)
Launches this taskboolean
launch(java.lang.String instance, java.lang.String root)
Launches this task with the given project instance and root directoryboolean
launch(java.lang.String instance, java.lang.String root, boolean blocking)
Launches this task with the given project instance and root directoryboolean
launch(java.lang.String instance, InterfaceProject project, boolean blocking)
boolean
processingFinished(boolean success, PipelineState state)
Called when a process worker thread finishes execution or terminates unexpectedly.void
setFromProcessInstance(PipelineProcessInstance process_instance)
void
setHasInput(boolean hasInput)
void
setInputFile(java.lang.String file)
Sets the path of the output file associated with this process.void
setInstance(int instance)
void
setLogger(java.lang.String logger)
void
setOutputFile(java.lang.String file)
Sets the path of the output file associated with this process.boolean
setParameter(java.lang.String name, java.lang.String value)
Sets the value of the specified parameter.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.void
setParameters(java.util.HashMap<java.lang.String,TaskParameterInstance> parameters)
Sets the parameters for this process.void
setPipeline(InterfacePipeline pipeline)
void
setPrependSubjectInput(boolean prependSubjectInput)
void
setPrependSubjectOutput(boolean prependSubjectOutput)
void
setProcess(PipelineProcess process)
Sets the process defining this instance.void
setTreeNode(InterfaceTreeNode node)
Sets the children for this node'sInterfaceTreeNode
.java.lang.String
toString()
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, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, isDestroyed, updateTreeNodes
Methods 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:
setPipeline
in classPipelineTask
-
getPipeline
- Specified by:
getPipeline
in classPipelineTask
-
getDataFlavor
public java.awt.datatransfer.DataFlavor getDataFlavor()- Specified by:
getDataFlavor
in 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:
toString
in classjava.lang.Object
-
getName
public java.lang.String getName()Description copied from interface:NamedObject
Gets the name for this object.- Specified by:
getName
in interfaceNamedObject
- Overrides:
getName
in classPipelineTask
- Returns:
-
launch
Description copied from class:PipelineTask
Launches this task- Specified by:
launch
in classPipelineTask
- Returns:
true
, if this launch was successful- Throws:
PipelineException
- If some exception was encountered during execution
-
launch
Description copied from class:PipelineTask
Launches this task- Specified by:
launch
in 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:
clone
in classPipelineTask
- Throws:
java.lang.CloneNotSupportedException
-
launch
Description copied from class:PipelineTask
Launches this task with the given project instance and root directory- Specified by:
launch
in 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:PipelineTask
Launches this task with the given project instance and root directory- Specified by:
launch
in 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:
launch
in 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:PipelineTask
Attempts to terminate the execution of this task, if it is started, and sets its status toTerminated
.- Overrides:
interrupt
in classPipelineTask
- Throws:
PipelineException
-
getArguments
Returns the parameters of this process instance as an array ofString
values.- Returns:
-
getArguments
Returns the parameters of this process instance as an array ofString
values, 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 ofString
values, for the specific instance and project.- Parameters:
instance
-project
-- Returns:
-
getSuccessMessage
public java.lang.String getSuccessMessage()Description copied from class:PipelineTask
Message to display if this task terminated successfully- Specified by:
getSuccessMessage
in classPipelineTask
- Returns:
-
getFailureMessage
public java.lang.String getFailureMessage()Description copied from class:PipelineTask
Message to display if this task failed- Specified by:
getFailureMessage
in classPipelineTask
- Returns:
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Returns:
-
getTreeLabel
public java.lang.String getTreeLabel()Description copied from interface:TreeObject
Returns the label text to appear in a tree node.- Specified by:
getTreeLabel
in interfaceTreeObject
- Overrides:
getTreeLabel
in classAbstractInterfaceObject
- Returns:
-
getPipelineTreeLabel
public java.lang.String getPipelineTreeLabel()- Overrides:
getPipelineTreeLabel
in 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:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in 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:XMLObject
Returns the local name associated with this XML object.- Specified by:
getLocalName
in interfaceXMLObject
- Overrides:
getLocalName
in classPipelineTask
- Returns:
-
getShortXML
public java.lang.String getShortXML(int tab)Description copied from interface:XMLObject
Returns a short XML representation of this object.- Specified by:
getShortXML
in interfaceXMLObject
- Overrides:
getShortXML
in classPipelineTask
- Returns:
-
getXML
public java.lang.String getXML(int tab)Description copied from interface:XMLObject
Returns 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:
getXML
in interfaceXMLObject
- Overrides:
getXML
in 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)
-