|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.operator.ALDOperatorControllable
de.unihalle.informatik.Alida.workflows.ALDWorkflow
public class ALDWorkflow
Class to model a workflow in Alida.
A workflow consists of nodes each holding one ALDOperator
and
edges connecting output parameters of the source node with input parameters of the target node.
Nested Class Summary | |
---|---|
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. |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
ALDOperatorControllable.OperatorControlStatus |
Nested classes/interfaces inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
ALDOperator.HidingMode |
Field Summary | |
---|---|
private static ALDDataConverterManager |
converterManager
converter manager singleton instance |
(package private) static int |
debug
For debugging information |
private static java.util.HashMap<ALDWorkflowEdgeID,ALDWorkflowEdge> |
edgeIdToEdge
Hash map of edges of this workflow. |
private java.util.LinkedList<ALDWorkflowEdge> |
edges
All edges of this workflow. |
private static java.util.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. |
private static java.util.HashMap<ALDWorkflowNodeID,ALDWorkflowNode> |
nodeIdToNode
Hash map of operator nodes of this workflow. |
private java.util.LinkedList<ALDWorkflowNode> |
nodes
All nodes contained in this workflow |
private static java.util.HashMap<ALDWorkflowNode,ALDWorkflowNodeID> |
nodeToNodeId
|
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 java.lang.String |
untitledWorkflowName
Name of a workflow with out a proper name |
private ALDWorkflow.ALDWorkflowContextType |
workflowContext
Determines the context of this workflow |
private java.util.HashMap<ALDWorkflowEventListener,ALDWorkflowEventManager> |
workflowEventMangerList
List of control event listeners attached to this workflow. |
protected static javax.swing.event.EventListenerList |
workflowLoadEventlistenerList
List of control event listeners attached to this class used for loading workflows. |
static java.lang.String |
workflowXMLFileExtension
Standard extension for a xml file holding the external representation of a workflow. |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
configurationEventlistenerList, controlEventlistenerList, notifyListenersRecursively, operatorStatus, stepSize, stepWiseExecution |
Fields inherited from class de.unihalle.informatik.Alida.operator.ALDOperator |
---|
completeDAG, name, portHashAccess, verbose, versionProvider |
Constructor Summary | |
---|---|
ALDWorkflow()
Constructor for an untitled workflow in a grappa context. |
|
ALDWorkflow(ALDWorkflow.ALDWorkflowContextType context)
Constructor for an untitled workflow |
|
ALDWorkflow(java.lang.String name)
Constructor for a workflow in a grappa context. |
|
ALDWorkflow(java.lang.String name,
ALDWorkflow.ALDWorkflowContextType context)
Constructor |
Method Summary | |
---|---|
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. |
void |
addParameter(ALDOpParameterDescriptor descriptor)
Add a new parameter to this workflow. |
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(java.lang.String name)
Add a new workflow as a child to this workflow. |
ALDWorkflowEdgeID |
createEdge(ALDWorkflowNodeID sourceNodeId,
java.lang.String sourceParameterName,
ALDWorkflowNodeID targetNodeId,
java.lang.String targetParameterName)
This method calls createEdge with the argument allowDataConversion = false . |
ALDWorkflowEdgeID |
createEdge(ALDWorkflowNodeID sourceNodeId,
java.lang.String sourceParameterName,
ALDWorkflowNodeID targetNodeId,
java.lang.String targetParameterName,
java.lang.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(java.lang.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,
java.lang.Boolean allowDataConversion)
Check if this edge is allowed. |
(package private) static java.lang.String |
edgeIdsToString(java.util.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(java.util.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,
java.lang.String sourceParameterName,
ALDWorkflowNode targetNode,
java.lang.String targetParameterName)
Get the workflow edge connecting given edges and parameters. |
java.util.Collection<ALDWorkflowEdgeID> |
getEdgeIds()
Return the current collection of EdgeIds of this workflow. |
java.util.concurrent.BlockingDeque<ALDWorkflowEvent> |
getEventQueue(ALDWorkflowEventListener listener)
Returns the event queue associated with the listener or null
it the listener is not registered. |
java.util.HashMap<ALDWorkflowEdgeID,java.lang.Integer> |
getMappingEdgeIdToInteger()
Return the current mapping of EdgeIds to integer ids. |
java.util.HashMap<java.lang.Integer,ALDWorkflowEdgeID> |
getMappingIntegerToEdgeId()
Return the current mapping of integer ids to EdgeIds. |
java.util.HashMap<java.lang.Integer,ALDWorkflowNodeID> |
getMappingIntegerToNodeId()
Return the current mapping of integer ids to NodeIds. |
java.util.HashMap<ALDWorkflowNodeID,java.lang.Integer> |
getMappingNodeIdToInteger()
Return the current mapping of NodeIds to integer ids. |
java.util.Collection<java.lang.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 . |
java.util.Collection<ALDWorkflowNodeID> |
getNodeIds()
Return the current collection of NodeIds of this workflow. |
private ALDWorkflowNode |
getNodeWithoutSources(java.util.HashMap<ALDWorkflowNode,java.util.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 . |
java.lang.Object |
getParameter(java.lang.String name)
Get the value of a parameter specified by name. |
ALDWorkflowNodeID |
getShadowNodeId()
|
ALDWorkflowNodeID |
getSourceNodeId(ALDWorkflowEdgeID edgeId)
Return the NodeId of the source node of this edge |
java.lang.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 |
java.lang.String |
getTargetParameterName(ALDWorkflowEdgeID edgeId)
Return the target parameter name of this edge |
ALDWorkflow.ALDWorkflowContextType |
getWorkflowContext()
|
void |
interruptExecution()
Deprecated. |
boolean |
isResetDisconnectedInput()
|
static ALDWorkflow |
load(java.io.File file)
Load a workflow from File and create a new workflow object. |
static ALDWorkflow |
load(java.io.File file,
boolean doFireEvent)
Load a workflow from File and create a new workflow object. |
static ALDWorkflow |
load(java.lang.String filename)
Load a workflow from file with filename and create a new workflow object. |
static ALDWorkflow |
load(java.lang.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 java.lang.String |
nodeIdsToString(java.util.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 java.lang.Object |
readResolve()
Init function for deserialized objects. |
void |
redirectSource(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newSourceNodeId,
java.lang.String newSourceParameterName)
Call redirectSource with with the argument allowDataConversion = false . |
void |
redirectSource(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newSourceNodeId,
java.lang.String newSourceParameterName,
java.lang.Boolean allowDataConversion)
Redirect the source of an edge. |
void |
redirectTarget(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newTargetNodeId,
java.lang.String newTargetParameterName)
Calls redirectTarget with the argument allowDataConversion = false
The same restrictions as for createEdge apply. |
void |
redirectTarget(ALDWorkflowEdgeID edgeId,
ALDWorkflowNodeID newTargetNodeId,
java.lang.String newTargetParameterName,
java.lang.Boolean allowDataConversion)
Redirect the target of an edge. |
protected void |
relocateNode(ALDWorkflowNodeID nodeId,
boolean disconnectEdges)
Relocate the node to this workflow. |
protected void |
relocateNodes(java.util.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. |
protected void |
removeParameter(java.lang.String parameterName)
Remove a parameter from this 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(java.io.File file)
Save this workflow to file. |
void |
save(java.io.File file,
boolean doFireEvent)
Save this workflow to file. |
void |
save(java.lang.String filename)
Save this workflow to file. |
void |
save(java.lang.String filename,
boolean doFireEvent)
Save this workflow to file. |
void |
setName(java.lang.String name)
Set the name of this operator |
void |
setOperator(ALDWorkflowNodeID nodeId,
ALDOperator newOp)
Set the operator associated with nodeId . |
void |
setParameter(java.lang.String name,
java.lang.Object value)
Set the value of a parameter specified by name. |
(package private) java.util.LinkedList<ALDWorkflowNode> |
topSort()
Topologically sorts all nodes of the workflow. |
(package private) java.util.LinkedList<ALDWorkflowNode> |
topSort(java.util.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(java.util.Collection<ALDWorkflowNode> nodesToCheck,
boolean doFireEvent)
Updates the states of nodesToCheck and their descendants. |
Methods inherited from class de.unihalle.informatik.Alida.operator.ALDOperatorControllable |
---|
addALDConfigurationEventListener, addALDControlEventListener, fireALDConfigurationEvent, fireALDControlEvent, handleALDConfigurationEvent, handleALDControlEvent, removeALDConfigurationEventListener, removeALDControlEventListener, setNotifyRecursiveFlag |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static ALDDataConverterManager converterManager
static int debug
private static java.util.HashMap<ALDWorkflowEdgeID,ALDWorkflowEdge> edgeIdToEdge
private java.util.LinkedList<ALDWorkflowEdge> edges
private static java.util.HashMap<ALDWorkflowEdge,ALDWorkflowEdgeID> edgeToEdgeId
@Deprecated private boolean executionInterrupted
private ALDWorkflowNode interiorShadowNode
private static java.util.HashMap<ALDWorkflowNodeID,ALDWorkflowNode> nodeIdToNode
private java.util.LinkedList<ALDWorkflowNode> nodes
private static java.util.HashMap<ALDWorkflowNode,ALDWorkflowNodeID> nodeToNodeId
private final boolean resetDisconnectedInput
public static final java.lang.String untitledWorkflowName
private final ALDWorkflow.ALDWorkflowContextType workflowContext
private transient java.util.HashMap<ALDWorkflowEventListener,ALDWorkflowEventManager> workflowEventMangerList
protected static transient volatile javax.swing.event.EventListenerList workflowLoadEventlistenerList
public static final java.lang.String workflowXMLFileExtension
Constructor Detail |
---|
public ALDWorkflow() throws ALDOperatorException
ALDOperatorException
public ALDWorkflow(ALDWorkflow.ALDWorkflowContextType context) throws ALDOperatorException
name
- of the workflowcontext
- context this workflow is running in
ALDOperatorException
public ALDWorkflow(java.lang.String name) throws ALDOperatorException
name
- of the workflow
ALDOperatorException
public ALDWorkflow(java.lang.String name, ALDWorkflow.ALDWorkflowContextType context) throws ALDOperatorException
name
- of the workflowcontext
- context this workflow is running in
ALDOperatorException
Method Detail |
---|
public static void addALDWorkflowClassEventListener(ALDWorkflowClassEventListener listener)
listener
- public void addALDWorkflowEventListener(ALDWorkflowEventListener listener)
ALDWorkflowEventReporter
addALDWorkflowEventListener
in interface ALDWorkflowEventReporter
listener
- Listener to be added.private void addEdge(ALDWorkflowEdge edge)
private void addNode(ALDWorkflowNode node)
node
- public void addParameter(ALDOpParameterDescriptor descriptor) throws ALDWorkflowException
descriptor
-
ALDWorkflowException
- in case of fatal errorprivate boolean checkDataflowStateChange(ALDWorkflowNode node) throws ALDWorkflowException
Note: this method does not fire an event to notify listeners.
node
-
ALDWorkflowException
private boolean checkLocalStateChange(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 ALDWorkflow.COMPATIBILITY classesAllowed(ALDOpParameterDescriptor sourceDescriptor, ALDOpParameterDescriptor targetDescriptor, ALDWorkflowEdge edge)
sourceDescriptor
- targetDescriptor
- edge
-
public ALDWorkflowNodeID copyNode(ALDWorkflowNodeID nodeId, boolean retainInEdges, boolean retainParameterValues) throws ALDWorkflowException
nodeId
- retainInEdges
- copy also all incoming edgesretainParameterValues
- copy the values of all input parameters
ALDWorkflowException
protected ALDWorkflowNodeID createChildWorkflow()
protected ALDWorkflowNodeID createChildWorkflow(java.lang.String name)
name
-
public ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId, java.lang.String sourceParameterName, ALDWorkflowNodeID targetNodeId, java.lang.String targetParameterName) throws ALDWorkflowException
createEdge
with the argument allowDataConversion = false
.
sourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
-
ALDWorkflowException
- if edge is not allowedpublic ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId, java.lang.String sourceParameterName, ALDWorkflowNodeID targetNodeId, java.lang.String targetParameterName, java.lang.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 available
sourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
- allowDataConversion
- if true the edge is allowed in case of non assignable parameters if
a data converter is available
ALDWorkflowException
public ALDWorkflowNodeID createNode(ALDOperator op) throws ALDWorkflowException
op
- Operator object to add in the new node
ALDWorkflowException
- if on OP_RUNNER context an we get more then one nodepublic ALDWorkflowNodeID createNode(ALDOperatorLocation location) throws ALDWorkflowException
opName
- Name of operator to add in the new node
ALDWorkflowException
- if the operator cannot be instantiatedpublic ALDWorkflowNodeID createNode(java.lang.String opName) throws ALDWorkflowException
opName
- Name of operator to add in the new node
ALDWorkflowException
- if the operator cannot be instantiatedprivate 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 parameter
ALDWorkflowException
- if direction is wrongprivate void doStateChange(ALDWorkflowNode node, ALDWorkflowNode.ALDWorkflowNodeState newState)
node
- newState
- private void edgeAllowed(ALDWorkflowEdge edge, java.lang.Boolean allowDataConversion) throws ALDWorkflowException
edge
- allowDataConversion
- is data conversion allowed for this edge
ALDWorkflowException
- if parameters are incompatiblestatic java.lang.String edgeIdsToString(java.util.Collection<ALDWorkflowEdge> edges)
edges
-
private 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 executeNonReadyNodes(java.util.List<ALDWorkflowNode> nodes, boolean waitForCompletion) throws ALDWorkflowException
nodeIds
- waitForCompletion
- if true wait for completion, otherwise return immediately
ALDWorkflowException
- if one of the nodes is not at least runnable
or the execution itself failspublic static void fireALDWorkflowClassEvent(ALDWorkflowClassEvent aldWorkflowClassEvent)
aldWorkflowClassEvent
- public void fireALDWorkflowEvent(ALDWorkflowEvent event)
ALDWorkflowEventReporter
fireALDWorkflowEvent
in interface ALDWorkflowEventReporter
event
- Event to be send to all listeners.public ALDWorkflowEdge getEdge(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
.
edgeId
-
ALDWorkflowException
- if the edge with edgeId
does not existpublic ALDWorkflowEdge getEdge(ALDWorkflowNode sourceNode, java.lang.String sourceParameterName, ALDWorkflowNode targetNode, java.lang.String targetParameterName)
sourceNodeId
- sourceParameterName
- targetNodeId
- targetParameterName
-
public java.util.Collection<ALDWorkflowEdgeID> getEdgeIds()
public java.util.concurrent.BlockingDeque<ALDWorkflowEvent> getEventQueue(ALDWorkflowEventListener listener)
listener
or null
it the listener is not registered.
listener
-
public java.util.HashMap<ALDWorkflowEdgeID,java.lang.Integer> getMappingEdgeIdToInteger()
public java.util.HashMap<java.lang.Integer,ALDWorkflowEdgeID> getMappingIntegerToEdgeId()
public java.util.HashMap<java.lang.Integer,ALDWorkflowNodeID> getMappingIntegerToNodeId()
public java.util.HashMap<ALDWorkflowNodeID,java.lang.Integer> getMappingNodeIdToInteger()
public java.util.Collection<java.lang.String> getMissingRequiredInputs(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
-
ALDWorkflowException
public ALDWorkflowNode getNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.
nodeId
- id of workflow node to return
ALDWorkflowException
- if the node with nodeId
does not exist.
java.lang.NullPointerException
- if nodeId
is null.public java.util.Collection<ALDWorkflowNodeID> getNodeIds()
private ALDWorkflowNode getNodeWithoutSources(java.util.HashMap<ALDWorkflowNode,java.util.Set<ALDWorkflowNode>> sourceNodeMap)
sourceNodeMap
with zero
source nodes, if any. If no such node exists, return null.
sourceNodeMap
-
public ALDOperator getOperator(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.
nodeId
- id of operator to return
null
if not existing
ALDWorkflowException
- if the node with nodeId
does not exist.public java.lang.Object getParameter(java.lang.String name) throws ALDOperatorException
ALDOperator
getParameter
in class ALDOperator
name
- Name of the parameter to get the new value for
ALDOperatorException
public ALDWorkflowNodeID getShadowNodeId()
public ALDWorkflowNodeID getSourceNodeId(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
-
ALDWorkflowException
public java.lang.String getSourceParameterName(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
-
ALDWorkflowException
public ALDWorkflowNode.ALDWorkflowNodeState getState(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
.
nodeId
- node id
ALDWorkflowException
- if the node with nodeId
does not exist.public ALDWorkflowNodeID getTargetNodeId(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
-
ALDWorkflowException
public java.lang.String getTargetParameterName(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
-
ALDWorkflowException
public ALDWorkflow.ALDWorkflowContextType getWorkflowContext()
@Deprecated public void interruptExecution()
public boolean isResetDisconnectedInput()
public static ALDWorkflow load(java.io.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(java.io.File file, boolean doFireEvent) throws ALDWorkflowException
File
and create a new workflow object.
file
- doFireEvent
- if true an appropriate event is fired
ALDWorkflowException
- if file cannot be opened for reading or deserialization failspublic static ALDWorkflow load(java.lang.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(java.lang.String filename, boolean doFireEvent) throws ALDWorkflowException
filename
and create a new workflow object.
filename
- doFireEvent
- if true an appropriate event is fired
ALDWorkflowException
- if file cannot be opened for reading or deserialization failsprotected static ALDWorkflowEdge mapeEdgeIdToEdge(ALDWorkflowEdgeID edgeId)
edgeId
- the edge or null if no edge with the given edgeId exists
protected static ALDWorkflowEdgeID mapEgdeToEdgeId(ALDWorkflowEdge edge)
protected static ALDWorkflowNode mapNodeIdToNode(ALDWorkflowNodeID nodeId)
nodeId
- the node or null if a node with the given nodeId does not exist
protected static ALDWorkflowNodeID mapNodeToNodeId(ALDWorkflowNode node)
node
- the NodeId or null (which should not happen)
static java.lang.String nodeIdsToString(java.util.Collection<ALDWorkflowNode> nodes)
nodes
-
public void nodeParameterChanged(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
have changed.
nodeId
-
ALDWorkflowException
- if the node with nodeId
does not exist.protected void operate() throws ALDOperatorException, ALDProcessingDAGException
ALDOperator
operate
in class ALDOperatorControllable
ALDOperatorException
ALDProcessingDAGException
public void print()
ALDOperator
print
in class ALDOperator
protected java.lang.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
public void redirectSource(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newSourceNodeId, java.lang.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 available
ALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void redirectSource(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newSourceNodeId, java.lang.String newSourceParameterName, java.lang.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 available
ALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existpublic void redirectTarget(ALDWorkflowEdgeID edgeId, ALDWorkflowNodeID newTargetNodeId, java.lang.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, java.lang.String newTargetParameterName, java.lang.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 available
ALDWorkflowException
- if edge is not allowed or the edge with edgeId does not existprotected void relocateNode(ALDWorkflowNodeID nodeId, boolean disconnectEdges)
nodeId
- protected void relocateNodes(java.util.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 static void removeALDWorkflowClassEventListener(ALDWorkflowEventListener listener)
listener
- public void removeALDWorkflowEventListener(ALDWorkflowEventListener listener)
ALDWorkflowEventReporter
removeALDWorkflowEventListener
in interface ALDWorkflowEventReporter
listener
- Listener to be removed.public void removeEdge(ALDWorkflowEdgeID edgeId) throws ALDWorkflowException
edgeId
- id of the edge to remove
ALDWorkflowException
- if edge is not allowed or the edge with edgeId
does not exist.public void removeNode(ALDWorkflowNodeID nodeId) throws ALDWorkflowException
nodeId
- id of the node to be removed
ALDWorkflowException
- if the node with nodeId
does not existprotected void removeParameter(java.lang.String parameterName) throws ALDWorkflowException
parameterName
-
ALDWorkflowException
- if this parameter does not exist or in case of fatal errorpublic 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 immediately
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, boolean stepRecursively) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelystepRecursively
- if true OP_STEP events are passed to the child operators
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) 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 immediately
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, boolean stepRecursively) throws ALDWorkflowException
nodeId
- waitForCompletion
- if true wait for completion, otherwise return immediatelystepRecursively
- if true OP_STEP events are passed to the child operators
ALDWorkflowException
- if not all nodes are at least runnable or the execution itself fails,
or the node with nodeId does not existpublic 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 immediately
ALDWorkflowException
- 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 operators
ALDWorkflowException
- if not all nodes are at least runnable or the execution itself failspublic void save(java.io.File file) throws ALDWorkflowException
filename
-
ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void save(java.io.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 void save(java.lang.String filename) throws ALDWorkflowException
filename
-
ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void save(java.lang.String filename, boolean doFireEvent) throws ALDWorkflowException
filename
- doFireEvent
- if true an appropriate event is fired
ALDWorkflowException
- if file cannot be opened for writing or serialization failspublic void setName(java.lang.String name)
ALDOperator
setName
in class ALDOperator
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 return
ALDWorkflowException
- if the new operator instance is of wrong type.public void setParameter(java.lang.String name, java.lang.Object value) throws ALDOperatorException
ALDOperator
setParameter
in class ALDOperator
name
- Name of the parameter to set a new value forvalue
- new value
ALDOperatorException
java.util.LinkedList<ALDWorkflowNode> topSort() throws ALDWorkflowException
ALDWorkflowException
- the workflow is cyclicjava.util.LinkedList<ALDWorkflowNode> topSort(java.util.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 sorted
nodes
ALDWorkflowException
- if the subgraph is cyclicor nodes
is null.private void updateState(ALDWorkflowNode node) throws ALDWorkflowException
updateStates(Collection, boolean)
with the single
node
.
node
-
ALDWorkflowException
private void updateStates(java.util.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 fired
ALDWorkflowException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |