net.sf.taverna.t2.provenance.lineageservice
Class EventProcessor

java.lang.Object
  extended by net.sf.taverna.t2.provenance.lineageservice.EventProcessor

public class EventProcessor
extends java.lang.Object

Author:
Paolo Missier

Constructor Summary
EventProcessor()
           
EventProcessor(ProvenanceWriter pw, ProvenanceQuery pq, WorkflowDataProcessor wfdp)
           
 
Method Summary
 void fillInputVarBindings(java.lang.Object context)
          for each arc of the form (_INPUT_/I, P/V): propagate VarBinding for P/V to var _INPUT_/I
 void fillOutputVarBindings(java.lang.Object context)
          for each arc of the form (P/V, _OUTPUT_/O): propagate VarBinding for P/V to var _OUTPUT_/O
 ProvenanceQuery getPq()
           
 ProvenanceWriter getPw()
           
 WorkflowDataProcessor getWfdp()
           
 java.lang.String getWfInstanceID()
           
 void patchTopLevelnputs()
          fills in the VBs for the global inputs -- this removes the need for explicit events that account for these value bindings...
 java.lang.String processDataflowStructure(net.sf.taverna.t2.workflowmodel.Dataflow df, java.lang.String dataflowID, java.lang.String externalName)
          note: this method can be called as part of a recursion on sub-workflows
 void processProcessEvent(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem, java.lang.String currentWorkflowID)
          processes an elementary process execution event from T2.
 java.lang.String processWorkflowStructure(net.sf.taverna.t2.workflowmodel.Dataflow df)
           
 java.lang.String processWorkflowStructure(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem)
          this is the new version that makes use of the T2 deserializer populate static portion of the DB
the static structure may already be in the DB -- this is detected as a duplicate top-level workflow ID.
 java.util.List<java.lang.String> propagateANL(java.lang.String wfInstanceId)
           
 void reconcileLocalOutputs(java.lang.String dataflowName, java.lang.String dataflowID)
          reconcile the top level outputs with the results from its immediate precedessors in the graph.
