de.unihalle.informatik.Alida.workflows
Class ALDWorkflow

java.lang.Object
  extended by de.unihalle.informatik.Alida.operator.ALDOperator
      extended by de.unihalle.informatik.Alida.operator.ALDOperatorControllable
          extended by de.unihalle.informatik.Alida.workflows.ALDWorkflow
All Implemented Interfaces:
ALDConfigurationValidator, ALDConfigurationEventListener, ALDConfigurationEventReporter, ALDControlEventListener, ALDControlEventReporter, ALDWorkflowEventReporter, java.util.EventListener

public class ALDWorkflow
extends ALDOperatorControllable
implements ALDWorkflowEventReporter

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.

Author:
posch

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 de.unihalle.informatik.Alida.operator.ALDOperator
deserializeFromXmlFile, fieldContained, getALDPortHashAccessKey, getConstructionMode, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameterDescriptor, getParameterNames, getSupplementalNames, getVerbose, getVersion, isConfigured, parametersToXmlObject, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, runOp, runOp, runOp, serializeToXmlFile, setConstructionMode, setParametersFromXml, setParametersFromXml, setVerbose, toStringVerbose, unconfiguredItems, validate, validateCustom, validateGeneric, writeHistory, writeHistory, writeHistory, writeParametersToXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

converterManager

private static ALDDataConverterManager converterManager
converter manager singleton instance


debug

static int debug
For debugging information


edgeIdToEdge

private static java.util.HashMap<ALDWorkflowEdgeID,ALDWorkflowEdge> edgeIdToEdge
Hash map of edges of this workflow. The id is used to identify and access an edge from outside of the workflow.


edges

private java.util.LinkedList<ALDWorkflowEdge> edges
All edges of this workflow. An edge may connect wfNode and nodes from nodes.


edgeToEdgeId

private static java.util.HashMap<ALDWorkflowEdge,ALDWorkflowEdgeID> edgeToEdgeId

executionInterrupted

@Deprecated
private boolean executionInterrupted
Deprecated. 
If true the user has requested an interrupt of the current execution of (part of) the workflow.


interiorShadowNode

private ALDWorkflowNode interiorShadowNode
This node is used as an interior shadow (or substitute) for the node holding this workflow. This is necessary (or at least convenient) as the workflow does not know about the node it holds, and this node may not exist at all.


nodeIdToNode

private static java.util.HashMap<ALDWorkflowNodeID,ALDWorkflowNode> nodeIdToNode
Hash map of operator nodes of this workflow. The id is used to identify and access a node from outside of the workflow.


nodes

private java.util.LinkedList<ALDWorkflowNode> nodes
All nodes contained in this workflow


nodeToNodeId

private static java.util.HashMap<ALDWorkflowNode,ALDWorkflowNodeID> nodeToNodeId

resetDisconnectedInput

private final 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.

See Also:
Constant Field Values

untitledWorkflowName

public static final java.lang.String untitledWorkflowName
Name of a workflow with out a proper name

See Also:
Constant Field Values

workflowContext

private final ALDWorkflow.ALDWorkflowContextType workflowContext
Determines the context of this workflow


workflowEventMangerList

private transient java.util.HashMap<ALDWorkflowEventListener,ALDWorkflowEventManager> workflowEventMangerList
List of control event listeners attached to this workflow.


workflowLoadEventlistenerList

protected static transient volatile javax.swing.event.EventListenerList workflowLoadEventlistenerList
List of control event listeners attached to this class used for loading workflows.


workflowXMLFileExtension

public static final java.lang.String workflowXMLFileExtension
Standard extension for a xml file holding the external representation of a workflow.

See Also:
Constant Field Values
Constructor Detail

ALDWorkflow

public ALDWorkflow()
            throws ALDOperatorException
Constructor for an untitled workflow in a grappa context.

Throws:
ALDOperatorException

ALDWorkflow

public ALDWorkflow(ALDWorkflow.ALDWorkflowContextType context)
            throws ALDOperatorException
Constructor for an untitled workflow

Parameters:
name - of the workflow
context - context this workflow is running in
Throws:
ALDOperatorException

ALDWorkflow

public ALDWorkflow(java.lang.String name)
            throws ALDOperatorException
Constructor for a workflow in a grappa context.

Parameters:
name - of the workflow
Throws:
ALDOperatorException

ALDWorkflow

public ALDWorkflow(java.lang.String name,
                   ALDWorkflow.ALDWorkflowContextType context)
            throws ALDOperatorException
Constructor

Parameters:
name - of the workflow
context - context this workflow is running in
Throws:
ALDOperatorException
Method Detail

addALDWorkflowClassEventListener

public static void addALDWorkflowClassEventListener(ALDWorkflowClassEventListener listener)
Add a listener for events thrown by the class ALDWorkflow (not an instance).

Parameters:
listener -

addALDWorkflowEventListener

public void addALDWorkflowEventListener(ALDWorkflowEventListener listener)
Description copied from interface: ALDWorkflowEventReporter
Adds a listener to this reporter.

Specified by:
addALDWorkflowEventListener in interface ALDWorkflowEventReporter
Parameters:
listener - Listener to be added.

addEdge

private void addEdge(ALDWorkflowEdge edge)

addNode

private void addNode(ALDWorkflowNode node)
Add this node to the workflow, create a NodeId and update mapping.

Parameters:
node -

addParameter

public void addParameter(ALDOpParameterDescriptor descriptor)
                  throws ALDWorkflowException
Add a new parameter to this workflow.
Note: adding a new parameter will shadow an already existing parameter.

Parameters:
descriptor -
Throws:
ALDWorkflowException - in case of fatal error

checkDataflowStateChange

private boolean checkDataflowStateChange(ALDWorkflowNode node)
                                  throws ALDWorkflowException
Updates the state of this node according to the states of its parents. Updates considered are only due to data flow, not due to changes in operator configuration or adding/removing of in coming edges.

Note: this method does not fire an event to notify listeners.

Parameters:
node -
Returns:
true if state was changed
Throws:
ALDWorkflowException

checkLocalStateChange

private boolean checkLocalStateChange(ALDWorkflowNode node)
                               throws ALDWorkflowException
Updates the state of this node according to its local configuration. Does not take state changes depending on the states of its parents into account

Note: this method does not fire an event to notify listeners.

Parameters:
node -
Returns:
true is state of the node has been changed
Throws:
ALDWorkflowException

checkParentStates

private boolean checkParentStates(ALDWorkflowNode node,
                                  ALDWorkflowNode.ALDWorkflowNodeState requiredState)
Check if all parents of the given node have a state at least requiredState.

Parameters:
node -
requiredState -
Returns:
true if all parents have a state at least requiredState
Throws:
ALDWorkflowException

classesAllowed

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

Parameters:
sourceDescriptor -
targetDescriptor -
edge -
Returns:

copyNode

public ALDWorkflowNodeID copyNode(ALDWorkflowNodeID nodeId,
                                  boolean retainInEdges,
                                  boolean retainParameterValues)
                           throws ALDWorkflowException
Copy this node.

Parameters:
nodeId -
retainInEdges - copy also all incoming edges
retainParameterValues - copy the values of all input parameters
Returns:
nodeId of the new copy
Throws:
ALDWorkflowException

createChildWorkflow

protected ALDWorkflowNodeID createChildWorkflow()
Add a new workflow as a child to this workflow.

Returns:

createChildWorkflow

protected ALDWorkflowNodeID createChildWorkflow(java.lang.String name)
Add a new workflow as a child to this workflow.

Parameters:
name -
Returns:

createEdge

public ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId,
                                    java.lang.String sourceParameterName,
                                    ALDWorkflowNodeID targetNodeId,
                                    java.lang.String targetParameterName)
                             throws ALDWorkflowException
This method calls createEdge with the argument allowDataConversion = false.

Parameters:
sourceNodeId -
sourceParameterName -
targetNodeId -
targetParameterName -
Throws:
ALDWorkflowException - if edge is not allowed

createEdge

