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
Tasks 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.StatusNested classes/interfaces inherited from interface mgui.interfaces.xml.XMLObject
XMLObject.XMLEncoding, XMLObject.XMLType -
Field Summary
Fields Modifier and Type Field Description protected InterfaceProjectassigned_projectprotected static java.awt.datatransfer.DataFlavordata_flavorprotected java.lang.Stringinstanceprotected InterfacePipelineroot_pipelineprotected PipelineStatestateprotected java.util.LinkedList<PipelineTask>tasksprotected booleanterminate_on_failureFields inherited from class mgui.pipelines.PipelineTask
attributes, current, startFields 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 voidaddDynamicListener(DynamicPipelineListener listener)voidaddStaticListener(StaticPipelineListener listener)voidappend(PipelineTask process)java.lang.Objectclone()protected voidfirePipelineLaunched()protected voidfirePipelineTaskLaunched(PipelineTask task)protected voidfirePipelineTaskTerminated(PipelineTask task)protected voidfirePipelineTaskUpdated(PipelineTask task)protected voidfirePipelineTerminated()protected voidfireStaticListeners(StaticPipelineEvent event)voidfireTaskModified(PipelineTask task)java.lang.StringgetCurrentInstance()java.awt.datatransfer.DataFlavorgetDataFlavor()java.lang.StringgetFailureMessage()Message to display if this task failedjavax.swing.IcongetObjectIcon()Returns theIconassociated with this object.InterfacePipelinegetPipeline()java.io.FilegetRootDir()PipelineStategetState()Returns the state of this pipeline, or the root pipeline if this is not the root.java.lang.StringgetSuccessMessage()Message to display if this task terminated successfullyPipelineTaskgetTaskAtIndex(int index)intgetTaskIndex(PipelineTask task)java.util.LinkedList<PipelineTask>getTasks()java.lang.StringgetXML(int tab)Returns this object's XML representation as a single string.voidinsert(int index, PipelineTask process)voidinsertBefore(PipelineTask existing_task, PipelineTask new_task)Insertexisting_taskbeforenew_task.booleaninterrupt()Attempts to terminate the execution of this task, if it is started, and sets its status toTerminated.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_dir, boolean blocking)Launches this task with the given project instance and root directorybooleanlaunch(java.lang.String instance, InterfaceProject project, boolean blocking)voidpush(PipelineTask process)voidremove(PipelineTask process)voidremoveDynamicListener(DynamicPipelineListener listener)voidremoveStaticListener(StaticPipelineListener listener)voidreset()Resets this task, and sets its status toNotStarted.voidresetTaskInstances()voidsetPipeline(InterfacePipeline pipeline)voidsetProject(InterfaceProject project)booleansetRootDirectory(java.io.File d)voidsetSubject(java.lang.String subject)voidsetTaskInstance(PipelineTask task)voidsetTreeNode(InterfaceTreeNode node)Sets the children for this node'sInterfaceTreeNode.voidtaskStatusChanged(PipelineTaskEvent e)java.lang.StringtoString()voidwriteXML(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, writeXMLMethods inherited from class mgui.interfaces.AbstractInterfaceObject
clean, destroy, getTreeLabel, isDestroyed, updateTreeNodesMethods 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:
setPipelinein classPipelineTask
-
getPipeline
- Specified by:
getPipelinein 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:
getDataFlavorin 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_taskbeforenew_task.- Parameters:
existing_task-new_task-
-
getTaskAtIndex
-
getTaskIndex
-
getTasks
-
reset
public void reset()Description copied from class:PipelineTaskResets this task, and sets its status toNotStarted.- Overrides:
resetin classPipelineTask
-
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
-
launch
public boolean launch(java.lang.String instance, java.lang.String root_dir, 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_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:
launchin classPipelineTask- Throws:
PipelineException
-
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
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
-
taskStatusChanged
- Specified by:
taskStatusChangedin interfacePipelineTaskListener
-
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:
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
getObjectIcon
public javax.swing.Icon getObjectIcon()Description copied from interface:IconObjectReturns theIconassociated with this object.- Specified by:
getObjectIconin interfaceIconObject- Returns:
-
setTreeNode
Description copied from interface:TreeObjectSets the children for this node'sInterfaceTreeNode.- Specified by:
setTreeNodein interfaceTreeObject- Overrides:
setTreeNodein classAbstractInterfaceObject
-
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:
-
writeXML
public void writeXML(int tab, java.io.Writer writer, XMLOutputOptions options, ProgressUpdater progress_bar) throws java.io.IOExceptionDescription copied from interface:XMLObjectWrites 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.Asciiwill be used.- Specified by:
writeXMLin interfaceXMLObject- Overrides:
writeXMLin 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:
clonein classPipelineTask- Throws:
java.lang.CloneNotSupportedException
-