various cases have to be considered: predecessors may include records that are not in the output, while the output may include nested list structures that are not in the precedessors.
 void reconcileTopLevelOutputs()
           
 void saveEvent(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem, net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary eventType)
          log raw event to file system
 void setPq(ProvenanceQuery pq)
           
 void setPw(ProvenanceWriter pw)
           
 void setWfdp(WorkflowDataProcessor wfdp)
           
 void setWfInstanceID(java.lang.String wfInstanceID)
           
 java.util.List<net.sf.taverna.t2.provenance.lineageservice.EventProcessor.Pair> toposort(java.lang.String dataflowName, java.lang.String wfInstanceId)
           
 java.util.List<net.sf.taverna.t2.provenance.lineageservice.EventProcessor.Pair> tsort(java.util.List<java.lang.String> procList, java.lang.String dataflowName, java.util.Map<java.lang.String,java.lang.Integer> predecessorsCount, java.util.Map<java.lang.String,java.util.List<java.lang.String>> successorsOf, java.lang.String wfNameRef, java.lang.String wfInstanceId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventProcessor

public EventProcessor()

EventProcessor

public EventProcessor(ProvenanceWriter pw,
                      ProvenanceQuery pq,
                      WorkflowDataProcessor wfdp)
               throws java.lang.InstantiationException,
                      java.lang.IllegalAccessException,
                      java.lang.ClassNotFoundException,
                      java.sql.SQLException
Parameters:
pw -
Throws:
java.sql.SQLException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
Method Detail

processWorkflowStructure

public java.lang.String processWorkflowStructure(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem)
this is the new version that makes use of the T2 deserializer populate static portion of the DB
the static structure may already be in the DB -- this is detected as a duplicate top-level workflow ID. In this case, we skip this processing altogether

Parameters:
content - is a serialized dataflow (XML) -- this is parsed using the T2 Deserializer
Returns:
the wfInstanceRef for this workflow structure

processWorkflowStructure

public java.lang.String processWorkflowStructure(net.sf.taverna.t2.workflowmodel.Dataflow df)

processDataflowStructure

public java.lang.String processDataflowStructure(net.sf.taverna.t2.workflowmodel.Dataflow df,
                                                 java.lang.String dataflowID,
                                                 java.lang.String externalName)
note: this method can be called as part of a recursion on sub-workflows

Parameters:
df -
dataflowID - the UUID for the entire dataflow (may be a sub-dataflow)
localName - the external name of the dataflow. Null if this is top level, not null if a sub-dataflow
Returns:
the wfInstanceRef for this workflow structure

processProcessEvent

public void processProcessEvent(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem,
                                java.lang.String currentWorkflowID)
processes an elementary process execution event from T2. Collects info from events as they happen and sends them to the writer for processing when the iteration event is received. Uses the map of procBindings to process event id and the map of child ids to parent ids to ensure that the correct proc binding is used

Parameters:
currentWorkflowID -
d -
context -

patchTopLevelnputs

public void patchTopLevelnputs()
fills in the VBs for the global inputs -- this removes the need for explicit events that account for these value bindings...


reconcileTopLevelOutputs

public void reconcileTopLevelOutputs()

reconcileLocalOutputs

public void reconcileLocalOutputs(java.lang.String dataflowName,
                                  java.lang.String dataflowID)
reconcile the top level outputs with the results from its immediate precedessors in the graph.
various cases have to be considered: predecessors may include records that are not in the output, while the output may include nested list structures that are not in the precedessors. This method accounts for a 2-way reconciliation that considers all possible cases.
at the end, outputs and their predecessors contain the same data.

NOTE: if we assume that data values (URIs) are always unique then this is greatly simplified by just comparing two sets of value records by their URIs and reconciling them. But this is not the way it is done here


saveEvent

public void saveEvent(net.sf.taverna.t2.provenance.item.ProvenanceItem provenanceItem,
                      net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary eventType)
               throws java.io.IOException
log raw event to file system

Parameters:
content -
eventType -
Throws:
java.io.IOException

fillInputVarBindings

public void fillInputVarBindings(java.lang.Object context)
                          throws java.sql.SQLException
for each arc of the form (_INPUT_/I, P/V): propagate VarBinding for P/V to var _INPUT_/I

Throws:
java.sql.SQLException

fillOutputVarBindings

public void fillOutputVarBindings(java.lang.Object context)
                           throws java.sql.SQLException
for each arc of the form (P/V, _OUTPUT_/O): propagate VarBinding for P/V to var _OUTPUT_/O

Throws:
java.sql.SQLException

toposort

public java.util.List<net.sf.taverna.t2.provenance.lineageservice.EventProcessor.Pair> toposort(java.lang.String dataflowName,
                                                                                                java.lang.String wfInstanceId)
                                                                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

tsort

public java.util.List<net.sf.taverna.t2.provenance.lineageservice.EventProcessor.Pair> tsort(java.util.List<java.lang.String> procList,
                                                                                             java.lang.String dataflowName,
                                                                                             java.util.Map<java.lang.String,java.lang.Integer> predecessorsCount,
                                                                                             java.util.Map<java.lang.String,java.util.List<java.lang.String>> successorsOf,
                                                                                             java.lang.String wfNameRef,
                                                                                             java.lang.String wfInstanceId)
                                                                                      throws java.sql.SQLException
Parameters:
procList -
predecessorsCount -
successorsOf -
wfInstanceId -
Returns:
Throws:
java.sql.SQLException

propagateANL

public java.util.List<java.lang.String> propagateANL(java.lang.String wfInstanceId)
                                              throws java.sql.SQLException
Throws:
java.sql.SQLException

setPw

public void setPw(ProvenanceWriter pw)

getPw

public ProvenanceWriter getPw()

setPq

public void setPq(ProvenanceQuery pq)

getPq

public ProvenanceQuery getPq()

setWfInstanceID

public void setWfInstanceID(java.lang.String wfInstanceID)

getWfInstanceID

public java.lang.String getWfInstanceID()

setWfdp

public void setWfdp(WorkflowDataProcessor wfdp)

getWfdp

public WorkflowDataProcessor getWfdp()