Class PipelineProcessInstance

java.lang.Object
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
  • Field Details

    • pipeline

      protected InterfacePipeline pipeline
    • process

      protected PipelineProcess 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

      protected java.util.HashMap<java.lang.String,​TaskParameterInstance> parameters
    • data_flavor

      protected static java.awt.datatransfer.DataFlavor data_flavor
  • Constructor Details

    • PipelineProcessInstance

      public PipelineProcessInstance()
    • PipelineProcessInstance

      public PipelineProcessInstance​(PipelineProcess process, int instance)
    • PipelineProcessInstance

      public PipelineProcessInstance​(PipelineProcessInstance process_instance)
  • Method Details

    • setFromProcessInstance

      public void setFromProcessInstance​(PipelineProcessInstance process_instance)
    • setPipeline

      public void setPipeline​(InterfacePipeline pipeline)
      Specified by:
      setPipeline in class PipelineTask
    • getPipeline

      public InterfacePipeline getPipeline()
      Specified by:
      getPipeline in class PipelineTask
    • getDataFlavor

      public java.awt.datatransfer.DataFlavor getDataFlavor()
      Specified by:
      getDataFlavor in class PipelineTask
    • initParameters

      protected void initParameters()
    • getParameter

      public TaskParameterInstance getParameter​(java.lang.String name)
      Returns the parameter instance for the specified name.
      Parameters:
      name -
      Returns:
    • getProcess

      public PipelineProcess getProcess()
      Returns the process of which this is an instance.
      Returns:
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • getName

      public java.lang.String getName()
      Description copied from interface: NamedObject
      Gets the name for this object.
      Specified by:
      getName in interface NamedObject
      Overrides:
      getName in class PipelineTask
      Returns:
    • launch

      public boolean launch() throws PipelineException
      Description copied from class: PipelineTask
      Launches this task
      Specified by:
      launch in class PipelineTask
      Returns:
      true, if this launch was successful
      Throws:
      PipelineException - If some exception was encountered during execution
    • launch

      public boolean launch​(boolean blocking) throws PipelineException
      Description copied from class: PipelineTask
      Launches this task
      Specified by:
      launch in class PipelineTask
      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 class PipelineTask
      Throws:
      java.lang.CloneNotSupportedException
    • launch

      public boolean launch​(java.lang.String instance, java.lang.String root) throws PipelineException
      Description copied from class: PipelineTask
      Launches this task with the given project instance and root directory
      Specified by:
      launch in class PipelineTask
      Parameters:
      instance - The project instance for which to launch this task
      root - 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 PipelineException
      Description copied from class: PipelineTask
      Launches this task with the given project instance and root directory
      Specified by:
      launch in class PipelineTask
      Parameters:
      instance - The project instance for which to launch this task
      root - The project root directory
      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
    • launch

      public boolean launch​(java.lang.String instance, InterfaceProject project, boolean blocking) throws PipelineException
      Specified by:
      launch in class PipelineTask
      Throws:
      PipelineException
    • processingFinished

      public boolean processingFinished​(boolean success, PipelineState state)
      Called when a process worker thread finishes execution or terminates unexpectedly.
      Parameters:
      success - Whether process returned successfully
      state - The state of the pipeline which launched this process instance
      Returns:
    • interrupt

      public boolean interrupt() throws PipelineException
      Description copied from class: PipelineTask
      Attempts to terminate the execution of this task, if it is started, and sets its status to Terminated.
      Overrides:
      interrupt in class PipelineTask
      Throws:
      PipelineException
    • getArguments

      public java.lang.String[] getArguments​(PipelineState state)
      Returns the parameters of this process instance as an array of String values.
      Returns:
    • getArguments

      public java.lang.String[] getArguments​(java.lang.String instance, PipelineState state)
      Returns the parameters of this process instance as an array of String 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 of String 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 class PipelineTask
      Returns:
    • getFailureMessage

      public java.lang.String getFailureMessage()
      Description copied from class: PipelineTask
      Message to display if this task failed
      Specified by:
      getFailureMessage in class PipelineTask
      Returns:
    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon 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 interface TreeObject
      Overrides:
      getTreeLabel in class AbstractInterfaceObject
      Returns:
    • getPipelineTreeLabel

      public java.lang.String getPipelineTreeLabel()
      Overrides:
      getPipelineTreeLabel in class PipelineTask
    • 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

      public void setTreeNode​(InterfaceTreeNode node)
      Description copied from interface: TreeObject
      Sets the children for this node's InterfaceTreeNode.
      Specified by:
      setTreeNode in interface TreeObject
      Overrides:
      setTreeNode in class AbstractInterfaceObject
    • 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 interface XMLObject
      Overrides:
      getLocalName in class PipelineTask
      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 interface XMLObject
      Overrides:
      getShortXML in class PipelineTask
      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 the XMLObject.writeXML(int,java.io.Writer,mgui.io.standard.xml.XMLOutputOptions,mgui.interfaces.ProgressUpdater) functions to write larger objects to file.
      Specified by:
      getXML in interface XMLObject
      Overrides:
      getXML in class PipelineTask
      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

      public java.util.HashMap<java.lang.String,​TaskParameterInstance> getParameters()
    • setParameters

      public void setParameters​(java.util.HashMap<java.lang.String,​TaskParameterInstance> parameters)
      Sets the parameters for this process.
      Parameters:
      process_instance -
    • setProcess

      public void setProcess​(PipelineProcess process)
      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)