Package mgui.pipelines
Class InterfacePipeline
java.lang.Object
mgui.interfaces.AbstractInterfaceObject
mgui.pipelines.PipelineTask
mgui.pipelines.InterfacePipeline
- All Implemented Interfaces:
java.awt.datatransfer.Transferable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<PipelineTask>
,InterfaceObject
,NamedObject
,TaskTreeNodeListener
,TreeObject
,CleanableObject
,XMLObject
,PipelineTaskListener
,IconObject
public class InterfacePipeline extends PipelineTask implements PipelineTaskListener
Represents a series of
Task
s that are to be run sequentially, such that the output of a
task becomes the input of the subsequent one.- 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 InterfaceProject
assigned_project
protected static java.awt.datatransfer.DataFlavor
data_flavor
protected java.lang.String
instance
protected InterfacePipeline
root_pipeline
protected PipelineState
state
protected java.util.LinkedList<PipelineTask>
tasks
protected boolean
terminate_on_failure
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 InterfacePipeline()
InterfacePipeline(java.lang.String name)
InterfacePipeline(java.lang.String name, java.util.LinkedList<PipelineTask> processes)
-
Method Summary
Modifier and Type Method Description void
addDynamicListener(DynamicPipelineListener listener)
void
addStaticListener(StaticPipelineListener listener)
void
append(PipelineTask process)
java.lang.Object
clone()
protected void
firePipelineLaunched()
protected void
firePipelineTaskLaunched(PipelineTask task)
protected void
firePipelineTaskTerminated(PipelineTask task)
protected void
firePipelineTaskUpdated(PipelineTask task)
protected void
firePipelineTerminated()
protected void
fireStaticListeners(StaticPipelineEvent event)
void
fireTaskModified(PipelineTask task)
java.lang.String
getCurrentInstance()
java.awt.datatransfer.DataFlavor
getDataFlavor()
java.lang.String
getFailureMessage()
Message to display if this task failedjavax.swing.Icon
getObjectIcon()
Returns theIcon
associated with this object.InterfacePipeline
getPipeline()
java.io.File
getRootDir()
PipelineState
getState()
Returns the state of this pipeline, or the root pipeline if this is not the root.java.lang.String
getSuccessMessage()
Message to display if this task terminated successfullyPipelineTask
getTaskAtIndex(int index)
int
getTaskIndex(PipelineTask task)
java.util.LinkedList<PipelineTask>
getTasks()
java.lang.String
getXML(int tab)
Returns this object's XML representation as a single string.void
insert(int index, PipelineTask process)
void
insertBefore(PipelineTask existing_task, PipelineTask new_task)
Insertexisting_task
beforenew_task
.boolean
interrupt()
Attempts to terminate the execution of this task, if it is started, and sets its status toTerminated
.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_dir, boolean blocking)
Launches this task with the given project instance and root directoryboolean
launch(java.lang.String instance, InterfaceProject project, boolean blocking)
void
push(PipelineTask process)
void
remove(PipelineTask process)
void
removeDynamicListener(DynamicPipelineListener listener)
void
removeStaticListener(StaticPipelineListener listener)
void
reset()
Resets this task, and sets its status toNotStarted
.void
resetTaskInstances()
void
setPipeline(InterfacePipeline pipeline)
void
setProject(InterfaceProject project)
boolean
setRootDirectory(java.io.File d)
void
setSubject(java.lang.String subject)
void
setTaskInstance(PipelineTask task)
void
setTreeNode(InterfaceTreeNode node)
Sets the children for this node'sInterfaceTreeNode
.void
taskStatusChanged(PipelineTaskEvent e)
java.lang.String
toString()
void
writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar)
Writes the XML representation of this object to file.Methods inherited from class mgui.pipelines.PipelineTask
addListener, compareTo, fireStatusChanged, getDTD, getElapsedTime, getLocalName, getName, getPipelineTreeLabel, getShortXML, getStatus, getStatusStr, getTransferData, getTransferDataFlavors, getXML, getXMLSchema, handleXMLElementEnd, handleXMLElementStart, handleXMLString, isDataFlavorSupported, issueTreeNode, launch, removeListener, setName, setStatus, treeNodeDetached, updateListeners, writeXML, writeXML
Methods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, updateTreeNodes
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
state
-
root_pipeline
-
tasks
-
assigned_project
-
instance
protected java.lang.String instance -
data_flavor
protected static java.awt.datatransfer.DataFlavor data_flavor -
terminate_on_failure
protected boolean terminate_on_failure
-
-
Constructor Details
-
InterfacePipeline
public InterfacePipeline() -
InterfacePipeline
public InterfacePipeline(java.lang.String name) -
InterfacePipeline
-
-
Method Details
-
getCurrentInstance
public java.lang.String getCurrentInstance() -
setProject
-
getRootDir
public java.io.File getRootDir() -
addStaticListener
-
removeStaticListener
-
fireStaticListeners
-
addDynamicListener
-
removeDynamicListener
-
firePipelineTaskLaunched
-
firePipelineTaskTerminated
-
firePipelineTaskUpdated
-
firePipelineLaunched
protected void firePipelineLaunched() -
firePipelineTerminated
protected void firePipelineTerminated() -
setPipeline
- Specified by:
setPipeline
in classPipelineTask
-
getPipeline
- Specified by:
getPipeline
in classPipelineTask
-
getState
Returns the state of this pipeline, or the root pipeline if this is not the root.- Returns:
-
getDataFlavor
public java.awt.datatransfer.DataFlavor getDataFlavor()- Specified by:
getDataFlavor
in classPipelineTask
-
setRootDirectory
public boolean setRootDirectory(java.io.File d) -
setSubject
public void setSubject(java.lang.String subject) -
append
-
fireTaskModified
-
resetTaskInstances
public void resetTaskInstances() -
setTaskInstance
-
push
-
insert
-
remove
-
insertBefore
Insertexisting_task
beforenew_task
.- Parameters:
existing_task
-new_task
-
-
getTaskAtIndex
-
getTaskIndex
-
getTasks
-
reset
public void reset()Description copied from class:PipelineTask
Resets this task, and sets its status toNotStarted
.- Overrides:
reset
in classPipelineTask
-
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
-
launch
public boolean launch(java.lang.String instance, java.lang.String root_dir, 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_dir
- 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
-
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
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
-
taskStatusChanged
- Specified by:
taskStatusChanged
in interfacePipelineTaskListener
-
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:
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObject
Returns theIcon
associated with this object.- Specified by:
getObjectIcon
in interfaceIconObject
- Returns:
-
setTreeNode
Description copied from interface:TreeObject
Sets the children for this node'sInterfaceTreeNode
.- Specified by:
setTreeNode
in interfaceTreeObject
- Overrides:
setTreeNode
in classAbstractInterfaceObject
-
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:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObject
Writes the XML representation of this object to file. The basic contract for this method is that it should not write a newline character at its start or end. The default format ofXMLFormat.Ascii
will be used.- Specified by:
writeXML
in interfaceXMLObject
- Overrides:
writeXML
in classPipelineTask
- Parameters:
tab
- The number of tabs to place before the XML textwriter
- The writeroptions
- XMLOutputOptions defining the write parametersprogress_bar
- Optional progress updater (may benull
)- Throws:
java.io.IOException
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clone
in classPipelineTask
- Throws:
java.lang.CloneNotSupportedException
-