public ALDWorkflowEdgeID createEdge(ALDWorkflowNodeID sourceNodeId,
                                    java.lang.String sourceParameterName,
                                    ALDWorkflowNodeID targetNodeId,
                                    java.lang.String targetParameterName,
                                    java.lang.Boolean allowDataConversion)
                             throws ALDWorkflowException
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. 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:
  1. Direction of the parameters to connect
    1. Source parameter
      If the source node represents the workflow, the source parameter needs to be of direction IN or INOUT. Otherwise it needs to be of direction OUT or INOUT.
    2. Target parameter
      If the target node represents the workflow, the target parameter needs to be of direction OUT or INOUT. Otherwise it needs to be of direction IN or INOUT.
  2. The parameter in the target operator must not already be connected by an edge.
  3. The java types associated with both parameters must be compatible. I.e. the target parameter must be assignable by the source parameter. if allowDataConversion the parameters are also compatible if a data converter is available
  4. No cycles may be introduced into the workflow

Parameters:
sourceNodeId -
sourceParameterName -
targetNodeId -
targetParameterName -
allowDataConversion - if true the edge is allowed in case of non assignable parameters if a data converter is available
Returns:
Throws:
ALDWorkflowException

createNode

public ALDWorkflowNodeID createNode(ALDOperator op)
                             throws ALDWorkflowException
Add a new operator to this workflow.

Parameters:
op - Operator object to add in the new node
Throws:
ALDWorkflowException - if on OP_RUNNER context an we get more then one node

createNode

public ALDWorkflowNodeID createNode(ALDOperatorLocation location)
                             throws ALDWorkflowException
Add a new operator node to this workflow.

Parameters:
opName - Name of operator to add in the new node
Throws:
ALDWorkflowException - if the operator cannot be instantiated

createNode

public ALDWorkflowNodeID createNode(java.lang.String opName)
                             throws ALDWorkflowException
Add a new operator node to this workflow.

Parameters:
opName - Name of operator to add in the new node
Throws:
ALDWorkflowException - if the operator cannot be instantiated

directionAllowd

private void directionAllowd(ALDWorkflowNode sourceNode,
                             ALDOpParameterDescriptor sourceDescriptor,
                             ALDWorkflowNode targetNode,
                             ALDOpParameterDescriptor targetDescriptor)
                      throws ALDWorkflowException
Checks if the direction are allowed
  1. Source parameter
    If the source node represents the workflow, the source parameter needs to be of direction IN or INOUT. Otherwise it needs to be of direction OUT or INOUT.
  2. Target parameter
    If the target node represents the workflow, the target parameter needs to be of direction OUT or INOUT. Otherwise it needs to be of direction IN or INOUT.

Parameters:
sourceNode - source node
sourceDescriptor - Descriptor of the source parameter
targetNode - target node
targetDescriptor - Descriptor of the target parameter
Throws:
ALDWorkflowException - if direction is wrong

doStateChange

private void doStateChange(ALDWorkflowNode node,
                           ALDWorkflowNode.ALDWorkflowNodeState newState)
Set the new state in the node and fire corresponding event.

Parameters:
node -
newState -

edgeAllowed

private void edgeAllowed(ALDWorkflowEdge edge,
                         java.lang.Boolean allowDataConversion)
                  throws ALDWorkflowException
Check if this edge is allowed. It is assumed that the edge to check was already added to the graph. An edge is not allowed, if
  1. it does not connect an OUT or INOUT parameter with an IN or INOUT parameter,
  2. if the target IN or INOUT parameter now has more the one incident links,
  3. if the classes of connected parameters are not compatible, or
  4. if no cycle was introduced
Classes are compatible either is they are assignable or a data converter exists and data conversion is allowed

Parameters:
edge -
allowDataConversion - is data conversion allowed for this edge
Throws:
ALDWorkflowException - if parameters are incompatible

edgeIdsToString

static java.lang.String edgeIdsToString(java.util.Collection<ALDWorkflowEdge> edges)
Formats the ids of the given edges into a string for debugging purposes.

Parameters:
edges -
Returns:

executeNode

private static void executeNode(ALDWorkflow workflow,
                                ALDWorkflowNode node,
                                boolean showResults)
                         throws ALDWorkflowException,
                                ALDOperatorException,
                                ALDProcessingDAGException,
                                ALDDataConverterManagerException,
                                ALDDataConverterManagerException
This actually runOps the operator in its own thread and takes care of firing events for state changes. The runOp method of the operator is invoked independently of the node's state. if showResults is true an corresponding event is fired.

Parameters:
workflow -
node -
showResults -
Throws:
ALDWorkflowException
ALDProcessingDAGException
ALDOperatorException
ALDDataConverterManagerException
ALDDataConverterManagerException

