public class ALDWorkflow extends ALDOperatorControllable implements ALDWorkflowEventReporter
ALDOperator
and
edges connecting output parameters of the source node with input parameters of the target node.Modifier and Type | Class and Description |
---|---|
static class |
ALDWorkflow.ALDWorkflowContextType
workflow context types.
|
private static class |
ALDWorkflow.COMPATIBILITY |
(package private) class |
ALDWorkflow.ExecuteThread
This thread executes all non-ready nodes in the given order.
|
ALDOperatorControllable.OperatorControlStatus, ALDOperatorControllable.OperatorControlStatusHandle, ALDOperatorControllable.OperatorExecutionStatus
ALDOperator.HidingMode, ALDOperator.HistoryConstructionMode
Modifier and Type | Field and Description |
---|---|
private static ALDDataConverterManager |
converterManager
converter manager singleton instance
|
(package private) static int |
debug
For debugging information
|
private static HashMap<ALDWorkflowEdgeID,ALDWorkflowEdge> |
edgeIdToEdge
Hash map of edges of this workflow.
|
private LinkedList<ALDWorkflowEdge> |
edges
All edges of this workflow.
|
private static HashMap<ALDWorkflowEdge,ALDWorkflowEdgeID> |
edgeToEdgeId |
private boolean |
executionInterrupted
Deprecated.
|
private ALDWorkflowNode |
interiorShadowNode
This node is used as an interior shadow (or substitute) for the
node holding this workflow.
|
(package private) ALDWorkflowEdgeID[] |
loadIndexToEdgeId
Gives the edgeIds of last loading of this workflow from an external representation
in the order as store externally.
|
(package private) ALDWorkflowNodeID[] |
loadIndexToNodeId
Gives the nodeIds of last loading of this workflow from an external representation
in the order as store externally.
|
private static HashMap<ALDWorkflowNodeID,ALDWorkflowNode> |
nodeIdToNode
Hash map of operator nodes of this workflow.
|
private LinkedList<ALDWorkflowNode> |
nodes
All nodes contained in this workflow
|
private static HashMap<ALDWorkflowNode,ALDWorkflowNodeID> |
nodeToNodeId |
(package private) boolean |
resetDisconnectedInput
If true, an input parameter is reset (currently set to null)
if is is disconnected (by removing or redirecting an edge) from its source.
|
static String |
untitledWorkflowName
Name of a workflow with out a proper name
|
private ALDWorkflow.ALDWorkflowContextType |
workflowContext
Determines the context of this workflow
|
private HashMap<ALDWorkflowEventListener,ALDWorkflowEventManager> |
workflowEventMangerList
List of control event listeners attached to this workflow.
|
protected static EventListenerList |
workflowLoadEventlistenerList
List of control event listeners attached to this class used for loading workflows.
|
static String |
workflowXMLFileExtension
Standard extension for a xml file holding the external representation
of a workflow.
|
configurationEventlistenerList, controlEventlistenerList, notifyListenersRecursively, operatorExecStatus, stepSize, stepWiseExecution
completeDAG, name, operatorExecutionEventlistenerList, portHashAccess, verbose, versionProvider
Constructor and Description |
---|
ALDWorkflow()
Constructor for an untitled workflow in a grappa context.
|
ALDWorkflow(ALDWorkflow.ALDWorkflowContextType context)
Constructor for an untitled workflow
|
ALDWorkflow(String name)
Constructor for a workflow in a grappa context.
|
ALDWorkflow(String name,
ALDWorkflow.ALDWorkflowContextType context)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static void |
addALDWorkflowClassEventListener(ALDWorkflowClassEventListener listener)
Add a listener for events thrown by the class ALDWorkflow (not an instance).
|
void |
addALDWorkflowEventListener(ALDWorkflowEventListener listener)
Adds a listener to this reporter.
|
private void |
addEdge(ALDWorkflowEdge edge) |
private void |
addNode(ALDWorkflowNode node)
Add this node to the workflow, create a NodeId and update mapping.
|
private boolean |
checkDataflowStateChange(ALDWorkflowNode node)
Updates the state of this node according to the states of its parents.
|
private boolean |
checkLocalStateChange(ALDWorkflowNode node)
Updates the state of this node according to its local configuration.
|
private boolean |
checkParentStates(ALDWorkflowNode node,
ALDWorkflowNode.ALDWorkflowNodeState requiredState)
Check if all parents of the given node have a state at least
requiredState . |
private ALDWorkflow.COMPATIBILITY |
classesAllowed(ALDOpParameterDescriptor sourceDescriptor,
ALDOpParameterDescriptor targetDescriptor,
ALDWorkflowEdge edge)
Check if class of source parameter is assignable to target parameter
or may be converted by a converter provider or is incompatible
|
ALDWorkflowNodeID |
copyNode(ALDWorkflowNodeID nodeId,
boolean retainInEdges,
boolean retainParameterValues)
Copy this node.
|
protected ALDWorkflowNodeID |
createChildWorkflow()
Add a new workflow as a child to this workflow.
|
protected ALDWorkflowNodeID |
createChildWorkflow(String name)
Add a new workflow as a child to this workflow.
|
ALDWorkflowEdgeID |
createEdge(ALDWorkflowNodeID sourceNodeId,
String sourceParameterName,
ALDWorkflowNodeID targetNodeId,
String targetParameterName)
This method calls
createEdge with the argument allowDataConversion = false . |
ALDWorkflowEdgeID |
createEdge(ALDWorkflowNodeID sourceNodeId,
String sourceParameterName,
ALDWorkflowNodeID targetNodeId,
String targetParameterName,
Boolean allowDataConversion)
Add an edge representing the data flow between the parameter
sourceParameterName in the operator represented by the node
with sourceNodeId
to the parameter targetParameterName in the operator represented by the node with
targetNodeId . |
ALDWorkflowNodeID |
createNode(ALDOperator op)
Add a new operator to this workflow.
|
ALDWorkflowNodeID |
createNode(ALDOperatorLocation location)
Add a new operator node to this workflow.
|
ALDWorkflowNodeID |
createNode(String opName)
Add a new operator node to this workflow.
|
private void |
directionAllowd(ALDWorkflowNode sourceNode,
ALDOpParameterDescriptor sourceDescriptor,
ALDWorkflowNode targetNode,
ALDOpParameterDescriptor targetDescriptor)
Checks if the direction are allowed
Source parameter
If the source node represents the workflow, the source parameter needs to be of direction IN or
INOUT . |
private void |
doStateChange(ALDWorkflowNode node,
ALDWorkflowNode.ALDWorkflowNodeState newState)
Set the new state in the node and fire corresponding event.
|
private void |
edgeAllowed(ALDWorkflowEdge edge,
Boolean allowDataConversion)
Check if this edge is allowed.
|
(package private) static String |
edgeIdsToString(Collection<ALDWorkflowEdge> edges)
Formats the ids of the given edges into a string for debugging purposes.
|
private static void |
executeNode(ALDWorkflow workflow,
ALDWorkflowNode node,
boolean showResults)
This actually runOps the operator in its own thread
and takes care of firing events for state changes.
|
private void |
executeNonReadyNodes(List<ALDWorkflowNode> nodes,
boolean waitForCompletion)
Run all not ready nodes of the list in the given order.
|
static void |
fireALDWorkflowClassEvent(ALDWorkflowClassEvent aldWorkflowClassEvent)
Fire an event by the class ALDWorkflow.
|
void |
fireALDWorkflowEvent(ALDWorkflowEvent event)
Sends the given event to all registered listeners.
|
ALDWorkflowEdge |
getEdge(ALDWorkflowEdgeID edgeId)
Get the workflow edge associated with
edgeId . |
ALDWorkflowEdge |
getEdge(ALDWorkflowNode sourceNode,
String sourceParameterName,
ALDWorkflowNode targetNode,
String targetParameterName)
Get the workflow edge connecting given edges and parameters.
|
ALDWorkflowEdgeID |
getEdgeIdDuringLoading(Integer idx)
Return the edgeId of the idx-th edge according to the order of the edges
in the external representation resulting from (last) loading this workflow.
|
Collection<ALDWorkflowEdge> |
getEdges()
Return a collection of all edges of this workflow
|
BlockingDeque<ALDWorkflowEvent> |
getEventQueue(ALDWorkflowEventListener listener)
Returns the event queue associated with the
listener or null
it the listener is not registered. |
HashMap<ALDWorkflowEdgeID,Integer> |
getMappingEdgeIdToInteger()
Return the current mapping of EdgeIds to integer ids.
|
HashMap<Integer,ALDWorkflowEdgeID> |
getMappingIntegerToEdgeId()
Return the current mapping of integer ids to EdgeIds.
|
HashMap<Integer,ALDWorkflowNodeID> |
getMappingIntegerToNodeId()
Return the current mapping of integer ids to NodeIds.
|
HashMap<ALDWorkflowNodeID,Integer> |
getMappingNodeIdToInteger()
Return the current mapping of NodeIds to integer ids.
|
Collection<String> |
getMissingRequiredInputs(ALDWorkflowNodeID nodeId)
Returns the names of all required input parameters of the operator object associated with the node
which are not linked and have a value of null.
|
ALDWorkflowNode |
getNode(ALDWorkflowNodeID nodeId)
Get the workflow node associated with
nodeId . |
ALDWorkflowNodeID |
getNodeIdDuringLoading(Integer idx)
Return the nodeId of the idx-th node according to the order of the nodes
in the external representation resulting from (last) loading this workflow.
|
Collection<ALDWorkflowNode> |
getNodes()
Return a collection of all nodes of this workflow
|
private ALDWorkflowNode |
getNodeWithoutSources(HashMap<ALDWorkflowNode,Set<ALDWorkflowNode>> sourceNodeMap)
Returns one node from the
sourceNodeMap with zero
source nodes, if any. |
ALDOperator |
getOperator(ALDWorkflowNodeID nodeId)
Get the operator associated with
nodeId . |
ALDWorkflowNodeID |
getShadowNodeId() |
ALDWorkflowNodeID |
getSourceNodeId(ALDWorkflowEdgeID edgeId)
Return the NodeId of the source node of this edge
|
String |
getSourceParameterName(ALDWorkflowEdgeID edgeId)
Return the source parameter name of this edge
|
ALDWorkflowNode.ALDWorkflowNodeState |
getState(ALDWorkflowNodeID nodeId)
Get the state of node with
nodeId . |
ALDWorkflowNodeID |
getTargetNodeId(ALDWorkflowEdgeID edgeId)
Return the NodeId of the target node of this edge
|
String |
getTargetParameterName(ALDWorkflowEdgeID edgeId)
Return the target parameter name of this edge
|
ALDWorkflow.ALDWorkflowContextType |
getWorkflowContext() |
void |
handleOperatorExecutionProgressEvent(ALDOperatorExecutionProgressEvent e)
Method which is called on event occurence.
|
void |
interruptExecution()
Deprecated.
|
boolean |
isResetDisconnectedInput() |
static ALDWorkflow |
load(File file)
Load a workflow from
File and create a new workflow object. |
static ALDWorkflow |
load(File file,
boolean doFireEvent)
Load a workflow from
File and create a new workflow object. |
static ALDWorkflow |
load(String filename)
Load a workflow from file with
filename and create a new workflow object. |
static ALDWorkflow |
load(String filename,
boolean doFireEvent)
Load a workflow from file with
filename and create a new workflow object. |
protected static ALDWorkflowEdge |
mapeEdgeIdToEdge(ALDWorkflowEdgeID edgeId)
Map an edgeId to its edge.
|
protected static ALDWorkflowEdgeID |
mapEgdeToEdgeId(ALDWorkflowEdge edge) |
protected static ALDWorkflowNode |
mapNodeIdToNode(ALDWorkflowNodeID nodeId)
Map a nodeId to its node.
|
protected static ALDWorkflowNodeID |
mapNodeToNodeId(ALDWorkflowNode node)
Map a node to its NodeId
|
(package private) static String |
nodeIdsToString(Collection<ALDWorkflowNode> nodes)
Formats the ids of the given nodes into a string for debugging purposes.
|
void |
nodeParameterChanged(ALDWorkflowNodeID nodeId)
Notify the workflow that parameters of the operator object associated with node
nodeId have changed. |
protected void |
operate()
This method does the actual work and needs to be implemented by every
subclass.
|
void |
print()
Print some information of the current state this operator to System.out.
|
protected Object |
readResolve()
Init function for deserialized objects.
|
void |
redirectSource(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newSourceNodeId,
String newSourceParameterName)
Call
redirectSource with with the argument allowDataConversion = false . |
void |
redirectSource(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newSourceNodeId,
String newSourceParameterName,
Boolean allowDataConversion)
Redirect the source of an edge.
|
void |
redirectTarget(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newTargetNodeId,
String newTargetParameterName)
Calls
redirectTarget with the argument allowDataConversion = false
The same restrictions as for createEdge apply. |
void |
redirectTarget(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newTargetNodeId,
String newTargetParameterName,
Boolean allowDataConversion)
Redirect the target of an edge.
|
protected void |
relocateNode(ALDWorkflowNodeID nodeId,
boolean disconnectEdges)
Relocate the node to this workflow.
|
protected void |
relocateNodes(Collection<ALDWorkflowNodeID> nodeIds,
boolean disconnectEdges)
Relocate the nodes
nodeIds and all edges of the sub graph induced by these
nodes to this workflow. |
static void |
removeALDWorkflowClassEventListener(ALDWorkflowEventListener listener)
Remove a listener for events thrown by the class ALDWorkflow (not an instance).
|
void |
removeALDWorkflowEventListener(ALDWorkflowEventListener listener)
Removes a listener from this reporter.
|
void |
removeEdge(ALDWorkflowEdgeID edgeId)
Remove an edge from the workflow.
|
void |
removeNode(ALDWorkflowNodeID nodeId)
Remove a node with all incoming and outgoing edges from the workflow.
|
void |
runFromNode(ALDWorkflowNodeID nodeId)
Run the given node and all descendants of the given node.
|
void |
runFromNode(ALDWorkflowNodeID nodeId,
boolean waitForCompletion)
Run the given node and all descendants of the given node.
|
void |
runFromNode(ALDWorkflowNodeID nodeId,
boolean waitForCompletion,
boolean stepRecursively)
Run the given node and all descendants of the given node.
|
void |
runNode(ALDWorkflowNodeID nodeId)
Run the given node and all its ancestors.
|
void |
runNode(ALDWorkflowNodeID nodeId,
boolean waitForCompletion)
Run the given node and all its ancestors.
|
void |
runNode(ALDWorkflowNodeID nodeId,
boolean waitForCompletion,
boolean stepRecursively)
Run the given node and all its ancestors.
|
void |
runWorkflow()
Run the complete workflow.
|
void |
runWorkflow(boolean waitForCompletion)
Run the complete workflow.
|
void |
runWorkflow(boolean waitForCompletion,
boolean stepRecursively)
Run the complete workflow.
|
void |
save(File file)
Save this workflow to file.
|
void |
save(File file,
boolean doFireEvent)
Save this workflow to file.
|
void |
save(String filename)
Save this workflow to file.
|
void |
save(String filename,
boolean doFireEvent)
Save this workflow to file.
|
void |
setName(String name)
Set the name of this operator
|
void |
setOperator(ALDWorkflowNodeID nodeId,
ALDOperator newOp)
Set the operator associated with
nodeId . |
(package private) void |
setResetDisconnectedInput(boolean resetDisconnectedInput) |
boolean |
supportsStepWiseExecution()
Function for indicating if step-wise execution is supported.
|
(package private) LinkedList<ALDWorkflowNode> |
topSort()
Topologically sorts all nodes of the workflow.
|
(package private) LinkedList<ALDWorkflowNode> |
topSort(Collection<ALDWorkflowNode> nodes)
Topologically sorts the nodes given in
nodes . |
private void |
updateState(ALDWorkflowNode node)
Convenience method which just invokes
updateStates(Collection, boolean) with the single
node . |
private void |
updateStates(Collection<ALDWorkflowNode> nodesToCheck,
boolean doFireEvent)
Updates the states of
nodesToCheck and their descendants. |
addALDConfigurationEventListener, addALDControlEventListener, fireALDConfigurationEvent, fireALDControlEvent, getControlStatus, getControlStatusHandle, getExecutionStatus, handleALDConfigurationEvent, handleALDControlEvent, removeALDConfigurationEventListener, removeALDControlEventListener, setControlStatus, setNotifyRecursiveFlag
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory
public static final String workflowXMLFileExtension
static int debug
public static final String untitledWorkflowName
private final ALDWorkflow.ALDWorkflowContextType workflowContext
boolean resetDisconnectedInput
private LinkedList<ALDWorkflowNode> nodes
private ALDWorkflowNode interiorShadowNode
private LinkedList<ALDWorkflowEdge> edges
@Deprecated private boolean executionInterrupted
private static HashMap<ALDWorkflowNodeID,ALDWorkflowNode> nodeIdToNode
private static HashMap<ALDWorkflowNode,ALDWorkflowNodeID> nodeToNodeId
private static HashMap<ALDWorkflowEdgeID,ALDWorkflowEdge> edgeIdToEdge
private static HashMap<ALDWorkflowEdge,ALDWorkflowEdgeID> edgeToEdgeId
ALDWorkflowNodeID[] loadIndexToNodeId
getMappingIntegerToNodeId()
ALDWorkflowEdgeID[] loadIndexToEdgeId
getMappingIntegerToEdgeId()
private static ALDDataConverterManager converterManager
private transient HashMap<ALDWorkflowEventListener,ALDWorkflowEventManager> workflowEventMangerList
protected static transient volatile EventListenerList workflowLoadEventlistenerList
public ALDWorkflow(String name) throws ALDOperatorException
name
- of the workflowALDOperatorException
public ALDWorkflow(String name, ALDWorkflow.ALDWorkflowContextType context) throws ALDOperatorException
name
- of the workflowcontext
- context this workflow is running inALDOperatorException
public ALDWorkflow() throws ALDOperatorException
ALDOperatorException
public ALDWorkflow(ALDWorkflow.ALDWorkflowContextType context) throws ALDOperatorException
name
- of the workflowcontext
- context this workflow is running inALDOperatorException
public boolean supportsStepWiseExecution()
ALDOperatorControllable
supportsStepWiseExecution
in class ALDOperatorControllable
protected void operate() throws ALDOperatorException, ALDProcessingDAGException
ALDOperator
operate
in class ALDOperator
ALDOperatorException
ALDProcessingDAGException
public void setName(String name)
ALDOperator
setName
in class ALDOperator
public boolean isResetDisconnectedInput()
void setResetDisconnectedInput(boolean resetDisconnectedInput)
resetDisconnectedInput
- the resetDisconnectedInput to setpublic ALDOperator getOperator(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.nodeId
- id of operator to returnnull
if not existingALDWorkflowException
- if the node with nodeId
does not exist.public void setOperator(ALDWorkflowNodeID nodeId, ALDOperator newOp) throws ALDWorkflowException
nodeId
.
The new operator instance needs to be of the same class as the current operator instance.nodeId
- id of operator to returnALDWorkflowException
- if the new operator instance is of wrong type.public ALDWorkflowNode.ALDWorkflowNodeState getState(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.nodeId
- node idALDWorkflowException
- if the node with nodeId
does not exist.public ALDWorkflow.ALDWorkflowContextType getWorkflowContext()
public Collection<String> getMissingRequiredInputs(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
- ALDWorkflowException
public ALDWorkflowNode getNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.nodeId
- id of workflow node to returnALDWorkflowException
- if the node with nodeId
does not exist.NullPointerException
- if nodeId
is null.public Collection<ALDWorkflowNode> getNodes()
public ALDWorkflowEdge getEdge(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
.edgeId
- ALDWorkflowException
- if the edge with edgeId
does not existpublic ALDWorkflowEdge getEdge(ALDWorkflowNode sourceNode, String sourceParameterName, ALDWorkflowNode targetNode, String targetParameterName)
sourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
- public Collection<ALDWorkflowEdge> getEdges()
public ALDWorkflowNodeID getSourceNodeId(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- ALDWorkflowException
public String getSourceParameterName(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- ALDWorkflowException
public ALDWorkflowNodeID getTargetNodeId(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- ALDWorkflowException
public String getTargetParameterName(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- ALDWorkflowException
public HashMap<ALDWorkflowNodeID,Integer> getMappingNodeIdToInteger()
public HashMap<Integer,ALDWorkflowNodeID> getMappingIntegerToNodeId()
public HashMap<ALDWorkflowEdgeID,Integer> getMappingEdgeIdToInteger()
public HashMap<Integer,ALDWorkflowEdgeID> getMappingIntegerToEdgeId()
public ALDWorkflowNodeID getNodeIdDuringLoading(Integer idx)
#getNodeIds()
at the time of saving
the workflow represented externally.idx
- public ALDWorkflowEdgeID getEdgeIdDuringLoading(Integer idx)
#getEdgeIds()
at the time of saving
the workflow represented externally.idx
- public ALDWorkflowNodeID createNode(String opName) throws ALDWorkflowException
opName
- Name of operator to add in the new nodeALDWorkflowException
- if the operator cannot be instantiatedpublic ALDWorkflowNodeID createNode(ALDOperatorLocation location) throws ALDWorkflowException
opName
- Name of operator to add in the new nodeALDWorkflowException
- if the operator cannot be instantiatedpublic ALDWorkflowNodeID createNode(ALDOperator op) throws ALDWorkflowException
op
- Operator object to add in the new nodeALDWorkflowException
- if on OP_RUNNER context an we get more then one nodepublic ALDWorkflowNodeID copyNode(ALDWorkflowNodeID nodeId, boolean retainInEdges, boolean retainParameterValues) throws ALDWorkflowException
nodeId
- retainInEdges
- copy also all incoming edgesretainParameterValues
- copy the values of all input parametersALDWorkflowException
public void removeNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
- id of the node to be removedALDWorkflowException
- if the node with nodeId
does not existpublic void nodeParameterChanged(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
have changed.nodeId
- ALDWorkflowException
- if the node with nodeId
does not exist.public ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId, String sourceParameterName, ALDWorkflowNodeID targetNodeId, String targetParameterName) throws ALDWorkflowException
createEdge
with the argument allowDataConversion = false
.sourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
- ALDWorkflowException
- if edge is not allowedpublic ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId, String sourceParameterName, ALDWorkflowNodeID targetNodeId, String targetParameterName, Boolean allowDataConversion) throws ALDWorkflowException
sourceParameterName
in the operator represented by the node
with sourceNodeId
to the parameter targetParameterName
in the operator represented by the node with
targetNodeId
.
If a nodeId is null then this nodeId refers to this workflow,
i.e. connects a parameter of the workflow.
Otherwise source and target node need to be a node of this workflow or represent the workflow itself.
The following restrictions apply for the edge to be created:
IN
or
INOUT
.
Otherwise
it needs to be of direction OUT
or
INOUT
.OUT
or
INOUT
.
Otherwise
it needs to be of direction IN
or
INOUT
.allowDataConversion
the parameters are also compatible if a data converter is availablesourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
- allowDataConversion
- if true the edge is allowed in case of non assignable parameters if
a data converter is availableALDWorkflowException
public void removeEdge(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- id of the edge to removeALDWorkflowException
- if edge is not allowed or the edge with edgeId
does not exist.public void redirectSource(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newSourceNodeId, String newSourceParameterName) throws ALDWorkflowException
redirectSource
with with the argument allowDataConversion = false
.
The same restrictions as for createEdge
apply.edgeId
- newSourceNodeId
- newSourceParameterName
- allowDataConversion
- if true the edge is allowed in case of non assignable parameters if
a data converter is availableALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void redirectSource(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newSourceNodeId, String newSourceParameterName, Boolean allowDataConversion) throws ALDWorkflowException
createEdge
apply.edgeId
- newSourceNodeId
- newSourceParameterName
- allowDataConversion
- if true the edge is allowed in case of non assignable parameters if
a data converter is availableALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void redirectTarget(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newTargetNodeId, String newTargetParameterName) throws ALDWorkflowException
redirectTarget
with the argument allowDataConversion = false
The same restrictions as for createEdge
apply.edgeId
- newTargetNodeId
- newTargetParameterName
- ALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void redirectTarget(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newTargetNodeId, String newTargetParameterName, Boolean allowDataConversion) throws ALDWorkflowException
createEdge
apply.edgeId
- newTargetNodeId
- newTargetParameterName
- allowDataConversion
- if true the edge is allowed in case of non assignable parameters if
a data converter is availableALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void save(String filename) throws ALDWorkflowException
filename
- ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void save(String filename, boolean doFireEvent) throws ALDWorkflowException
filename
- doFireEvent
- if true an appropriate event is firedALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void save(File file) throws ALDWorkflowException
filename
- ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void save(File file, boolean doFireEvent) throws ALDWorkflowException
doFireEvent
- if true an appropriate event is firedfilename
- ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic static ALDWorkflow load(String filename) throws ALDWorkflowException
filename
and create a new workflow object.
Does not fire an LOAD event.filename
- ALDWorkflowException
- if file cannot be opened for reading or deserialization failspublic static ALDWorkflow load(String filename, boolean doFireEvent) throws ALDWorkflowException
filename
and create a new workflow object.filename
- doFireEvent
- if true an appropriate event is firedALDWorkflowException
- if file cannot be opened for reading or deserialization failspublic static ALDWorkflow load(File file) throws ALDWorkflowException
File
and create a new workflow object.
Does not fire an LOAD event.file
- ALDWorkflowException
- if file cannot be opened for reading or deserialization failspublic static ALDWorkflow load(File file, boolean doFireEvent) throws ALDWorkflowException
File
and create a new workflow object.file
- doFireEvent
- if true an appropriate event is firedALDWorkflowException
- if file cannot be opened for reading or deserialization failsprotected Object readResolve()
This function is called on an instance of this class being deserialized from file, prior to handing the instance over to the user. It takes care of a proper initialization of transient member variables as they are not initialized to the default values during deserialization.
readResolve
in class ALDOperator
private void edgeAllowed(ALDWorkflowEdge edge, Boolean allowDataConversion) throws ALDWorkflowException
edge
- allowDataConversion
- is data conversion allowed for this edgeALDWorkflowException
- if parameters are incompatibleprivate void directionAllowd(ALDWorkflowNode sourceNode, ALDOpParameterDescriptor sourceDescriptor, ALDWorkflowNode targetNode, ALDOpParameterDescriptor targetDescriptor) throws ALDWorkflowException
IN
or
INOUT
.
Otherwise
it needs to be of direction OUT
or
INOUT
.OUT
or
INOUT
.
Otherwise
it needs to be of direction IN
or
INOUT
.sourceNode
- source nodesourceDescriptor
- Descriptor of the source parametertargetNode
- target nodetargetDescriptor
- Descriptor of the target parameterALDWorkflowException
- if direction is wrongprivate ALDWorkflow.COMPATIBILITY classesAllowed(ALDOpParameterDescriptor sourceDescriptor, ALDOpParameterDescriptor targetDescriptor, ALDWorkflowEdge edge)
sourceDescriptor
- targetDescriptor
- edge
- public void runWorkflow() throws ALDWorkflowException
ALDWorkflowException
- if not all nodes are at least runnable or the execution itself failspublic void runWorkflow(boolean waitForCompletion) throws ALDWorkflowException
waitForCompletion
- if true wait for completion, otherwise return immediatelyALDWorkflowException
- if not all nodes are at least runnable or the execution itself failspublic void runWorkflow(boolean waitForCompletion, boolean stepRecursively) throws ALDWorkflowException
waitForCompletion
- if true wait for completion, otherwise return immediatelystepRecursively
- if true OP_STEP events are passed to the child operatorsALDWorkflowException
- if not all nodes are at least runnable or the execution itself failspublic void runNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
- ALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic void runNode(ALDWorkflowNodeID nodeId, boolean waitForCompletion) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelyALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic void runNode(ALDWorkflowNodeID nodeId, boolean waitForCompletion, boolean stepRecursively) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelystepRecursively
- if true OP_STEP events are passed to the child operatorsALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic void runFromNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
- ALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic void runFromNode(ALDWorkflowNodeID nodeId, boolean waitForCompletion) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelyALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic void runFromNode(ALDWorkflowNodeID nodeId, boolean waitForCompletion, boolean stepRecursively) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelystepRecursively
- if true OP_STEP events are passed to the child operatorsALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not exist@Deprecated public void interruptExecution()
private void executeNonReadyNodes(List<ALDWorkflowNode> nodes, boolean waitForCompletion) throws ALDWorkflowException
nodeIds
- waitForCompletion
- if true wait for completion, otherwise return immediatelyALDWorkflowException
- if one of the nodes is not at least runnable
or the execution itself failsprivate static void executeNode(ALDWorkflow workflow, ALDWorkflowNode node, boolean showResults) throws ALDWorkflowException, ALDOperatorException, ALDProcessingDAGException, ALDDataConverterManagerException, ALDDataConverterManagerException
showResults
is true an corresponding event is fired.workflow
- node
- showResults
- ALDWorkflowException
ALDProcessingDAGException
ALDOperatorException
ALDDataConverterManagerException
ALDDataConverterManagerException
private void updateStates(Collection<ALDWorkflowNode> nodesToCheck, boolean doFireEvent) throws ALDWorkflowException
nodesToCheck
and their descendants.
The nodes nodesToCheck
may have changed their state according
to change of the configuration of their operator or adding/removing of
in coming edges.
These nodes and all their descendants may have also changed their state
due to the data flow dependencies.
This methods changes the states of the nodes within the workflow and also
fires an event notifying the listeners of the state changes.nodesToCheck
- doFireEvent
- if true an appropriate event is firedALDWorkflowException
private void updateState(ALDWorkflowNode node) throws ALDWorkflowException
updateStates(Collection, boolean)
with the single
node
.node
- ALDWorkflowException
private boolean checkLocalStateChange(ALDWorkflowNode node) throws ALDWorkflowException
Note: this method does not fire an event to notify listeners.
node
- ALDWorkflowException
private boolean checkDataflowStateChange(ALDWorkflowNode node) throws ALDWorkflowException
Note: this method does not fire an event to notify listeners.
node
- ALDWorkflowException
private boolean checkParentStates(ALDWorkflowNode node, ALDWorkflowNode.ALDWorkflowNodeState requiredState)
requiredState
.node
- requiredState
- requiredState
ALDWorkflowException
private void doStateChange(ALDWorkflowNode node, ALDWorkflowNode.ALDWorkflowNodeState newState)
node
- newState
- LinkedList<ALDWorkflowNode> topSort(Collection<ALDWorkflowNode> nodes) throws ALDWorkflowException
nodes
.
For sorting the subgraph of the complete workflow induced by nodes
is
considered.
If the subgraph is cyclic an exception is raised.nodes
- of the subgraph to be sortednodes
ALDWorkflowException
- if the subgraph is cyclicor nodes
is null.LinkedList<ALDWorkflowNode> topSort() throws ALDWorkflowException
ALDWorkflowException
- the workflow is cyclicprivate ALDWorkflowNode getNodeWithoutSources(HashMap<ALDWorkflowNode,Set<ALDWorkflowNode>> sourceNodeMap)
sourceNodeMap
with zero
source nodes, if any. If no such node exists, return null.sourceNodeMap
- protected static ALDWorkflowNode mapNodeIdToNode(ALDWorkflowNodeID nodeId)
nodeId
- the node or null if a node with the given nodeId does not existprotected static ALDWorkflowNodeID mapNodeToNodeId(ALDWorkflowNode node)
node
- the NodeId or null (which should not happen)private void addNode(ALDWorkflowNode node)
node
- private void addEdge(ALDWorkflowEdge edge)
protected static ALDWorkflowEdge mapeEdgeIdToEdge(ALDWorkflowEdgeID edgeId)
edgeId
- the edge or null if no edge with the given edgeId existsprotected static ALDWorkflowEdgeID mapEgdeToEdgeId(ALDWorkflowEdge edge)
public ALDWorkflowNodeID getShadowNodeId()
public void addALDWorkflowEventListener(ALDWorkflowEventListener listener)
ALDWorkflowEventReporter
addALDWorkflowEventListener
in interface ALDWorkflowEventReporter
listener
- Listener to be added.public void removeALDWorkflowEventListener(ALDWorkflowEventListener listener)
ALDWorkflowEventReporter
removeALDWorkflowEventListener
in interface ALDWorkflowEventReporter
listener
- Listener to be removed.public BlockingDeque<ALDWorkflowEvent> getEventQueue(ALDWorkflowEventListener listener)
listener
or null
it the listener is not registered.listener
- public void fireALDWorkflowEvent(ALDWorkflowEvent event)
ALDWorkflowEventReporter
fireALDWorkflowEvent
in interface ALDWorkflowEventReporter
event
- Event to be send to all listeners.public static void addALDWorkflowClassEventListener(ALDWorkflowClassEventListener listener)
listener
- public static void removeALDWorkflowClassEventListener(ALDWorkflowEventListener listener)
listener
- public static void fireALDWorkflowClassEvent(ALDWorkflowClassEvent aldWorkflowClassEvent)
aldWorkflowClassEvent
- protected ALDWorkflowNodeID createChildWorkflow()
protected ALDWorkflowNodeID createChildWorkflow(String name)
name
- protected void relocateNode(ALDWorkflowNodeID nodeId, boolean disconnectEdges)
nodeId
- protected void relocateNodes(Collection<ALDWorkflowNodeID> nodeIds, boolean disconnectEdges)
nodeIds
and all edges of the sub graph induced by these
nodes to this workflow.
If disconnectEdges
is true, all edges connecting nodeIds
to nodes outside of this sub graph are removed.
Otherwise an exception is thrown if such edges exist.nodeIds
- disconnectEdges
- public void print()
ALDOperator
print
in class ALDOperator
static String nodeIdsToString(Collection<ALDWorkflowNode> nodes)
nodes
- static String edgeIdsToString(Collection<ALDWorkflowEdge> edges)
edges
- public void handleOperatorExecutionProgressEvent(ALDOperatorExecutionProgressEvent e) throws ALDWorkflowException
ALDOperatorExecutionProgressEventListener
handleOperatorExecutionProgressEvent
in interface ALDOperatorExecutionProgressEventListener
handleOperatorExecutionProgressEvent
in class ALDOperator
e
- Event to be handled.ALDWorkflowException
Copyright © 2010–2021 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.