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.
 
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
static java.lang.String untitledWorkflowName
          Name of a workflow with out a proper name
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.
 void addParameter(ALDOpParameterDescriptor descriptor)
          Add a new parameter to this workflow.
 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.
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.
 ALDWorkflowEdgeID getEdgeIdDuringLoading(java.lang.Integer idx)
          Return the edgeId of the idx-th edge according to the order of the edges in the external representation resulting from (last) loading this workflow.
 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.
 ALDWorkflowNodeID getNodeIdDuringLoading(java.lang.Integer idx)
          Return the nodeId of the idx-th node according to the order of the nodes in the external representation resulting from (last) loading this workflow.
 java.util.Collection<ALDWorkflowNodeID> getNodeIds()
          Return the current collection of NodeIds of this workflow.
 java.util.Collection<ALDWorkflowNode> getNodes()
          Return a collection of all nodes of this workflow
 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
 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.
 
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

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

untitledWorkflowName

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

See Also:
Constant Field Values

workflowLoadEventlistenerList

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

Constructor Detail

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

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
Method Detail

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

setName

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

Overrides:
setName in class ALDOperator

isResetDisconnectedInput

public boolean isResetDisconnectedInput()
Returns:
the resetDisconnectedInput

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.

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.

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.

getWorkflowContext

public ALDWorkflow.ALDWorkflowContextType getWorkflowContext()
Returns:
the workflowContext

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.

getNodes

public java.util.Collection<ALDWorkflowNode> getNodes()
Return a collection of all nodes of this workflow

Returns:
all nodes of this workflow

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

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

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

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

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

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

getNodeIdDuringLoading

public ALDWorkflowNodeID getNodeIdDuringLoading(java.lang.Integer idx)
Return the nodeId of the idx-th node according to the order of the nodes in the external representation resulting from (last) loading this workflow. The order is identical as return from getNodeIds() at the time of saving the workflow represented externally.

Parameters:
idx -
Returns:

getEdgeIdDuringLoading

public ALDWorkflowEdgeID getEdgeIdDuringLoading(java.lang.Integer idx)
Return the edgeId of the idx-th edge according to the order of the edges in the external representation resulting from (last) loading this workflow. The order is identical as return from getEdgeIds() at the time of saving the workflow represented externally.

Parameters:
idx -
Returns:

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

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

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

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

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.

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

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.

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

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

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

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

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

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:

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

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

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

interruptExecution

@Deprecated
public void interruptExecution()
Deprecated. 

Ask execution of nodes to be terminated.


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:

getNodeIds

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

Returns:

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)

getEdgeIds

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

Returns:

getShadowNodeId

public ALDWorkflowNodeID getShadowNodeId()

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.

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.

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:

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.

addALDWorkflowClassEventListener

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

Parameters:
listener -

removeALDWorkflowClassEventListener

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

Parameters:
listener -

fireALDWorkflowClassEvent

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

Parameters:
aldWorkflowClassEvent -

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

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

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

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

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:

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 -

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


Copyright © 2010-2014 Martin Luther University Halle-Wittenberg. All Rights Reserved.