executeNonReadyNodes

private void executeNonReadyNodes(java.util.List<ALDWorkflowNode> nodes,
                                  boolean waitForCompletion)
                           throws ALDWorkflowException
Run all not ready nodes of the list in the given order.

Parameters:
nodeIds -
waitForCompletion - if true wait for completion, otherwise return immediately
Throws:
ALDWorkflowException - if one of the nodes is not at least runnable or the execution itself fails

fireALDWorkflowClassEvent

public static void fireALDWorkflowClassEvent(ALDWorkflowClassEvent aldWorkflowClassEvent)
Fire an event by the class ALDWorkflow.

Parameters:
aldWorkflowClassEvent -

fireALDWorkflowEvent

public void fireALDWorkflowEvent(ALDWorkflowEvent event)
Description copied from interface: ALDWorkflowEventReporter
Sends the given event to all registered listeners.

Specified by:
fireALDWorkflowEvent in interface ALDWorkflowEventReporter
Parameters:
event - Event to be send to all listeners.

getEdge

public ALDWorkflowEdge getEdge(ALDWorkflowEdgeID edgeId)
                        throws ALDWorkflowException
Get the workflow edge associated with edgeId.

Parameters:
edgeId -
Returns:
Throws:
ALDWorkflowException - if the edge with edgeId does not exist

getEdge

public ALDWorkflowEdge getEdge(ALDWorkflowNode sourceNode,
                               java.lang.String sourceParameterName,
                               ALDWorkflowNode targetNode,
                               java.lang.String targetParameterName)
Get the workflow edge connecting given edges and parameters.

Parameters:
sourceNodeId -
sourceParameterName -
targetNodeId -
targetParameterName -
Returns:
the edge or null if the edge does not exists

getEdgeIds

public java.util.Collection<ALDWorkflowEdgeID> getEdgeIds()
Return the current collection of EdgeIds of this workflow.

Returns:

getEventQueue

public java.util.concurrent.BlockingDeque<ALDWorkflowEvent> getEventQueue(ALDWorkflowEventListener listener)
Returns the event queue associated with the listener or null it the listener is not registered.

Parameters:
listener -
Returns:

getMappingEdgeIdToInteger

public java.util.HashMap<ALDWorkflowEdgeID,java.lang.Integer> getMappingEdgeIdToInteger()
Return the current mapping of EdgeIds to integer ids. Note: this mapping may change during manipulation of the workflow, i.e. the same EdgeId may have different mappings if the workflow has changed is graph structure. The set of ids is a contiguous interval of non negative integers starting at zero.

Returns:
current mapping of EdgeIds to integer ids

getMappingIntegerToEdgeId

public java.util.HashMap<java.lang.Integer,ALDWorkflowEdgeID> getMappingIntegerToEdgeId()
Return the current mapping of integer ids to EdgeIds. Note: this mapping may change during manipulation of the workflow, i.e. the same EdgeId may have different mappings if the workflow has changed is graph structure. The set of ids is a contiguous interval of non negative integers starting a zero.

Returns:
current mapping of integer ids to EdgeIds

getMappingIntegerToNodeId

public java.util.HashMap<java.lang.Integer,ALDWorkflowNodeID> getMappingIntegerToNodeId()
Return the current mapping of integer ids to NodeIds. Note: this mapping may change during manipulation of the workflow, i.e. the same NodeId may have different mappings if the workflow has changed is graph structure. The set of ids is a contiguous interval of non negative integers starting a zero.

Returns:
current mapping of integer ids to NodeIds

getMappingNodeIdToInteger

public java.util.HashMap<ALDWorkflowNodeID,java.lang.Integer> getMappingNodeIdToInteger()
Return the current mapping of NodeIds to integer ids. Note: this mapping may change during manipulation of the workflow, i.e. the same NodeId may have different mappings if the workflow has changed is graph structure. The set of ids is a contiguous interval of non negative integers starting a zero.

Returns:
current mapping of NodeIds to integer ids

getMissingRequiredInputs

public java.util.Collection<java.lang.String> getMissingRequiredInputs(ALDWorkflowNodeID nodeId)
                                                                throws ALDWorkflowException
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.

Parameters:
nodeId -
Returns:
Throws:
ALDWorkflowException

getNode

public ALDWorkflowNode getNode(ALDWorkflowNodeID nodeId)
                        throws ALDWorkflowException
Get the workflow node associated with nodeId.

Parameters:
nodeId - id of workflow node to return
Returns:
node
Throws:
ALDWorkflowException - if the node with nodeId does not exist.
java.lang.NullPointerException - if nodeId is null.

getNodeIds

public java.util.Collection<ALDWorkflowNodeID> getNodeIds()
Return the current collection of NodeIds of this workflow.

Returns:

getNodeWithoutSources

private ALDWorkflowNode getNodeWithoutSources(java.util.HashMap<ALDWorkflowNode,java.util.Set<ALDWorkflowNode>> sourceNodeMap)
Returns one node from the sourceNodeMap with zero source nodes, if any. If no such node exists, return null.

Parameters:
sourceNodeMap -
Returns:

getOperator

public ALDOperator getOperator(ALDWorkflowNodeID nodeId)
                        throws ALDWorkflowException
Get the operator associated with nodeId.

Parameters:
nodeId - id of operator to return
Returns:
operator object or null if not existing
Throws:
ALDWorkflowException - if the node with nodeId does not exist.

getParameter

public java.lang.Object getParameter(java.lang.String name)
                              throws ALDOperatorException
Description copied from class: ALDOperator
Get the value of a parameter specified by name.

Overrides:
getParameter in class ALDOperator
Parameters:
name - Name of the parameter to get the new value for
Returns:
value of the parameter
Throws:
ALDOperatorException

getShadowNodeId

public ALDWorkflowNodeID getShadowNodeId()

getSourceNodeId

public ALDWorkflowNodeID getSourceNodeId(ALDWorkflowEdgeID edgeId)
                                  throws ALDWorkflowException
Return the NodeId of the source node of this edge

Parameters:
edgeId -
Returns:
Throws:
ALDWorkflowException

getSourceParameterName

public java.lang.String getSourceParameterName(ALDWorkflowEdgeID edgeId)
                                        throws ALDWorkflowException
Return the source parameter name of this edge

Parameters:
edgeId -
Returns:
Throws:
ALDWorkflowException

getState

public ALDWorkflowNode.ALDWorkflowNodeState getState(ALDWorkflowNodeID nodeId)
                                              throws ALDWorkflowException
Get the state of node with nodeId.

Parameters:
nodeId - node id
Returns:
state of the node
Throws:
ALDWorkflowException - if the node with nodeId does not exist.

getTargetNodeId

public ALDWorkflowNodeID getTargetNodeId(ALDWorkflowEdgeID edgeId)
                                  throws ALDWorkflowException
Return the NodeId of the target node of this edge

Parameters:
edgeId -
Returns:
Throws:
ALDWorkflowException

getTargetParameterName

public java.lang.String getTargetParameterName(ALDWorkflowEdgeID edgeId)
                                        throws ALDWorkflowException
Return the target parameter name of this edge

Parameters:
edgeId -
Returns:
Throws:
ALDWorkflowException

getWorkflowContext

public ALDWorkflow.ALDWorkflowContextType getWorkflowContext()
Returns:
the workflowContext

interruptExecution

@Deprecated
public void interruptExecution()
Deprecated. 

Ask execution of nodes to be terminated.


isResetDisconnectedInput

public boolean isResetDisconnectedInput()
Returns:
the resetDisconnectedInput

load

public static ALDWorkflow load(java.io.File file)
                        throws ALDWorkflowException
Load a workflow from File and create a new workflow object. Does not fire an LOAD event.

Parameters:
file -
Returns:
the workflow read from file
Throws:
ALDWorkflowException - if file cannot be opened for reading or deserialization fails

load

public static ALDWorkflow load(java.io.File file,
                               boolean doFireEvent)
                        throws ALDWorkflowException
Load a workflow from File and create a new workflow object.

Parameters:
file -
doFireEvent - if true an appropriate event is fired
Returns:
Throws:
ALDWorkflowException - if file cannot be opened for reading or deserialization fails

load

public static ALDWorkflow load(java.lang.String filename)
                        throws ALDWorkflowException
Load a workflow from file with filename and create a new workflow object. Does not fire an LOAD event.

Parameters:
filename -
Returns:
the workflow read from file
Throws:
ALDWorkflowException - if file cannot be opened for reading or deserialization fails

load

public static ALDWorkflow load(java.lang.String filename,
                               boolean doFireEvent)
                        throws ALDWorkflowException
Load a workflow from file with filename and create a new workflow object.

Parameters:
filename -
doFireEvent - if true an appropriate event is fired
Returns:
the workflow read from file
Throws:
ALDWorkflowException - if file cannot be opened for reading or deserialization fails

mapeEdgeIdToEdge

protected static ALDWorkflowEdge mapeEdgeIdToEdge(ALDWorkflowEdgeID edgeId)
Map an edgeId to its edge.

Parameters:
edgeId - the edge or null if no edge with the given edgeId exists
Returns:

mapEgdeToEdgeId

protected static ALDWorkflowEdgeID mapEgdeToEdgeId(ALDWorkflowEdge edge)

mapNodeIdToNode

protected static ALDWorkflowNode mapNodeIdToNode(ALDWorkflowNodeID nodeId)
Map a nodeId to its node.

Parameters:
nodeId - the node or null if a node with the given nodeId does not exist
Returns:

mapNodeToNodeId

protected static ALDWorkflowNodeID mapNodeToNodeId(ALDWorkflowNode node)
Map a node to its NodeId

Parameters:
node - the NodeId or null (which should not happen)
Returns:

nodeIdsToString

static java.lang.String nodeIdsToString(java.util.Collection<ALDWorkflowNode> nodes)
Formats the ids of the given nodes into a string for debugging purposes.

Parameters:
nodes -
Returns:

nodeParameterChanged

public void nodeParameterChanged(ALDWorkflowNodeID nodeId)
                          throws ALDWorkflowException
Notify the workflow that parameters of the operator object associated with node nodeId have changed.

Parameters:
nodeId -
Throws:
ALDWorkflowException - if the node with nodeId does not exist.

operate

protected void operate()
                throws ALDOperatorException,
                       ALDProcessingDAGException
Description copied from class: ALDOperator
This method does the actual work and needs to be implemented by every subclass.

Overrides:
operate in class ALDOperatorControllable
Throws:
ALDOperatorException
ALDProcessingDAGException

print

public void print()
Description copied from class: ALDOperator
Print some information of the current state this operator to System.out.

Overrides:
print in class ALDOperator

readResolve

protected java.lang.Object readResolve()
Init function for deserialized objects.

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.

Overrides:
readResolve in class ALDOperator
Returns:

redirectSource

public void redirectSource(ALDWorkflowEdgeID edgeId,
                           ALDWorkflowNodeID newSourceNodeId,
                           java.lang.String newSourceParameterName)
                    throws ALDWorkflowException
Call redirectSource with with the argument allowDataConversion = false. The same restrictions as for createEdge apply.

Parameters:
edgeId -
newSourceNodeId -
newSourceParameterName -
allowDataConversion - if true the edge is allowed in case of non assignable parameters if a data converter is available
Throws:
ALDWorkflowException - if edge is not allowed or the edge with edgeId does not exist

redirectSource

public void redirectSource(ALDWorkflowEdgeID edgeId,
                           ALDWorkflowNodeID newSourceNodeId,
                           java.lang.String newSourceParameterName,
                           java.lang.Boolean allowDataConversion)
                    throws ALDWorkflowException
Redirect the source of an edge. The same restrictions as for createEdge apply.

Parameters:
edgeId -
newSourceNodeId -
newSourceParameterName -
allowDataConversion - if true the edge is allowed in case of non assignable parameters if a data converter is available
Throws:
ALDWorkflowException - if edge is not allowed or the edge with edgeId does not exist

redirectTarget

public void redirectTarget(ALDWorkflowEdgeID edgeId,
                           ALDWorkflowNodeID newTargetNodeId,
                           java.lang.String newTargetParameterName)
                    throws ALDWorkflowException
Calls redirectTarget with the argument allowDataConversion = false The same restrictions as for createEdge apply.

Parameters:
edgeId -
newTargetNodeId -
newTargetParameterName -
Throws:
ALDWorkflowException - if edge is not allowed or the edge with edgeId does not exist

redirectTarget

public void redirectTarget(ALDWorkflowEdgeID edgeId,
                           ALDWorkflowNodeID newTargetNodeId,
                           java.lang.String newTargetParameterName,
                           java.lang.Boolean allowDataConversion)
                    throws ALDWorkflowException
Redirect the target of an edge. The same restrictions as for createEdge apply.

Parameters:
edgeId -
newTargetNodeId -
newTargetParameterName -
allowDataConversion - if true the edge is allowed in case of non assignable parameters if a data converter is available
Throws:
ALDWorkflowException - if edge is not allowed or the edge with edgeId does not exist

relocateNode

protected void relocateNode(ALDWorkflowNodeID nodeId,
                            boolean disconnectEdges)
Relocate the node to this workflow.

Parameters:
nodeId -

relocateNodes

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. 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.

Parameters:
nodeIds -
disconnectEdges -

removeALDWorkflowClassEventListener

public static void removeALDWorkflowClassEventListener(ALDWorkflowEventListener listener)
Remove a listener for events thrown by the class ALDWorkflow (not an instance).

Parameters:
listener -

removeALDWorkflowEventListener

public void removeALDWorkflowEventListener(ALDWorkflowEventListener listener)
Description copied from interface: ALDWorkflowEventReporter
Removes a listener from this reporter.

Specified by:
removeALDWorkflowEventListener in interface ALDWorkflowEventReporter
Parameters:
listener - Listener to be removed.

removeEdge

public void removeEdge(ALDWorkflowEdgeID edgeId)
                throws ALDWorkflowException
Remove an edge from the workflow.

Parameters:
edgeId - id of the edge to remove
Throws:
ALDWorkflowException - if edge is not allowed or the edge with edgeId does not exist.

removeNode

public void removeNode(ALDWorkflowNodeID nodeId)
                throws ALDWorkflowException
Remove a node with all incoming and outgoing edges from the workflow.

Parameters:
nodeId - id of the node to be removed
Throws:
ALDWorkflowException - if the node with nodeId does not exist

removeParameter

protected void removeParameter(java.lang.String parameterName)
                        throws ALDWorkflowException
Remove a parameter from this workflow.

Parameters:
parameterName -
Throws:
ALDWorkflowException - if this parameter does not exist or in case of fatal error

runFromNode

public void runFromNode(ALDWorkflowNodeID nodeId)
                 throws ALDWorkflowException
Run the given node and all descendants of the given node. Additionally also all ancestors of these nodes are invoked. A node is only executed if it is not ready. Immediately returns after starting the execution.

Parameters:
nodeId -
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runFromNode

public void runFromNode(ALDWorkflowNodeID nodeId,
                        boolean waitForCompletion)
                 throws ALDWorkflowException
Run the given node and all descendants of the given node. Additionally also all ancestors of these nodes are invoked. A node is only executed if it is not ready.

Parameters:
nodeId -
waitForCompletion - if true wait for completion, otherwise return immediately
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runFromNode

public void runFromNode(ALDWorkflowNodeID nodeId,
                        boolean waitForCompletion,
                        boolean stepRecursively)
                 throws ALDWorkflowException
Run the given node and all descendants of the given node. Additionally also all ancestors of these nodes are invoked. A node is only executed if it is not ready.

Parameters:
nodeId -
waitForCompletion - if true wait for completion, otherwise return immediately
stepRecursively - if true OP_STEP events are passed to the child operators
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runNode

public void runNode(ALDWorkflowNodeID nodeId)
             throws ALDWorkflowException
Run the given node and all its ancestors. A node is only executed if it is not ready. Immediately returns after starting the execution.

Parameters:
nodeId -
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runNode

public void runNode(ALDWorkflowNodeID nodeId,
                    boolean waitForCompletion)
             throws ALDWorkflowException
Run the given node and all its ancestors. A node is only executed if it is not ready.

Parameters:
nodeId -
waitForCompletion - if true wait for completion, otherwise return immediately
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runNode

public void runNode(ALDWorkflowNodeID nodeId,
                    boolean waitForCompletion,
                    boolean stepRecursively)
             throws ALDWorkflowException
Run the given node and all its ancestors. A node is only executed if it is not ready.

Parameters:
nodeId -
waitForCompletion - if true wait for completion, otherwise return immediately
stepRecursively - if true OP_STEP events are passed to the child operators
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails, or the node with nodeId does not exist

runWorkflow

public void runWorkflow()
                 throws ALDWorkflowException
Run the complete workflow. A node is only executed if it is not ready. Immediately returns after starting the execution.

Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails

runWorkflow

public void runWorkflow(boolean waitForCompletion)
                 throws ALDWorkflowException
Run the complete workflow. A node is only executed if it is not ready.

Parameters:
waitForCompletion - if true wait for completion, otherwise return immediately
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails

runWorkflow

public void runWorkflow(boolean waitForCompletion,
                        boolean stepRecursively)
                 throws ALDWorkflowException
Run the complete workflow. A node is only executed if it is not ready.

Parameters:
waitForCompletion - if true wait for completion, otherwise return immediately
stepRecursively - if true OP_STEP events are passed to the child operators
Throws:
ALDWorkflowException - if not all nodes are at least runnable or the execution itself fails

save

public void save(java.io.File file)
          throws ALDWorkflowException
Save this workflow to file. Does not fire an LOAD event.

Parameters:
filename -
Throws:
ALDWorkflowException - if file cannot be opened for writing or serialization fails

save

public void save(java.io.File file,
                 boolean doFireEvent)
          throws ALDWorkflowException
Save this workflow to file.

Parameters:
doFireEvent - if true an appropriate event is fired
filename -
Throws:
ALDWorkflowException - if file cannot be opened for writing or serialization fails

save

public void save(java.lang.String filename)
          throws ALDWorkflowException
Save this workflow to file. Does not fire an LOAD event.

Parameters:
filename -
Throws:
ALDWorkflowException - if file cannot be opened for writing or serialization fails

save

public void save(java.lang.String filename,
                 boolean doFireEvent)
          throws ALDWorkflowException
Save this workflow to file.

Parameters:
filename -
doFireEvent - if true an appropriate event is fired
Throws:
ALDWorkflowException - if file cannot be opened for writing or serialization fails

setName

public void setName(java.lang.String name)
Description copied from class: ALDOperator
Set the name of this operator

Overrides:
setName in class ALDOperator

setOperator

public void setOperator(ALDWorkflowNodeID nodeId,
                        ALDOperator newOp)
                 throws ALDWorkflowException
Set the operator associated with nodeId. The new operator instance needs to be of the same class as the current operator instance.

Parameters:
nodeId - id of operator to return
Throws:
ALDWorkflowException - if the new operator instance is of wrong type.

setParameter

public void setParameter(java.lang.String name,
                         java.lang.Object value)
                  throws ALDOperatorException
Description copied from class: ALDOperator
Set the value of a parameter specified by name.

Overrides:
setParameter in class ALDOperator
Parameters:
name - Name of the parameter to set a new value for
value - new value
Throws:
ALDOperatorException

topSort

java.util.LinkedList<ALDWorkflowNode> topSort()
                                        throws ALDWorkflowException
Topologically sorts all nodes of the workflow.

Returns:
topologically sorted list of all nodes in the workflow
Throws:
ALDWorkflowException - the workflow is cyclic

topSort

java.util.LinkedList<ALDWorkflowNode> topSort(java.util.Collection<ALDWorkflowNode> nodes)
                                        throws ALDWorkflowException
Topologically sorts the nodes given in nodes. For sorting the subgraph of the complete workflow induced by nodes is considered. If the subgraph is cyclic an exception is raised.

Parameters:
nodes - of the subgraph to be sorted
Returns:
topologically sorted list of nodes
Throws:
ALDWorkflowException - if the subgraph is cyclicor nodes is null.

updateState

private void updateState(ALDWorkflowNode node)
                  throws ALDWorkflowException
Convenience method which just invokes updateStates(Collection, boolean) with the single node.

Parameters:
node -
Throws:
ALDWorkflowException

updateStates

private void updateStates(java.util.Collection<ALDWorkflowNode> nodesToCheck,
                          boolean doFireEvent)
                   throws ALDWorkflowException
Updates the states of 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.

Parameters:
nodesToCheck -
doFireEvent - if true an appropriate event is fired
Throws:
ALDWorkflowException