T2-936 retagged t2core
git-svn-id: https://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.core/tags/core-0.9@9282 bf327186-88b3-11dd-a302-d386e5130c1c
diff --git a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java
index ca896f5..27fdbe4 100644
--- a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java
+++ b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java
@@ -625,7 +625,7 @@
try {
getPw().addProcessorBinding(procBinding);
} catch (SQLException e) {
- logger.info("WARNING: provenance has duplicate processor binding -- due to workflow nesting?", e);
+ logger.debug("provenance has duplicate processor binding -- skipping the insertion"); //, e);
}
} else if (provenanceItem.getEventType().equals(SharedVocabulary.END_WORKFLOW_EVENT_TYPE)) {
@@ -1122,9 +1122,6 @@
vb.setCollIDRef(collIdRef);
vb.setPositionInColl(positionInCollection);
- logger.debug("new input VB with wfNameRef="+currentWorkflowID+" processorId="+processorId+
- " valueType="+valueType+" portName="+portName+" collIdRef="+collIdRef+" position="+positionInCollection+" itvector="+iterationVector);
-
newBindings.add(vb);
if (valueType.equals("literal")) {
@@ -1136,6 +1133,11 @@
vb.setIterationVector(iterationVector);
vb.setValue(valueEl.getAttributeValue("id"));
+ logger.debug("new input VB with wfNameRef="+currentWorkflowID+" processorId="+processorId+
+ " valueType="+valueType+" portName="+portName+" collIdRef="+collIdRef+
+ " position="+positionInCollection+" itvector="+iterationVector+
+ " value="+vb.getValue());
+
// logger.info("calling addVarBinding on "+vb.getPNameRef()+" : "+vb.getVarNameRef());
getPw().addVarBinding(vb);
@@ -1149,16 +1151,26 @@
vb.setValue(valueEl.getAttributeValue("id"));
vb.setRef(valueEl.getChildText("reference"));
+ logger.debug("new input VB with wfNameRef="+currentWorkflowID+" processorId="+processorId+
+ " valueType="+valueType+" portName="+portName+" collIdRef="+collIdRef+
+ " position="+positionInCollection+" itvector="+iterationVector+
+ " value="+vb.getValue());
+
try {
// logger.debug("calling addVarBinding on "+vb.getPNameRef()+" : "+vb.getVarNameRef()+" with it "+vb.getIteration());
getPw().addVarBinding(vb);
} catch (SQLException e) {
- logger.warn("Problem processing var binding", e);
+ logger.debug("Problem processing var binding -- performing update instead of insert", e); //, e);
+ // try to update the existing record instead using the current collection info
+
+ getPw().updateVarBinding(vb);
+// logger.warn("VarBinding update successful");
+
}
} else if (valueType.equals("list")) {
-// logger.warn("input of type list");
+ logger.debug("input of type list");
// add entries to the Collection and to the VarBinding tables
// list id --> Collection.collId
diff --git a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java
index eafe89e..da26f7b 100644
--- a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java
+++ b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java
@@ -498,6 +498,8 @@
q = q + " and '"+conds.get(0)+"'";
conds.remove(0);
}
+
+ q = q + " ORDER BY timestamp desc ";
try {
connection = getConnection();
@@ -2355,7 +2357,11 @@
-
+/**
+ * returns a Workflow record from the DB given the workflow internal ID
+ * @param dataflowID
+ * @return
+ */
public Workflow getWorkflow(String dataflowID) {
PreparedStatement ps = null;
diff --git a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java
index 76df3a8..c61f7f0 100644
--- a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java
+++ b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java
@@ -341,7 +341,11 @@
logger.warn("Error inserting record for Processor binding", e1);
} finally {
if (connection != null) {
- connection.close();
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ logger.warn("Can't close connection", e);
+ }
}
}
@@ -475,8 +479,8 @@
logger.warn("Error inserting record for a varBinding", e1);
} catch (ClassNotFoundException e1) {
logger.warn("Error inserting record for a varBinding", e1);
- } catch (SQLException e) {
- logger.warn("Var binding insert failed", e);
+// } catch (SQLException e) {
+// logger.warn("Var binding insert failed", e);
} finally {
if (connection != null) {
connection.close();
@@ -552,13 +556,13 @@
cnt++;
} catch (SQLException e) {
- logger.info("**** insert failed due to [" + e.getMessage() + "]");
+ logger.warn("**** insert failed for query ", e);
} catch (InstantiationException e) {
- logger.info("**** insert failed due to [" + e.getMessage() + "]");
+ logger.warn("**** insert failed ", e);
} catch (IllegalAccessException e) {
- logger.info("**** insert failed due to [" + e.getMessage() + "]");
+ logger.warn("**** insert failed ", e);
} catch (ClassNotFoundException e) {
- logger.info("**** insert failed due to [" + e.getMessage() + "]");
+ logger.warn("**** insert failed ", e);
} finally {
if (connection != null) {
try {
diff --git a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java
index e7e0455..72913fa 100644
--- a/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java
+++ b/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java
@@ -21,10 +21,12 @@
* this class manages the outputs from a workflow, as they come along through WorkflowData events
*/
public class WorkflowDataProcessor {
-
+
private static Logger logger = Logger.getLogger(WorkflowDataProcessor.class);
// set of trees (impl as lists), one for each varname
+ // PM varname not enough must use the WFID as context as well, because the same output varname
+ // may occur in multiple nested workflows
Map<String, List<WorkflowDataNode>> workflowDataTrees = new HashMap<String, List<WorkflowDataNode>>();
ProvenanceQuery pq=null;
@@ -43,6 +45,7 @@
int[] index = ((WorkflowDataProvenanceItem)provenanceItem).getIndex();
String iterationToString = ProvenanceUtils.iterationToString(index);
wdn.setIndex(iterationToString);
+ wdn.setWorkflowID(((WorkflowDataProvenanceItem)provenanceItem).getWorkflowId());
if (wdn.getValue().contains("list")) wdn.setList(true); // HACK
else wdn.setList(false);
@@ -58,7 +61,7 @@
for (WorkflowDataNode aNode: aTree) {
if (isParent(wdn.getIndex(), aNode.getIndex())) {
aNode.setParent(wdn);
-
+
// set position in collection as the last index in the vector
aNode.setRelativePosition(getPosition(aNode));
}
@@ -85,54 +88,60 @@
String varName = entry.getKey();
List<WorkflowDataNode> tree = entry.getValue();
- try {
+ VarBinding vb = null;
- logger.debug("storing tree for var "+varName);
+ try {
+ logger.debug("storing tree for var "+varName+" in workflow with ID "+dataflowID+" and instance "+wfInstanceRef);
for (WorkflowDataNode node:tree) {
+
+ if (!node.getWorkflowID().equals(dataflowID)) continue;
+
if (node.isList) {
logger.debug("creating collection entry for "+
node.value+" with index "+
node.index);
-
+
if (node.getParent()!=null) {
logger.debug(" and parent "+node.parent.index);
- // write a collection record to DB
- getPw().addCollection(dataflowID,
- node.getValue(),
- node.getParent().getValue(),
- node.getIndex(),
- varName,
- wfInstanceRef);
+ // write a collection record to DB
+ getPw().addCollection(dataflowID,
+ node.getValue(),
+ node.getParent().getValue(),
+ node.getIndex(),
+ varName,
+ wfInstanceRef);
} else {
getPw().addCollection(dataflowID,
- node.getValue(),
- null,
- node.getIndex(),
- varName,
- wfInstanceRef);
+ node.getValue(),
+ null,
+ node.getIndex(),
+ varName,
+ wfInstanceRef);
}
} else {
logger.debug("creating VarBinding for "+node.value+" with index "+node.index);
-
- VarBinding vb = new VarBinding();
+
+ vb = new VarBinding();
vb.setWfNameRef(dataflowID);
vb.setWfInstanceRef(wfInstanceRef);
- vb.setPNameRef(dataflowID);
+
+ vb.setPNameRef(pq.getWorkflow(dataflowID).getExternalName());
+
// vb.setValueType(); // TODO not sure what to set this to
vb.setVarNameRef(varName);
vb.setIterationVector(node.getIndex());
vb.setValue(node.getValue());
-
+
if (node.getParent()!=null) {
logger.debug(" in collection "+node.getParent().value+
" with index "+node.getParent().getIndex());
-
+
vb.setCollIDRef(node.getParent().getValue());
vb.setPositionInColl(node.getRelativePosition());
-
+
} else {
vb.setPositionInColl(1); // default
}
@@ -140,24 +149,26 @@
}
}
} catch (SQLException e) {
- logger.error("Problem processing trees for workflow: " +dataflowID + " instance: " + wfInstanceRef + " : ", e);
+ logger.debug("Problem processing trees for workflow: " +dataflowID + " instance: " + wfInstanceRef + " : "+
+ " updating instead of inserting");
+ getPw().updateVarBinding(vb);
}
}
}
-
+
/**
* @param node
* @return the last digit in the index
*/
private int getPosition(WorkflowDataNode node) {
-
+
String[] vector = node.getIndex().substring(1, node.getIndex().length()-1).split(",");
//TODO need some logic here to avoid trying to parse "" as integer, this is my try
-
+
//logger.debug("Vector length is " + vector.length);
//logger.debug("get position is " + vector[vector.length-1]);
if ((vector[vector.length-1]).equals("")) {
@@ -196,6 +207,7 @@
String varName;
String value;
String index;
+ String workflowID;
int relativePosition;
boolean isList;
WorkflowDataNode parent;
@@ -273,6 +285,18 @@
public void setRelativePosition(int relativePosition) {
this.relativePosition = relativePosition;
}
+ /**
+ * @return the workflowID
+ */
+ public String getWorkflowID() {
+ return workflowID;
+ }
+ /**
+ * @param workflowID the workflowID to set
+ */
+ public void setWorkflowID(String workflowID) {
+ this.workflowID = workflowID;
+ }
}
diff --git a/trunk/checkstyle.xml b/trunk/checkstyle.xml
deleted file mode 100644
index f0c64bb..0000000
--- a/trunk/checkstyle.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" ?>
-
-<!DOCTYPE module PUBLIC
- "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
- "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
-
-<module name="Checker">
- <module name="TreeWalker">
- <module name="LineLength">
- <property name="max" value="200" />
- <property name="severity" value="warning"/>
- </module>
- <module name="JavadocMethod">
- <property name="scope" value="public"/>
- <property name="allowUndeclaredRTE" value="true"/>
- <property name="severity" value="error"/>
- <property name="allowMissingParamTags" value="true"/>
- <property name="allowMissingThrowsTags" value="true"/>
- <property name="allowMissingReturnTag" value="true"/>
- <property name="allowMissingPropertyJavadoc" value="true"/>
- </module>
- <module name="JavadocType">
- <property name="scope" value="public"/>
- </module>
- <module name="ReturnCount">
- <property name="severity" value="warning"/>
- </module>
- </module>
- <module name="PackageHtml"/>
-</module>
diff --git a/trunk/pom.xml b/trunk/pom.xml
deleted file mode 100644
index 9eae277..0000000
--- a/trunk/pom.xml
+++ /dev/null
@@ -1,289 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>parent</artifactId>
- <groupId>net.sf.taverna</groupId>
- <version>0.1.2009-02-12</version>
- </parent>
-
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- <packaging>pom</packaging>
-
- <name>Taverna 2 Core</name>
- <build>
- <plugins>
-<plugin>
- <artifactId>maven-release-plugin</artifactId>
- <version>2.0-beta-9</version>
- </plugin>
-
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- <executions>
- <execution>
- <phase>pre-site</phase>
- <goals>
- <goal>instrument</goal>
- <goal>aggregate</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <jdk>1.5</jdk>
- <targetPercentage>50%</targetPercentage>
- <failOnViolation>false</failOnViolation>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <properties>
- <t2.infrastructure.version>1.12</t2.infrastructure.version>
- <t2.lang.version>0.6</t2.lang.version>
- </properties>
-
- <modules>
- <module>reference-api</module>
- <module>reference-impl</module>
- <module>reference-testhelpers</module>
- <module>workflowmodel-api</module>
- <module>workflowmodel-impl</module>
- <module>provenanceconnector</module>
- </modules>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <id>mygrid-repository</id>
- <name>myGrid Repository</name>
- <url>http://www.mygrid.org.uk/maven/repository</url>
- </repository>
- </repositories>
- <reporting>
- <plugins>
- <plugin>
- <artifactId>maven-checkstyle-plugin</artifactId>
- <configuration>
- <configLocation>
- ${basedir}/../checkstyle.xml
- </configLocation>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-clover-plugin</artifactId>
- <configuration>
- <generatePdf>true</generatePdf>
- <generateXml>true</generateXml>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <minmemory>128m</minmemory>
- <maxmemory>512</maxmemory>
- <aggregate>true</aggregate>
- <links>
- <link>
- http://www.mygrid.org.uk/taverna/api/
- </link>
- <link>
- http://java.sun.com/j2se/1.5.0/docs/api/
- </link>
- </links>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jxr-maven-plugin</artifactId>
- </plugin>
- </plugins>
- </reporting>
- <scm>
- <connection>scm:svn:http://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.core/trunk/</connection>
- <developerConnection>scm:svn:https://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.core/trunk/</developerConnection>
- <url>http://code.google.com/p/taverna/source/browse/#svn/taverna/engine/net.sf.taverna.t2.core/trunk</url>
- </scm>
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.13</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3</version>
- </dependency>
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>3.1</version>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.2</version>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- <version>1.0</version>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-beanshell-processor
- </artifactId>
- <version>${taverna.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-biomart-processor
- </artifactId>
- <version>${taverna.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-soaplab-processor
- </artifactId>
- <version>${taverna.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-localworkers</artifactId>
- <version>${taverna.version}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.scufl
- </groupId>
- <artifactId>scufl-model</artifactId>
- <version>${taverna.version}</version>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-stringconstant-processor
- </artifactId>
- <version>${taverna.version}</version>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>uk.org.mygrid.taverna.processors
- </groupId>
- <artifactId>taverna-java-processor</artifactId>
- <version>${taverna.version}</version>
- <exclusions>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven</artifactId>
- </exclusion>
- <exclusion>
- <groupId>uk.org.mygrid.taverna.raven
- </groupId>
- <artifactId>raven-log4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </dependencyManagement>
-</project>
diff --git a/trunk/provenanceconnector/javadoc.xml b/trunk/provenanceconnector/javadoc.xml
deleted file mode 100644
index 3d863c6..0000000
--- a/trunk/provenanceconnector/javadoc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project default="javadoc">
-<target name="javadoc">
-<javadoc access="public" author="true" classpath="/Users/paolo/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/core/reference-api/0.9-SNAPSHOT/reference-api-0.9-SNAPSHOT.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/launcher-api/1.12-SNAPSHOT/launcher-api-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/raven/1.12-SNAPSHOT/raven-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/geronimo-spec/geronimo-spec-jta/1.0-M1/geronimo-spec-jta-1.0-M1.jar:/Users/paolo/.m2/repository/org/aspectj/aspectjweaver/1.6.0/aspectjweaver-1.6.0.jar:/Users/paolo/.m2/repository/org/springframework/spring-orm/2.5.4/spring-orm-2.5.4.jar:/Users/paolo/.m2/repository/org/jvnet/jaxb2_commons/runtime/0.2.RC1/runtime-0.2.RC1.jar:/Users/paolo/.m2/repository/asm/asm/1.5.3/asm-1.5.3.jar:/Users/paolo/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/raven-log4j/1.12-SNAPSHOT/raven-log4j-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/org/springframework/spring-aop/2.5.4/spring-aop-2.5.4.jar:/Users/paolo/.m2/repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar:/Users/paolo/.m2/repository/org/openprovenance/tupelo/1.0.3/tupelo-1.0.3.jar:/Users/paolo/.m2/repository/org/springframework/spring-tx/2.5.4/spring-tx-2.5.4.jar:/Users/paolo/.m2/repository/commons-codec/commons-codec/1.2/commons-codec-1.2.jar:/Users/paolo/.m2/repository/org/openprovenance/opm/1.0.3/opm-1.0.3.jar:/Users/paolo/.m2/repository/junit/junit/4.4/junit-4.4.jar:/Users/paolo/.m2/repository/cglib/cglib/2.1_3/cglib-2.1_3.jar:/Users/paolo/.m2/repository/org/springframework/spring-beans/2.5.4/spring-beans-2.5.4.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/core/reference-core-extensions/0.7-SNAPSHOT/reference-core-extensions-0.7-SNAPSHOT.jar:/Users/paolo/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/spi-discovery-api/1.12-SNAPSHOT/spi-discovery-api-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/commons-lang/commons-lang/2.2/commons-lang-2.2.jar:/Users/paolo/.m2/repository/org/openprovenance/toolbox/1.0.3/toolbox-1.0.3.jar:/Users/paolo/.m2/repository/commons-jxpath/commons-jxpath/1.2/commons-jxpath-1.2.jar:/Users/paolo/.m2/repository/org/tupeloproject/tupelo-kernel/2.4.3/tupelo-kernel-2.4.3.jar:target/test-classes:/Users/paolo/.m2/repository/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/core/workflowmodel-api/0.9-SNAPSHOT/workflowmodel-api-0.9-SNAPSHOT.jar:/Users/paolo/.m2/repository/commons-io/commons-io/1.3/commons-io-1.3.jar:/Users/paolo/.m2/repository/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar:/Users/paolo/.m2/repository/org/aspectj/aspectjrt/1.6.0/aspectjrt-1.6.0.jar:/Users/paolo/.m2/repository/org/tupeloproject/tupelo-cet/2.4.3/tupelo-cet-2.4.3.jar:/Users/paolo/.m2/repository/org/tupeloproject/tupelo-util/2.4.3/tupelo-util-2.4.3.jar:/Users/paolo/.m2/repository/org/hibernate/hibernate/3.2.5.ga.raven/hibernate-3.2.5.ga.raven.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/appconfig/1.12-SNAPSHOT/appconfig-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/commons-pool/commons-pool/1.3/commons-pool-1.3.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/infrastructure/prelauncher/1.12-SNAPSHOT/prelauncher-1.12-SNAPSHOT.jar:/Users/paolo/.m2/repository/commons-beanutils/commons-beanutils/1.4/commons-beanutils-1.4.jar:/Users/paolo/.m2/repository/jdom/jdom/1.0/jdom-1.0.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/core/reference-impl/0.9-SNAPSHOT/reference-impl-0.9-SNAPSHOT.jar:/Users/paolo/.m2/repository/net/sf/taverna/t2/lang/observer/0.6-SNAPSHOT/observer-0.6-SNAPSHOT.jar:/Users/paolo/.m2/repository/simple-jndi/simple-jndi/0.11.1/simple-jndi-0.11.1.jar:/Users/paolo/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/paolo/.m2/repository/com/sun/xml/bind/jaxb-impl/2.1.3/jaxb-impl-2.1.3.jar:/Users/paolo/.m2/repository/commons-dbcp/commons-dbcp/1.2.2/commons-dbcp-1.2.2.jar:/Users/paolo/.m2/repository/org/springframework/spring-core/2.5.4/spring-core-2.5.4.jar:/Users/paolo/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar:/Users/paolo/.m2/repository/org/springframework/spring-context/2.5.4/spring-context-2.5.4.jar:/Users/paolo/.m2/repository/org/springframework/spring-jdbc/2.5.4/spring-jdbc-2.5.4.jar:/Users/paolo/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/paolo/.m2/repository/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar" destdir="doc" doctitle="ProvenanceConnector and Provenance Access API" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" source="1.5" sourcefiles="src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorRegistry.java,src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactory.java,src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactoryRegistry.java" sourcepath="src/main/java:src/test/java:src/main/resources" splitindex="true" use="true" version="true"/>
-</target>
-</project>
diff --git a/trunk/provenanceconnector/pom.xml b/trunk/provenanceconnector/pom.xml
deleted file mode 100644
index e527bdb..0000000
--- a/trunk/provenanceconnector/pom.xml
+++ /dev/null
@@ -1,128 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>provenanceconnector</artifactId>
- <name>Database storage and analysis of provenance info</name>
- <url>http://maven.apache.org</url>
- <properties>
- <t2.ui.components.version>0.10</t2.ui.components.version>
- </properties>
- <repositories>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>tupelo2</id>
- <name>tupelo2</name>
- <url>http://dlt-dev.ncsa.uiuc.edu/m2</url>
- </repository>
- <repository>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <id>opm</id>
- <name>opm</name>
- <url>http://openprovenance.org/java/maven-releases</url>
- </repository>
- </repositories>
-
- <dependencies>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.infrastructure</groupId>
- <artifactId>spi-discovery-api</artifactId>
- <version>${t2.infrastructure.version}</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-impl</artifactId>
- <version>0.9</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-core-extensions</artifactId>
- <version>0.7</version>
- </dependency>
-
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.tupeloproject</groupId>
- <artifactId>tupelo-cet</artifactId>
- <version>2.4.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.openprovenance</groupId>
- <artifactId>opm</artifactId>
- <version>1.0.3</version>
- </dependency>
-
- <dependency>
- <groupId>org.openprovenance</groupId>
- <artifactId>toolbox</artifactId>
- <version>1.0.3</version>
- </dependency>
-
- <dependency>
- <groupId>simple-jndi</groupId>
- <artifactId>simple-jndi</artifactId>
- <version>0.11.1</version>
- <exclusions>
- <exclusion>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-pool</groupId>
- <artifactId>commons-pool</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>commons-dbcp</groupId>
- <artifactId>commons-dbcp</artifactId>
- <version>1.2.2</version>
- </dependency>
-
-
- </dependencies>
-
-</project>
-
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactory.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactory.java
deleted file mode 100644
index 6166a4b..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactory.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package net.sf.taverna.t2.provenance;
-
-import net.sf.taverna.t2.provenance.connector.ProvenanceConnector;
-
-public interface ProvenanceConnectorFactory {
-
- public ProvenanceConnector getProvenanceConnector();
- public String getConnectorType();
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactoryRegistry.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactoryRegistry.java
deleted file mode 100644
index fe4b6e9..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorFactoryRegistry.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance;
-
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-/**
- * Get all the instances of {@link ProvenanceConnectorFactory} that are available using
- * this SPI Registry. Loads instances by looking at all files in
- * META-INF/services/net.sf.taverna.t2.provenance.ProvenanceConnectorFactory
- *
- * @author Ian Dunlop
- *
- */
-public class ProvenanceConnectorFactoryRegistry extends
- SPIRegistry<ProvenanceConnectorFactory> {
-
- private static ProvenanceConnectorFactoryRegistry instance;
-
- protected ProvenanceConnectorFactoryRegistry() {
- super(ProvenanceConnectorFactory.class);
- }
-
- /**
- * Get an instance of the registry that you can then get all the available
- * {@link ProvenanceConnector} instances from
- *
- * @return
- */
- public static synchronized ProvenanceConnectorFactoryRegistry getInstance() {
-
- if (instance == null) {
- instance = new ProvenanceConnectorFactoryRegistry();
- }
- return instance;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorRegistry.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorRegistry.java
deleted file mode 100644
index ba41dab..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/ProvenanceConnectorRegistry.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance;
-
-import net.sf.taverna.t2.provenance.connector.ProvenanceConnector;
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-/**
- * Get all the instances of {@link ProvenanceConnector} that are available using
- * this SPI Registry. Loads instances by looking at all files in
- * META-INF/services/net.sf.taverna.t2.provenance.connector.ProvenanceConnector
- *
- * @author Ian Dunlop
- *
- */
-public class ProvenanceConnectorRegistry extends
- SPIRegistry<ProvenanceConnector> {
-
- private static ProvenanceConnectorRegistry instance;
-
- protected ProvenanceConnectorRegistry() {
- super(ProvenanceConnector.class);
- }
-
- /**
- * Get an instance of the registry that you can then get all the available
- * {@link ProvenanceConnector} instances from
- *
- * @return
- */
- public static synchronized ProvenanceConnectorRegistry getInstance() {
-
- if (instance == null) {
- instance = new ProvenanceConnectorRegistry();
- }
- return instance;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/NativeAnswer.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/NativeAnswer.java
deleted file mode 100644
index 14659ca..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/NativeAnswer.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.api;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.provenance.lineageservice.Dependencies;
-import net.sf.taverna.t2.provenance.lineageservice.utils.QueryVar;
-
-/**
- * @author Paolo Missier<br/>
- * Java bean used to encapsulate the results of a provenance query
- *
- */
-public class NativeAnswer {
-
- Map<QueryVar, Map<String, List<Dependencies>>> answer;
-
- /**
- * @return a Map of the form: {@link QueryVar} --> ( <path> --> [ {@link Dependencies} ]) where
- * <ul>
- * <li> {@link QueryVar} denotes one of the ports in the <select> element of the input query
- * <li> <path> is the index within the value associated to the port, for instance [1,2,3] or [].
- * Multiple paths may appear if the query asked for the provenance of specific elements within a collection value, for example
- * <li> [{@link Dependencies}] is a list of {@link Dependencies}, each associated with one target processor and port as requested
- * in the input query.
- */
- public Map<QueryVar, Map<String, List<Dependencies>>> getAnswer() { return answer; }
-
- /**
- * @param sets the query answer, in the format described in {@link #getAnswer()}
- */
- public void setAnswer(Map<QueryVar, Map<String, List<Dependencies>>> answer) { this.answer = answer; }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceAccess.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceAccess.java
deleted file mode 100644
index 0361cc1..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceAccess.java
+++ /dev/null
@@ -1,558 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- *
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.api;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import net.sf.taverna.platform.spring.RavenAwareClassPathXmlApplicationContext;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.provenance.ProvenanceConnectorFactory;
-import net.sf.taverna.t2.provenance.ProvenanceConnectorFactoryRegistry;
-import net.sf.taverna.t2.provenance.connector.ProvenanceConnector;
-import net.sf.taverna.t2.provenance.lineageservice.Dependencies;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceAnalysis;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceQuery;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceWriter;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Workflow;
-import net.sf.taverna.t2.provenance.lineageservice.utils.WorkflowInstance;
-import net.sf.taverna.t2.provenance.reporter.ProvenanceReporter;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.log4j.Logger;
-import org.springframework.context.ApplicationContext;
-
-/**
- * @author Paolo Missier
- * @author Stuart Owen
- * <p/>This API is the single access point into the Taverna provenance database. Its main functionality is to
- * let clients query the content of the DB, either using dedicated methods that retrieve specific entity values from the
- * DB, or through a more general XML-based query language. Examples of XML provenance queries can be found in the external package
- * {@link net.sf.taverna.t2.provenance.apic.client.resources}. Class {@link net.sf.taverna.t2.provenance.api.client.ProvenanceAPISampleClient}
- * provides an example of API client that third parties would use to interact with this API.<br/>
- * The XML schema for the XML query language is {@code pquery.xsd} in {@link net.sf.taverna.t2.provenance.apic.client.resources}
- */
-public class ProvenanceAccess {
-
- private static Logger logger = Logger.getLogger(ProvenanceAccess.class);
- ProvenanceConnector provenanceConnector = null;
- ProvenanceAnalysis pa = null;
- ProvenanceQuery pq;
- ProvenanceWriter pw;
- Query q = null;
- private String connectorType;
- private boolean computeOPMGraph;
-
- public ProvenanceAccess(String connectorType) {
- this.connectorType = connectorType;
- init();
- }
-
- /**
- * The recommended data source intitialisation method, where only a driver name and jdbc url are required.<br/>
- * If the driver supports multiple connections,
- * then a pool will be created of 10 min idle, 50 max idle, and 50 max active connections.
- *
- * @param driverClassName
- * @param jdbcUrl
- */
- public static void initDataSource(String driverClassName,String jdbcUrl) {
- initDataSource(driverClassName,jdbcUrl,null,null,10,50,50);
- }
-
- /**
- * Initialises a named JNDI DataSource if not already set up externally.
- * The DataSource is named jdbc/taverna
- *
- * @param driverClassName - the classname for the driver to be used.
- * @param jdbcUrl - the jdbc connection url
- * @param username - the username, if required (otherwise null)
- * @param password - the password, if required (oteherwise null)
- * @param minIdle - if the driver supports multiple connections, then the minumum number of idle connections in the pool
- * @param maxIdle - if the driver supports multiple connections, then the maximum number of idle connections in the pool
- * @param maxActive - if the driver supports multiple connections, then the minumum number of connections in the pool
- */
- public static void initDataSource(String driverClassName, String jdbcUrl, String username, String password, int minIdle, int maxIdle, int maxActive) {
- System.setProperty(Context.INITIAL_CONTEXT_FACTORY,
- "org.osjava.sj.memory.MemoryContextFactory");
- System.setProperty("org.osjava.sj.jndi.shared", "true");
-
- BasicDataSource ds = new BasicDataSource();
- ds.setDriverClassName(driverClassName);
- ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
- ds.setMaxActive(maxActive);
- ds.setMinIdle(minIdle);
- ds.setMaxIdle(maxIdle);
- ds.setDefaultAutoCommit(true);
- if (username != null) {
- ds.setUsername(username);
- }
- if (password != null) {
- ds.setPassword(password);
- }
-
- ds.setUrl(jdbcUrl);
-
- InitialContext context;
- try {
- context = new InitialContext();
- context.rebind("jdbc/taverna", ds);
- } catch (NamingException ex) {
- logger.error("Problem rebinding the jdbc context: " + ex);
- }
-
- }
-
- /**
- * Initialises a default Reference Service for storing data and their associated references.
- * This creates a reference service using the named JNDI Data Source 'jdbc/taverna'.<br/>
- * the new Reference Service is associated to the {@link ProvenanceConnector}, enabling data references to be resolved
- */
- public InvocationContext initDefaultReferenceService() {
- return initReferenceService("hibernateReferenceServiceContext.xml");
- }
-
- /**
- * Initialises the Reference Service for a given hibernate context definition.
- * This mapping file must be available in the root of the classpath.
- * @see #initDefaultReferenceService()
- * @param hibernateContext
- */
- public InvocationContext initReferenceService(String hibernateContext) {
- ApplicationContext appContext = new RavenAwareClassPathXmlApplicationContext(hibernateContext);
-
- final ReferenceService referenceService = (ReferenceService) appContext
- .getBean("t2reference.service.referenceService");
-
- InvocationContext context = new InvocationContext() {
-
- public ReferenceService getReferenceService() {
- return referenceService;
- }
-
- public ProvenanceReporter getProvenanceReporter() {
- return provenanceConnector;
- }
-
- public <T> List<? extends T> getEntities(Class<T> entityType) {
- // TODO Auto-generated method stub
- return null;
- }
- };
-
- return context;
-
- }
-
-
- public void init() {
-
- for (ProvenanceConnectorFactory factory : ProvenanceConnectorFactoryRegistry.getInstance().getInstances()) {
- if (connectorType.equalsIgnoreCase(factory.getConnectorType())) {
- provenanceConnector = factory.getProvenanceConnector();
- }
- }
- logger.info("Provenance being captured using: " + provenanceConnector);
-
- //slight change, the init is outside but it also means that the init call has to ensure that the dbURL
- //is set correctly
- provenanceConnector.init();
-
- InvocationContext context = initDefaultReferenceService();
- provenanceConnector.setReferenceService(context.getReferenceService()); // CHECK context.getReferenceService());
- provenanceConnector.setInvocationContext(context);
-
- pa = provenanceConnector.getProvenanceAnalysis();
- pq = provenanceConnector.getQuery();
- pw = provenanceConnector.getWriter();
- }
-
-
-/////////
-// / main provenance query methods
-
-
-
- /**
- * Executes a provenance query. Please see separate doc. for the XML query language schema.
- * @throws SQLException
- */
- public QueryAnswer executeQuery (Query pq) throws SQLException {
-
- return pa.lineageQuery(pq.getTargetVars(), pq.getRunIDList().get(0), pq.getSelectedProcessors());
- }
-
-
- /**
- * Returns individal records from the provenance DB in response to a query that specifies
- * specific elements within values associated with a processor port, in the context of a specific run of a workflow.
- * <br/>This is used in the workbench to retrieve the "intermediate results" at various points during workflow execution,
- * as opposed to a set of dependencies in response to a full-fledged provenance query.
- * @param wfInstance lineage scope -- a specific instance
- * @param pname for a specific processor [required]
- * @param a specific (input or output) variable [optional]
- * @param iteration and a specific iteration [optional]
- * @return a list of {@ LineageQueryResultRecord}, encapsulated in a {@link Dependencies} object
- * @throws SQLException
- */
- public Dependencies fetchPortData(
- String wfInstance,
- String workflowId,
- String pname,
- String port,
- String iteration) {
-
- logger.info("running fetchPortData on instance "+wfInstance+
- " workflow "+workflowId+
- " processor "+pname+
- " port "+port+
- " iteration "+iteration);
- // TODO add context workflowID to query
- try {
- return pa.fetchIntermediateResult(wfInstance, workflowId, pname, port, iteration);
- } catch (SQLException e) {
- logger.error("Problem with fetching intermediate results: " + e);
- }
- return null;
- }
-
-// / manage instances
-
-
- /**
- * @param workflowId defines the scope of the query - if null then the query runs on all available workflows
- * @param conditions additional conditions to be defined. This is a placeholder as conditions are currently ignored
- * @return a list of wfInstanceID, each representing one run of the input workflowID
- */
- public List<WorkflowInstance> listRuns(String workflowId, Map<String, String> conditions) {
-
- try {
- return pq.getRuns(workflowId, conditions);
- } catch (SQLException e) {
- logger.error("Problem with listing runs: " + e);
- return null;
- }
- }
-
-
- /**
- * Removes all records that pertain to a specific run (but not the static specification of the workflow run)
- * @param runID the internal ID of a run. This can be obtained using {@link #listRuns(String, Map)}
- * @return the set of data references that pertain to the deleted run. This can be used by the Data Manager to ensure that
- * no dangling references are left in the main Taverna data repositorry
- */
- public Set<String> removeRun(String runID) {
-
- Set<String> danglingDataRefs = null;
-
- // implement using clearDynamic() method or a variation. Collect references and forward
- try {
- danglingDataRefs = pw.clearDBDynamic(runID);
-
- logger.debug("references collected during removeRun:");
- for (String s:danglingDataRefs) {
- logger.debug(s);
- }
-
- // TODO send the list of dangling refs to the Data manager for removal of the corresponding data values
- } catch (SQLException e) {
- logger.error("Problem while removing run : " + runID + " : "+ e.getMessage());
- }
- return danglingDataRefs;
- }
-
-
- /**
- * removes all records pertaining to the static structure of a workflow.
- *
- * @param wfName the ID (not the external name) of the workflow whose static structure is to be deleted from the DB
- */
- public void removeWorkflow(String wfName) {
-
- try {
- pw.clearDBStatic(wfName);
- } catch (SQLException e) {
- logger.error("Problem with removing static workflow: " + wfName+ " : "+ e.getMessage());
- }
- }
-
-
- /**
- * returns a set of workflowIDs for a given runID. The set is a singleton if the workflow has no nesting,
- * but in general the list contains one workflowID for each nested workflow involved in the run
- * @param runID the internal ID for a specific workflow run
- * @return a list of workflow IDs, one for each nested workflow involved in the input run
- */
- public List<String> getWorkflowID(String runID) {
-
- try {
- return pq.getWfNames(runID);
- } catch (SQLException e) {
- logger.error("Problem getting workflow ID: " + runID + " : " + e);
- }
- return null;
- }
-
-
- /**
- * @param runID the internal ID for a specific workflow run
- * @return the ID of the top-level workflow that executed during the input run
- */
- public String getTopLevelWorkflowID(String runID) {
-
- try {
- return pq.getTopLevelWfName(runID);
- } catch (SQLException e) {
- logger.error("Problem getting top level workflow: " + runID + " : " + e);
- }
- return null;
- }
-
-
- /**
- *
- * @return a list of {@link WorkflowInstance} beans, each representing the complete description of a workflow run (note that this is
- * not just the ID of the run)
- */
- public List<WorkflowInstance> getAllWorkflowIDs() {
- try {
- return pq.getRuns(null, null);
- } catch (SQLException e) {
- logger.error("Problem getting all workflow IDs: " + e);
- return null;
- }
-
- }
-
-
-// / access static workflow structure
-
-
- /**
- * @param a workflow processor name
- * @return the IDs of all workflows that contain a processor named pname
- */
- public List<Workflow> getContainingWorkflowsForProcessor(String pname) {
- return pq.getContainingWorkflowsForProcessor(pname);
- }
-
-
-
- /**
- *
- * @param workflowID
- * @return a Map: workflowID -> [ {@ link ProvenanceProcessor} ]
- * Each entry in the list pertains to one composing sub-workflow
- * (if no nesting then this contains only one workflow, namely the top level one)
- */
- public Map<String, List<ProvenanceProcessor>> getProcessorsInWorkflow(String workflowID) {
- return pq.getProcessorsDeep(null, workflowID);
- }
-
-
-
-
- /**
- * lists all ports for a processor
- * @param workflowID
- * @return a list of {@link Var} beans, each representing an input or output port for the workflow
- */
- public List<Var> getPortsForDataflow(String workflowID) {
-
- Workflow w = pq.getWorkflow(workflowID);
-
- Map<String, String> queryConstraints = new HashMap<String, String>();
- queryConstraints.put("wfInstanceRef", workflowID);
- queryConstraints.put("pnameRef", w.getExternalName());
-
- try {
- return pq.getVars(queryConstraints);
- } catch (SQLException e) {
- logger.error("Problem getting ports for dataflow: " + workflowID + " : " + e);
- }
- return null;
- }
-
-
-
- /**
- * list all ports for a specific processor within a workflow
- * @param workflowID
- * @param processorName
- * @return a list of {@link Var} beans, each representing an input or output port for the input processor
- */
- public List<Var> getPortsForProcessor(String workflowID, String processorName) {
-
- Map<String, String> queryConstraints = new HashMap<String, String>();
- queryConstraints.put("wfInstanceRef", workflowID);
- queryConstraints.put("pnameRef", processorName);
-
- try {
- return pq.getVars(queryConstraints);
- } catch (SQLException e) {
- logger.error("Problem getting ports for processor: " + processorName + " worflow: " + workflowID + " : " + e);
- }
- return null;
- }
-
-
-// public List<ProvenanceProcessor> getSuccessors(String workflowID, String processorName, String portName) {
-// return null; // TODO
-// }
-//
-// public List<String> getActivities(String workflowID, String processorName) {
-// return null; // TODO
-// }
-
-
-
-
-// / configure provenance query functionality
-
-
-
- /**
- * include valus of output ports in the query result? input port values are always included<br>
- * default is FALSE
- */
- public void toggleIncludeProcessorOutputs(boolean active) {
- return; // TODO
- }
-
-
- public boolean isIncludeProcessorOutputs() {
- return false; // TODO
- }
-
-
- /**
- * @return an instance of {@link InvocationContext} that can be used by a client to deref a Taverna data reference
- */
- public InvocationContext getInvocationContext() { return getProvenanceConnector().getInvocationContext(); }
-
-// / OPM management
-
-
- /**
- * should an OPM graph be generated in response to a query?<br>
- * default is TRUE
- */
- public void toggleOPMGeneration(boolean active) { pa.setGenerateOPMGraph(active); }
-
- /**
- *
- * @return true if OPM is set to be generated in response to a query
- */
- public boolean isOPMGenerationActive() { return pa.isGenerateOPMGraph(); }
-
-
- /**
- * should actual artifact values be attached to OPM artifact nodes?<br>
- * default is FALSE<br/>
- * THIS IS CURRENTLY UNSUPPORTED -- DEFAULTS TO FALSE
- * @param active
- */
- public void toggleAttachOPMArtifactValues(boolean active) {
- return; // TODO
- }
-
-
-/**
- *
- * @return true if the OPM graph artifacts are annotated with actual values
- */ public boolean isAttachOPMArtifactValues() {
- return false; // TODO
- }
-
-
- public String getWorkflowIDForExternalName(String workflowName) {
- return pq.getWfNameForDataflow(workflowName);
- }
-
- public String getProcessorNameForWorkflowID(String workflowID) {
- return pq.getProcessorForWorkflow(workflowID);
- }
-
-
-
- /**
- * @return the singleton {@link ProvenanceConnector} used by the API to operate on the DB. Currently we support
- * MySQL {@link MySQLProvenanceConnector} and Derby {@link DerbyProvenanceConnector} connectors.
- * The set of supported connectors is extensible. The available connectors are discovered automatically by the API
- * upon startup, and it includes all the connectors that are mentioned in the <dependencies> section of pom.xml
- * for Maven module {@code net.sf.taverna.t2.core.provenanceconnector}
- */
- public ProvenanceConnector getProvenanceConnector() { return provenanceConnector; }
-
-
- /**
- * @param a specific provenanceConnector used by the API
- */
- public void setProvenanceConnector(ProvenanceConnector provenanceConnector) {
- this.provenanceConnector = provenanceConnector;
- }
-
-
- /**
- * @return
- */
- public ProvenanceAnalysis getPa() {
- return pa;
- }
-
-
- /**
- * @param pa the pa to set
- */
- public void setPa(ProvenanceAnalysis pa) {
- this.pa = pa;
- }
-
-
- /**
- * @return the pq
- */
- public ProvenanceQuery getPq() {
- return pq;
- }
-
-
- /**
- * @param pq the pq to set
- */
- public void setPq(ProvenanceQuery pq) {
- this.pq = pq;
- }
-
-
-}
\ No newline at end of file
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceConnectorType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceConnectorType.java
deleted file mode 100644
index ccbda63..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceConnectorType.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package net.sf.taverna.t2.provenance.api;
-
-
-/**
- * Defines names for the common Provenance Connector types
- *
- * @author Stuart Owen
- */
-public class ProvenanceConnectorType {
- public static String MYSQL="mysql";
- public static String DERBY="derby";
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceQueryParser.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceQueryParser.java
deleted file mode 100644
index 638c7b0..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ProvenanceQueryParser.java
+++ /dev/null
@@ -1,509 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.api;
-
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.utils.QueryVar;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.WorkflowInstance;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.Namespace;
-import org.jdom.input.SAXBuilder;
-
-/**
- * @author paolo
- *
- */
-public class ProvenanceQueryParser {
-
- private static Logger logger = Logger.getLogger(ProvenanceQueryParser.class);
-
-
- private static final String SCOPE_EL = "scope";
- private static final String QUERY_SCOPE_ATTR = "workflow";
- private static final String PQUERY_EL = "pquery";
- private static final String RUNS_EL = "runs";
- private static final String RUN_ID = "id";
- private static final Object RUN_EL = "run";
- private static final Object RANGE_EL = "range";
- private static final String RANGE_FROM = "from";
- private static final String RANGE_TO = "to";
-
- private static final String PORT_SELECTION_EL = "select";
- private static final String WORKFLOW_NAME_ATTR = "name";
- private static final String PORT_EL = "outputPort";
- private static final String WORKFLOW_EL = "workflow";
- private static final String PROCESSOR_EL = "processor";
- private static final String PORT_NAME_ATTR = "name";
- private static final String PROC_NAME_ATTR = "name";
- private static final String PORT_NAME_EL = "name";
-
- private static final String PROC_FOCUS_EL = "focus";
-
- private static final String INDEX_ATTR = "index";
-
- private static final String PQUERY_NS = "http://taverna.org.uk/2009/provenance/pquery/";
-
-
- private static Namespace ns = Namespace.getNamespace(PQUERY_NS);
-
- private ProvenanceAccess pAccess;
-
- private String mainWorkflowExternalName = null;
- private String mainWorkflowID = null;
-
- /**
- *
- * @param XMLQuerySpec A string representation of the XML provenace query
- * @return
- */
- @SuppressWarnings("unchecked")
- public Query parseProvenanceQuery(String XMLQuerySpecFilename) {
-
- Query q = new Query();
-
- Document d=null;
-
- // parse the XML using JDOM
- SAXBuilder b = new SAXBuilder();
-
- try {
- d = b.build (new FileReader((XMLQuerySpecFilename)));
- } catch (Exception e) {
- logger.error("Problem parsing provenance query: " + e);
- return null;
- }
-
- q.setRunIDList(parseWorkflowAndRuns(d)); // sets the set of runs
- q.setWorkflowName(mainWorkflowExternalName);
- q.setTargetVars(parsePortSelection(d));
- q.setSelectedProcessors(parseProcessorFocus(d));
-
- return q;
- }
-
-
- /**
- * processor the <processorFocus> section of the query spec
- * @param d
- * @return
- */
- @SuppressWarnings("unchecked")
- private List<ProvenanceProcessor> parseProcessorFocus(Document d) {
-
- List<ProvenanceProcessor> selectedProcessors = new ArrayList<ProvenanceProcessor>();
-
- Element root = d.getRootElement();
-
- if (!root.getName().equals(PQUERY_EL)) {
- logger.fatal("input XML query is invalid");
- return null;
- }
-
- Element processorFocusEl = root.getChild(PROC_FOCUS_EL, ns);
-
- if (processorFocusEl == null) { // completely implicit: set to output ports of topLevelWorkflowID
- return processProcessorFocus(mainWorkflowID, mainWorkflowExternalName, null);
- }
-
- logger.debug("setting explicit processor focus");
-
- // expect a sequence of a mix of PROCESSOR or WORKFLOW elements
- List<Element> children = processorFocusEl.getChildren();
- for (Element childEl: children) {
-
- logger.debug("processing element "+childEl.getName());
-
- if (childEl.getName().equals(WORKFLOW_EL)) { //
- logger.debug("processorFocus>workflow"); // set new workflow scope
- selectedProcessors.addAll(processWorkflowFocus(childEl));
-
- } else if (childEl.getName().equals(PROCESSOR_EL)) { // ports within this processor
- logger.debug("processorFocus>processor"); // set new workflow scope
- String procName = childEl.getAttributeValue(PROC_NAME_ATTR);
- if (procName == null) {
- logger.warn("processor name not found in processorFocus > processor element");
- continue;
- }
- selectedProcessors.addAll(processProcessorFocus(mainWorkflowID, procName, childEl));
- }
-
- }
- return selectedProcessors;
- }
-
-
-
- /**
- * here we are processing <processor> within <workflow> within <processorFocus>
- * @param procScope
- * @param procScope
- */
- private List<ProvenanceProcessor> processProcessorFocus(String workflowID, String procScope, Element childEl) {
-
-// String processorNameScope = childEl.getAttributeValue(PROC_NAME_ATTR);
-// if (processorNameScope == null) {
-// logger.warn("no processor name found in <processor> tag");
-// return null;
-// }
-
- // get the ProvenanceProcessor object within the current scope
-
- // this gets a map workflowId -> [ProvenanceProcessor] for all workflows nested within the top workflowID
- Map<String, List<ProvenanceProcessor>> allProcessors = pAccess.getProcessorsInWorkflow(workflowID);
-
- List<ProvenanceProcessor> myProcs = allProcessors.get(workflowID); // processors for this specific workflow
- for (ProvenanceProcessor pp:myProcs) {
- if (procScope.equals(pp.getPname())) {
- List<ProvenanceProcessor> ppList = new ArrayList<ProvenanceProcessor>();
- ppList.add(pp);
- return ppList;
- }
- }
- return null;
- }
-
-
- /**
- * here we are parsing <workflow> inside <processorFocus>
- * @param childEl a <workflow> element
- * @return
- */
- private Collection<? extends ProvenanceProcessor> processWorkflowFocus(
- Element childEl) {
-
- List<ProvenanceProcessor> processors = new ArrayList<ProvenanceProcessor>();
-
- String workflowNameScope = childEl.getAttributeValue(WORKFLOW_NAME_ATTR);
- if (workflowNameScope == null) {
- logger.warn("no workflow name found in <workflow> tag");
- return null;
- }
- String workflowIDScope = pAccess.getWorkflowIDForExternalName(workflowNameScope);
-
- List<Element> children = childEl.getChildren(); // expect <processor> elements, or nothing
- if (children.size()==0) { // add all processors within this workflow
-
- // does a deep traversal of nesting hierarchy collecting all processors along the way
- Map<String, List<ProvenanceProcessor>> allProcs = pAccess.getProcessorsInWorkflow(workflowIDScope);
- for (Map.Entry<String, List<ProvenanceProcessor>> procList:allProcs.entrySet()) {
- processors.addAll(procList.getValue());
- }
- return processors;
- }
- for (Element processorEl:children) {
- String procScope = processorEl.getAttributeValue(PROC_NAME_ATTR);
-
- if (!processorEl.getName().equals(PROCESSOR_EL) || procScope == null) {
- logger.debug("no processorFocus > workflow > processor element or "+
- " no attribute "+PROC_NAME_ATTR+" in element processorFocus > workflow > processor");
- continue;
- }
- processors.addAll(processProcessorFocus(workflowIDScope, procScope, childEl));
- }
- return processors;
- }
-
-
-
- @SuppressWarnings("unchecked")
- private List<QueryVar> parsePorts(String workflowID, String procName, Element childEl) {
-
- List<QueryVar> queryVars = new ArrayList<QueryVar>();
- List<String> portNames = new ArrayList<String>();
-
- List<Var> ports = pAccess.getPortsForProcessor(workflowID, procName);
-
- List<Element> children = childEl.getChildren();
- if (children.size() == 0) {
- // add all output ports
- for (Var p:ports) {
- if (!p.isInput()) {
- QueryVar qv = new QueryVar();
- qv.setWfName(p.getWfInstanceRef());
- qv.setPname(p.getPName());
- qv.setVname(p.getVName());
- qv.setPath("ALL");
- queryVars.add(qv);
- }
- }
- } else {
- Map<String, String> portToIndex = new HashMap<String, String>();
- for (Element portEl:children) {
- if (portEl.getName().equals(PORT_EL)) {
- String portName = portEl.getAttributeValue(PORT_NAME_ATTR);
- String index = portEl.getAttributeValue(INDEX_ATTR);
- portNames.add(portName);
- if (index == null) portToIndex.put(portName, "ALL");
- else portToIndex.put(portName, index);
- }
- }
-
- Set<String> availableOutPortNames = new HashSet<String>();
- for (Var p:ports) if (!p.isInput()) { availableOutPortNames.add(p.getVName()); }
-
- for (String portName:portNames) {
-
- boolean found = false;
- for (Var p1:ports) {
- if (portName.equals(p1.getVName())) {
- QueryVar qv = new QueryVar();
- qv.setWfName(p1.getWfInstanceRef());
- qv.setPname(p1.getPName());
- qv.setVname(p1.getVName());
- String index = portToIndex.get(p1.getVName());
- if (index != null) qv.setPath(portToIndex.get(p1.getVName()));
- else qv.setPath("ALL");
- queryVars.add(qv);
- found = true;
- logger.debug("adding port "+p1.getPName()+":"+p1.getVName()+" to targetVars");
- break;
- }
- } if (!found) {
- logger.warn("output port "+portNames+" not found while processing <select>");
- }
- }
- }
- return queryVars;
- }
-
-
- private List<QueryVar> parseProcessor(String workflowID, Element childEl) {
- String procName = childEl.getAttributeValue(PROC_NAME_ATTR);
- logger.debug("portSelection>processor");
-
- return parsePorts(workflowID, procName, childEl); // parse all ports within this processor
- }
-
-
- @SuppressWarnings("unchecked")
- private List<QueryVar> parseWorkflow(Element workflowEl) {
-
- List<QueryVar> queryVars = new ArrayList<QueryVar>();
-
- String workflowNameScope = workflowEl.getAttributeValue(WORKFLOW_NAME_ATTR);
- String workflowIDScope = pAccess.getWorkflowIDForExternalName(workflowNameScope);
- //String defaultProcName = pAccess.getProcessorNameForWorkflowID(workflowIDScope);
-
- // expect nested processor elements
- List<Element> children = workflowEl.getChildren();
- for (Element childEl:children) {
- if (childEl.getName().equals(PROCESSOR_EL)) {
- queryVars.addAll(parseProcessor(workflowIDScope, childEl));
- } else if (childEl.getName().equals(PORT_EL)) { // pport with implicit processor scope = workflow scope
- queryVars.addAll(parsePorts(workflowIDScope, workflowNameScope, workflowEl)); // pass the parent's element
- }
- }
- return queryVars;
- }
-
-
-
- /**
- * the scope for a query can be partially specified. Please see doc elsewhere
- * @param d
- * @return
- */
- @SuppressWarnings("unchecked")
- private List<QueryVar> parsePortSelection(Document d) {
-
- List<QueryVar> queryVars = new ArrayList<QueryVar>();
- Element root = d.getRootElement();
-
- if (!root.getName().equals(PQUERY_EL)) {
- logger.fatal("input XML query is invalid");
- return null;
- }
-
- Element portSelection = root.getChild(PORT_SELECTION_EL, ns);
-
- if (portSelection == null) { // completely implicit: set to output ports of topLevelWorkflowID
- return parsePorts(mainWorkflowID, mainWorkflowExternalName, null);
- }
-
- logger.debug("setting explicit port selections");
-
- // expect a sequence of a mix of PORT elements or PROCESSOR or WORKFLOW elements
- List<Element> children = portSelection.getChildren();
- for (Element childEl: children) {
- logger.debug("processing element "+childEl.getName());
-
- if (childEl.getName().equals(WORKFLOW_EL)) { //
- logger.debug("portSelection>workflow"); // set new workflow scope
- queryVars.addAll(parseWorkflow(childEl));
- } else if (childEl.getName().equals(PROCESSOR_EL)) { // ports within this processor
- queryVars.addAll(parseProcessor(mainWorkflowID, childEl));
- } else if (childEl.getName().equals(PORT_EL)) { // ports within this processor
- queryVars.addAll(parsePorts(mainWorkflowID, mainWorkflowExternalName, portSelection));
- }
- }
- return queryVars;
- }
-
-
-
- /**
- * process runs scope, with the constraint that all the runs refer to the same (top level) workflow: queries over multiple workflows
- * are not supported.
- * @param d the XML Document describing the query
- * @return
- */
- @SuppressWarnings("unchecked")
- private List<String> parseWorkflowAndRuns(Document d) {
-
- List<String> runsScope = new ArrayList<String>(); // list of run IDs
- List<WorkflowInstance> feasibleWfInstances = new ArrayList<WorkflowInstance>();
- List<String> feasibleRuns = new ArrayList<String>();
-
- Element root = d.getRootElement(); // this should be a <pquery>
-
- if (!root.getName().equals(PQUERY_EL)) {
- logger.fatal("input XML query is invalid");
- return null;
- }
-
- Element queryScopeEl = root.getChild(SCOPE_EL, ns);
-
- // expect workflow ID
-
- if (queryScopeEl != null) {
- mainWorkflowExternalName = queryScopeEl.getAttributeValue(QUERY_SCOPE_ATTR);
-
- if (mainWorkflowExternalName == null) {
- logger.debug("no external name specified in workflow - giving up");
- return null;
- }
-
- // validate this workflowID
- List<WorkflowInstance> allWfInstances = pAccess.listRuns(null, null); // returns all available runs ordered by timestamp
- // is this workflow in one of the instances?
-
- for (WorkflowInstance i:allWfInstances) {
- if (mainWorkflowExternalName.equals(i.getWorkflowExternalName())) {
- mainWorkflowID = i.getWorkflowIdentifier();
- logger.debug("workflow name found corresponding to ID "+mainWorkflowID);
- feasibleWfInstances.add(i);
- feasibleRuns.add(i.getInstanceID());
- }
- }
- if (mainWorkflowID == null) {
- logger.fatal("workflow name "+mainWorkflowExternalName+" not in DB, terminating query");
- return null;
- }
- } else {
- logger.fatal("no <scope> tag found, giving up");
- return null;
- }
- if (feasibleWfInstances.size() == 0) {
- logger.debug("workflow "+mainWorkflowExternalName+" not found -- giving up");
- return null;
- }
-
- // get into the element and set the runs scope.
- Element runs = queryScopeEl.getChild(RUNS_EL, ns);
- if (runs != null) {
- logger.debug("setting explicit runs scope");
-
- // expect a sequence of run elements and/ or a single <range> element
- List<Element> runElList = runs.getChildren();
- for (Element runEl:runElList) {
-
- // explicit runID given
- if (runEl.getName().equals(RUN_EL)) {
- String runID = runEl.getAttributeValue(RUN_ID);
- if (runID!=null) {
- if (feasibleRuns.contains(runID)) {
- logger.debug("adding runID "+runID+" to runs scope");
- runsScope.add(runID);
- } else {
- logger.debug("selected runID "+runID+" not in provenance DB -- ignored");
- }
- } else {
- logger.warn("<run> element with no ID");
- }
-
- // time range given
- } else if (runEl.getName().equals(RANGE_EL)) {
- String from = runEl.getAttributeValue(RANGE_FROM,ns);
- String to = runEl.getAttributeValue(RANGE_TO,ns);
-
- logger.debug("processing runs range from "+from+" to "+to);
-
- for (WorkflowInstance i:feasibleWfInstances) {
-
- Date fromInstanceDate = null;
- Date toInstanceDate = null;
- DateFormat f = new SimpleDateFormat();
- Date fromDate=null, toDate=null;
-
- if (from != null) {
- try {
- fromDate = f.parse(from);
- fromInstanceDate = f.parse(i.getTimestamp());
- } catch (ParseException e) {
- logger.warn(from+" cannot be parsed as a date -- ignored");
- }
- }
-
- if (to != null) {
- try {
- toDate = f.parse(to);
- toInstanceDate = f.parse(i.getTimestamp());
- } catch (ParseException e) {
- logger.warn(to+" cannot be parsed as a date -- ignored");
- }
- }
- if (fromDate == null || (fromDate != null && fromDate.before(fromInstanceDate))) {
- if (toDate == null || (toDate != null && toInstanceDate.before(toDate)));
- runsScope.add(i.getInstanceID());
- }
- }
- }
- }
- } else {
- // no explicit run: using latest from feasible
- logger.debug("null runs scope: using latest run");
- if (feasibleWfInstances != null) runsScope.add(feasibleWfInstances.get(0).getInstanceID());
- }
-
- logger.debug("runs scope:");
- for (String r:runsScope) logger.debug(r);
-
- return runsScope;
- }
-
-
- /**
- * @return the provenance Access object
- */
- public ProvenanceAccess getPAccess() {
- return pAccess;
- }
-
- /**
- * @param access the pAccess to set
- */
- public void setPAccess(ProvenanceAccess access) {
- pAccess = access;
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/Query.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/Query.java
deleted file mode 100644
index b04d94a..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/Query.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.api;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.utils.QueryVar;
-
-/**
- * @author Paolo Missier</br>
- *
- * Bean encapsulating one provenance query, consisting of the following elements:
- * <ul>
- * <li>static scope: the (single) name of the workflow whose run(s) are queried
- * <li>dynamic scope: a list of workflow run IDs.
- * <li>a list of <select> variables, encoded as List<{@link QueryVar}>
- * <li>a list of <target> processors, encoded as List<{@link ProvenanceProcessor}>
- * </ul>
- */
-public class Query {
-
- String workflowName;
- List<QueryVar> targetVars;
- List<String> runIDList;
- List<ProvenanceProcessor> selectedProcessors;
-
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
- sb.append("\n **** QUERY SCOPE: ****\n").
- append("\tworkflow name: ").append(getWorkflowName()).
-
- append("\n\truns: ");
- for (String r:getRunIDList()) {
- sb.append("\n\t"+r);
- }
-
- sb.append("\n**** TARGET PORTS: ****\n");
- for (QueryVar v:getTargetVars()) {
- sb.append("\n\t"+v.toString());
- }
-
- sb.append("\n\n**** SELECTED PROCESSORS: **** ");
- for (ProvenanceProcessor pp:getSelectedProcessors()) {
- sb.append("\n\t"+pp.toString());
- }
-
- return sb.toString();
- }
-
- /**
- * @return the targetVars
- */
- public List<QueryVar> getTargetVars() {
- return targetVars;
- }
- /**
- * @param targetVars the targetVars to set
- */
- public void setTargetVars(List<QueryVar> targetVars) {
- this.targetVars = targetVars;
- }
- /**
- * @return the selectedProcessors
- */
- public List<ProvenanceProcessor> getSelectedProcessors() {
- return selectedProcessors;
- }
- /**
- * @param selectedProcessors the selectedProcessors to set
- */
- public void setSelectedProcessors(List<ProvenanceProcessor> selectedProcessors) {
- this.selectedProcessors = selectedProcessors;
- }
- /**
- * @return the runIDList
- */
- public List<String> getRunIDList() {
- return runIDList;
- }
- /**
- * @param runIDList the runIDList to set
- */
- public void setRunIDList(List<String> runIDList) {
- this.runIDList = runIDList;
- }
-
- /**
- * @return the workflowName
- */
- public String getWorkflowName() {
- return workflowName;
- }
-
- /**
- * @param workflowName the workflowName to set
- */
- public void setWorkflowName(String workflowName) {
- this.workflowName = workflowName;
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/QueryAnswer.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/QueryAnswer.java
deleted file mode 100644
index ca1403d..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/QueryAnswer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.api;
-
-/**
- * @author Paolo Missier
- *<p/>Encapsulates a native Java data structure as a well as a String that holds the OPM graph that represents the query answer
- *
- */
-public class QueryAnswer {
-
- NativeAnswer nativeAnswer;
-
- String _OPMAnswer_AsRDF;
-
- /**
- * @return the native Java part of the query answer
- */
- public NativeAnswer getNativeAnswer() { return nativeAnswer; }
-
- /**
- * @param sets the query answer
- */
- public void setNativeAnswer(NativeAnswer a) { this.nativeAnswer= a; }
-
- /**
- * @return the OPM graph as RDF/XML string, or null if OPM was inhibited {@see OPM.computeGraph in APIClient.properties}
- */
- public String getOPMAnswer_AsRDF() {
- return _OPMAnswer_AsRDF;
- }
-
- /**
- * @param set the OPM graph as RDF/XML string
- */
- public void setOPMAnswer_AsRDF(String asRDF) {
- _OPMAnswer_AsRDF = asRDF;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ReadProvenanceConfiguration.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ReadProvenanceConfiguration.java
deleted file mode 100644
index c8d5aeb..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/api/ReadProvenanceConfiguration.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package net.sf.taverna.t2.provenance.api;
-
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-public class ReadProvenanceConfiguration {
-
- String bundleName;
- private ResourceBundle RESOURCE_BUNDLE;
-
- private final String BUNDLE_NAME = "net.sf.taverna.t2.lineageService.capture.test.CaptureTestFiles"; //$NON-NLS-1$
-
- public ReadProvenanceConfiguration(String bundleName) {
- this.bundleName = bundleName;
- RESOURCE_BUNDLE = ResourceBundle.getBundle(bundleName);
- }
-
- public String getString(String key) {
- try {
- return RESOURCE_BUNDLE.getString(key);
- } catch (MissingResourceException e) {
- return '!' + key + '!';
- }
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/JDBCConnector.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/JDBCConnector.java
deleted file mode 100644
index db49d66..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/JDBCConnector.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package net.sf.taverna.t2.provenance.connector;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.sql.DataSource;
-
-/**
- * A shared factory class for retrieving a connection to the database.
- * The client is responsible for closing the connection once its finished with.
- *
- * The connection needs to be configured externally using a JNDI data source named "jdbc/taverna"
- *
- * @author Stuart Owen
- */
-
-public class JDBCConnector {
-
- /**
- * Provides a connection to a database, that has been defined externally as a JNDI DataSource with the name 'jdbc/taverna'
- *
- * The client is responsible for closing the connection once finished with.
- *
- * @return a connection to the database
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ClassNotFoundException
- * @throws SQLException
- */
- public static Connection getConnection() throws InstantiationException,
- IllegalAccessException, ClassNotFoundException, SQLException {
- InitialContext context;
- Connection connection = null;
- try {
- context = new InitialContext();
- DataSource ds = (DataSource) context.lookup("jdbc/taverna");
- connection = ds.getConnection();
- } catch (NamingException ex) {
- throw new SQLException("Unable to retrieve database connection for name jdbc/taverna");
- }
-
- return connection;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceConnector.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceConnector.java
deleted file mode 100644
index cfe09db..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceConnector.java
+++ /dev/null
@@ -1,443 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.connector;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.provenance.lineageservice.EventProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.LineageQueryResultRecord;
-import net.sf.taverna.t2.provenance.lineageservice.Provenance;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceAnalysis;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceQuery;
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceWriter;
-import net.sf.taverna.t2.provenance.lineageservice.WorkflowDataProcessor;
-import net.sf.taverna.t2.provenance.reporter.ProvenanceReporter;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-import org.apache.log4j.Logger;
-
-/**
- * Collects {@link ProvenanceItem}s as it travels up and down the dispatch stack
- * inside the InvocationContext
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- *
- */
-public abstract class ProvenanceConnector implements ProvenanceReporter {
-
- private static Logger logger = Logger.getLogger(ProvenanceConnector.class);
- private String saveEvents;
- private ProvenanceAnalysis provenanceAnalysis;
- private ExecutorService executor = Executors.newSingleThreadExecutor();
- private boolean finished = false;
- private String sessionID;
- private InvocationContext invocationContext;
- private ReferenceService referenceService;
-
- private Provenance provenance;
- private ProvenanceWriter writer;
- private ProvenanceQuery query;
- private WorkflowDataProcessor wfdp;
- private EventProcessor eventProcessor;
-
- public ProvenanceConnector() { }
-
-
- /**
- * Set up the the {@link EventProcessor}, {@link ProvenanceWriter} &
- * {@link ProvenanceQuery}. Since it is an SPI you don't want any code
- * cluttering the default constructor. Call this method after instantiation
- * and after the dbURL has been set.
- */
- public void init() {
-
- createDatabase();
-
- try {
- setWfdp(new WorkflowDataProcessor());
- getWfdp().setPq(getQuery());
- getWfdp().setPw(getWriter());
-
- setEventProcessor(new EventProcessor());
- getEventProcessor().setPw(getWriter());
- getEventProcessor().setPq(getQuery());
- getEventProcessor().setWfdp(getWfdp());
-
- setProvenanceAnalysis(new ProvenanceAnalysis(getQuery()));
- setProvenance(new Provenance(getEventProcessor()));
- } catch (InstantiationException e) {
- logger.error("Problem with provenance initialisation: ",e);
- } catch (IllegalAccessException e) {
- logger.error("Problem with provenance initialisation: ",e);
- } catch (ClassNotFoundException e) {
- logger.error("Problem with provenance initialisation: ",e);
- } catch (SQLException e) {
- logger.error("Problem with provenance initialisation: ",e);
- }
- }
-
-
-
- /**
- * @return the invocationContext
- */
- public InvocationContext getInvocationContext() {
- return invocationContext;
- }
-
- /**
- * @param invocationContext the invocationContext to set
- */
- public void setInvocationContext(InvocationContext invocationContext) {
- this.invocationContext = invocationContext;
- }
-
- /**
- * @return the referenceService
- */
- public ReferenceService getReferenceService() {
- return referenceService;
- }
-
- /**
- * @param referenceService the referenceService to set
- */
- public void setReferenceService(ReferenceService referenceService) {
- this.referenceService = referenceService;
- }
-
-
- /**
- * Uses a {@link ScheduledThreadPoolExecutor} to process events in a Thread
- * safe manner
- */
- public synchronized void addProvenanceItem(
- final ProvenanceItem provenanceItem) {
-
-// Runnable runnable = new Runnable() {
-//
-// public void run() {
- try {
-
- getProvenance().acceptRawProvenanceEvent(
- provenanceItem.getEventType(), provenanceItem);
-
- } catch (SQLException e) {
- logger.warn("Could not add provenance for " + provenanceItem.getEventType() + " " + provenanceItem.getIdentifier() + " " + e);
- } catch (IOException e) {
- logger.warn("Could not add provenance for " + provenanceItem.getEventType() + " " + provenanceItem.getIdentifier() + " " + e);
- }
-//
-// }
-// };
-// getExecutor().execute(runnable);
-
- }
-
- protected Connection getConnection() throws InstantiationException,
- IllegalAccessException, ClassNotFoundException, SQLException {
- return JDBCConnector.getConnection();
- }
-
- /**
- * Used by database backed provenance stores. Ask the implementation to
- * create the database. Requires each datbase type to create all its own
- * tables
- */
- public abstract void createDatabase();
-
-
- public void clearDatabase() { clearDatabase(true); }
-
- /**
- * Clear all the values in the database but keep the db there
- */
- public void clearDatabase(boolean isClearDB) {
-
- if (isClearDB) {
- logger.info("clearing DB");
- try {
- getWriter().clearDBStatic();
-
- Set<String> danglingDataRefs = getWriter().clearDBDynamic();
-
- logger.info("references collected during removeRun:");
- for (String s:danglingDataRefs) {
- logger.info(s);
- }
-
- } catch (SQLException e) {
- logger.error("Problem clearing database: " + e);
- }
- } else {
- System.out.println("clearDB is FALSE: not clearing");
- }
-
-// String q = null;
-// Connection connection = null;
-
-// Statement stmt = null;
-// try {
-// connection = getConnection();
-// stmt = connection.createStatement();
-// } catch (SQLException e) {
-// logger.warn("Could not create database statement :" + e);
-// } catch (InstantiationException e) {
-// logger.warn("Could not create database statement :" + e);
-// } catch (IllegalAccessException e) {
-// logger.warn("Could not create database statement :" + e);
-// } catch (ClassNotFoundException e) {
-// logger.warn("Could not create database statement :" + e);
-// }
-
-// q = "DELETE FROM Workflow";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM Processor";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM Arc";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM Var";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM WfInstance";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM ProcBinding";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM VarBinding";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM Collection";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// q = "DELETE FROM Data";
-// try {
-// stmt.executeUpdate(q);
-// } catch (SQLException e) {
-// logger.warn("Could not execute statement " + q + " :" + e);
-// }
-
-// if (connection!=null) try {
-// connection.close();
-// } catch (SQLException ex) {
-// logger.error("Error closing connection",ex);
-// }
- }
-
- /**
- * The name for this type of provenance connector. Is used by the workbench
- * to ensure it adds the correct one to the InvocationContext
- *
- * @return
- */
- public abstract String getName();
-
- /**
- * A unique identifier for this run of provenance, should correspond to the
- * initial {@link WorkflowProvenanceItem} idenifier that gets sent through
- *
- * @param identifier
- */
- public void setSessionID(String sessionID) {
- this.sessionID = sessionID;
- }
-
- /**
- * What is the unique identifier used by this connector
- *
- * @return
- */
- public String getSessionID() {
- return sessionID;
- }
-
-
- public List<LineageQueryResultRecord> computeLineage(String wfInstance,
- String var, String proc, String path, Set<String> selectedProcessors) {
- return null;
- }
-
- public String getDataflowInstance(String dataflowId) {
- String instanceID = null;
- try {
- instanceID = (getProvenance()).getPq().getRuns(dataflowId, null).get(0).getInstanceID();
- } catch (SQLException e) {
- logger.error("Error finding the dataflow instance", e);
- }
- return instanceID;
- }
-
- /**
- * @return the saveEvents
- */
- public String getSaveEvents() {
- return saveEvents;
- }
-
- /**
- * @param saveEvents
- * the saveEvents to set
- */
- public void setSaveEvents(String saveEvents) {
- this.saveEvents = saveEvents;
- }
-
- public void setProvenance(Provenance provenance) {
- this.provenance = provenance;
- }
-
- public Provenance getProvenance() {
- return provenance;
- }
-
- public void setFinished(boolean finished) {
- this.finished = finished;
- }
-
- public boolean isFinished() {
- return finished;
- }
-
- public void setExecutor(ExecutorService executor) {
- this.executor = executor;
- }
-
- public synchronized ExecutorService getExecutor() {
- return executor;
- }
-
- public void setProvenanceAnalysis(ProvenanceAnalysis provenanceAnalysis) {
- this.provenanceAnalysis = provenanceAnalysis;
- }
-
- /**
- * Use this {@link ProvenanceAnalysis} to carry out lineage queries on the
- * provenance
- *
- * @return
- */
- public ProvenanceAnalysis getProvenanceAnalysis() {
- return provenanceAnalysis;
- }
-
- /**
- * @return the writer
- */
- public ProvenanceWriter getWriter() {
- return writer;
- }
-
- /**
- * @param writer the writer to set
- */
- protected void setWriter(ProvenanceWriter writer) {
- this.writer = writer;
- }
-
- /**
- * @return the query
- */
- public ProvenanceQuery getQuery() {
- return query;
- }
-
- /**
- * @param query the query to set
- */
- protected void setQuery(ProvenanceQuery query) {
- this.query = query;
- }
-
- /**
- * @return the wfdp
- */
- public WorkflowDataProcessor getWfdp() {
- return wfdp;
- }
-
- /**
- * @param wfdp the wfdp to set
- */
- public void setWfdp(WorkflowDataProcessor wfdp) {
- this.wfdp = wfdp;
- }
-
- /**
- * @return the eventProcessor
- */
- public EventProcessor getEventProcessor() {
- return eventProcessor;
- }
-
- /**
- * @param eventProcessor the eventProcessor to set
- */
- public void setEventProcessor(EventProcessor eventProcessor) {
- this.eventProcessor = eventProcessor;
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceSQL.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceSQL.java
deleted file mode 100644
index 628c80e..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/connector/ProvenanceSQL.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package net.sf.taverna.t2.provenance.connector;
-
-public class ProvenanceSQL {
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/AnnotationsLoader.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/AnnotationsLoader.java
deleted file mode 100644
index 5c5debf..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/AnnotationsLoader.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-/**
- * @author Paolo Missier
- *
- */
-public class AnnotationsLoader {
-
- private static Logger logger = Logger.getLogger(AnnotationsLoader.class);
-
-
- /**
- *
- * @param annotationFile by convention we use <workflow file name>+"annotations"
- * @return a map pname -> annotation so that the lineage query alg can use the annotation
- * when processing pname
- */
- @SuppressWarnings("unchecked")
- public Map<String,List<String>> getAnnotations(String annotationFile) {
-
-
- Map<String,List<String>> procAnnotations = new HashMap<String,List<String>>();
-
- // load XML file as doc
-// parse the event into DOM
- SAXBuilder b = new SAXBuilder();
- Document d;
-
- try {
- d = b.build (new FileReader(annotationFile));
-
- if (d == null) return null;
-
- Element root = d.getRootElement();
-
- // look for all processor elements
- List<Element> processors = root.getChildren();
-
- for (Element el:processors) {
-
- String pName = el.getAttributeValue("name");
- logger.info("processor name: "+pName);
-
- List<String> annotations = new ArrayList<String>();
- // extract all annotations for this pname
-
- List<Element> annotEl = el.getChildren();
-
- for (Element annotElement: annotEl) {
-
- String annot = annotElement.getAttributeValue("type");
- logger.info("annotation: "+annot);
-
- // add this annotation
- annotations.add(annot);
- }
-
- procAnnotations.put(pName, annotations);
-
- }
-
-
- } catch (JDOMException e) {
- logger.error("Problem getting annotations from: " + annotationFile + " : " + e);
- } catch (IOException e) {
- logger.error("Problem getting annotations from: " + annotationFile + " : " + e);
- }
- return procAnnotations;
-
-
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Dependencies.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Dependencies.java
deleted file mode 100644
index 1e376e5..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Dependencies.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-/**
- * @author Paolo Missier<p/>
- * Java bean to hold a list of dependencies, all of them associated with a pair (<port name>, <path>), as described in {@link net.sf.taverna.t2.provenance.api.QueryAnswer}.
- * <br/> Each element of the list is a record of type {@link LineageQueryResultRecord} in the provenance DB at the finest possible level of granularity, i.e.,
- * a single value possibly within a collection, bound to a processor port and associated to a specific run of a specific workflow.
- * @see LineageQueryResultRecord
- */
-public class Dependencies {
-
- final public static String COLL_TYPE = "referenceSetCollection";
- final public static String ATOM_TYPE = "referenceSet";
-
- boolean printResolvedValue;
-
- private List<LineageQueryResultRecord> records = new ArrayList<LineageQueryResultRecord>();
-
- public ListIterator<LineageQueryResultRecord> iterator() { return getRecords().listIterator(); }
-
- /**
- * adds a single record to the list of dependencies
- * @param wfNameRef
- * @param pname
- * @param vname
- * @param wfInstance
- * @param iteration
- * @param collIdRef
- * @param parentCollIDRef
- * @param value
- * @param resolvedValue
- * @param type
- * @param isInput
- * @param isCollection
- */
- public void addLineageQueryResultRecord(
- String wfNameRef,
- String pname,
- String vname,
- String wfInstance,
- String iteration,
- String collIdRef,
- String parentCollIDRef,
- String value,
- String resolvedValue,
- String type, boolean isInput, boolean isCollection) {
-
- LineageQueryResultRecord record = new LineageQueryResultRecord();
-
- record.setWfName(wfNameRef);
- record.setWfInstance(wfInstance);
- record.setPname(pname);
- record.setValue(value);
- record.setVname(vname);
- record.setIteration(iteration);
- record.setResolvedValue(resolvedValue);
- record.setInput(isInput);
- record.setCollIdRef(collIdRef);
- record.setParentCollIDRef(parentCollIDRef);
- record.setCollection(isCollection);
-
- getRecords().add(record);
- }
-
- /**
- * populates the bean with an entire list of {@link LineageQueryResultRecord} elements
- * @param records
- */
- public void setRecords(List<LineageQueryResultRecord> records) {
- this.records = records;
- }
-
- /**
- * @return the entire set of records
- */
- public List<LineageQueryResultRecord> getRecords() {
- return records;
- }
-
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
- for (LineageQueryResultRecord record:getRecords()) {
-
- record.setPrintResolvedValue(printResolvedValue);
- sb.append("*** record: ****\n"+record.toString());
- }
- return sb.toString();
- }
-
- /**
- * @return true is the records contain the actual values, in addition to the URI references to the values
- * <br/>NOT YET SUPPORTED. This switch is currently ignored and no values are returned in the current version
- */
- public boolean isPrintResolvedValue() {
- return printResolvedValue;
- }
-
- /**
- * @param toggles insertion of values in addition to references to values in the records
- * <br/>NOT YET SUPPORTED. This switch is currently ignored and no values are returned in the current version
- */
- public void setPrintResolvedValue(boolean printResolvedValue) {
- this.printResolvedValue = printResolvedValue;
- }
-}
-
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java
deleted file mode 100644
index 27fdbe4..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/EventProcessor.java
+++ /dev/null
@@ -1,1735 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.beans.ExceptionListener;
-import java.beans.XMLEncoder;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.sql.Blob;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.sql.rowset.serial.SerialBlob;
-
-import net.sf.taverna.t2.provenance.item.InputDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.IterationProvenanceItem;
-import net.sf.taverna.t2.provenance.item.OutputDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Arc;
-import net.sf.taverna.t2.provenance.lineageservice.utils.NestedListNode;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProcBinding;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceUtils;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializerRegistry;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.Namespace;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.XMLOutputter;
-
-/**
- * @author Paolo Missier
- */
-public class EventProcessor {
- /**
- * A map of UUIDs of the originating processor to the ProcBinding object
- * that contains its parameters
- */
- private Map<String, ProcBinding> procBindingMap = new ConcurrentHashMap<String, ProcBinding>();;
-
- /** A map of child ids to their parents in the hierarchy of events:
- * workflow -> process -> processor -> activity -> iteration
- */
- private Map<String, String> parentChildMap= new ConcurrentHashMap<String, String>();
-
- private static Logger logger = Logger.getLogger(EventProcessor.class);
-
- private static final String OUTPUT_CONTAINER_PROCESSOR = "_OUTPUT_";
- private static final String INPUT_CONTAINER_PROCESSOR = "_INPUT_";
- private static final String TEST_EVENTS_FOLDER = "/tmp/TEST-EVENTS";
-
- private static final String DATAFLOW_PROCESSOR_TYPE = "net.sf.taverna.t2.activities.dataflow.DataflowActivity";
-
- private int eventCnt = 0; // for events logging
- private volatile boolean workflowStructureDone = false; // used to inhibit processing of multiple workflow events -- we only need the first
- private int dataflowDepth = 0; // incremented when we recurse on a subflow, decremented on exit
- private volatile String wfInstanceID = null; // unique run ID. set when we see the first event of type "process"
-
- String topLevelDataflowName = null;
- String topLevelDataflowID = null;
-
- Map<String, String> wfNestingMap = new ConcurrentHashMap<String, String>();
-
- // all input bindings are accumulated here so they can be "backpatched" (see backpatching() )
- List<VarBinding> allInputVarBindings = Collections.synchronizedList(new ArrayList<VarBinding>());
-
- // dedicated class for processing WorkflowData events which carry workflow output info
- private WorkflowDataProcessor wfdp;
- private ProvenanceWriter pw = null;
- private ProvenanceQuery pq = null;
-
- public EventProcessor() { }
-
- /**
- * @param pw
- * @throws SQLException
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- *
- */
- public EventProcessor(ProvenanceWriter pw, ProvenanceQuery pq, WorkflowDataProcessor wfdp)
- throws InstantiationException, IllegalAccessException,
- ClassNotFoundException, SQLException {
- this.pw = pw;
- this.pq = pq;
- this.wfdp = wfdp;
-
- logger.setLevel((Level)Level.INFO);
- }
-
-
- /**
- * this is the new version that makes use of the T2 deserializer
- * populate static portion of the DB<br/>
- * 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
- * @param content
- * is a serialized dataflow (XML) -- this is parsed using the T2
- * Deserializer
- * @return the wfInstanceRef for this workflow structure
- */
- public String processWorkflowStructure(ProvenanceItem provenanceItem) {
-
- // this flag is set to prevent processing of separate workflowProvenanceItems that describe nested workflows.
- // the processing of all nested workflows is done as part of the very first workflowProvenanceItem that we receive,
- // which is self-consistent. so we ignore all others
- if (workflowStructureDone) { return null; }
-
- setWfInstanceID(((WorkflowProvenanceItem)provenanceItem).getIdentifier());
-// logger.debug("Workflow instance is: " + getWfInstanceID());
- Dataflow df = null;
-
- df = ((WorkflowProvenanceItem)provenanceItem).getDataflow();
-
- workflowStructureDone = true;
-
- topLevelDataflowName = df.getLocalName();
- topLevelDataflowID = df.getInternalIdentier();
-
- // check whether we already have this WF in the DB
- List<String> wfNames = null;
- try {
- wfNames = pq.getAllWFnames();
- } catch (SQLException e) {
- logger.warn("Problem processing workflow structure", e);
- }
-
- if (wfNames != null && wfNames.contains(topLevelDataflowID)) { // already in the DB
-// logger.info("workflow structure with ID "+topLevelDataflowID+" is in the DB -- clearing static portion");
-
- // clearing the portion of the static DB that pertains to this specific WF.
- // it is going to be rewritten right away in the rest of this method
- // this is simpler to implement than selectively avoiding duplicate writes to the DB
- try {
- pw.clearDBStatic(topLevelDataflowID);
- } catch (SQLException e) {
- logger.warn("Can't clear static database for " + topLevelDataflowID, e);
- }
-
- } else {
-// logger.info("new workflow structure with ID "+topLevelDataflowID);
- }
-
- // record the top level dataflow as a processor in the DB
- try {
- pw.addProcessor(topLevelDataflowName, DATAFLOW_PROCESSOR_TYPE, topLevelDataflowID, true); // true -> is top level
- } catch (SQLException e) {
- logger.warn("Can't add processor " + topLevelDataflowID, e);
- }
-
-// logger.info("top level wf name: "+topLevelDataflowName);
- return processDataflowStructure(df, topLevelDataflowID, df.getLocalName()); // null: no external name given to top level dataflow
- }
-
-
- /**
- * note: this method can be called as part of a recursion on sub-workflows
- * @param df
- * @param dataflowID the UUID for the entire dataflow (may be a sub-dataflow)
- * @param localName the external name of the dataflow. Null if this is top level, not null if a sub-dataflow
- * @return the wfInstanceRef for this workflow structure
- */
- @SuppressWarnings("unchecked")
- public String processDataflowStructure(Dataflow df, String dataflowID, String externalName) {
-
- String localWfInstanceID = getWfInstanceID();
-
- dataflowDepth++;
-
- try {
-
- List<Var> vars = new ArrayList<Var>();
-
- // check whether we already have this WF in the DB
- List<String> wfNames = null;
- try {
- wfNames = pq.getAllWFnames();
- } catch (SQLException e) {
- logger.warn("Problem processing dataflow structure for " + dataflowID, e);
- }
-
- if (wfNames != null && wfNames.contains(dataflowID)) { // already in the DB
-// logger.info("workflow structure with ID "+dataflowID+" is in the DB -- clearing static portion");
-
- // clearing the portion of the static DB that pertains to this specific WF.
- // it is going to be rewritten right away in the rest of this method
- // this is simpler to implement than selectively avoiding duplicate writes to the DB
- pw.clearDBStatic(dataflowID);
- } else {
-// logger.warn("new workflow structure with ID "+dataflowID);
- }
-
- // //////
- // add workflow ID -- this is NOT THE SAME AS the wfInstanceID
- // /////
-
- // this could be a nested workflow -- in this case, override its wfInstanceID with that of its parent
- String parentDataflow;
- if ((parentDataflow = wfNestingMap.get(dataflowID)) == null) {
- Element serializeDataflow = XMLSerializerRegistry.getInstance().getSerializer().serializeDataflow(df);
- String dataflowString = null;
- try {
- XMLOutputter outputter = new XMLOutputter();
- StringWriter stringWriter = new StringWriter();
- outputter.output(serializeDataflow, stringWriter);
- dataflowString = stringWriter.toString();
-
- } catch (java.io.IOException e) {
- logger.error("Could not serialise dataflow", e);
- }
- Blob blob = new SerialBlob(dataflowString.getBytes("UTF-8"));
- // this is a top level dataflow description
- pw.addWFId(dataflowID, null, externalName, blob); // set its dataflowID with no parent
-
- } else {
- Element serializeDataflow = XMLSerializerRegistry.getInstance().getSerializer().serializeDataflow(df);
- String dataflowString = null;
- try {
- XMLOutputter outputter = new XMLOutputter();
- StringWriter stringWriter = new StringWriter();
- outputter.output(serializeDataflow, stringWriter);
- dataflowString = stringWriter.toString();
-
- } catch (java.io.IOException e) {
- logger.error("Could not serialise dataflow", e);
- }
-
- Blob blob = new SerialBlob(dataflowString.getBytes("UTF-8"));
- // we are processing a nested workflow structure
- logger.debug("dataflow "+dataflowID+" with external name "+externalName+" is nested within "+parentDataflow);
-
- pw.addWFId(dataflowID, parentDataflow, externalName, blob); // set its dataflowID along with its parent
-
- // override wfInstanceID to point to top level -- UNCOMMENTED PM 9/09 CHECK
- localWfInstanceID = pq.getRuns(parentDataflow, null).get(0).getInstanceID();
-// logger.debug("overriding nested WFRef "+getWfInstanceID()+" with parent WFRef "+localWfInstanceID);
-
-
- }
- pw.addWFInstanceId(dataflowID, localWfInstanceID); // wfInstanceID stripped by stripWfInstanceHeader() above
-
- // //////
- // add processors along with their variables
- // /////
- List<? extends Processor> processors = df.getProcessors();
-
- for (Processor p : processors) {
-
-// logger.info("adding processor "+p.getLocalName());
-
- String pName = p.getLocalName();
-
- //CHECK get type of first activity and set this as the type of the processor itself
- List<? extends Activity<?>> activities = p.getActivityList();
-
- String pType = null;
- if (activities != null && !activities.isEmpty()) {
- pType = activities.get(0).getClass().getCanonicalName();
- }
- pw.addProcessor(pName, pType, dataflowID, false); // false: not a top level processor
-
- // ///
- // add all input ports for this processor as input variables
- // ///
- List<? extends ProcessorInputPort> inputs = p.getInputPorts();
-
- for (ProcessorInputPort ip : inputs) {
-
- Var inputVar = new Var();
-
- inputVar.setPName(pName);
- inputVar.setWfInstanceRef(dataflowID);
- inputVar.setVName(ip.getName());
- inputVar.setTypeNestingLevel(ip.getDepth());
- inputVar.setInput(true);
-
-// logger.info("processDataflowStructure: adding input var "+pName+":"+ip.getName());
-
- vars.add(inputVar);
- }
-
- // ///
- // add all output ports for this processor as output variables
- // ///
- List<? extends ProcessorOutputPort> outputs = p
- .getOutputPorts();
-
- for (ProcessorOutputPort op : outputs) {
-
- Var outputVar = new Var();
-
- outputVar.setPName(pName);
- outputVar.setWfInstanceRef(dataflowID);
- outputVar.setVName(op.getName());
- outputVar.setTypeNestingLevel(op.getDepth());
- outputVar.setInput(false);
-
- vars.add(outputVar);
- }
-
-
- // check for nested structures: if the activity is DataflowActivity
- // then this processor is a nested workflow
- // make an entry into wfNesting map with its ID and recurse on the nested workflow
-
- for (Activity a:activities) {
-
- if (a.getClass().getCanonicalName().contains("DataflowActivity" )) {
-
- Dataflow nested = (Dataflow) a.getConfiguration();
-// logger.info("RECURSION ON nested workflow: "+p.getLocalName()+" with id: "+nested.getInternalIdentier());
-
- wfNestingMap.put(nested.getInternalIdentier(), dataflowID); // child -> parent
-
- //////////////
- /// RECURSIVE CALL
- //////////////
- processDataflowStructure(nested, nested.getInternalIdentier(), p.getLocalName());
-
- //List<? extends Processor> procs = nested.getProcessors();
-// for (Processor nestedP:procs) {
-// System.out.println("recursion on nested processor: "+nestedP.getLocalName());
-// }
-
- }
- }
-
- } // end for each processor
-
- // ////
- // add inputs to entire dataflow
- // ////
-
- String pName = INPUT_CONTAINER_PROCESSOR; // overridden -- see below
-
- // check whether we are processing a nested workflow. in this case
- // the input vars are not assigned to the INPUT processor but to the containing dataflow
-
- if (externalName != null) { // override the default if we are nested or someone external name is provided
- pName = externalName;
- }
-
- List<? extends DataflowInputPort> inputPorts = df.getInputPorts();
-
- for (DataflowInputPort ip : inputPorts) {
-
- Var inputVar = new Var();
-
- inputVar.setPName(pName);
- inputVar.setWfInstanceRef(dataflowID);
- inputVar.setVName(ip.getName());
- inputVar.setTypeNestingLevel(ip.getDepth());
- inputVar.setInput(true); // CHECK PM modified 11/08 -- input vars are actually outputs of input processors...
-
- vars.add(inputVar);
- }
-
- // ////
- // add outputs of entire dataflow
- // ////
- pName = OUTPUT_CONTAINER_PROCESSOR; // overridden -- see below
-
- // check whether we are processing a nested workflow. in this case
- // the output vars are not assigned to the OUTPUT processor but to the containing dataflow
-
- if (externalName != null) { // we are nested
- pName = externalName;
- }
-
- List<? extends DataflowOutputPort> outputPorts = df
- .getOutputPorts();
-
- for (DataflowOutputPort op : outputPorts) {
-
- Var outputVar = new Var();
-
- outputVar.setPName(pName);
- outputVar.setWfInstanceRef(dataflowID);
- outputVar.setVName(op.getName());
- outputVar.setTypeNestingLevel(op.getDepth());
- outputVar.setInput(false); // CHECK PM modified 11/08 -- output vars are actually outputs of output processors...
- vars.add(outputVar);
- }
-
- pw.addVariables(vars, dataflowID);
-
- // ////
- // add arc records using the dataflow links
- // retrieving the processor names requires navigating from links to
- // source/sink and from there to the processors
- // ////
- List<? extends Datalink> links = df.getLinks();
-
- for (Datalink l : links) {
-
- // TODO cover the case of arcs from an input and to an output to
- // the entire dataflow
-
- String sourcePname = null;
- String sinkPname = null;
-
- if (l.getSource() instanceof ProcessorOutputPort) {
- sourcePname = ((ProcessorOutputPort) l.getSource())
- .getProcessor().getLocalName();
- } else {
-// System.out.println("found link from dataflow input");
- }
-
- if (l.getSink() instanceof ProcessorInputPort) {
- sinkPname = ((ProcessorInputPort) l.getSink())
- .getProcessor().getLocalName();
- } else {
-// System.out.println("found link to dataflow output");
- }
-
- if (sourcePname != null && sinkPname != null) {
-// System.out.println("adding regular internal arc");
-
- pw.addArc(l.getSource().getName(), sourcePname, l.getSink()
- .getName(), sinkPname, dataflowID);
-
- } else if (sourcePname == null) {
- // link is from dataflow input or subflow input
- if (externalName != null) { // link from subflow input
- sourcePname = externalName;
- } else {
- sourcePname = INPUT_CONTAINER_PROCESSOR;
- }
-
- //Ian added this logic since there were some null sinkPnameRefs with merge ports
-
- if (sinkPname == null) {
- // link is to dataflow output
-
- if (externalName != null) { // link from subflow input
- sinkPname = externalName;
- } else {
- sinkPname = OUTPUT_CONTAINER_PROCESSOR;
- }
- }
-
-// System.out.println("adding arc from dataflow input");
-
- pw.addArc(l.getSource().getName(),
- sourcePname, l.getSink().getName(),
- sinkPname, dataflowID);
-
- } else if (sinkPname == null) {
- // link is to dataflow output
-
- if (externalName != null) { // link from subflow input
- sinkPname = externalName;
- } else {
- sinkPname = OUTPUT_CONTAINER_PROCESSOR;
- }
-
- //Ian added this bit at the same time as the null sinkPnameRef logic above - hope it is correct
-
- if (sourcePname == null) {
- // link is from dataflow input or subflow input
- if (externalName != null) { // link from subflow input
- sourcePname = externalName;
- } else {
- sourcePname = INPUT_CONTAINER_PROCESSOR;
- }
- }
-
- // System.out.println("adding arc to dataflow output");
-
- pw.addArc(l.getSource().getName(), sourcePname, l.getSink()
- .getName(), sinkPname,
- dataflowID);
- }
- }
-// logger.info("completed processing dataflow " + dataflowID);
-
- } catch (Exception e) {
- logger.error("Problem processing provenance for dataflow", e);
- }
-
-// logger.debug("wfInstanceID at the end of processDataflowStructure: "+getWfInstanceID());
-
- return dataflowID;
- }
-
-
-
- private Element stripWfInstanceHeader(String content) {
-
- SAXBuilder b = new SAXBuilder();
- Document d;
-
- try {
- d = b.build (new StringReader(content));
-
- // get identifier from <workflowItem> element
- Element root = d.getRootElement();
-
- setWfInstanceID(root.getAttributeValue("identifier"));
-
- Namespace ns = Namespace.getNamespace("http://taverna.sf.net/2008/xml/t2flow");
-
- Element workflowEl = root.getChild("workflow", ns);
-
- return workflowEl;
-
- } catch (JDOMException e) {
- logger.warn("Problem stripping workflow instance header", e);
- } catch (IOException e) {
- logger.warn("Problem stripping workflow instance header", e);
- }
-
-
- return null;
- }
-
- /**
- * 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
- * @param currentWorkflowID
- *
- * @param d
- * @param context
- */
- public void processProcessEvent(ProvenanceItem provenanceItem, String currentWorkflowID) {
-
- if (provenanceItem.getEventType().equals(SharedVocabulary.PROCESS_EVENT_TYPE)) {
-
- String parentId = provenanceItem.getParentId(); // this is the workflowID
- String identifier = provenanceItem.getIdentifier(); // use this as wfInstanceID if this is the top-level process
-
- parentChildMap.put(identifier, parentId);
- ProcBinding pb = new ProcBinding();
- pb.setExecIDRef(getWfInstanceID());
- pb.setWfNameRef(currentWorkflowID);
- procBindingMap.put(identifier, pb);
-
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.PROCESSOR_EVENT_TYPE)) {
-
- String identifier = provenanceItem.getIdentifier();
- String parentId = provenanceItem.getParentId();
- String processID = provenanceItem.getProcessId(); // this is the external process ID
-
- // this has the weird form facade0:dataflowname:pname need to extract pname from here
- String[] processName = processID.split(":");
- procBindingMap.get(parentId).setPNameRef(processName[processName.length-1]); // 3rd component of composite name
-
-
- parentChildMap.put(identifier, parentId);
-
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.ACTIVITY_EVENT_TYPE)) {
-
- String identifier = provenanceItem.getIdentifier();
- String parentId = provenanceItem.getParentId();
- procBindingMap.get(parentChildMap.get(parentId)).setActName(identifier);
- parentChildMap.put(identifier, parentId);
-
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.ITERATION_EVENT_TYPE)) {
-
- // traverse up to root to retrieve ProcBinding that was created when we saw the process event
- String iterationID = provenanceItem.getIdentifier();
- String activityID = provenanceItem.getParentId();
- String processorID = parentChildMap.get(activityID);
- String processID = parentChildMap.get(processorID);
- parentChildMap.put(iterationID, activityID);
- parentChildMap.put(iterationID, activityID);
- ProcBinding procBinding = procBindingMap.get(processID);
-
- String itVector = extractIterationVector(ProvenanceUtils.iterationToString(((IterationProvenanceItem)provenanceItem).getIteration()));
- procBinding.setIterationVector(itVector);
- InputDataProvenanceItem inputDataEl = ((IterationProvenanceItem)provenanceItem).getInputDataItem();
- OutputDataProvenanceItem outputDataEl = ((IterationProvenanceItem)provenanceItem).getOutputDataItem();
- processInput(inputDataEl, procBinding, currentWorkflowID);
- processOutput(outputDataEl, procBinding, currentWorkflowID);
-
- try {
- getPw().addProcessorBinding(procBinding);
- } catch (SQLException e) {
- logger.debug("provenance has duplicate processor binding -- skipping the insertion"); //, e);
- }
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.END_WORKFLOW_EVENT_TYPE)) {
-
- // use this event to do housekeeping on the input/output varbindings
-
- dataflowDepth--;
- if (dataflowDepth == 0) {
-
- // process the outputs accumulated by WorkflowDataProcessor
- getWfdp().processTrees(provenanceItem.getWorkflowId(), getWfInstanceID());
-
- patchTopLevelnputs();
-
- // PM changed 23/4/09
- reconcileTopLevelOutputs(); // patchTopLevelOutputs
- workflowStructureDone = false; // CHECK reset for next run...
- }
-
-
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.WORKFLOW_DATA_EVENT_TYPE)) {
- // give this event to a WorkflowDataProcessor object for pre-processing
-// try {
- // TODO may generate an exception when the data is an error CHECK
- getWfdp().addWorkflowDataItem(provenanceItem);
-// } catch (NumberFormatException e) {
-// logger.error(e);
-// }
-// logger.info("Received workflow data - not processing");
- //FIXME not sure - needs to be stored somehow
-
- } else if (provenanceItem.getEventType().equals((SharedVocabulary.ERROR_EVENT_TYPE))) {
- //TODO process the error
-
- } else {
- // TODO broken, should we throw something here?
- return;
- }
-
- }
-
- /**
- * fills in the VBs for the global inputs -- this removes the need for explicit events
- * that account for these value bindings...
- */
- public void patchTopLevelnputs() {
-
- // for each input I to topLevelDataflow:
- // pick first outgoing arc with sink P:X
- // copy value X to I -- this can be a collection, so copy everything
-
- // get all global input vars
-
-// logger.info("\n\n BACKPATCHING GLOBAL INPUTS with dataflowDepth = "+dataflowDepth+"*******\n");
-
- List<Var> inputs=null;
- try {
- inputs = getPq().getInputVars(topLevelDataflowName, topLevelDataflowID, getWfInstanceID());
-
- for (Var input:inputs) {
-
-// logger.info("global input: "+input.getVName());
-
- Map<String,String> queryConstraints = new HashMap<String,String>();
-
- queryConstraints.put("sourceVarNameRef", input.getVName());
- queryConstraints.put("sourcePNameRef", input.getPName());
-
- List<Arc> outgoingArcs = getPq().getArcs(queryConstraints);
-
- // any arc will do, use the first
- String targetPname = outgoingArcs.get(0).getSinkPnameRef();
- String targetVname = outgoingArcs.get(0).getSinkVarNameRef();
-
-// logger.info("copying values from ["+targetPname+":"+targetVname+"] for instance ID: ["+wfInstanceID+"]");
-
- queryConstraints.clear();
- queryConstraints.put("varNameRef", targetVname);
- queryConstraints.put("V.pNameRef", targetPname);
- queryConstraints.put("VB.wfInstanceRef", getWfInstanceID());
- queryConstraints.put("V.wfInstanceRef", topLevelDataflowID);
-
- List<VarBinding> VBs = getPq().getVarBindings(queryConstraints);
-
-// logger.info("found the following VBs:");
- for (VarBinding vb:VBs) {
-// logger.info(vb.getValue());
-
- // insert VarBinding back into VB with the global input varname
- vb.setPNameRef(input.getPName());
- vb.setVarNameRef(input.getVName());
- getPw().addVarBinding(vb);
-
-// logger.info("added");
-
- }
-
- }
- } catch (SQLException e) {
- logger.warn("Patch top level inputs problem for provenance", e);
- } catch (IndexOutOfBoundsException e) {
- logger.error("Could not patch top level", e);
- }
-
- }
-
-
- // PM added 23/4/09
- /**
- * reconcile the top level outputs with the results from its immediate precedessors in the graph.<br/>
- * 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.<br/>
- * at the end, outputs and their predecessors contain the same data.<p/>
- * NOTE: if we assume that data values (URIs) are <em>always</em> 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
- */
- public void reconcileTopLevelOutputs() {
- /*
- for each output O
-
- for each variable V in predecessors(O)
-
- fetch all VB records for O into list OValues
- fetch all VB records for V into list Yalues
-
- compare OValues and VValues:
- it SHOULD be the case that OValues is a subset of YValues. Under this assumption:
-
- for each vb in YValues:
- - if there is a matching o in OValues then (vb may be missing collection information)
- copy o to vb
- else
- if vb has no collection info && there is a matching tree node tn in OTree (use iteration index for the match) then
- set vb to be in collection tb
- copy vb to o
-
- finally copy all Collection records for O in OTree -- catch duplicate errors
- */
-
- Map<String,String> queryConstraints = new HashMap<String,String>();
-
- List<Var> outputs=null;
- try {
-
- outputs = pq.getOutputVars(topLevelDataflowName, topLevelDataflowID, null); // null InstanceID
-
- // for each output O
- for (Var output:outputs) {
-
- // collect all VBs for O
-// String oPName = output.getPName();
-// String oVName = output.getVName();
-// queryConstraints.put("varNameRef", oVName);
-// queryConstraints.put("V.pNameRef", oPName);
-// queryConstraints.put("VB.wfInstanceRef", wfInstanceID);
-// queryConstraints.put("V.wfInstanceRef", topLevelDataflowID);
-
-// List<VarBinding> OValues = pq.getVarBindings(queryConstraints);
-
- // find all records for the immediate precedessor Y of O
- queryConstraints.clear();
- queryConstraints.put("sinkVarNameRef", output.getVName());
- queryConstraints.put("sinkPNameRef", output.getPName());
-
- List<Arc> incomingArcs = pq.getArcs(queryConstraints);
-
- // there can be only one -- but check that there is one!
- if (incomingArcs.size()==0) continue;
-
- String sourcePname = incomingArcs.get(0).getSourcePnameRef();
- String sourceVname = incomingArcs.get(0).getSourceVarNameRef();
-
- queryConstraints.clear();
- queryConstraints.put("varNameRef", sourceVname);
- queryConstraints.put("V.pNameRef", sourcePname);
- queryConstraints.put("VB.wfInstanceRef", getWfInstanceID());
- queryConstraints.put("V.wfInstanceRef", topLevelDataflowID);
-
- List<VarBinding> YValues = pq.getVarBindings(queryConstraints);
-
- // for each YValue look for a match in OValues
- // (assume the YValues values are a superset of OValues)!)
-
- for (VarBinding yValue:YValues) {
-
-
-// System.out.println("reconcileTopLevelOutputs:: processing "+
-// yValue.getPNameRef()+"/"+yValue.getVarNameRef()+"/"+yValue.getValue()+
-// " with collid "+yValue.getCollIDRef());
-
- // look for a matching record in VarBinding for output O
- queryConstraints.clear();
- queryConstraints.put("varNameRef", output.getVName());
- queryConstraints.put("V.pNameRef", output.getPName());
- queryConstraints.put("VB.wfInstanceRef", getWfInstanceID());
- queryConstraints.put("V.wfInstanceRef", topLevelDataflowID);
- queryConstraints.put("VB.iteration", yValue.getIteration());
- if (yValue.getCollIDRef()!= null) {
- queryConstraints.put("VB.collIDRef", yValue.getCollIDRef());
- queryConstraints.put("VB.positionInColl", Integer.toString(yValue.getPositionInColl()));
- }
- List<VarBinding> matchingOValues = pq.getVarBindings(queryConstraints);
-
-// System.out.println("querying for matching oValues: ");
-
- // result at most size 1
- if (matchingOValues.size() > 0) {
-
- VarBinding oValue = matchingOValues.get(0);
-
-// System.out.println("found "+oValue.getPNameRef()+"/"+oValue.getVarNameRef()+"/"+oValue.getValue()+
-// " with collid "+oValue.getCollIDRef());
-
- // copy collection info from oValue to yValue
- yValue.setCollIDRef(oValue.getCollIDRef());
- yValue.setPositionInColl(oValue.getPositionInColl());
-
- pw.updateVarBinding(yValue);
-
-// System.out.println("oValue copied to yValue");
- } else {
-
-// System.out.println("no match found");
-
- // copy the yValue to O
- // insert VarBinding back into VB with the global output varname
- yValue.setPNameRef(output.getPName());
- yValue.setVarNameRef(output.getVName());
- pw.addVarBinding(yValue);
- }
-
- } // for each yValue in YValues
-
- // copy all Collection records for O to Y
-
- // get all collections refs for O
- queryConstraints.clear();
- queryConstraints.put("wfInstanceRef", getWfInstanceID());
- queryConstraints.put("PNameRef", output.getPName());
- queryConstraints.put("varNameRef", output.getVName());
-
- List<NestedListNode> oCollections = pq.getNestedListNodes(queryConstraints);
-
- // insert back as collection refs for Y -- catch duplicates
- for (NestedListNode nln:oCollections) {
-// System.out.println("collection: "+nln.getCollId());
-
- nln.setPNameRef(sourcePname);
- nln.setPNameRef(sourceVname);
-
- getPw().replaceCollectionRecord(nln, sourcePname, sourceVname);
- }
-
- } // for each output var
-
- } catch (SQLException e) {
- logger.warn("Problem reconciling top level outputs", e);
- }
-
- }
-
-
-
-
- @SuppressWarnings("unchecked")
- private void processOutput(OutputDataProvenanceItem provenanceItem, ProcBinding procBinding, String currentWorkflowID) {
-
- Element dataItemAsXML = ProvenanceUtils.getDataItemAsXML(provenanceItem);
- List<Element> outputPorts = dataItemAsXML.getChildren("port");
- for (Element outputport : outputPorts) {
-
- String portName = outputport.getAttributeValue("name");
-
- // value type may vary
- List<Element> valueElements = outputport.getChildren();
- if (valueElements != null && valueElements.size() > 0) {
-
- Element valueEl = valueElements.get(0); // only really 1 child
-
- processVarBinding(valueEl, procBinding.getPNameRef(), portName, procBinding.getIterationVector(),
- getWfInstanceID(), currentWorkflowID);
- }
- }
-
- }
-
-
- /**
- * this method reconciles values in varBindings across an arc: Firstly, if vb's value is within a collection,
- * _and_ it is copied from a value generated during a previous iteration,
- * then this method propagates the list reference to that iteration value, which wouldn't have it.
- * Conversely, if vb is going to be input to an iteration, then it's lost its containing list node, and we
- * put it back in by looking at the corresponding predecessor
- * @param vb
- * @throws SQLException
- */
- private void backpatchIterationResults(List<VarBinding> newBindings) throws SQLException {
-
- logger.debug("backpatchIterationResults: start");
- for (VarBinding vb:newBindings) {
-
- logger.debug("backpatchIterationResults: processing vb "+vb.getPNameRef()+"/"+vb.getVarNameRef()+"="+vb.getValue());
-
- if (vb.getCollIDRef()!= null) { // this is a member of a collection
- logger.debug("...which is inside a collection ");
- }
-
- // look for its antecedent
- Map<String,String> queryConstraints = new HashMap<String,String>();
-
- queryConstraints.put("sinkVarNameRef", vb.getVarNameRef());
- queryConstraints.put("sinkPNameRef", vb.getPNameRef());
- queryConstraints.put("wfInstanceRef", pq.getWfNames(vb.getWfInstanceRef()).get(0)); // CHECK picking first element in list...
-
- List<Arc> incomingArcs = pq.getArcs(queryConstraints);
-
- // there can be only one -- but check that there is one!
- if (incomingArcs.size()==0) return;
-
- String sourcePname = incomingArcs.get(0).getSourcePnameRef();
- String sourceVname = incomingArcs.get(0).getSourceVarNameRef();
-
- logger.debug("antecedent: "+sourcePname+":"+sourceVname);
-
- // get the varbindings for this port and select the one with the same iteration vector as its successor
- queryConstraints.clear();
- queryConstraints.put("varNameRef", sourceVname);
- queryConstraints.put("V.pNameRef", sourcePname);
- queryConstraints.put("VB.value", vb.getValue());
- queryConstraints.put("VB.wfInstanceRef", vb.getWfInstanceRef());
-
- List<VarBinding> VBs = pq.getVarBindings(queryConstraints);
-
- if (VBs.size() == 0) { logger.debug("nothing to reconcile"); }
-
- // reconcile
- for (VarBinding b:VBs) {
-
- logger.debug("backpatching "+sourceVname+" "+sourcePname);
-
- if (vb.getCollIDRef() != null && b.getCollIDRef() == null) {
-
- logger.debug("successor "+vb.getVarNameRef()+" is in collection "+vb.getCollIDRef()+" but pred "+b.getVarNameRef()+" is not");
- logger.debug("putting "+b.getVarNameRef()+" in collection "+vb.getCollIDRef()+" at pos "+vb.getPositionInColl());
- b.setCollIDRef(vb.getCollIDRef());
- b.setPositionInColl(vb.getPositionInColl());
- getPw().updateVarBinding(b);
-
- } else if (vb.getCollIDRef() == null && b.getCollIDRef() != null) {
-
- logger.debug("successor "+vb.getVarNameRef()+" is NOT in collection but pred "+b.getVarNameRef()+" IS");
- logger.debug("putting "+vb.getVarNameRef()+" in collection "+b.getCollIDRef()+" at pos "+b.getPositionInColl());
- vb.setCollIDRef(b.getCollIDRef());
- vb.setPositionInColl(b.getPositionInColl());
- getPw().updateVarBinding(vb);
- }
- }
- }
- }
-
-
- /**
- * create one new VarBinding record for each input port binding
- * @param currentWorkflowID
- */
- @SuppressWarnings("unchecked")
- private void processInput(InputDataProvenanceItem provenanceItem, ProcBinding procBinding, String currentWorkflowID) {
-
- Element dataItemAsXML = ProvenanceUtils.getDataItemAsXML(provenanceItem);
- List<Element> inputPorts = dataItemAsXML.getChildren("port");
- int order = 0;
- for (Element inputport : inputPorts) {
-
- String portName = inputport.getAttributeValue("name");
-// logger.info("processInput: processing VarBinding for "+procBinding.getPNameRef()+" "+portName);
-
- try {
- // add process order sequence to Var for this portName
-
- Map<String, String> queryConstraints = new HashMap<String, String>();
- queryConstraints.put("wfInstanceRef", currentWorkflowID);
- queryConstraints.put("pnameRef", procBinding.getPNameRef());
- queryConstraints.put("varName", portName);
- queryConstraints.put("inputOrOutput", "1");
-
- List<Var> vars = getPq().getVars(queryConstraints);
- try {
- Var v = vars.get(0);
- v.setPortNameOrder(order++);
- getPw().updateVar(v);
- }
- catch (IndexOutOfBoundsException e) {
- logger.error("Could not process input " + portName, e);
- }
- } catch (SQLException e1) {
- logger.error("Could not process input " + portName, e1);
- }
-
- // value type may vary
- List<Element> valueElements = inputport.getChildren(); // hopefully
- // in the
- // right
- // order...
- if (valueElements != null && valueElements.size() > 0) {
-
- Element valueEl = valueElements.get(0); // expect only 1 child
-// processVarBinding(valueEl, processor, portName, iterationVector,
-// dataflow);
-
- List<VarBinding> newBindings =
- processVarBinding(valueEl, procBinding.getPNameRef(), portName, procBinding.getIterationVector(),
- getWfInstanceID(), currentWorkflowID);
- // this is a list whenever valueEl is of type list: in this case processVarBinding recursively
- // processes all values within the collection, and generates one VarBinding record for each of them
-
- allInputVarBindings.addAll(newBindings);
-
-// logger.debug("newBindings now has "+newBindings.size()+" elements");
-
- // // if the new binding involves list values, then check to see if they need to be propagated back to
-// // results of iterations
- try {
- backpatchIterationResults(newBindings);
- } catch (SQLException e) {
- logger.warn("Problem with back patching iteration results", e);
-
- }
-
- } else {
- if (valueElements != null) logger.debug("port name "+portName+" "+valueElements.size());
- else logger.debug("valueElements is null for port name "+portName);
- }
- }
-
- }
-
- /**
- * capture the default case where the value is not a list
- *
- * @param valueEl
- * @param processorId
- * @param portName
- * @param iterationId
- * @param wfInstanceRef
- * @param currentWorkflowID
- */
- private List<VarBinding> processVarBinding(Element valueEl, String processorId,
- String portName, String iterationId, String wfInstanceRef, String currentWorkflowID) {
-
- // uses the defaults:
- // collIdRef = null
- // parentcollectionRef = null
- // positionInCollection = 1
- return processVarBinding(valueEl, processorId, portName, null, 1, null,
- iterationId, wfInstanceRef, null, currentWorkflowID);
- }
-
- /**
- * general case where value can be a list
- * @param valueEl
- * @param processorId
- * @param portName
- * @param collIdRef
- * @param positionInCollection
- * @param parentCollectionRef
- * @param iterationId
- * @param wfInstanceRef
- * @param currentWorkflowID
- */
- @SuppressWarnings("unchecked")
- private List<VarBinding> processVarBinding(Element valueEl, String processorId,
- String portName, String collIdRef, int positionInCollection,
- String parentCollectionRef, String iterationId, String wfInstanceRef, String itVector, String currentWorkflowID) {
-
- List<VarBinding> newBindings = new ArrayList<VarBinding>();
-
- String valueType = valueEl.getName();
-// logger.info("value element for " + processorId + ": "
-// + valueType);
-
- String iterationVector = null;
-
- if (itVector == null)
- iterationVector = extractIterationVector(iterationId);
- else iterationVector = itVector;
-
- VarBinding vb = new VarBinding();
-
- vb.setWfNameRef(currentWorkflowID);
- vb.setWfInstanceRef(wfInstanceRef);
- vb.setPNameRef(processorId);
- vb.setValueType(valueType);
- vb.setVarNameRef(portName);
- vb.setCollIDRef(collIdRef);
- vb.setPositionInColl(positionInCollection);
-
- newBindings.add(vb);
-
- if (valueType.equals("literal")) {
-
-// logger.warn("input of type literal");
-
- try {
-
- vb.setIterationVector(iterationVector);
- vb.setValue(valueEl.getAttributeValue("id"));
-
- logger.debug("new input VB with wfNameRef="+currentWorkflowID+" processorId="+processorId+
- " valueType="+valueType+" portName="+portName+" collIdRef="+collIdRef+
- " position="+positionInCollection+" itvector="+iterationVector+
- " value="+vb.getValue());
-
-// logger.info("calling addVarBinding on "+vb.getPNameRef()+" : "+vb.getVarNameRef());
- getPw().addVarBinding(vb);
-
- } catch (SQLException e) {
- logger.warn("Process Var Binding problem with provenance", e);
- }
-
- } else if (valueType.equals("referenceSet")) {
-
- vb.setIterationVector(iterationVector);
- vb.setValue(valueEl.getAttributeValue("id"));
- vb.setRef(valueEl.getChildText("reference"));
-
- logger.debug("new input VB with wfNameRef="+currentWorkflowID+" processorId="+processorId+
- " valueType="+valueType+" portName="+portName+" collIdRef="+collIdRef+
- " position="+positionInCollection+" itvector="+iterationVector+
- " value="+vb.getValue());
-
- try {
-// logger.debug("calling addVarBinding on "+vb.getPNameRef()+" : "+vb.getVarNameRef()+" with it "+vb.getIteration());
- getPw().addVarBinding(vb);
- } catch (SQLException e) {
- logger.debug("Problem processing var binding -- performing update instead of insert", e); //, e);
- // try to update the existing record instead using the current collection info
-
- getPw().updateVarBinding(vb);
-// logger.warn("VarBinding update successful");
-
- }
-
- } else if (valueType.equals("list")) {
-
- logger.debug("input of type list");
-
- // add entries to the Collection and to the VarBinding tables
- // list id --> Collection.collId
-
- String collId = valueEl.getAttributeValue("id");
- try {
-
- parentCollectionRef = getPw().addCollection(processorId, collId,
- parentCollectionRef, iterationVector, portName,
- wfInstanceRef);
-
- // iterate over each list element
- List<Element> listElements = valueEl.getChildren();
-
- positionInCollection = 1; // also use this as a suffix to extend the iteration vector
-
- // extend iteration vector to account for additional levels within the list
-
- String originalIterationVector = iterationVector;
-
- // children can be any base type, including list itself -- so
- // use recursion
- for (Element el : listElements) {
-
- if (originalIterationVector.length() >2) { // vector is not empty
- iterationVector = originalIterationVector.substring(0,
- originalIterationVector.length()-1) + ","+
- Integer.toString(positionInCollection-1) + "]";
- } else {
- iterationVector = "["+ Integer.toString(positionInCollection-1) + "]";
- }
-
- List<VarBinding> bindings = processVarBinding(el, processorId, portName, collId,
- positionInCollection, parentCollectionRef,
- iterationId, wfInstanceRef, iterationVector, currentWorkflowID);
-
- newBindings.addAll(bindings);
-
- positionInCollection++;
- }
-
- } catch (SQLException e) {
- logger.warn("Problem processing var binding", e);
- }
- } else if (valueType.equals("error")) {
- try {
- vb.setIterationVector(iterationVector);
- vb.setValue(valueEl.getAttributeValue("id"));
-
- getPw().addVarBinding(vb);
-
- } catch (SQLException e) {
- logger.warn("Process Var Binding problem with provenance", e);
- }
- } else {
- logger.warn("unrecognized value type element for "
- + processorId + ": " + valueType);
- }
-
- return newBindings;
- }
-
-
- /**
- * OBSOLETE: returns the iteration vector x,y,z,... from [x,y,z,...]
- * <p/>
- * now returns the vector itself -- this is still experimental
- *
- * @param iteration
- * @return
- */
- String extractIterationVector(String iteration) {
-
- return iteration;
- // return iteration.substring(1, iteration.length() - 1);
- // iteration is of the form "[n]" so we extract n
- // String iterationN = iteration.substring(1, iteration.length()-1);
-
- // if (iterationN.length() == 0) return 0;
-
- // return Integer.parseInt(iterationN);
- }
-
- /**
- * log raw event to file system
- *
- * @param content
- * @param eventType
- * @throws IOException
- */
- public void saveEvent(ProvenanceItem provenanceItem, SharedVocabulary eventType) throws IOException {
-
- // HACK -- XMLEncoder fails on IterationEvents and there is no way to catch the exception...
- // so avoid this case
- if (eventType.equals(SharedVocabulary.ITERATION_EVENT_TYPE)) {
- return;
- }
-
-// System.out.println("saveEvent: start");
-
- File f1 = null;
-
- f1 = new File(TEST_EVENTS_FOLDER);
- FileUtils.forceMkdir(f1);
-
- String fname = "event_" + eventCnt++ + "_" + eventType + ".xml";
- File f = new File(f1, fname);
-
-// FileWriter fw = new FileWriter(f);
-
- XMLEncoder en = new XMLEncoder(new BufferedOutputStream(
- new FileOutputStream(f)));
-
- en.setExceptionListener(new ExceptionListener()
- {
- public void exceptionThrown(Exception e)
- {
- logger.warn("XML encoding ERROR", e);
- return;
- }
- });
-
- logger.debug("saving to " + f); // save event for later inspection
- logger.debug(provenanceItem);
-
- en.writeObject(provenanceItem);
-
- logger.debug("writer ok");
- en.close();
- logger.debug("closed");
-
-// fw.write(content);
-// fw.flush();
-// fw.close();
-
-// FileWriter fw = new FileWriter(f);
-// fw.write(content);
-// fw.flush();
-// fw.close();
-
-// System.out.println("saved as file " + fname);
-
-
- }
-
- /**
- * for each arc of the form (_INPUT_/I, P/V): propagate VarBinding for P/V
- * to var _INPUT_/I <br/>
- *
- * @throws SQLException
- */
- public void fillInputVarBindings(Object context) throws SQLException {
-
- // System.out.println("*** fillInputVarBindings: ***");
-
- // retrieve appropriate arcs
- Map<String, String> constraints = new HashMap<String, String>();
- constraints.put("sourcePnameRef", "_INPUT_");
- constraints.put("W.instanceID", getWfInstanceID());
- List<Arc> arcs = getPq().getArcs(constraints);
-
- // backpropagate VarBinding from the target var of the arc to the source
- for (Arc aArc : arcs) {
-
-// logger.info("propagating VarBinding from ["
-// + aArc.getSinkPnameRef() + "/" + aArc.getSinkVarNameRef()
-// + "] to input [" + aArc.getSourcePnameRef() + "/"
-// + aArc.getSourceVarNameRef() + "]");
-
- // get the varBinding for the arc sinks
- Map<String, String> vbConstraints = new HashMap<String, String>();
- vbConstraints.put("VB.PNameRef", aArc.getSinkPnameRef());
- vbConstraints.put("VB.varNameRef", aArc.getSinkVarNameRef());
- vbConstraints.put("VB.wfInstanceRef", getWfInstanceID());
-
- List<VarBinding> vbList = getPq().getVarBindings(vbConstraints); // DB
- // QUERY
-
- for (VarBinding vb : vbList) {
- // add a new VarBinding for the input
-
- vb.setPNameRef(aArc.getSourcePnameRef());
- vb.setVarNameRef(aArc.getSourceVarNameRef());
- // all other attributes are the same --> CHECK!!
-
- getPw().addVarBinding(vb);
- }
- }
- }
-
- /**
- * for each arc of the form (P/V, _OUTPUT_/O): propagate VarBinding for P/V
- * to var _OUTPUT_/O <br/>
- *
- * @throws SQLException
- */
- public void fillOutputVarBindings(Object context) throws SQLException {
-
- //System.out.println("*** fillOutputVarBindings: ***");
-
- // retrieve appropriate arcs
- Map<String, String> constraints = new HashMap<String, String>();
- constraints.put("sinkPnameRef", "_OUTPUT_");
- constraints.put("wfInstanceRef", getWfInstanceID());
- List<Arc> arcs = getPq().getArcs(constraints);
-
- // fowd propagate VarBinding from the source var of the arc to the
- // output
- for (Arc aArc : arcs) {
-
-// logger.info("fwd propagating VarBinding from ["
-// + aArc.getSourcePnameRef() + "/"
-// + aArc.getSourceVarNameRef() + "] to input ["
-// + aArc.getSinkPnameRef() + "/" + aArc.getSinkVarNameRef()
-// + "]");
-
- // get the varBinding for the arc sinks
- Map<String, String> vbConstraints = new HashMap<String, String>();
- vbConstraints.put("VB.PNameRef", aArc.getSourcePnameRef());
- vbConstraints.put("VB.varNameRef", aArc.getSourceVarNameRef());
- vbConstraints.put("VB.wfInstanceRef", getWfInstanceID());
-
- List<VarBinding> vbList = getPq().getVarBindings(vbConstraints); // DB
- // QUERY
-
- for (VarBinding vb : vbList) {
- // add a new VarBinding for the input
- getPw().addVarBinding(vb); // DB UPDATE
- }
-
- }
- }
-
-
- /**
- * silly class to hold pairs of strings. any better way??
- * @author paolo
- *
- */
- class Pair {
- String v1, v2;
-
- public Pair(String current, String wfNameRef) {
- v1=current; v2=wfNameRef;
- }
-
- /**
- * @return the v1
- */
- public String getV1() {
- return v1;
- }
-
- /**
- * @param v1 the v1 to set
- */
- public void setV1(String v1) {
- this.v1 = v1;
- }
-
- /**
- * @return the v2
- */
- public String getV2() {
- return v2;
- }
-
- /**
- * @param v2 the v2 to set
- */
- public void setV2(String v2) {
- this.v2 = v2;
- }
-
- }
-
- public List<Pair> toposort(String dataflowName, String wfInstanceId) throws SQLException {
-
-// String wfNameRef = pq.getWfNameForDataflow(dataflowName, wfInstanceID);
- String wfNameRef = pq.getWfNameForDataflow(dataflowName);
-
- // fetch processors along with the count of their predecessors
- Map<String, Integer> predecessorsCount = getPq().getPredecessorsCount(wfInstanceId);
- Map<String, List<String>> successorsOf = new HashMap<String, List<String>>();
-// List<String> procList = pq.getContainedProcessors(dataflowName, wfInstanceId);
- List<String> procList = pq.getContainedProcessors(dataflowName);
-
-// logger.debug("toposort on "+dataflowName);
-
-// logger.debug("contained procs: ");
- for (String s:procList) {
-
- List<String> successors = getPq().getSuccProcessors(s, wfNameRef, wfInstanceId);
- successorsOf.put(s, successors);
-
-// logger.debug(s+" with "+predecessorsCount.get(s)+" predecessors and successors:");
-
-// for (String s1:successors) { logger.debug(s1); }
- }
-
- List<Pair> sorted = tsort(procList, dataflowName, predecessorsCount, successorsOf, wfNameRef, wfInstanceId);
-
-// logger.debug("tsort:");
-// for (String p : sorted) { logger.debug(p); }
-
- for (int i=0; i< sorted.size(); i++) {
-
- String procName = sorted.get(i).getV1();
-
- if (pq.isDataflow(procName) && !procName.equals(dataflowName)) { // handle weirdness: a dataflow is contained within itself..
- // recurse on procName
-
-// logger.debug("recursion on "+procName);
- List<Pair> sortedSublist = toposort(procName, wfInstanceId);
-
- // replace procName with sortedSublist in sorted
- sorted.remove(i);
- sorted.addAll(i, sortedSublist);
- }
- }
- return sorted;
- }
-
-
-
- /**
- * STUB
- * @param procList
- * @param predecessorsCount
- * @param successorsOf
- * @param wfInstanceId
- * @return
- * @throws SQLException
- */
- public List<Pair> tsort(List<String> procList,
- String dataflowName,
- Map<String, Integer> predecessorsCount,
- Map<String, List<String>> successorsOf,
- String wfNameRef, String wfInstanceId) throws SQLException {
-
- List<Pair> L = new ArrayList<Pair>(); // holds sorted elements
- List<String> Q = new ArrayList<String>(); // temp queue
- Set<String> visited = new HashSet<String>();
-
-// logger.debug("queue init with procList");
- // init queue with procList processors that have no predecessors
- for (String proc:procList) {
-
-// logger.debug("dataflowName: "+dataflowName+" proc: "+proc);
-
- if (predecessorsCount.get(proc) == null || predecessorsCount.get(proc) == 0 &&
- !proc.equals(dataflowName)) {
-
- Q.add(proc);
- }
-// logger.debug(proc + " added to queue");
-// } else
-// logger.debug(proc+" not added to queue");
- }
-
-// logger.debug("queue has "+Q.size()+" elements");
- while (!Q.isEmpty()) {
-
- String current = Q.remove(0);
-// logger.debug("extracted "+current+" and added to L");
- L.add(new Pair(current,wfNameRef));
-
-// for (String s:L) logger.debug(s);
-
- List<String> successors = successorsOf.get(current);
-
-// logger.debug("\n****successors of "+current);
-
- if (successors == null) continue;
-
- // reduce the number of predecessors to each of the successors by one
- // NB we must traverse an additional arc through a nested workflow input if the successor is a dataflow!!
- for (String succ : successors) {
-
-// logger.debug(succ);
-
- // decrease edge count for each successor processor
- Integer cnt = predecessorsCount.get(succ);
- predecessorsCount.put(succ, new Integer(cnt.intValue() - 1));
-
-// logger.debug("now "+succ+" has "+predecessorsCount.get(succ)+" predecessors");
-
- if (predecessorsCount.get(succ) == 0 && !succ.equals(dataflowName)) {
- Q.add(succ);
-// logger.debug("adding "+succ+" to queue");
- }
- }
- } // end loop on Q
- return L;
- }
-
-
- public void propagateANL(String wfInstanceId) throws SQLException {
-
- String top = pq.getTopLevelDataflowName(wfInstanceId);
-
- // //////////////////////
- // PHASE I: toposort the processors in the whole graph
- // //////////////////////
- List<Pair> sorted = toposort(top, wfInstanceId);
-
- logger.debug("final sorted list of processors");
- for (Pair p:sorted) { logger.debug(p.getV1()+" in wfnameRef "+p.getV2()); }
-
- // //////////////////////
- // PHASE II: traverse and set anl on each port
- // //////////////////////
-
-// logger.debug("***** STARTING ANL *****");
-
-// // sorted processor names in L at this point
-// // process them in order
- for (Pair pnameInContext : sorted) {
-
-// logger.debug("setting ANL for "+pnameInContext.getV1()+" input vars");
-
-// // process pname's inputs -- set ANL to be the DNL if not set in prior steps
- String pname = pnameInContext.getV1();
- String wfNameRef = pnameInContext.getV2();
-
-// logger.debug("processor "+pname);
-
- List<Var> inputs = getPq().getInputVars(pname, wfNameRef, wfInstanceId); // null -> do not use instance (??) CHECK
-
-// logger.debug(inputs.size()+" inputs for "+pnameInContext.getV1());
-
- int totalANL = 0;
- for (Var iv : inputs) {
-
- if (iv.isANLset() == false) {
- iv.setActualNestingLevel(iv.getTypeNestingLevel());
- iv.setANLset(true);
- getPw().updateVar(iv);
-
-// logger.debug("var: "+iv.getVName()+" set at nominal level "+iv.getActualNestingLevel());
- }
-
- int delta_nl = iv.getActualNestingLevel() - iv.getTypeNestingLevel();
-
- // if delta_nl < 0 then Taverna wraps the value into a list --> use dnl(X) in this case
- if (delta_nl < 0 ) delta_nl = 0;// CHECK iv.getTypeNestingLevel();
-// logger.debug("delta for "+iv.getVName()+" "+delta_nl);
-
- totalANL += delta_nl;
-
- // this should take care of the special case of the top level dataflow with inputs that have successors in the graph
- // propagate this through all the links from this var
-// List<Var> successors = getPq().getSuccVars(pname, iv.getVName(), wfInstanceId);
-
-// logger.debug(successors.size()+ " successors for var "+iv.getVName());
-
-// for (Var v : successors) {
-// v.setActualNestingLevel(iv.getActualNestingLevel());
-// v.setANLset(true);
-// getPw().updateVar(v);
-// }
- }
-// logger.debug("total anl: "+totalANL);
-
-// logger.debug("now setting ANL for "+pname+" output vars");
-
- // process pname's outputs -- set ANL based on the sum formula (see
- // paper)
- List<Var> outputs = getPq().getOutputVars(pname, wfNameRef, wfInstanceId);
- for (Var ov : outputs) {
-
- ov.setActualNestingLevel(ov.getTypeNestingLevel() + totalANL);
-
- logger.debug("anl for "+pname+":"+ov.getVName()+" = "+(ov.getTypeNestingLevel() + totalANL));
- ov.setANLset(true);
- getPw().updateVar(ov);
-
- // propagate this through all the links from this var
- List<Var> successors = getPq().getSuccVars(pname, ov.getVName(), wfNameRef);
-
-// logger.debug(successors.size()+ " successors for var "+ov.getVName());
-
- for (Var v : successors) {
-
- List<Var> toBeProcessed = new ArrayList<Var>();
- toBeProcessed.add(v);
-
- if (pq.isDataflow(v.getPName()) && v.isInput()) { // this is the input to a nested workflow
-
-// String tempWfNameRef = pq.getWfNameForDataflow(v.getPName(), wfInstanceId);
- String tempWfNameRef = pq.getWfNameForDataflow(v.getPName());
- List<Var> realSuccessors = getPq().getSuccVars(v.getPName(), v.getVName(), tempWfNameRef);
-
-// logger.debug("realSuccessors size = "+realSuccessors.size());
-
- toBeProcessed.remove(0);
- toBeProcessed.addAll(realSuccessors);
-
- } else if (pq.isDataflow(v.getPName()) && !v.isInput()) { // this is the output to a nested workflow
-
-// String tempWfNameRef = pq.getWfNameForDataflow(v.getPName(), wfInstanceId);
- String tempWfNameRef = pq.getWfNameForDataflow(v.getPName());
- List<Var> realSuccessors = getPq().getSuccVars(v.getPName(), v.getVName(), null);
-
-// logger.debug("realSuccessors size = "+realSuccessors.size());
-
- toBeProcessed.remove(0);
- toBeProcessed.addAll(realSuccessors);
-
- }
-
- for (Var v1:toBeProcessed) {
- v1.setActualNestingLevel(ov.getActualNestingLevel());
- logger.debug("anl for "+v1.getPName()+":"+v1.getVName()+" = "+ov.getActualNestingLevel());
-
- v1.setANLset(true);
- getPw().updateVar(v1);
- }
- }
- }
- }
- }
-
-
-
-
- public void setPw(ProvenanceWriter pw) {
- this.pw = pw;
- }
-
-
- public ProvenanceWriter getPw() {
- return pw;
- }
-
-
- public void setPq(ProvenanceQuery pq) {
- this.pq = pq;
- }
-
-
- public ProvenanceQuery getPq() {
- return pq;
- }
-
- public void setWfInstanceID(String wfInstanceID) {
- this.wfInstanceID = wfInstanceID;
- }
-
- public String getWfInstanceID() {
- return wfInstanceID;
- }
-
- public void setWfdp(WorkflowDataProcessor wfdp) {
- this.wfdp = wfdp;
- }
-
- public WorkflowDataProcessor getWfdp() {
- return wfdp;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageQueryResultRecord.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageQueryResultRecord.java
deleted file mode 100644
index 3339034..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageQueryResultRecord.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-/**
- *
- * @author Paolo Missier<p/>
- * Java bean, holds a single provenance record at the finest level of granularity as it comes from the provenance DB.
- * The content of such records is described elsewhere (see UML documentation)
- *
- */
-public class LineageQueryResultRecord {
-
- String wfName;
- String pname;
- String vname;
- String wfInstance;
- String iteration;
- String value; // atomic or XML-formatted collection -- this is actually a reference to the value...
- String collIdRef;
- String parentCollIDRef;
- String resolvedValue;
- String type; // one of referenceSet, referenceSetCollection
- boolean printResolvedValue;
- boolean isInput;
- boolean isCollection;
-
- public String toString() {
- if (isCollection) {
- return "COLLECTION: proc "+getPname()+
- " var "+getVname()+" " +
- " iteration: "+getIteration()+
- " value: "+getValue()+
- " collection id: "+getCollIdRef()+
- " parent collection: "+getParentCollIDRef();
- } else {
-
- if (printResolvedValue)
- return "workflow "+ getWfName()+
- " proc "+getPname()+
- " var "+getVname()+" " +
- " iteration: "+getIteration()+
- " value: "+getValue()+
- " collection id: "+getCollIdRef()+
- " resolvedValue: "+getResolvedValue();
- else
- return "workflow "+ getWfName()+
- " proc "+getPname()+
- " var "+getVname()+" " +
- " iteration: "+getIteration()+
- " collection id: "+getCollIdRef()+
- " value: "+getValue();
- }
- }
-
-
- /**
- * @return the pname
- */
- public String getPname() {
- return pname;
- }
- /**
- * @param pname the pname to set
- */
- public void setPname(String pname) {
- this.pname = pname;
- }
- /**
- * @return the vname
- */
- public String getVname() {
- return vname;
- }
- /**
- * @param vname the vname to set
- */
- public void setVname(String vname) {
- this.vname = vname;
- }
- /**
- * @return the wfInstance
- */
- public String getWfInstance() {
- return wfInstance;
- }
- /**
- * @param wfInstance the wfInstance to set
- */
- public void setWfInstance(String wfInstance) {
- this.wfInstance = wfInstance;
- }
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
- /**
- * @return the iteration
- */
- public String getIteration() {
- return iteration;
- }
- /**
- * @param iteration the iteration to set
- */
- public void setIteration(String iteration) {
- this.iteration = iteration;
- }
- /**
- * @return the resolvedValue
- */
- public String getResolvedValue() {
- return resolvedValue;
- }
- /**
- * @param resolvedValue the resolvedValue to set
- */
- public void setResolvedValue(String resolvedValue) {
- this.resolvedValue = resolvedValue;
- }
-
-
- public void setPrintResolvedValue(boolean b) {
- this.printResolvedValue = b
- ; }
-
-
- /**
- * @return the isInput
- */
- public boolean isInput() {
- return isInput;
- }
-
-
- /**
- * @param isInput the isInput to set
- */
- public void setInput(boolean isInput) {
- this.isInput = isInput;
- }
-
-
- /**
- * @return the collIdRef
- */
- public String getCollIdRef() {
- return collIdRef;
- }
-
-
- /**
- * @param collIdRef the collIdRef to set
- */
- public void setCollIdRef(String collIdRef) {
- this.collIdRef = collIdRef;
- }
-
-
- /**
- * @return the isCollection
- */
- public boolean isCollection() {
- return isCollection;
- }
-
-
- /**
- * @param isCollection the isCollection to set
- */
- public void setCollection(boolean isCollection) {
- this.isCollection = isCollection;
- }
-
-
- /**
- * @return the parentCollIDRef
- */
- public String getParentCollIDRef() {
- return parentCollIDRef;
- }
-
-
- /**
- * @param parentCollIDRef the parentCollIDRef to set
- */
- public void setParentCollIDRef(String parentCollIDRef) {
- this.parentCollIDRef = parentCollIDRef;
- }
-
-
- /**
- * @return the wfName
- */
- public String getWfName() {
- return wfName;
- }
-
-
- /**
- * @param wfName the wfName to set
- */
- public void setWfName(String wfName) {
- this.wfName = wfName;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageSQLQuery.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageSQLQuery.java
deleted file mode 100644
index b92638d..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/LineageSQLQuery.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-/**
- * encapsulates an SQL query along with directives on how to interpret the results, i.e., which elements of the select clause
- * are to be considered relevant. For instance when the query includes a join with Collection, the intent is that lineage should
- * return the collection itself as opposed to any of its elements.
- * @author paolo
- *
- */
-public class LineageSQLQuery {
-
- String vbQuery = null;
- String collQuery = null;
-
- int nestingLevel = 0; // =0 => use var values, >0 => use enclosing collection
-
-
- /**
- * @return the nestingLevel
- */
- public int getNestingLevel() {
- return nestingLevel;
- }
-
- /**
- * @param nestingLevel the nestingLevel to set
- */
- public void setNestingLevel(int nestingLevel) {
- this.nestingLevel = nestingLevel;
- }
-
- /**
- * @return the collQuery
- */
- public String getCollQuery() {
- return collQuery;
- }
-
- /**
- * @param collQuery the collQuery to set
- */
- public void setCollQuery(String collQuery) {
- this.collQuery = collQuery;
- }
-
- /**
- * @return the vbQuery
- */
- public String getVbQuery() {
- return vbQuery;
- }
-
- /**
- * @param vbQuery the vbQuery to set
- */
- public void setVbQuery(String vbQuery) {
- this.vbQuery = vbQuery;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Provenance.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Provenance.java
deleted file mode 100644
index 669bfb2..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/Provenance.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import net.sf.taverna.t2.provenance.connector.ProvenanceConnector;
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-import org.apache.log4j.Logger;
-
-/**
- * Implemented by the database class that a {@link ProvenanceConnector}
- * implementation uses for storage purposes
- *
- * @author Paolo Missier
- * @author Ian Dunlop
- *
- */
-//FIXME is this class really needed. Can't we just push the
-//acceptRawProvanceEvent up into the ProvenanceConnector?
-public class Provenance {
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(Provenance.class);
-
- protected ProvenanceQuery pq;
- protected ProvenanceWriter pw;
- protected EventProcessor ep;
-
- private String saveEvents;
-
- private volatile boolean firstWorkflowStructure = true;
-
- public boolean isFirstWorkflowStructure() {
- return firstWorkflowStructure;
- }
-
- public void setFirstWorkflowStructure(boolean firstWorkflowStructure) {
- this.firstWorkflowStructure = firstWorkflowStructure;
- }
-
- private List<String> workflowIDStack = Collections.synchronizedList(new ArrayList<String>());
-
- private Map<String, String> workflowIDMap = new ConcurrentHashMap<String, String>();
-
- public Provenance() { }
-
- public Provenance(EventProcessor eventProcessor) {
- this.ep = eventProcessor;
- this.pq = ep.getPq();
- this.pw = ep.getPw();
- }
-
- public void clearDB() throws SQLException {
- getPw().clearDBStatic();
- getPw().clearDBDynamic();
- }
-
-
- /**
- * @return the saveEvents
- */
- public String getSaveEvents() {
- return saveEvents;
- }
-
- /**
- * @param saveEvents
- * the saveEvents to set
- */
- public void setSaveEvents(String saveEvents) {
- this.saveEvents = saveEvents;
- }
-
- // FIXME I think the provenance query and writer should both come from the
- // EventProcessor
- // seems silly setting the ep, pq and pw separately.
- public void setPq(ProvenanceQuery pq) {
- this.pq = pq;
- }
-
- public ProvenanceQuery getPq() {
- return pq;
- }
-
- public void setPw(ProvenanceWriter pw) {
- this.pw = pw;
- }
-
- public ProvenanceWriter getPw() {
- return pw;
- }
-
- public void setEp(EventProcessor ep) {
- this.ep = ep;
- }
-
- public EventProcessor getEp() {
- return ep;
- }
-
- /**
- * maps each incoming event to an insert query into the provenance store
- *
- * @param eventType
- * @param content
- * @throws SQLException
- * @throws IOException
- */
- public void acceptRawProvenanceEvent(SharedVocabulary eventType,
- ProvenanceItem provenanceItem) throws SQLException, IOException {
-
- processEvent(provenanceItem, eventType);
- }
-
- /**
- * parse d and generate SQL insert calls into the provenance DB
- *
- * @param d
- * DOM for the event
- * @param eventType
- * see {@link SharedVocabulary}
- * @throws SQLException
- * @throws IOException
- */
- @SuppressWarnings("unchecked")
- protected void processEvent(ProvenanceItem provenanceItem,
- SharedVocabulary eventType) throws SQLException, IOException {
-
- // only attempt to save the data events, since the workflow itself may not be XMLEncode-able
- if (!eventType.equals(SharedVocabulary.WORKFLOW_EVENT_TYPE)) {
-
- // saveEvent for debugging / testing
- if ("all".equals(getSaveEvents())) {
- getEp().saveEvent(provenanceItem, eventType);
- } else if ("iteration".equals(getSaveEvents())) {
- if (eventType.equals("iteration"))
- getEp().saveEvent(provenanceItem, eventType);
-
- }
- }
-
- if (eventType.equals(SharedVocabulary.WORKFLOW_EVENT_TYPE)) {
- // process the workflow structure
-
- if (isFirstWorkflowStructure()) {
-
- String dataflowId = ((WorkflowProvenanceItem) provenanceItem).getDataflow().getInternalIdentier();
- String instanceId = provenanceItem.getIdentifier();
-
- workflowIDMap.put(instanceId, dataflowId);
-// logger.debug("pushed workflowID "+dataflowId);
- setFirstWorkflowStructure(false);
-// logger.debug("processing event of type "
-// + SharedVocabulary.WORKFLOW_EVENT_TYPE);
- String processWorkflowStructure = getEp().processWorkflowStructure(provenanceItem);
- synchronized(workflowIDStack) {
- workflowIDStack.add(0,processWorkflowStructure);
- }
-
-// logger.debug("pushed workflowID "+workflowIDStack.get(0));
-
- getEp().propagateANL(provenanceItem.getIdentifier());
- } else {
-
- String dataflowId = ((WorkflowProvenanceItem) provenanceItem).getDataflow().getInternalIdentier();
- String instanceId = provenanceItem.getIdentifier();
-
- workflowIDMap.put(instanceId, dataflowId);
-// logger.debug("pushed workflowID "+dataflowId);
-
- Dataflow df = ((WorkflowProvenanceItem)provenanceItem).getDataflow();
- synchronized(workflowIDStack) {
- workflowIDStack.add(0,df.getInternalIdentier());
- }
- }
-
- } else if (provenanceItem.getEventType().equals(SharedVocabulary.END_WORKFLOW_EVENT_TYPE)) {
-
-// String currentWorkflowID = workflowIDStack.get(0);
-// workflowIDStack.remove(0);
-
-
- String currentWorkflowID = workflowIDMap.get(provenanceItem.getParentId());
-
-// logger.debug("popped workflowID "+currentWorkflowID);
-
- getEp().processProcessEvent(provenanceItem, currentWorkflowID);
-
- } else { // all other event types (iteration etc.)
-
-// logger.debug("processEvent of type "+provenanceItem.getEventType()+" for item of type "+provenanceItem.getClass().getName());
- String currentWorkflowID = provenanceItem.getWorkflowId();
-// String currentWorkflowID = workflowIDMap.get(provenanceItem.getParentId());
-
-// logger.debug("setting currentWorkflowID to "+ currentWorkflowID);
- getEp().processProcessEvent(provenanceItem, currentWorkflowID);
-
-// getEp().processProcessEvent(provenanceItem, workflowIDStack.get(0));
- }
-
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceAnalysis.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceAnalysis.java
deleted file mode 100644
index d75317e..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceAnalysis.java
+++ /dev/null
@@ -1,1157 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.io.IOException;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.JAXBException;
-
-import net.sf.taverna.t2.provenance.api.NativeAnswer;
-import net.sf.taverna.t2.provenance.api.QueryAnswer;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Arc;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.utils.QueryVar;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-import net.sf.taverna.t2.provenance.lineageservice.utils.WorkflowInstance;
-import net.sf.taverna.t2.provenance.opm.OPMManager;
-
-import org.apache.log4j.Logger;
-import org.tupeloproject.kernel.OperatorException;
-import org.tupeloproject.provenance.ProvenanceArtifact;
-import org.tupeloproject.provenance.ProvenanceRole;
-
-/**
- * @author paolo<p/>
- * the main class for querying the lineage DB
- * assumes a provenance DB ready to be queried
- */
-public class ProvenanceAnalysis {
-
- private static Logger logger = Logger.getLogger(ProvenanceAnalysis.class);
-
- private static final String IP_ANNOTATION = "index-preserving";
- private static final String OUTPUT_CONTAINER_PROCESSOR = "_OUTPUT_";
- private static final String INPUT_CONTAINER_PROCESSOR = "_INPUT_";
- public static final String ALL_PATHS_KEYWORD = "ALL";
-
- private ProvenanceQuery pq = null;
- private AnnotationsLoader al = new AnnotationsLoader(); // singleton
-
- // paths collected by lineageQuery and to be used by naive provenance query
- private Map<ProvenanceProcessor, List<List<String>>> validPaths = new HashMap<ProvenanceProcessor, List<List<String>>>();
-
- private List<String> currentPath;
- private Map<String,List<String>> annotations = null; // user-made annotations to processors
-
- private boolean ready = false; // set to true as soon as init succeeds. this means pa is ready to answer queries
-
- private boolean returnOutputs = false; // by default only return input bindings
-
- private boolean includeDataValue = false; // forces the lineage queries to return de-referenced data values
-
- private boolean generateOPMGraph = true;
-
- // TODO extract this to prefs -- selects which OPMManager is to be used to export to OPM
- private String OPMManagerClass = "net.sf.taverna.t2.provenance.lineageservice.ext.pc3.PANSTARRSOPMManager";
-
- private OPMManager aOPMManager = null;
-
- private boolean recordArtifactValues = false;
-
- public ProvenanceAnalysis() { ; }
-
- public ProvenanceAnalysis(ProvenanceQuery pq) throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
- this.pq = pq;
- setReady(tryInit());
- }
-
-
- private boolean tryInit() throws SQLException {
-
- if (getWFInstanceIDs() != null && getWFInstanceIDs().size()>0) {
- initGraph(); // init OPM provenance graph
- return true;
- } else
- return false;
- }
-
- /**
- * Call to create the opm graph and annotation loader.
- * this may fail due to queries being issued before DB is populated, minimally with wfInstanceID
- */
- public void initGraph() {
-
- // OPM management
- try {
- aOPMManager = (OPMManager) Class.forName(OPMManagerClass).newInstance();
- } catch (InstantiationException e1) {
- logger.error("Problem initialising opm graph: ", e1);
- } catch (IllegalAccessException e1) {
- logger.error("Problem initialising opm graph: ", e1);
- } catch (ClassNotFoundException e1) {
- logger.info("chosen OPMmanager: "+OPMManagerClass+" not available, reverting to default");
- aOPMManager = new OPMManager();
- }
-
- try {
- aOPMManager.createAccount(getWFInstanceIDs().get(0).getInstanceID());
- } catch (SQLException e) {
- logger.error("Could not initialise OPM Manager: ", e);
- }
- }
-
-
- /**
- * asks the OPM manager to convert its current RDF OPMGraph to XML
- * @return the filename of the OPM XML file
- * @throws OperatorException
- * @throws IOException
- * @throws JAXBException
- */
-// public String OPMRdf2Xml() throws OperatorException, IOException, JAXBException {
-// if (isReady()) {
-// return aOPMManager.Rdf2Xml();
-// }
-// return null;
-// }
-
- /**
- * asks the OPM manager to create a dot file representing its current RDF OPMGraph<br/>
- * needs fixing
- * @return
- * @throws IOException
- * @throws OperatorException
- */
- public String OPMRdf2Dot() throws OperatorException, IOException {
- if (aOPMManager != null && aOPMManager.isActive() && isReady()) {
- return aOPMManager.Rdf2Dot();
- }
- return null;
- }
-
-
- public void setAnnotationFile(String annotationFile) {
-
- annotations = al.getAnnotations(annotationFile);
-
- if (annotations == null) {
- logger.warn("no annotations have been loaded");
- return;
- }
-
- logger.info("processor annotations for lineage refinement: ");
- for (Map.Entry<String,List<String>> entry:annotations.entrySet()) {
-
- logger.info("annotations for proc "+entry.getKey());
- for (String ann: (List<String>) entry.getValue()) {
- logger.info(ann);
- }
- }
-
- }
-
-
- /**
- * returns all available instances across all workflows
- * @return
- * @throws SQLException
- */
- public List<WorkflowInstance> getWFInstanceIDs() throws SQLException { return getPq().getRuns(null, null); }
-
-
- /**
- * returns all available instances for workflow wfName
- *@param wfName
- * @return
- * @throws SQLException
- */
- public List<WorkflowInstance> getWFInstanceID(String wfName) throws SQLException {
- return getPq().getRuns(wfName, null); }
-
-
- /**
- * @param wfInstance lineage scope -- a specific instance
- * @param pname for a specific processor [required]
- * @param a specific (input or output) variable [optional]
- * @param iteration and a specific iteration [optional]
- * @param wfNameRef
- * @return a lineage query ready to be executed, or null if we cannot return an answer because we are not ready
- * (for instance the DB is not yet populated)
- * @throws SQLException
- */
- public Dependencies fetchIntermediateResult(
- String wfInstance,
- String wfNameRef,
- String pname,
- String vname,
- String iteration) throws SQLException {
-
- if (!isReady()) {
- setReady(tryInit());
- if (!isReady()) return null;
- }
-
-
- LineageSQLQuery lq = getPq().simpleLineageQuery(wfInstance, wfNameRef, pname, vname, iteration);
-
- return getPq().runLineageQuery(lq, isIncludeDataValue());
- }
-
-
-
- public QueryAnswer lineageQuery(List<QueryVar> qvList,
- String wfInstance, List<ProvenanceProcessor> selectedProcessors) throws SQLException {
-
- QueryAnswer completeAnswer = new QueryAnswer();
- NativeAnswer nativeAnswer = new NativeAnswer();
-
- Map<QueryVar, Map<String, List<Dependencies>>> answerContent = new HashMap<QueryVar, Map<String, List<Dependencies>>>();
-
- // launch a lineage query for each target variable
- for (QueryVar qv:qvList) {
-
- // full lineage query
- logger.info("************\n lineage query: [instance, workflow, proc, port, path] = ["+
- wfInstance+","+qv.getWfName()+","+qv.getPname()+","+qv.getVname()+",["+qv.getPath()+"]]\n***********");
-
- // the OPM manager builds an OPM graph behind the scenes as a side-effect
- Map<String, List<Dependencies>> a =
- computeLineageSingleVar(wfInstance, qv.getWfName(), qv.getVname(), qv.getPname(), qv.getPath(), selectedProcessors);
-
- answerContent.put(qv, a);
- }
-
- nativeAnswer.setAnswer(answerContent);
- completeAnswer.setNativeAnswer(nativeAnswer);
-
- if (aOPMManager != null && aOPMManager.isActive()) {
-// String _OPM_asXML_File;
-// try {
-
-// _OPM_asXML_File = aOPMManager.Rdf2Xml();
- String _OPM_asRDF_File = aOPMManager.writeGraph();
-
- completeAnswer.setOPMAnswer_AsRDF(_OPM_asRDF_File);
-// completeAnswer.setOPMAnswer_AsXML(_OPM_asXML_File);
-
-// } catch (OperatorException e) {
-// logger.error("Problem running query: " + e);
-// } catch (IOException e) {
-// logger.error("Problem running query: " + e);
-// } catch (JAXBException e) {
-// logger.error("Problem running query: " + e);
-// }
- }
- return completeAnswer;
- }
-
- /**
- * facade for computeLineage: if path == ALL then it retrieves all VBs for (proc,var) ignoring path
- * (i.e., all values within the collection bound to var) and invokes computeLineageSingleBinding() on each path</br>
- * if path is specified, however, this just passes the request to computeLineageSingleBinding. in this case the result map
- * only contains one entry
- * @param wfInstance
- * @param var
- * @param proc
- * @param path
- * @param string
- * @param selectedProcessors
- * @return a map <pre>{ path -> List<LineageQueryResult> }</pre>, one entry for each path
- * @throws SQLException
- */
- public Map<String, List<Dependencies>> computeLineageSingleVar (
- String wfInstance, // dynamic scope
- String wfNameRef, // static scope
- String var, // target var
- String proc, // qualified with its processor name
- String path, // possibly empty when no collections or no granular lineage required
- List<ProvenanceProcessor> selectedProcessors
- ) throws SQLException {
-
- if (!isReady()) {
- setReady(tryInit());
- if (!isReady()) return null;
- }
-
- // are we returning all outputs in addition to the inputs?
- logger.info("return outputs: "+isReturnOutputs());
-
- Map<String, List<Dependencies>> qa = new HashMap<String, List<Dependencies>>();
-
- // run a query for each variable in the entire workflow graph
- if (path.equals(ALL_PATHS_KEYWORD)) {
-
- Map<String, String> vbConstraints = new HashMap<String, String>();
- vbConstraints.put("VB.PNameRef", proc);
- vbConstraints.put("VB.varNameRef", var);
- vbConstraints.put("VB.wfInstanceRef", wfInstance);
-
- List<VarBinding> vbList = getPq().getVarBindings(vbConstraints); // DB
-
- if (vbList.isEmpty()) {
- logger.warn(ALL_PATHS_KEYWORD+" specified for paths but no varBindings found. nothing to compute");
- }
-
- for (VarBinding vb:vbList) {
-
- // path is of the form [x,y..] we need it as x,y...
- path = vb.getIteration().substring(1, vb.getIteration().length()-1);
-
- List<Dependencies> result = computeLineageSingleBinding(
- wfInstance, wfNameRef, var, proc, path, selectedProcessors);
- qa.put(vb.getIteration(), result);
- }
- } else {
- qa.put(path, computeLineageSingleBinding(
- wfInstance, wfNameRef, var, proc, path, selectedProcessors));
- }
- return qa;
- }
-
-
- /**
- * main lineage query method. queries the provenance DB
- * with a single originating proc/var/path and a set of selected Processors
- * @param wfID
- * @param var
- * @param proc
- * @param path
- * @param path2
- * @param selectedProcessors
- * @return a list of bindings. each binding involves an input var for one of the selectedProcessors. Note
- * each var can contribute multiple bindings, i.e., when all elements in a collection bound to the var are retrieved.
- * Note also that bindings for input vars are returned as well, when the query is configured with returnOutputs = true
- * {@link ProvenanceAnalysis#isReturnOutputs() }
- * @throws SQLException
- */
- public List<Dependencies> computeLineageSingleBinding(
- String wfID, // dynamic scope
- String wfNameRef, // static scope
- String var, // target var
- String proc, // qualified with its processor name
- String path, // possibly empty when no collections or no granular lineage required
- List<ProvenanceProcessor> selectedProcessors
- ) throws SQLException {
-
-// Map<String, LineageSQLQuery> varName2lqList = new HashMap<String, LineageSQLQuery>();
-
-// System.out.println("timing starts...");
- long start = System.currentTimeMillis();
-
- List<LineageSQLQuery> lqList = searchDataflowGraph(wfID, wfNameRef, var, proc, path, selectedProcessors);
- long stop = System.currentTimeMillis();
-
- long gst = stop-start;
-
- // execute queries in the LineageSQLQuery list
- logger.info("\n**************** executing lineage queries: (includeDataValue is "+ isIncludeDataValue() +"**************\n");
- start = System.currentTimeMillis();
-
- List<Dependencies> results = getPq().runLineageQueries(lqList, isIncludeDataValue());
- stop = System.currentTimeMillis();
-
- long qrt = stop-start;
- logger.info("search time: "+gst+"ms\nlineage query response time: "+qrt+" ms");
- logger.info("total exec time "+(gst+qrt)+"ms");
-
- return results;
- }
-
-
- /**
- * compute lineage queries using path projections
- * @param wfID the (single) instance defines the scope of a query<br/>
- * added 2/9: collect a list of paths in the process to be used by the naive query. In practice
- * we use this as the graph search phase that is needed by the naive query anyway
- * @param var
- * @param proc
- * @param path within var (can be empty but not null)
- * @param selectedProcessors pairs (wfID, proceName), encoded as a Map. only report lineage when you reach any of these processors
- * @throws SQLException
- */
- public List<LineageSQLQuery> searchDataflowGraph(
- String wfID, // dymamic scope
- String wfNameRef, // static scope
- String var, // target var
- String proc, // qualified with its processor name
- String path, // can be empty but not null
- List<ProvenanceProcessor> selectedProcessors
- ) throws SQLException {
-
- List<LineageSQLQuery> lqList = new ArrayList<LineageSQLQuery>();
-
- // TODO we are ignoring the wfId context information in the list of selected processors!!
-
- // init paths accumulation. here "path" is a path in the graph, not within a collection!
- // associate an empty list of paths to each selected processor
- for (ProvenanceProcessor s:selectedProcessors) { validPaths.put(s, new ArrayList<List<String>>()); }
-
- currentPath = new ArrayList<String>();
-
- // start with xfer or xform depending on whether initial var is output or input
-
- // get (var, proc) from Var to see if it's input/output
- Map<String, String> varQueryConstraints = new HashMap<String, String>();
- varQueryConstraints.put("W.instanceID", wfID);
- varQueryConstraints.put("V.pnameRef", proc);
- varQueryConstraints.put("V.varName", var);
- varQueryConstraints.put("V.wfInstanceRef", wfNameRef);
-
- List<Var> vars = getPq().getVars(varQueryConstraints);
-
- if (vars.isEmpty()) {
- logger.info("variable ("+var+","+proc+") not found, lineage query terminated");
- return null;
- }
-
- Var v = vars.get(0); // expect exactly one record
- // CHECK there can be multiple (pname, varname) pairs, i.e., in case of nested workflows
- // here we pick the first that turns up -- we would need to let users choose, or process all of them...
-
- if (v.isInput() || getPq().isDataflow(proc)) { // if vName is input, then do a xfer() step
-
- // rec. accumulates SQL queries into lqList
- xferStep(wfID, wfNameRef, var, proc, path, selectedProcessors, lqList);
-
- } else { // start with xform
-
- // rec. accumulates SQL queries into lqList
- xformStep(wfID, wfNameRef, v, proc, path, selectedProcessors, lqList);
- }
-
- return lqList;
-
- } // end searchDataflowGraph
-
-
-
- /**
- * accounts for an inverse transformation from one output to all inputs of a processor
- * @param wfID
- * @param var the output var
- * @param proc the processor
- * @param selectedProcessors the processors for which we are interested in producing lineage
- * @param path iteration vector within a VarBinding collection
- * @param lqList partial list of spot lineage queries, to be added to
- * @throws SQLException
- */
- private void xformStep(
- String wfID,
- String wfNameRef,
- Var outputVar, // we need the dnl from this output var
- String proc,
- String path,
- List<ProvenanceProcessor> selectedProcessors,
- List<LineageSQLQuery> lqList
- ) throws SQLException {
-
- // retrieve input vars for current processor
- Map<String, String> varsQueryConstraints = new HashMap<String, String>();
-
- List<Var> inputVars = null;
-
- // here we fetch the input vars for the current proc.
- // however, it may be the case that we are looking at a dataflow port (for the entire dataflow or
- // for a subdataflow) rather than a real processor. in this case
- // we treat this as a
- // special processor that does nothing -- so we "input var" in this case
- // is a copy of the port, and we are ready to go for the next xfer step.
- // in this way we can seamlessly traverse the graph over intermediate I/O that are part
- // of nested dataflows
-
- if (getPq().isDataflow(proc)) { // if we are looking at the output of an entire dataflow
-
- // force the "input vars" for this step to be the output var itself
- // this causes the following xfer step to trace back to the next processor _within_ proc
- inputVars = new ArrayList<Var>();
- inputVars.add(outputVar);
-
- } else if (proc.equals(OUTPUT_CONTAINER_PROCESSOR)) { // same action as prev case, but may change in the future
-
- inputVars = new ArrayList<Var>();
- inputVars.add(outputVar);
-
- } else {
-
- varsQueryConstraints.put("W.instanceID", wfID);
- varsQueryConstraints.put("pnameRef", proc);
- varsQueryConstraints.put("inputOrOutput", "1");
-
- inputVars = getPq().getVars(varsQueryConstraints);
- }
-
- ///////////
- /// path projections
- ///////////
- // maps each var to its projected path
- Map<Var,String> var2Path = new HashMap<Var,String>();
- Map<Var,Integer> var2delta = new HashMap<Var,Integer>();
-
- if (path == null) { // nothing to split
- for (Var inputVar: inputVars) var2Path.put(inputVar, null);
- } else {
-
- int minPathLength = 0; // if input path is shorter than this we give up granularity altogether
- for (Var inputVar: inputVars) {
- int delta = inputVar.getActualNestingLevel() - inputVar.getTypeNestingLevel();
- var2delta.put(inputVar, new Integer(delta));
- minPathLength += delta;
-// System.out.println("xform() from ["+proc+"] upwards to ["+inputVar.getPName()+":"+inputVar.getVName()+"]");
- }
-
- String iterationVector[] = path.split(",");
-
- if (iterationVector.length < minPathLength) { // no path is propagated
- for (Var inputVar: inputVars) {
- var2Path.put(inputVar, null);
- }
- } else { // compute projected paths
-
- String[] projectedPath;
-
- int start = 0;
- for (Var inputVar: inputVars) {
-
- // 24/7/08 get DNL (declared nesting level) and ANL (actual nesting level) from VAR
- // TODO account for empty paths
- int projectedPathLength = var2delta.get(inputVar); // this is delta
-
- if (projectedPathLength > 0) { // this var is involved in iteration
-
- projectedPath = new String[projectedPathLength];
- for (int i=0; i<projectedPathLength; i++) {
- projectedPath[i] = iterationVector[start+i];
- }
- start += projectedPathLength;
-
- StringBuffer iterationFragment = new StringBuffer();
- for (String s:projectedPath) { iterationFragment.append(s+","); }
- iterationFragment.deleteCharAt(iterationFragment.length()-1);
-
- var2Path.put(inputVar, iterationFragment.toString());
- } else { // associate empty path to this var
- var2Path.put(inputVar, null);
- }
- }
- }
- }
-
- // accumulate this proc to current path
- currentPath.add(proc);
-
- // if this is a selected processor, add a copy of the current path to the list of paths for the processor
-
- // is <wfNameRef, proc> in selectedProcessors?
- boolean isSelected = false;
- for (ProvenanceProcessor pp: selectedProcessors) {
- if (pp.getWfInstanceRef().equals(wfNameRef) && pp.getPname().equals(proc)) {
- List<List<String>> paths = validPaths.get(pp);
-
- // copy the path since the original will change
- // also remove spurious dataflow processors at this point
- List<String> pathCopy = new ArrayList<String>();
- for (String s:currentPath) {
- if (!getPq().isDataflow(s)) pathCopy.add(s);
- }
- paths.add(pathCopy);
- isSelected = true;
- break;
- }
- }
-
- ///////////
- /// generate SQL if necessary -- for all input vars, based on the current path
- /// the projected paths are required to determine the level in the collection at which
- /// we look at the value assignment
- ///////////
-
- Map<String, ProvenanceArtifact> var2Artifact = new HashMap<String, ProvenanceArtifact>();
- Map<String, ProvenanceRole> var2ArtifactRole = new HashMap<String, ProvenanceRole>();
-
- // if this transformation is important to the user, produce an output and also an OPM graph fragment
- if (selectedProcessors.isEmpty() || isSelected) {
-
- List<LineageSQLQuery> newLqList = getPq().lineageQueryGen(wfID, proc, var2Path, outputVar, path, isReturnOutputs() || var2Path.isEmpty());
- lqList.addAll(newLqList);
-
- // BEGIN OPM update section
- //
- // create OPM artifact and role for the output var of this xform
- //
- boolean doOPM = (aOPMManager != null && aOPMManager.isActive()); // any problem below will set this to false
-
- String role = null;
- VarBinding vb = null;
- String URIFriendlyIterationVector =null;
-
- if (doOPM) {
- // fetch value for this variable and assert it as an Artifact in the OPM graph
- Map<String, String> vbConstraints = new HashMap<String, String>();
- vbConstraints.put("VB.PNameRef", outputVar.getPName());
- vbConstraints.put("VB.varNameRef", outputVar.getVName());
- vbConstraints.put("VB.wfInstanceRef", wfID);
-
- if (path != null) {
-
- // account for x,y,.. format as well as [x,y,...] depending on where the request is coming from
- // TODO this is just irritating must be removed
- if (path.startsWith("["))
- vbConstraints.put("VB.iteration", path);
- else
- vbConstraints.put("VB.iteration", "["+path+"]");
- }
-
- List<VarBinding> vbList = getPq().getVarBindings(vbConstraints); // DB
-
- // use only the first result (expect only one) -- in this method we assume path is not null
-
- // map the resulting varBinding to an Artifact
- if (vbList == null || vbList.size()==0) {
- logger.debug("no entry corresponding to conditions: proc="+
- outputVar.getPName()+" var = "+outputVar.getVName()+" iteration = "+path);
- doOPM = false;
- } else {
- vb = vbList.get(0);
-
- URIFriendlyIterationVector = vb.getIteration().
- replace(',', '-').replace('[', ' ').replace(']', ' ').trim();
-
- if (URIFriendlyIterationVector.length()>0) {
- role = vb.getPNameRef()+"/"+vb.getVarNameRef()+"?it="+URIFriendlyIterationVector;
- } else
- role = vb.getPNameRef()+"/"+vb.getVarNameRef();
-
- if (aOPMManager!=null && !pq.isDataflow(proc)) {
- if (isRecordArtifactValues())
- aOPMManager.addArtifact(vb.getValue(), vb.getResolvedValue());
- else
- aOPMManager.addArtifact(vb.getValue());
-
- aOPMManager.createRole(role);
- }
-
- // assert proc as Process -- include iteration vector to separate different activations of the same process
- aOPMManager.addProcess(proc, vb.getIteration(), URIFriendlyIterationVector);
-
- //
- // create OPM generatedBy property between output value and this process node
- // avoid the pathological case where a dataflow generates its own inputs
- //
- aOPMManager.assertGeneratedBy(
- aOPMManager.getCurrentArtifact(),
- aOPMManager.getCurrentProcess(),
- aOPMManager.getCurrentRole(),
- aOPMManager.getCurrentAccount(),
- true); // true -> prevent duplicates CHECK
- }
- }
- //
- // create OPM process for this xform
- //
- for (LineageSQLQuery lq: newLqList) {
- // if OPM is on, execute the query so we get the value we need for the Artifact node
- Dependencies inputs = getPq().runLineageQuery(lq, isIncludeDataValue());
-
- if (doOPM && inputs.getRecords().size()>0 && !pq.isDataflow(proc)) {
-
- // update OPM graph with inputs and used properties
- for (LineageQueryResultRecord resultRecord: inputs.getRecords()) {
-
- // process inputs only
- if (!resultRecord.isInput()) continue;
-
- URIFriendlyIterationVector = resultRecord.getIteration().
- replace(',', '-').replace('[', ' ').replace(']', ' ').trim();
-
- boolean found = false; // used to avoid duplicate process resources
-
- // map each input var in the resultRecord to an Artifact
- // create new Resource for the resultRecord
- // use the value as URI for the Artifact, and resolvedValue as the actual value
-
- //
- // create OPM artifact and role for the input var obtained by path projection
- //
- if (isRecordArtifactValues())
- aOPMManager.addArtifact(resultRecord.getValue(), resultRecord.getResolvedValue());
- else
- aOPMManager.addArtifact(resultRecord.getValue());
- var2Artifact.put(resultRecord.getVname(), aOPMManager.getCurrentArtifact());
-
- if (URIFriendlyIterationVector.length()>0) {
- role = resultRecord.getPname()+"/"+resultRecord.getVname()+"?it="+URIFriendlyIterationVector;
- } else
- role = resultRecord.getPname()+"/"+resultRecord.getVname();
-
- aOPMManager.createRole(role); // this also sets currentRole to role
- var2ArtifactRole.put(resultRecord.getVname(), aOPMManager.getCurrentRole());
-
-
- //
- // create OPM used property between process and the input var obtained by path projection
- //
- // avoid output variables, it would assert that P used one of its outputs!
-
- aOPMManager.assertUsed(
- aOPMManager.getCurrentArtifact(),
- aOPMManager.getCurrentProcess(),
- aOPMManager.getCurrentRole(),
- aOPMManager.getCurrentAccount(),
- true); // true -> prevent duplicates CHECK
- }
- }
- }
-// END OPM update section
- }
-
- // recursion -- xfer path is next up
- for (Var inputVar: inputVars) {
- xferStep(wfID, wfNameRef, inputVar.getVName(), inputVar.getPName(), var2Path.get(inputVar), selectedProcessors, lqList);
- }
- currentPath.remove(currentPath.size()-1); // CHECK
- } // end xformStep
-
-
-
- private void xferStep(
- String wfInstanceID,
- String wfNameRef,
- String var,
- String proc,
- String path,
- List<ProvenanceProcessor> selectedProcessors,
- List<LineageSQLQuery> lqList) throws SQLException {
-
- String sourceProcName = null;
- String sourceVarName = null;
-
- // retrieve all Arcs ending with (var,proc) -- ideally there is exactly one
- // (because multiple incoming arcs are disallowed)
- Map<String, String> arcsQueryConstraints = new HashMap<String, String>();
-
- arcsQueryConstraints.put("W.instanceID", wfInstanceID);
- arcsQueryConstraints.put("sinkVarNameRef", var);
- arcsQueryConstraints.put("sinkPNameRef", proc);
-
- List<Arc> arcs = getPq().getArcs(arcsQueryConstraints);
-
- if (arcs.size() == 0) {
-// System.out.println("no arcs going up from ["+proc+","+var+"] ... returning");
- return; // CHECK
- }
-
- Arc a = arcs.get(0);
-
- // get source node
- sourceProcName = a.getSourcePnameRef();
- sourceVarName = a.getSourceVarNameRef();
-
- //System.out.println("xfer() from ["+proc+","+var+"] to ["+sourceProcName+","+sourceVarName+"]");
-
- // CHECK transfer same path with only exception: when anl(sink) > anl(source)
- // in this case set path to null
-
- // retrieve full record for var:
- // retrieve input vars for current processor
- Map<String, String> varsQueryConstraints = new HashMap<String, String>();
-
- varsQueryConstraints.put("W.instanceID", wfInstanceID);
- varsQueryConstraints.put("pnameRef", sourceProcName);
- varsQueryConstraints.put("varName", sourceVarName);
- List<Var> varList = getPq().getVars(varsQueryConstraints);
-
- Var outputVar = varList.get(0);
-
- // recurse on xform
- xformStep(wfInstanceID, wfNameRef, outputVar, sourceProcName, path, selectedProcessors, lqList);
-
- } // end xferStep2
-
-
- /**
- * this class represents the annotation (single or sequence, to be determined)
- * that are produced upon visiting the graph structure and that drive the generation of
- * a pinpoint lineage query<br/>
- * this is still a placeholder
- */
- class LineageAnnotation {
-
- List<String> path = new ArrayList<String>();
-
- boolean isXform = true;
-
- String iteration = ""; // this is the iteration projected on a single variable. Used for propagation upwards default is no iteration --
- String iterationVector = ""; // iteration vector accounts for cross-products. Used to be matched exactly in queries.
- int iic = 0; // index in collection -- default is 0
- int collectionNesting = 0; // n indicates granularity is n levels from leaf.
- // This quantifies loss of lineage precision when working with collections
- String collectionRef = null;
- String proc;
- String var;
- String varType = null; // dtring, XML,... see Taverna type system
-
- int DNL = 0; // declared nesting level -- copied from VAR
- int ANL = 0; // actual nesting level -- copied from Var
-
- String wfInstance; // TODO generalize to list / time interval?
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
-
- if (isXform) sb.append(" xform: ");
- else sb.append(" xfer: ");
-
- sb.append("<PROC/VAR/VARTYPE, IT, IIC, ITVECTOR, COLLNESTING> = "+
- proc + "/" + var + "/" + varType +
- "," + "["+iteration +"]"+
- ","+ iic +
- ", ["+ iterationVector + "]"+
- ","+ collectionNesting);
-
- return sb.toString();
- }
-
-
- public void addStep(String step) {
- path.add(step);
- }
-
- public void removeLastStep() {
- path.remove(path.size()-1);
- }
-
-
- /**
- * @return the path
- */
- public List<String> getPath() {
- return path;
- }
-
-
- /**
- * @param path the path to set
- */
- public void setPath(List<String> path) {
- this.path = path;
- }
-
-
- /**
- * @return the iteration
- */
- public String getIteration() {
- return iteration;
- }
-
-
- /**
- * @param iteration the iteration to set
- */
- public void setIteration(String iteration) {
- this.iteration = iteration;
- }
-
-
- /**
- * @return the iic
- */
- public int getIic() {
- return iic;
- }
-
-
- /**
- * @param iic the iic to set
- */
- public void setIic(int iic) {
- this.iic = iic;
- }
-
-
- /**
- * @return the collectionRef
- */
- public String getCollectionRef() {
- return collectionRef;
- }
-
-
- /**
- * @param collectionRef the collectionRef to set
- */
- public void setCollectionRef(String collectionRef) {
- this.collectionRef = collectionRef;
- }
-
-
- /**
- * @return the proc
- */
- public String getProc() {
- return proc;
- }
-
-
- /**
- * @param proc the proc to set
- */
- public void setProc(String proc) {
- this.proc = proc;
- }
-
-
- /**
- * @return the var
- */
- public String getVar() {
- return var;
- }
-
-
- /**
- * @param var the var to set
- */
- public void setVar(String var) {
- this.var = var;
- }
-
-
- /**
- * @return the varType
- */
- public String getVarType() {
- return varType;
- }
-
-
- /**
- * @param varType the varType to set
- */
- public void setVarType(String varType) {
- this.varType = varType;
- }
-
-
- /**
- * @return the wfInstance
- */
- public String getWfInstance() {
- return wfInstance;
- }
-
-
- /**
- * @param wfInstance the wfInstance to set
- */
- public void setWfInstance(String wfInstance) {
- this.wfInstance = wfInstance;
- }
-
-
- /**
- * @return the isXform
- */
- public boolean isXform() {
- return isXform;
- }
-
-
- /**
- * @param isXform the isXform to set
- */
- public void setXform(boolean isXform) {
- this.isXform = isXform;
- }
-
-
-
- /**
- * @return the collectionNesting
- */
- public int getCollectionNesting() {
- return collectionNesting;
- }
-
-
- /**
- * @param collectionNesting the collectionNesting to set
- */
- public void setCollectionNesting(int collectionNesting) {
- this.collectionNesting = collectionNesting;
- }
-
-
- /**
- * @return the iterationVector
- */
- public String getIterationVector() {
- return iterationVector;
- }
-
-
- /**
- * @param iterationVector the iterationVector to set
- */
- public void setIterationVector(String iterationVector) {
- this.iterationVector = iterationVector;
- }
-
-
- /**
- * @return the dNL
- */
- public int getDNL() {
- return DNL;
- }
-
-
- /**
- * @param dnl the dNL to set
- */
- public void setDNL(int dnl) {
- DNL = dnl;
- }
-
-
- /**
- * @return the aNL
- */
- public int getANL() {
- return ANL;
- }
-
-
- /**
- * @param anl the aNL to set
- */
- public void setANL(int anl) {
- ANL = anl;
- }
- }
-
-
- /**
- * @return the validPaths
- */
- public Map<ProvenanceProcessor, List<List<String>>> getValidPaths() {
- return validPaths;
- }
-
-
- /**
- * @param validPaths the validPaths to set
- */
- public void setValidPaths(Map<ProvenanceProcessor, List<List<String>>> validPaths) {
- this.validPaths = validPaths;
- }
-
-
- public void setPq(ProvenanceQuery pq) {
- this.pq = pq;
- }
-
-
- public ProvenanceQuery getPq() {
- return pq;
- }
-
- /**
- * @return the ready
- */
- public boolean isReady() {
- return ready;
- }
-
- /**
- * @param ready the ready to set
- */
- public void setReady(boolean ready) {
- this.ready = ready;
- }
-
- /**
- * @return the returnOutputs
- */
- public boolean isReturnOutputs() {
- return returnOutputs;
- }
-
- /**
- * @param returnOutputs the returnOutputs to set
- */
- public void setReturnOutputs(boolean returnOutputs) {
- this.returnOutputs = returnOutputs;
- }
-
- /**
- * @return the recordArtifactValues
- */
- public boolean isRecordArtifactValues() {
- return recordArtifactValues;
- }
-
- /**
- * @param recordArtifactValues the recordArtifactValues to set
- */
- public void setRecordArtifactValues(boolean recordArtifactValues) {
- this.recordArtifactValues = recordArtifactValues;
-
- }
-
- /**
- * @return the includeDataValue
- */
- public boolean isIncludeDataValue() {
- return includeDataValue;
- }
-
- /**
- * @param includeDataValue the includeDataValue to set
- */
- public void setIncludeDataValue(boolean includeDataValue) {
- this.includeDataValue = includeDataValue;
- }
-
- /**
- * @return the generateOPMGraph
- */
- public boolean isGenerateOPMGraph() {
- return generateOPMGraph;
- }
-
- /**
- * @param generateOPMGraph the generateOPMGraph to set
- */
- public void setGenerateOPMGraph(boolean generateOPMGraph) {
- this.generateOPMGraph = generateOPMGraph;
- if (aOPMManager != null) { aOPMManager.setActive(generateOPMGraph); }
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java
deleted file mode 100644
index da26f7b..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceQuery.java
+++ /dev/null
@@ -1,2414 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.sql.Blob;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.provenance.connector.JDBCConnector;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Arc;
-import net.sf.taverna.t2.provenance.lineageservice.utils.DDRecord;
-import net.sf.taverna.t2.provenance.lineageservice.utils.NestedListNode;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProcBinding;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceProcessor;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Workflow;
-import net.sf.taverna.t2.provenance.lineageservice.utils.WorkflowInstance;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.impl.T2ReferenceImpl;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-
-/**
- * Handles all the querying of provenance items in the database layer. Uses
- * standard SQL so all specific instances of this class can extend this writer
- * to handle all of the db queries
- *
- * @author Paolo Missier
- * @author Ian Dunlop
- * @author Stuart Owen
- *
- */
-public abstract class ProvenanceQuery {
-
- protected Logger logger = Logger.getLogger(ProvenanceQuery.class);
- public static String DATAFLOW_TYPE = "net.sf.taverna.t2.activities.dataflow.DataflowActivity";
-
- public Connection getConnection() throws InstantiationException,
- IllegalAccessException, ClassNotFoundException, SQLException {
- return JDBCConnector.getConnection();
- }
-
- /**
- * implements a set of query constraints of the form var = value into a
- * WHERE clause
- *
- * @param q0
- * @param queryConstraints
- * @return
- */
- protected String addWhereClauseToQuery(String q0,
- Map<String, String> queryConstraints, boolean terminate) {
-
- // complete query according to constraints
- StringBuffer q = new StringBuffer(q0);
-
- boolean first = true;
- if (queryConstraints != null && queryConstraints.size() > 0) {
- q.append(" where ");
-
- for (Entry<String, String> entry : queryConstraints.entrySet()) {
- if (!first) {
- q.append(" and ");
- }
- q.append(" " + entry.getKey() + " = \'" + entry.getValue() + "\' ");
- first = false;
- }
- }
-
- return q.toString();
- }
-
- protected String addOrderByToQuery(String q0, List<String> orderAttr,
- boolean terminate) {
-
- // complete query according to constraints
- StringBuffer q = new StringBuffer(q0);
-
- boolean first = true;
- if (orderAttr != null && orderAttr.size() > 0) {
- q.append(" ORDER BY ");
-
- int i = 1;
- for (String attr : orderAttr) {
- q.append(attr);
- if (i++ < orderAttr.size()) {
- q.append(",");
- }
- }
- }
-
- return q.toString();
- }
-
- /**
- * select Var records that satisfy constraints
- */
- public List<Var> getVars(Map<String, String> queryConstraints)
- throws SQLException {
- List<Var> result = new ArrayList<Var>();
-
- String q0 = "SELECT * FROM Var V JOIN WfInstance W ON W.wfnameRef = V.wfInstanceRef";
-
- String q = addWhereClauseToQuery(q0, queryConstraints, true);
-
- List<String> orderAttr = new ArrayList<String>();
- orderAttr.add("V.order");
-
- String q1 = addOrderByToQuery(q, orderAttr, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q1.toString());
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- Var aVar = new Var();
-
- aVar.setWfInstanceRef(rs.getString("WfInstanceRef"));
-
- if (rs.getInt("inputOrOutput") == 1) {
- aVar.setInput(true);
- } else {
- aVar.setInput(false);
- }
- aVar.setPName(rs.getString("pnameRef"));
- aVar.setVName(rs.getString("varName"));
- aVar.setType(rs.getString("type"));
- aVar.setTypeNestingLevel(rs.getInt("nestingLevel"));
- aVar.setActualNestingLevel(rs.getInt("actualNestingLevel"));
- aVar.setANLset((rs.getInt("anlSet") == 1 ? true : false));
- result.add(aVar);
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
-
- return result;
- }
-
- private List<Var> getVarsNoInstance(Map<String, String> queryConstraints)
- throws SQLException {
-
- List<Var> result = new ArrayList<Var>();
-
- String q0 = "SELECT * FROM Var V";
-
- String q = addWhereClauseToQuery(q0, queryConstraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q.toString());
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- Var aVar = new Var();
-
- aVar.setWfInstanceRef(rs.getString("WfInstanceRef"));
-
- if (rs.getInt("inputOrOutput") == 1) {
- aVar.setInput(true);
- } else {
- aVar.setInput(false);
- }
- aVar.setPName(rs.getString("pnameRef"));
- aVar.setVName(rs.getString("varName"));
- aVar.setType(rs.getString("type"));
- aVar.setTypeNestingLevel(rs.getInt("nestingLevel"));
- aVar.setActualNestingLevel(rs.getInt("actualNestingLevel"));
- aVar.setANLset((rs.getInt("anlSet") == 1 ? true : false));
- result.add(aVar);
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- public List<String> getVarValues(String wfInstance, String pname,
- String vname) throws SQLException {
-
- List<String> result = new ArrayList<String>();
-
- String q0 = "SELECT value FROM VarBinding VB";
-
- Map<String, String> queryConstraints = new HashMap<String, String>();
- queryConstraints.put("wfInstanceRef", wfInstance);
- queryConstraints.put("PNameRef", pname);
- queryConstraints.put("varNameRef", vname);
-
- String q = addWhereClauseToQuery(q0, queryConstraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q.toString());
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
- result.add(rs.getString("value"));
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
-
- return result;
- }
-
- /**
- * return the input variables for a given processor and a wfInstanceId
- *
- * @param pname
- * @param wfInstanceId
- * @return list of input variables
- * @throws SQLException
- */
- public List<Var> getInputVars(String pname, String wfID, String wfInstanceID)
- throws SQLException {
- // get (var, proc) from Var to see if it's input/output
- Map<String, String> varQueryConstraints = new HashMap<String, String>();
-
- varQueryConstraints.put("V.wfInstanceRef", wfID);
- varQueryConstraints.put("V.pnameRef", pname);
- varQueryConstraints.put("V.inputOrOutput", "1");
- if (wfInstanceID != null) {
- varQueryConstraints.put("W.instanceID", wfInstanceID);
- return getVars(varQueryConstraints);
- } else {
- return getVarsNoInstance(varQueryConstraints);
- }
- }
-
- /**
- * return the output variables for a given processor and a wfInstanceId
- *
- * @param pname
- * @param wfInstanceId
- * @return list of output variables
- * @throws SQLException
- */
- public List<Var> getOutputVars(String pname, String wfID, String wfInstanceID)
- throws SQLException {
- // get (var, proc) from Var to see if it's input/output
- Map<String, String> varQueryConstraints = new HashMap<String, String>();
-
- varQueryConstraints.put("V.wfInstanceRef", wfID);
- varQueryConstraints.put("V.pnameRef", pname);
- varQueryConstraints.put("V.inputOrOutput", "0");
- if (wfInstanceID != null) {
- varQueryConstraints.put("W.instanceID", wfInstanceID);
- }
-
- return getVars(varQueryConstraints);
- }
-
- /**
- * selects all Arcs
- *
- * @param queryConstraints
- * @return
- * @throws SQLException
- */
- public List<Arc> getArcs(Map<String, String> queryConstraints)
- throws SQLException {
- List<Arc> result = new ArrayList<Arc>();
-
- String q0 = "SELECT * FROM Arc A JOIN WfInstance W ON W.wfnameRef = A.wfInstanceRef";
-
- String q = addWhereClauseToQuery(q0, queryConstraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q.toString());
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- Arc aArc = new Arc();
-
- aArc.setWfInstanceRef(rs.getString("WfInstanceRef"));
- aArc.setSourcePnameRef(rs.getString("sourcePNameRef"));
- aArc.setSourceVarNameRef(rs.getString("sourceVarNameRef"));
- aArc.setSinkPnameRef(rs.getString("sinkPNameRef"));
- aArc.setSinkVarNameRef(rs.getString("sinkVarNameRef"));
-
- result.add(aArc);
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
-
- public String getTopLevelWfName(String runID) throws SQLException {
-
- List<String> wfNames = new ArrayList<String>();
-
- List<Workflow> workflows = getWorkflowForRun(runID);
-
- for (Workflow w:workflows) {
- if (w.getParentWFname() == null) { return w.getWfname(); }
- }
- return null;
- }
-
- /**
- * returns the names of all workflows (top level + nested) for a given runID
- * @param runID
- * @return
- * @throws SQLException
- */
- public List<String> getWfNames(String runID) throws SQLException {
-
- List<String> wfNames = new ArrayList<String>();
-
- List<Workflow> workflows = getWorkflowForRun(runID);
-
- for (Workflow w:workflows) { wfNames.add(w.getWfname()); }
-
- return wfNames;
- }
-
-
- /**
- * returns the workflows associated to a single runID
- * @param runID
- * @return
- * @throws SQLException
- */
- public List<Workflow> getWorkflowForRun(String runID) throws SQLException {
-
- List<Workflow> result = new ArrayList<Workflow>();
-
- String q = "SELECT * FROM WfInstance I join Workflow W on I.wfnameRef = W.wfname where instanceID = ?";
-
- PreparedStatement stmt = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- stmt = connection.prepareStatement(q);
- stmt.setString(1, runID);
-
- boolean success = stmt.execute();
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- Workflow w = new Workflow();
- w.setWfName(rs.getString("wfnameRef"));
- w.setParentWFname(rs.getString("parentWFName"));
-
- result.add(w);
- }
- }
- } catch (InstantiationException e) {
- logger.error("Error finding the workflow reference", e);
- } catch (IllegalAccessException e) {
- logger.error("Error finding the workflow reference", e);
- } catch (ClassNotFoundException e) {
- logger.error("Error finding the workflow reference", e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return result;
- }
-
-
-
- /**
- * @param dataflowID
- * @param conditions currently only understands "from" and "to" as timestamps for range queries
- * @return
- * @throws SQLException
- */
- public List<WorkflowInstance> getRuns(String dataflowID, Map<String, String> conditions) throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- List<WorkflowInstance> result = new ArrayList<WorkflowInstance>();
-
- String q = "SELECT * FROM WfInstance I join Workflow W on I.wfnameRef = W.wfname";
-
- List<String> conds = new ArrayList<String>();
-
- if (dataflowID != null) { conds.add("wfnameRef = '"+dataflowID+"'"); }
- if (conditions != null) {
- if (conditions.get("from") != null) { conds.add("timestamp >= "+conditions.get("from")); }
- if (conditions.get("to") != null) { conds.add("timestamp <= "+conditions.get("to")); }
- }
- if (conds.size()>0) { q = q + " where "+conds.get(0); conds.remove(0); }
-
- while (conds.size()>0) {
- q = q + " and '"+conds.get(0)+"'";
- conds.remove(0);
- }
-
- q = q + " ORDER BY timestamp desc ";
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(q);
-
- logger.debug(q);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
- WorkflowInstance i = new WorkflowInstance();
- i.setInstanceID(rs.getString("instanceID"));
- i.setTimestamp(rs.getString("timestamp"));
- i.setWorkflowIdentifier(rs.getString("wfnameRef"));
- i.setWorkflowExternalName(rs.getString("externalName"));
- Blob blob = rs.getBlob("dataflow");
- long length = blob.length();
- blob.getBytes(1, (int) length);
- i.setDataflowBlob(blob.getBytes(1, (int) length));
- result.add(i);
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return result;
- }
-
-
- /*
- * gets all available run instances, most recent first
- * @return a list of pairs <wfanme, wfinstance>
- * @see net.sf.taverna.t2.provenance.lineageservice.mysql.ProvenanceQuery#
- * getWFInstanceIDs()
- */
- public List<String> getWFNamesByTime() throws SQLException {
-
- List<String> result = new ArrayList<String>();
-
- String q = "SELECT instanceID, wfnameRef FROM WfInstance order by timestamp desc";
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- result.add(rs.getString("wfnameRef"));
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- /**
- * all ProCBinding records that satisfy the input constraints
- *
- * @param constraints
- * @return
- * @throws SQLException
- */
- public List<ProcBinding> getProcBindings(Map<String, String> constraints)
- throws SQLException {
- List<ProcBinding> result = new ArrayList<ProcBinding>();
-
- String q = "SELECT * FROM ProcBinding PB ";
-
- q = addWhereClauseToQuery(q, constraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
-
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
- ProcBinding pb = new ProcBinding();
-
- pb.setActName(rs.getString("actName"));
- pb.setExecIDRef(rs.getString("execIDRef"));
- pb.setIterationVector(rs.getString("iteration"));
- pb.setPNameRef(rs.getString("pnameRef"));
- pb.setWfNameRef(rs.getString("wfNameRef"));
-
- result.add(pb);
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
-
- }
-
- /**
- * TODO this currently returns the data value as a string, which is
- * incorrect as it is an untyped byte array
- *
- * @param constraints
- * a Map columnName -> value that defines the query constraints.
- * Note: columnName must be fully qualified. This is not done
- * well at the moment, i.e., PNameRef should be
- * VarBinding.PNameRef to avoid ambiguities
- * @return
- * @throws SQLException
- */
- public List<VarBinding> getVarBindings(Map<String, String> constraints)
- throws SQLException {
- List<VarBinding> result = new ArrayList<VarBinding>();
-
- String q = "SELECT * FROM VarBinding VB join Var V " +
- "on (VB.varNameRef = V.varName and VB.PNameRef = V.PNameRef and VB.wfNameRef = V.wfInstanceRef) " +
- "JOIN WfInstance W ON VB.wfInstanceRef = W.instanceID and VB.wfNameRef = W.wfnameRef " +
- "LEFT OUTER JOIN Data D ON D.wfInstanceID = VB.wfInstanceRef and D.dataReference = VB.value";
-
- q = addWhereClauseToQuery(q, constraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
- VarBinding vb = new VarBinding();
-
- vb.setWfNameRef(rs.getString("wfNameRef"));
- vb.setVarNameRef(rs.getString("varNameRef"));
- vb.setWfInstanceRef(rs.getString("wfInstanceRef"));
- vb.setValue(rs.getString("value"));
-
- if (rs.getString("collIdRef") == null || rs.getString("collIdRef").equals("null")) {
- vb.setCollIDRef(null);
- } else {
- vb.setCollIDRef(rs.getString("collIdRef"));
- }
-
- vb.setIterationVector(rs.getString("iteration"));
- vb.setPNameRef(rs.getString("PNameRef"));
- vb.setPositionInColl(rs.getInt("positionInColl"));
- try {
- vb.setResolvedValue(rs.getString("D.data"));
- } catch (Exception e1) {
- // ignore this since D.data is experimental and will be
- // removed at some point
- }
-
- result.add(vb);
- }
-
- }
- } catch (Exception e) {
- logger.warn("Add VB failed:" + e.getMessage());
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return result;
- }
-
- public List<NestedListNode> getNestedListNodes(
- Map<String, String> constraints) throws SQLException {
-
- List<NestedListNode> result = new ArrayList<NestedListNode>();
-
- String q = "SELECT * FROM Collection C ";
-
- q = addWhereClauseToQuery(q, constraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- } catch (InstantiationException e) {
- logger.error("Error finding the nested list nodes", e);
- } catch (IllegalAccessException e) {
- logger.error("Error finding the nested list nodes", e);
- } catch (ClassNotFoundException e) {
- logger.error("Error finding the nested list nodes", e);
- }
-
- boolean success;
- try {
- success = stmt.execute(q);
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
- VarBinding vb = new VarBinding();
-
- NestedListNode nln = new NestedListNode();
-
- nln.setCollId(rs.getString("collId"));
- nln.setParentCollIdRef(rs.getString("parentCollIdRef"));
- nln.setWfInstanceRef(rs.getString("wfInstanceRef"));
- nln.setPNameRef(rs.getString("PNameRef"));
- nln.setVarNameRef(rs.getString("varNameRef"));
- nln.setIteration(rs.getString("iteration"));
-
- result.add(nln);
-
- }
- }
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
-
- return result;
- }
-
- public Map<String, Integer> getPredecessorsCount(String wfInstanceID) {
-
- PreparedStatement ps = null;
-
- Map<String, Integer> result = new HashMap<String, Integer>();
-
- // get all arcs for the entire workflow structure for this particular instance
- Connection connection = null;
- try {
-
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT A.sourcePNameRef as source , A.sinkPNameRef as sink, A.wfInstanceRef as wfName1, W1.wfName as wfName2, W2.wfName as wfName3 " +
- "FROM Arc A join WfInstance I on A.wfInstanceRef = I.wfnameRef " +
- "left outer join Workflow W1 on W1.externalName = A.sourcePNameRef " +
- "left outer join Workflow W2 on W2.externalName = A.sinkPNameRef " +
- "where I.instanceID = ? order by wfInstanceRef");
- ps.setString(1, wfInstanceID);
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
-
- String sink = rs.getString("sink");
- String source = rs.getString("source");
-
- if (result.get(sink) == null) {
- result.put(sink, 0);
- }
-
- String name1 = rs.getString("wfName1");
- String name2 = rs.getString("wfName2");
- String name3 = rs.getString("wfName3");
-
- if (isDataflow(source) && name1.equals(name2)) {
- continue;
- }
- if (isDataflow(sink) && name1.equals(name3)) {
- continue;
- }
-
- result.put(sink, result.get(sink) + 1);
- }
- }
- } catch (InstantiationException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (SQLException e) {
- logger.error("Error executing query", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- return result;
- }
-
- /**
- * new impl of getProcessorsIncomingLinks whicih avoids complications due to nesting, and relies on the wfInstanceID
- * rather than the wfnameRef
- * @param wfInstanceID
- * @return
- */
- public Map<String, Integer> getPredecessorsCountOld(String wfInstanceID) {
-
- PreparedStatement ps = null;
-
- Map<String, Integer> result = new HashMap<String, Integer>();
-
- // get all arcs for the entire workflow structure for this particular instance
- Connection connection = null;
- try {
-
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT sinkPnameRef, P1.type, count(*) as pred " +
- " FROM Arc A join WfInstance I on A.wfInstanceRef = I.wfnameRef " +
- " join Processor P1 on P1.pname = A.sinkPnameRef " +
- " join Processor P2 on P2.pname = A.sourcePnameRef " +
- " where I.instanceID = ? " +
- " and P2.type <> 'net.sf.taverna.t2.activities.dataflow.DataflowActivity' " +
- " and ((P1.type = 'net.sf.taverna.t2.activities.dataflow.DataflowActivity' and P1.wfInstanceRef = A.wfInstanceRef) or " +
- " (P1.type <> 'net.sf.taverna.t2.activities.dataflow.DataflowActivity')) " +
- " group by A.sinkPnameRef, type");
- ps.setString(1, wfInstanceID);
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
-
- int cnt = rs.getInt("pred");
-
- result.put(rs.getString("sinkPnameRef"), new Integer(cnt));
- }
- }
- } catch (InstantiationException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- return result;
- }
-
- /**
- * used in the toposort phase -- propagation of anl() values through the
- * graph
- *
- * @param wfnameRef
- * reference to static wf name
- * @return a map <processor name> --> <incoming links count> for each
- * processor, without counting the arcs from the dataflow input to
- * processors. So a processor is at the root of the graph if it has
- * no incoming links, or all of its incoming links are from dataflow
- * inputs.<br/>
- * Note: this must be checked for processors that are roots of
- * sub-flows... are these counted as top-level root nodes??
- */
- public Map<String, Integer> getProcessorsIncomingLinks(String wfnameRef)
- throws SQLException {
- Map<String, Integer> result = new HashMap<String, Integer>();
-
- boolean success;
-
- String currentWorkflowProcessor = null;
-
- PreparedStatement ps = null;
-
- Statement stmt;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT pName, type FROM Processor WHERE wfInstanceRef = ?");
- ps.setString(1, wfnameRef);
-
- success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
-
- // PM CHECK 6/09
- if (rs.getString("type").equals("net.sf.taverna.t2.activities.dataflow.DataflowActivity")) {
- currentWorkflowProcessor = rs.getString("pName");
- logger.info("currentWorkflowProcessor = " + currentWorkflowProcessor);
- }
- result.put(rs.getString("pName"), new Integer(0));
- }
- }
- } catch (InstantiationException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute query: " + e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute query: " + e1);
- } finally {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- connection = null;
- }
-
- // fetch the name of the top-level dataflow. We use this to exclude arcs
- // outgoing from its inputs
-
- ////////////////
- // CHECK below -- gets confused on nested workflows
- ////////////////
- String parentWF = getParentOfWorkflow(wfnameRef);
- if (parentWF == null) {
- parentWF = wfnameRef; // null parent means we are the top
- }
- logger.debug("parent WF: " + parentWF);
-
- // get nested dataflows -- we want to avoid these in the toposort algorithm
- List<ProvenanceProcessor> procs = getProcessorsShallow(
- "net.sf.taverna.t2.activities.dataflow.DataflowActivity",
- parentWF);
-
- StringBuffer pNames = new StringBuffer();
- pNames.append("(");
- boolean first = true;
- for (ProvenanceProcessor p : procs) {
-
- if (!first) {
- pNames.append(",");
- } else {
- first = false;
- }
- pNames.append(" '" + p.getPname() + "' ");
- }
- pNames.append(")");
-
-
- // exclude processors connected to inputs -- those have 0 predecessors
- // for our purposes
- // and we add them later
-
- // PM 6/09 not sure we need to exclude arcs going into sub-flows?? so commented out the condition
- String q = "SELECT sinkPNameRef, count(*) as cnt " + "FROM Arc " + "WHERE wfInstanceRef = \'" + wfnameRef + "\' " + "AND sinkPNameRef NOT IN " + pNames + " " // + "AND sourcePNameRef NOT IN " + pNames
- + " GROUP BY sinkPNameRef";
-
- logger.info("executing \n" + q);
-
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- success = stmt.execute(q);
- if (success) {
- ResultSet rs = stmt.getResultSet();
- while (rs.next()) {
-
- if (!rs.getString("sinkPNameRef").equals(currentWorkflowProcessor)) {
- result.put(rs.getString("sinkPNameRef"), new Integer(rs.getInt("cnt")));
- }
- }
- result.put(currentWorkflowProcessor, 0);
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- }
-
- return result;
- }
-
- public List<Var> getSuccVars(String pName, String vName,
- String wfInstanceRef) throws SQLException {
-
- List<Var> result = new ArrayList<Var>();
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT v.* " + "FROM Arc a JOIN Var v ON a.sinkPNameRef = v.pnameRef " + "AND a.sinkVarNameRef = v.varName " + "AND a.wfInstanceRef = v.wfInstanceRef " + "WHERE sourceVarNameRef = ? AND sourcePNameRef = ?");
-
- ps.setString(1, vName);
- ps.setString(2, pName);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
-
- if (wfInstanceRef != null && !rs.getString("v.wfInstanceRef").equals(wfInstanceRef)) {
- continue;
- }
-
- Var aVar = new Var();
-
- aVar.setWfInstanceRef(rs.getString("WfInstanceRef"));
-
- if (rs.getInt("inputOrOutput") == 1) {
- aVar.setInput(true);
- } else {
- aVar.setInput(false);
- }
- aVar.setPName(rs.getString("pnameRef"));
- aVar.setVName(rs.getString("varName"));
- aVar.setType(rs.getString("type"));
- aVar.setTypeNestingLevel(rs.getInt("nestingLevel"));
- aVar.setActualNestingLevel(rs.getInt("actualNestingLevel"));
- aVar.setANLset((rs.getInt("anlSet") == 1 ? true : false));
-
- result.add(aVar);
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- public List<String> getSuccProcessors(String pName, String wfNameRef, String wfInstanceId)
- throws SQLException {
- List<String> result = new ArrayList<String>();
-
- PreparedStatement ps = null;
-
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT distinct sinkPNameRef FROM Arc A JOIN Wfinstance I on A.wfInstanceRef = I.wfnameRef " + "WHERE A.wfInstanceRef = ? and I.instanceID = ? AND sourcePNameRef = ?");
- ps.setString(1, wfNameRef);
- ps.setString(2, wfInstanceId);
- ps.setString(3, pName);
-
- boolean success = ps.execute();
-
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
- result.add(rs.getString("sinkPNameRef"));
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- /**
- * get all processors of a given type within a structure identified by
- * wfnameRef (reference to dataflow). type constraint is ignored if value is null.<br>
- * this only returns the processor for the input wfNameRef, without going into any neted workflows
- *
- * @param wfnameRef
- * @param type
- * @return a list, that contains at most one element
- * @throws SQLException
- */
- public List<ProvenanceProcessor> getProcessorsShallow(String type, String wfnameRef)
- throws SQLException {
- Map<String, String> constraints = new HashMap<String, String>();
-
- constraints.put("P.wfInstanceRef", wfnameRef);
- if (type != null) {
- constraints.put("P.type", type);
- }
- return getProcessors(constraints);
- }
-
-
- /**
- * this is similar to {@link #getProcessorsShallow(String, String)} but it recursively fetches all processors
- * within nested workflows. The result is collected in the form of a map: wfName -> {ProvenanceProcessor}
- * @param type
- * @param wfnameRef
- * @return a map: wfName -> {ProvenanceProcessor} where wfName is the name of a (possibly nested) workflow, and
- * the values are the processors within that workflow
- */
- public Map<String, List<ProvenanceProcessor>> getProcessorsDeep(String type, String wfnameRef) {
-
- Map<String, List<ProvenanceProcessor>> result = new HashMap<String, List<ProvenanceProcessor>>();
-
- List<ProvenanceProcessor> currentProcs;
-
- try {
- currentProcs = getProcessorsShallow(type, wfnameRef);
-
- result.put(wfnameRef, currentProcs);
-
- for (ProvenanceProcessor pp:currentProcs) {
- if (pp.getType() == DATAFLOW_TYPE) {
- // recurse
- Map<String, List<ProvenanceProcessor>> deepProcessors = getProcessorsDeep(type, pp.getWfInstanceRef());
-
- for (Map.Entry<String, List<ProvenanceProcessor>> entry: deepProcessors.entrySet()) {
- result.put(entry.getKey(), entry.getValue());
- }
- }
- }
- } catch (SQLException e) {
- logger.error("Problem getting nested workflow processors for: " + wfnameRef + " : " + e);
- }
- return result;
- }
-
- /**
- * generic method to fetch processors subject to additional query constraints
- * @param constraints
- * @return
- * @throws SQLException
- */
- public List<ProvenanceProcessor> getProcessors(
- Map<String, String> constraints) throws SQLException {
- List<ProvenanceProcessor> result = new ArrayList<ProvenanceProcessor>();
-
- String q = "SELECT * FROM Processor P JOIN WfInstance W ON P.wfInstanceRef = W.wfnameRef "+
- "JOIN Workflow WF on W.wfnameRef = WF.wfname";
-
- q = addWhereClauseToQuery(q, constraints, true);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
- ProvenanceProcessor proc = new ProvenanceProcessor();
-
- proc.setPname(rs.getString("pname"));
- proc.setType(rs.getString("type"));
- proc.setWfInstanceRef(rs.getString("wfInstanceRef"));
- proc.setWorkflowExternalName(rs.getString("externalName"));
-
- result.add(proc);
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return result;
- }
-
-
- public String getProcessorForWorkflow(String workflowID) {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT * from Processor WHERE wfInstanceRef = ?");
- ps.setString(1, workflowID);
-
- boolean success = ps.execute();
- if (success) {
- ResultSet rs = ps.getResultSet();
- if (rs.next()) { return rs.getString("pname"); }
- }
- } catch (SQLException e) {
- logger.error("Problem getting processor for workflow: " + workflowID+ " : " + e);
- } catch (InstantiationException e) {
- logger.error("Problem getting processor for workflow: " + workflowID+ " : " + e);
- } catch (IllegalAccessException e) {
- logger.error("Problem getting processor for workflow: " + workflowID+ " : " + e);
- } catch (ClassNotFoundException e) {
- logger.error("Problem getting processor for workflow: " + workflowID+ " : " + e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- logger.error("Problem getting processor for workflow: " + workflowID+ " : " + e);
- }
- }
- }
- return null;
- }
-
- /**
- * simplest possible pinpoint query. Uses iteration info straight away. Assumes result is in VarBinding not in Collection
- *
- * @param wfInstance
- * @param pname
- * @param vname
- * @param iteration
- * @return
- */
- public LineageSQLQuery simpleLineageQuery(String wfInstance, String wfNameRef, String pname,
- String vname, String iteration) {
- LineageSQLQuery lq = new LineageSQLQuery();
-
- String q1 = "SELECT * FROM VarBinding VB join Var V " +
- "on (VB.varNameRef = V.varName and VB.PNameRef = V.PNameRef and VB.wfNameRef=V.wfInstanceRef) " +
- "JOIN WfInstance W ON VB.wfInstanceRef = W.instanceID and VB.wfNameRef = W.wfnameRef ";
-// + "LEFT OUTER JOIN Data D ON D.wfInstanceID = VB.wfInstanceRef and D.dataReference = VB.value";
-
- // constraints:
- Map<String, String> lineageQueryConstraints = new HashMap<String, String>();
-
- lineageQueryConstraints.put("W.instanceID", wfInstance);
- lineageQueryConstraints.put("VB.PNameRef", pname);
- lineageQueryConstraints.put("VB.wfNameRef", wfNameRef);
-
- if (vname != null) {
- lineageQueryConstraints.put("VB.varNameRef", vname);
- }
- if (iteration != null) {
- lineageQueryConstraints.put("VB.iteration", iteration);
- }
-
- q1 = addWhereClauseToQuery(q1, lineageQueryConstraints, false); // false:
- // do
- // not
- // terminate
- // query
-
- // add order by clause
- List<String> orderAttr = new ArrayList<String>();
- orderAttr.add("varNameRef");
- orderAttr.add("iteration");
-
- q1 = addOrderByToQuery(q1, orderAttr, true);
-
- logger.debug("Query is: " + q1);
- lq.setVbQuery(q1);
-
- return lq;
- }
-
- /**
- * if var2Path is null this generates a trivial query for the current output
- * var and current path
- *
- * @param wfInstanceID
- * @param proc
- * @param var2Path
- * @param outputVar
- * @param path
- * @param returnOutputs
- * returns inputs *and* outputs if set to true
- * @return
- */
- public List<LineageSQLQuery> lineageQueryGen(String wfInstanceID, String proc,
- Map<Var, String> var2Path, Var outputVar, String path,
- boolean returnOutputs) {
- // setup
- StringBuffer effectivePath = new StringBuffer();
-
- List<LineageSQLQuery> newQueries = new ArrayList<LineageSQLQuery>();
-
- // use the calculated path for each input var
- boolean isInput = true;
- for (Var v : var2Path.keySet()) {
- LineageSQLQuery q = generateSQL2(wfInstanceID, proc, v.getVName(), var2Path.get(v), isInput);
- if (q != null) {
- newQueries.add(q);
- }
- }
-
- // is returnOutputs is true, then use proc, path for the output var as well
- if (returnOutputs) {
-
- isInput = false;
-
- LineageSQLQuery q = generateSQL2(wfInstanceID, proc, outputVar.getVName(), path, isInput); // && !var2Path.isEmpty());
- if (q != null) {
- newQueries.add(q);
- }
- }
- return newQueries;
-
-
- }
-
- protected LineageSQLQuery generateSQL2(String wfInstance, String proc,
- String var, String path, boolean returnInput) {
-
- LineageSQLQuery lq = new LineageSQLQuery();
-
- // constraints:
- Map<String, String> collQueryConstraints = new HashMap<String, String>();
-
- // base Collection query
- String collQuery = "SELECT * FROM Collection C JOIN WfInstance W ON " + "C.wfInstanceRef = W.instanceID " + "JOIN Var V on " + "V.wfInstanceRef = W.wfnameRef and C.PNameRef = V.pnameRef and C.varNameRef = V.varName ";
-
- collQueryConstraints.put("W.instanceID", wfInstance);
- collQueryConstraints.put("C.PNameRef", proc);
-
- if (path != null && path.length() > 0) {
- collQueryConstraints.put("C.iteration", "[" + path + "]"); // PM 1/09 -- path
- }
-
- // inputs or outputs?
- if (returnInput) {
- collQueryConstraints.put("V.inputOrOutput", "1");
- } else {
- collQueryConstraints.put("V.inputOrOutput", "0");
- }
-
- collQuery = addWhereClauseToQuery(collQuery, collQueryConstraints, false);
-
- lq.setCollQuery(collQuery);
-
- // vb query
-
- Map<String, String> vbQueryConstraints = new HashMap<String, String>();
-
- // base VarBinding query
- String vbQuery = "SELECT * FROM VarBinding VB JOIN WfInstance W ON " +
- "VB.wfInstanceRef = W.instanceID " +
- "JOIN Var V on " +
- "V.wfInstanceRef = W.wfnameRef and VB.PNameRef = V.pnameRef and VB.varNameRef = V.varName ";
-// "LEFT OUTER JOIN Data D ON D.wfInstanceID = VB.wfInstanceRef and D.dataReference = VB.value";
-
- vbQueryConstraints.put("W.instanceID", wfInstance);
- vbQueryConstraints.put("VB.PNameRef", proc);
- vbQueryConstraints.put("VB.varNameRef", var);
-
- if (path != null && path.length() > 0) {
- vbQueryConstraints.put("VB.iteration", "[" + path + "]"); // PM 1/09 -- path
- }
-
- // limit to inputs?
- if (returnInput) {
- vbQueryConstraints.put("V.inputOrOutput", "1");
- } else {
- vbQueryConstraints.put("V.inputOrOutput", "0");
- }
-
- vbQuery = addWhereClauseToQuery(vbQuery, vbQueryConstraints, false);
-
- List<String> orderAttr = new ArrayList<String>();
- orderAttr.add("varNameRef");
- orderAttr.add("iteration");
-
- vbQuery = addOrderByToQuery(vbQuery, orderAttr, true);
-
- lq.setVbQuery(vbQuery);
-
- return lq;
- }
-
- /**
- * if effectivePath is not null: query varBinding using: wfInstanceRef =
- * wfInstance, iteration = effectivePath, PNameRef = proc if input vars is
- * null, then use the output var this returns the bindings for the set of
- * input vars at the correct iteration if effectivePath is null: fetch
- * VarBindings for all input vars, without constraint on the iteration<br/>
- * added outer join with Data<br/>
- * additionally, try querying the collection table first -- if the query succeeds, it means
- * the path is pointing to an internal node in the collection, and we just got the right node.
- * Otherwise, query VarBinding for the leaves
- *
- * @param wfInstance
- * @param proc
- * @param effectivePath
- * @param returnOutputs
- * returns both inputs and outputs if set to true
- * @return
- */
- public LineageSQLQuery generateSQL(String wfInstance, String proc,
- String effectivePath, boolean returnOutputs) {
-
- LineageSQLQuery lq = new LineageSQLQuery();
-
- // constraints:
- Map<String, String> collQueryConstraints = new HashMap<String, String>();
-
- // base Collection query
- String collQuery = "SELECT * FROM Collection C JOIN WfInstance W ON " + "C.wfInstanceRef = W.instanceID " + "JOIN Var V on " + "V.wfInstanceRef = W.wfnameRef and C.PNameRef = V.pnameRef and C.varNameRef = V.varName ";
-
- collQueryConstraints.put("W.instanceID", wfInstance);
- collQueryConstraints.put("C.PNameRef", proc);
-
- if (effectivePath != null && effectivePath.length() > 0) {
- collQueryConstraints.put("C.iteration", "[" + effectivePath.toString() + "]"); // PM 1/09 -- path
- }
-
- // limit to inputs?
- if (returnOutputs) {
- collQueryConstraints.put("V.inputOrOutput", "1");
- }
-
- collQuery = addWhereClauseToQuery(collQuery, collQueryConstraints, false);
-
- lq.setCollQuery(collQuery);
-
- // vb query
-
- Map<String, String> vbQueryConstraints = new HashMap<String, String>();
-
- // base VarBinding query
-// String vbQuery = "SELECT * FROM VarBinding VB JOIN wfInstance W ON " + "VB.wfInstanceRef = W.instanceID " + "JOIN Var V on " + "V.wfInstanceRef = W.wfnameRef and VB.PNameRef = V.pnameRef and VB.varNameRef = V.varName " + "LEFT OUTER JOIN Data D ON D.wfInstanceID = VB.wfInstanceRef and D.dataReference = VB.value";
-
- String vbQuery = "SELECT * FROM VarBinding VB JOIN WfInstance W ON " +
- "VB.wfInstanceRef = W.instanceID " +
- "JOIN Var V on " +
- "V.wfInstanceRef = W.wfnameRef and VB.PNameRef = V.pnameRef and VB.varNameRef = V.varName ";
-
- vbQueryConstraints.put("W.instanceID", wfInstance);
- vbQueryConstraints.put("VB.PNameRef", proc);
-
- if (effectivePath != null && effectivePath.length() > 0) {
- vbQueryConstraints.put("VB.iteration", "[" + effectivePath.toString() + "]"); // PM 1/09 -- path
- }
-
- // limit to inputs?
- if (!returnOutputs) {
- vbQueryConstraints.put("V.inputOrOutput", "1");
- }
-
- vbQuery = addWhereClauseToQuery(vbQuery, vbQueryConstraints, false);
-
- List<String> orderAttr = new ArrayList<String>();
- orderAttr.add("varNameRef");
- orderAttr.add("iteration");
-
- vbQuery = addOrderByToQuery(vbQuery, orderAttr, true);
-
-
- lq.setVbQuery(vbQuery);
-
- return lq;
- }
-
- public Dependencies runCollectionQuery(LineageSQLQuery lq) throws SQLException {
-
- String q = lq.getCollQuery();
-
- Dependencies lqr = new Dependencies();
-
- if (q == null) {
- return lqr;
- }
-
- logger.debug("running collection query: " + q);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
-
- while (rs.next()) {
-
- String type = lqr.ATOM_TYPE; // temp -- FIXME
-
- String wfNameRef = rs.getString("wfNameRef");
- String wfInstance = rs.getString("wfInstanceRef");
- String proc = rs.getString("PNameRef");
- String var = rs.getString("varNameRef");
- String it = rs.getString("iteration");
- String coll = rs.getString("collID");
- String parentColl = rs.getString("parentCollIDRef");
-
- lqr.addLineageQueryResultRecord(wfNameRef, proc, var, wfInstance,
- it, coll, parentColl, null, null, type, false, true); // true -> is a collection
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return lqr;
- }
-
-
- /**
- *
- * @param lq
- * @param includeDataValue IGNORED. always false
- * @return
- * @throws SQLException
- */
- public Dependencies runVBQuery(LineageSQLQuery lq, boolean includeDataValue) throws SQLException {
-
- String q = lq.getVbQuery();
-
- logger.debug("running VB query: " + q);
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- Dependencies lqr = new Dependencies();
-
- while (rs.next()) {
-
- String type = lqr.ATOM_TYPE; // temp -- FIXME
-
- String wfNameRef = rs.getString("wfNameRef");
- String wfInstance = rs.getString("wfInstanceRef");
- String proc = rs.getString("PNameRef");
- String var = rs.getString("varNameRef");
- String it = rs.getString("iteration");
- String coll = rs.getString("collIDRef");
- String value = rs.getString("value");
- boolean isInput = (rs.getInt("inputOrOutput") == 1) ? true
- : false;
-
-
- // FIXME there is no D and no VB - this is in generateSQL,
- // not simpleLineageQuery
- // commented out as D table no longer available. Need to replace this with deref from DataManager
-// if (includeDataValue) {
-// String resolvedValue = rs.getString("D.data");
-
- // System.out.println("resolved value: "+resolvedValue);
-// lqr.addLineageQueryResultRecord(wfNameRef, proc, var, wfInstance,
-// it, coll, null, value, resolvedValue, type, isInput, false); // false -> not a collection
-// } else {
-
- // FIXME if the data is required then the query needs
- // fixing
- lqr.addLineageQueryResultRecord(wfNameRef, proc, var, wfInstance,
- it, coll, null, value, null, type, isInput, false);
-// }
- }
- return lqr;
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return null;
- }
-
- /**
- * executes one of the lineage queries produced by the graph visit algorithm. This first executes the collection query, and then
- * if no result is returned, the varBinding query
- *
- * @param lq
- * a lineage query computed during the graph traversal
- * @param includeDataValue
- * if true, then the referenced value is included in the result.
- * This may only be necessary for testing: the data reference in
- * field value (which is a misleading field name, and actually
- * refers to the data reference) should be sufficient
- * @return
- * @throws SQLException
- */
- public Dependencies runLineageQuery(LineageSQLQuery lq,
- boolean includeDataValue) throws SQLException {
-
- Dependencies result = runCollectionQuery(lq);
-
- if (result.getRecords().size() == 0) // query was really VB
- {
- return runVBQuery(lq, includeDataValue);
- }
-
- return result;
- }
-
- public List<Dependencies> runLineageQueries(
- List<LineageSQLQuery> lqList, boolean includeDataValue)
- throws SQLException {
-
- List<Dependencies> allResults = new ArrayList<Dependencies>();
-
- if (lqList == null) {
- logger.warn("lineage queries list is NULL, nothing to evaluate");
- return allResults;
- }
-
- for (LineageSQLQuery lq : lqList) {
- if (lq == null) {
- continue;
- }
- allResults.add(runLineageQuery(lq, includeDataValue));
- }
-
- return allResults;
- }
-
- /**
- * takes an ordered set of records for the same variable with iteration
- * indexes and builds a collection out of it
- *
- * @param lqr
- * @return a jdom Document with the collection
- */
- public Document recordsToCollection(Dependencies lqr) {
- // process each var name in turn
- // lqr ordered by var name and by iteration number
- Document d = new Document(new Element("list"));
-
- String currentVar = null;
- for (ListIterator<LineageQueryResultRecord> it = lqr.iterator(); it.hasNext();) {
-
- LineageQueryResultRecord record = it.next();
-
- if (currentVar != null && record.getVname().equals(currentVar)) { // multiple
- // occurrences
- addToCollection(record, d); // adds record to d in the correct
- // position given by the iteration
- // vector
- }
- if (currentVar == null) {
- currentVar = record.getVname();
- }
- }
- return d;
- }
-
- private void addToCollection(LineageQueryResultRecord record, Document d) {
-
- Element root = d.getRootElement();
-
- String[] itVector = record.getIteration().split(",");
-
- Element currentEl = root;
- // each element gives us a corresponding child in the tree
- for (int i = 0; i < itVector.length; i++) {
-
- int index = Integer.parseInt(itVector[i]);
-
- List<Element> children = currentEl.getChildren();
- if (index < children.size()) { // we already have the child, just
- // descend
- currentEl = children.get(index);
- } else { // create child
- if (i == itVector.length - 1) { // this is a leaf --> atomic
- // element
- currentEl.addContent(new Element(record.getValue()));
- } else { // create internal element
- currentEl.addContent(new Element("list"));
- }
- }
- }
-
- }
-
- /**
- * returns the set of all processors that are structurally contained within
- * the wf corresponding to the input dataflow name
- * @param dataflowName the name of a processor of type DataFlowActivity
- * @return
- */
- public List<String> getContainedProcessors(String dataflowName) {
-
- List<String> result = new ArrayList<String>();
-
- // dataflow name -> wfRef
- String containerDataflow = getWfNameForDataflow(dataflowName);
-
- // get all processors within containerDataflow
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
-// "SELECT pname FROM Processor P join wfInstance I on P.wfInstanceRef = I.wfnameRef " +
-// "where wfInstanceRef = ? and I.instanceID = ?");
- "SELECT pname FROM Processor P " +
- "where wfInstanceRef = ?");
- ps.setString(1, containerDataflow);
-// ps.setString(2, instanceID);
-
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
- result.add(rs.getString("pname"));
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- }
- return result;
- }
-
- public String getTopLevelDataflowName(String wfInstanceID) {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT pname FROM Processor P join WfInstance I on P.wfInstanceRef = I.wfnameRef " +
- "where I.instanceID =? and isTopLevel = 1");
-
-
- ps.setString(1, wfInstanceID);
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- if (rs.next()) {
- return rs.getString("pname");
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- }
- return null;
- }
-
-
- /**
- * returns the internal ID of a dataflow given its external name
- * @param dataflowName
- * @param instanceID
- * @return
- */
- public String getWfNameForDataflow(String dataflowName) {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
-
- ps = connection.prepareStatement(
-// "SELECT wfname FROM Workflow W join WfInstance I on W.wfname = I.wfNameRef WHERE W.externalName = ? and I.instanceID = ?");
- "SELECT wfname FROM Workflow W WHERE W.externalName = ?");
- ps.setString(1, dataflowName);
-// ps.setString(2, instanceID);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- if (rs.next()) {
- return rs.getString("wfname");
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.error("Could not execute query: " + e);
- } finally {
- try {
- if (connection != null) {
- connection.close();
- }
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- }
- return null;
- }
-
- public List<String> getChildrenOfWorkflow(String parentWFName)
- throws SQLException {
-
- List<String> result = new ArrayList<String>();
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT wfname FROM Workflow WHERE parentWFname = ? ");
- ps.setString(1, parentWFName);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
- result.add(rs.getString("wfname"));
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return result;
- }
-
- /**
- * fetch children of parentWFName from the Workflow table
- *
- * @return
- * @param childWFName
- * @throws SQLException
- */
- public String getParentOfWorkflow(String childWFName) throws SQLException {
-
- PreparedStatement ps = null;
- String result = null;
- Connection connection = null;
-
- String q = "SELECT parentWFname FROM Workflow WHERE wfname = ?";
- // Statement stmt;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(q);
- ps.setString(1, childWFName);
-
- logger.debug("getParentOfWorkflow - query: " + q + " with wfname = " + childWFName);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
-
- result = rs.getString("parentWFname");
-
- logger.debug("result: " + result);
- break;
-
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- public List<String> getAllWFnames() throws SQLException {
- List<String> result = new ArrayList<String>();
-
- String q = "SELECT wfname FROM Workflow";
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
- while (rs.next()) {
- result.add(rs.getString("wfname"));
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return result;
- }
-
- /**
- *
- * @param procName
- * @return true if procName is the external name of a dataflow, false
- * otherwise
- * @throws SQLException
- */
- public boolean isDataflow(String procName) throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT type FROM Processor WHERE pname = ?");
- ps.setString(1, procName);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- if (rs.next() && rs.getString("type") != null && rs.getString("type").equals(DATAFLOW_TYPE)) {
- return true;
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return false;
- }
-
- public String getTopDataflow(String wfInstanceID) {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT * FROM T2Provenance.Processor P join WfInstance I on P.wfInstanceRef = I.wfNameRef " +
- " where I.instanceID = ? " +
- " and isTopLevel = 1 ");
- ps.setString(1, wfInstanceID);
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- if (rs.next()) {
- return rs.getString("PName");
- }
- }
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- try {
- if (connection != null) {
- connection.close();
- }
- } catch (SQLException ex) {
- logger.error("An error occurred closing the database connection", ex);
- }
- }
- return null;
- }
-
- /**
- *
- * @param p
- * pTo processor
- * @param var
- * vTo
- * @param value
- * valTo
- * @return a set of DDRecord
- * @throws SQLException
- */
- public List<DDRecord> queryDD(String p, String var, String value,
- String iteration, String wfInstance) throws SQLException {
-
- List<DDRecord> result = new ArrayList<DDRecord>();
-
- Map<String, String> queryConstraints = new HashMap<String, String>();
-
- queryConstraints.put("pTo", p);
- queryConstraints.put("vTo", var);
- if (value != null) {
- queryConstraints.put("valTo", value);
- }
- if (iteration != null) {
- queryConstraints.put("iteration", iteration);
- }
- if (wfInstance != null) {
- queryConstraints.put("wfInstance", wfInstance);
- }
-
- String q = "SELECT * FROM DD ";
-
- q = addWhereClauseToQuery(q, queryConstraints, true); // true: terminate
- // SQL statement
-
- Statement stmt;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- boolean success = stmt.execute(q);
-
- if (success) {
- ResultSet rs = stmt.getResultSet();
-
- while (rs.next()) {
-
- DDRecord aDDrecord = new DDRecord();
- aDDrecord.setPFrom(rs.getString("pFrom"));
- aDDrecord.setVFrom(rs.getString("vFrom"));
- aDDrecord.setValFrom(rs.getString("valFrom"));
- aDDrecord.setPTo(rs.getString("pTo"));
- aDDrecord.setVTo(rs.getString("vTo"));
- aDDrecord.setValTo(rs.getString("valTo"));
-
- result.add(aDDrecord);
- }
- return result;
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return null;
- }
-
- public Set<DDRecord> queryArcsForDD(String p, String v, String val,
- String wfInstance) throws SQLException {
-
- Set<DDRecord> result = new HashSet<DDRecord>();
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- String q = "SELECT DISTINCT A.sourcePNameRef AS p, A.sourceVarNameRef AS var, VB.value AS val " + "FROM Arc A JOIN VarBinding VB ON VB.varNameRef = A.sinkVarNameRef AND VB.PNameRef = A.sinkPNameRef " + "JOIN WfInstance WF ON WF.wfnameRef = A.wfInstanceRef AND WF.instanceID = VB.wfInstanceRef " + "WHERE WF.instanceID = '" + wfInstance + "' AND A.sinkPNameRef = '" + p + "' AND A.sinkVarNameRef = '" + v + "' AND VB.value = '" + val + "' ";
-
- // Statement stmt;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT DISTINCT A.sourcePNameRef AS p, A.sourceVarNameRef AS var, VB.value AS val " + "FROM Arc A JOIN VarBinding VB ON VB.varNameRef = A.sinkVarNameRef AND VB.PNameRef = A.sinkPNameRef " + "JOIN WfInstance WF ON WF.wfnameRef = A.wfInstanceRef AND WF.instanceID = VB.wfInstanceRef " + "WHERE WF.instanceID = ? AND A.sinkPNameRef = ? AND A.sinkVarNameRef = ? AND VB.value = ?");
-
- ps.setString(1, wfInstance);
- ps.setString(2, p);
- ps.setString(3, v);
- ps.setString(4, val);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
-
- DDRecord aDDrecord = new DDRecord();
- aDDrecord.setPTo(rs.getString("p"));
- aDDrecord.setVTo(rs.getString("var"));
- aDDrecord.setValTo(rs.getString("val"));
-
- result.add(aDDrecord);
- }
- return result;
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return null;
- }
-
- public Set<DDRecord> queryAllFromValues(String wfInstance)
- throws SQLException {
-
- Set<DDRecord> result = new HashSet<DDRecord>();
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT DISTINCT PFrom, vFrom, valFrom FROM DD where wfInstance = ?");
- ps.setString(1, wfInstance);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
-
- DDRecord aDDrecord = new DDRecord();
- aDDrecord.setPFrom(rs.getString("PFrom"));
- aDDrecord.setVFrom(rs.getString("vFrom"));
- aDDrecord.setValFrom(rs.getString("valFrom"));
-
- result.add(aDDrecord);
- }
- return result;
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- return null;
-
- }
-
-
- public boolean isRootProcessorOfWorkflow(String procName, String wfName,
- String wfInstanceId) {
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT * FROM Arc A join WfInstance I on A.wfInstanceRef = I.wfnameRef " +
- "join Processor P on P.pname = A.sourcePnameRef where sourcePnameRef = ? " +
- "and P.wfInstanceRef <> A.wfInstanceRef " +
- "and I.instanceID = ? " +
- "and sinkPNameRef = ? ");
-
- ps.setString(1, wfName);
- ps.setString(2, wfInstanceId);
- ps.setString(3, procName);
-
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- if (rs.next()) {
- return true;
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- return false;
- }
-
-
- public List<Workflow> getContainingWorkflowsForProcessor(
- String pname) {
-
- List<Workflow> wfList = new ArrayList<Workflow>();
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT * FROM T2Provenance.Processor P "+
- "join Workflow W on P.wfInstanceRef = W.wfName "+
- "where pname = ? ");
-
- ps.setString(1, pname);
-
- boolean success = ps.execute();
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- while (rs.next()) {
- Workflow wf = new Workflow();
- wf.setWfName(rs.getString("wfInstanceRef"));
- wf.setParentWFname(rs.getString("parentWFName"));
-
- wfList.add(wf);
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- return wfList;
- }
-
-
-
-/**
- * returns a Workflow record from the DB given the workflow internal ID
- * @param dataflowID
- * @return
- */
- public Workflow getWorkflow(String dataflowID) {
-
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "SELECT * FROM T2Provenance.Workflow W "+
- "where wfname = ? ");
-
- ps.setString(1, dataflowID);
-
- boolean success = ps.execute();
- if (success) {
- ResultSet rs = ps.getResultSet();
-
- if (rs.next()) {
- Workflow wf = new Workflow();
- wf.setWfName(rs.getString("wfname"));
- wf.setParentWFname(rs.getString("parentWFName"));
- wf.setExternalName(rs.getString("externalName"));
-
- return wf;
- }
- }
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } catch (SQLException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- return null;
-
- }
-
-}
-
-
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java
deleted file mode 100644
index c61f7f0..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/ProvenanceWriter.java
+++ /dev/null
@@ -1,914 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.sql.Blob;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.provenance.connector.JDBCConnector;
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.provenance.lineageservice.utils.NestedListNode;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProcBinding;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-
-/**
- * Handles all the writing out of provenance items to the database layer. Uses
- * standard SQL so all specific instances of this class can extend this writer
- * to handle all of the db writes
- *
- * @author Paolo Missier
- * @author Ian Dunlop
- * @author Stuart Owen
- *
- */
-public abstract class ProvenanceWriter {
-
- protected static Logger logger = Logger.getLogger(ProvenanceWriter.class);
- protected int cnt; // counts number of calls to VarBinding
-
- public Connection getConnection() throws InstantiationException,
- IllegalAccessException, ClassNotFoundException, SQLException {
- return JDBCConnector.getConnection();
- }
-
- /**
- * add each Var as a row into the VAR DB table<br/>
- * <strong>note: no static var type available as part of the
- * dataflow...</strong>
- *
- * @param vars
- * @param wfId
- * @throws SQLException
- */
- public void addVariables(List<Var> vars, String wfId) throws SQLException {
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Var (varname, pNameRef, inputOrOutput, nestingLevel, wfInstanceRef) VALUES(?,?,?,?,?)");
- String q;
- for (Var v : vars) {
-
- int isInput = v.isInput() ? 1 : 0;
-
- int i = v.getTypeNestingLevel() >= 0 ? v.getTypeNestingLevel() : 0;
- ps.setString(1, v.getVName());
- ps.setString(2, v.getPName());
- ps.setInt(3, isInput);
- ps.setInt(4, i);
- ps.setString(5, wfId);
-
- try {
- ps.executeUpdate();
-
- } catch (Exception e) {
- continue;
- }
-
- }
-
- } catch (InstantiationException e1) {
- logger.warn("Could not execute insert to add variables", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute insert to add variables", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute insert to add variables", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- }
-
- /**
- * inserts one row into the ARC DB table -- OBSOLETE, see instead
- *
- * @param sourceVar
- * @param sinkVar
- * @param wfId
- */
- public void addArc(Var sourceVar, Var sinkVar, String wfId)
- throws SQLException {
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Arc (wfInstanceRef, sourcePNameRef, SourceVarNameRef, sinkPNameRef,sinkVarNameRef) VALUES(?,?,?,?,?)");
- ps.setString(1, wfId);
- ps.setString(2, sourceVar.getPName());
- ps.setString(3, sourceVar.getVName());
- ps.setString(4, sinkVar.getPName());
- ps.setString(5, sinkVar.getVName());
-
- int result = ps.executeUpdate();
-
- } catch (InstantiationException e1) {
- logger.warn("Could not execute insert for Arc", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute insert for Arc", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute insert for Arc", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- }
-
- public void addArc(String sourceVarName, String sourceProcName,
- String sinkVarName, String sinkProcName, String wfId) {
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Arc (wfInstanceRef, sourcePNameRef, sourceVarNameRef, sinkPNameRef, sinkVarNameRef) VALUES(?,?,?,?,?)");
-
-
- ps.setString(1, wfId);
- ps.setString(2, sourceProcName);
- ps.setString(3, sourceVarName);
- ps.setString(4, sinkProcName);
- ps.setString(5, sinkVarName);
-
- int result = ps.executeUpdate();
-
-
- } catch (InstantiationException e1) {
- logger.warn("Could not execute insert to add Arc", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Could not execute insert to add Arc", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Could not execute insert to add Arc", e1);
- } catch (SQLException e) {
- logger.warn("Could not execute insert to add Arc", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
-
- }
-
- public void addWFId(String wfId) throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Workflow (wfName) VALUES (?)");
- ps.setString(1, wfId);
- ps.executeUpdate();
-
- } catch (InstantiationException e1) {
- logger.warn(e1);
- } catch (IllegalAccessException e1) {
- logger.warn(e1);
- } catch (ClassNotFoundException e1) {
- logger.warn(e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- public void addWFId(String wfId, String parentWFname, String externalName, Blob dataflow) throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Workflow (wfname, parentWFname, externalName, dataflow) VALUES (?,?,?, ?)");
- ps.setString(1, wfId);
- ps.setString(2, parentWFname);
- ps.setString(3, externalName);
- ps.setBlob(4, dataflow);
-
- ps.executeUpdate();
-
- } catch (InstantiationException e1) {
- logger.warn(e1);
- } catch (IllegalAccessException e1) {
- logger.warn(e1);
- } catch (ClassNotFoundException e1) {
- logger.warn(e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- public void addWFInstanceId(String wfId, String wfInstanceId)
- throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO WfInstance (instanceID, wfnameRef) VALUES (?,?)");
-
- ps.setString(1, wfInstanceId);
- ps.setString(2, wfId);
-
- ps.executeUpdate();
- } catch (InstantiationException e1) {
- logger.warn(e1);
- } catch (IllegalAccessException e1) {
- logger.warn(e1);
- } catch (ClassNotFoundException e1) {
- logger.warn(e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- /**
- * insert new processor into the provenance DB
- *
- * @param name
- * @throws SQLException
- */
- public void addProcessor(String name, String wfID, boolean isTopLevel) throws SQLException {
- addProcessor(name, null, wfID, isTopLevel);
- }
-
- /**
- * add a processor to the static portion of the DB with given name, type and
- * wfnameRef scope
- *
- * @param name
- * @param type
- * @param wfNameRef
- * @throws SQLException
- */
- public void addProcessor(String name, String type, String wfNameRef, boolean isTopLevel)
- throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Processor (pname, type, wfInstanceRef, isTopLevel) VALUES (?,?,?,?)");
-
- ps.setString(1, name);
- ps.setString(2, type);
- ps.setString(3, wfNameRef);
- ps.setBoolean(4, isTopLevel);
-
- ps.executeUpdate();
- } catch (InstantiationException e1) {
- logger.warn("Error inserting record for Processor", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error inserting record for Processor", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error inserting record for Processor", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
-
- }
-
- public void addProcessorBinding(ProcBinding pb) throws SQLException {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO ProcBinding (wfNameRef, pnameRef, execIDRef, iteration, actName) VALUES(?,?,?,?,?)");
- ps.setString(1, pb.getWfNameRef());
- ps.setString(2, pb.getPNameRef());
- ps.setString(3, pb.getExecIDRef());
- ps.setString(4, pb.getIterationVector());
- ps.setString(5, pb.getActName());
-
- ps.executeUpdate();
- logger.debug("adding proc binding:\n "+ps.toString());
-
- } catch (InstantiationException e1) {
- logger.warn("Error inserting record for Processor binding", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error inserting record for Processor binding", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error inserting record for Processor binding", e1);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException e) {
- logger.warn("Can't close connection", e);
- }
- }
- }
-
-
-
-
-
- }
-
- public String addCollection(String processorId, String collId,
- String parentCollectionId, String iteration, String portName,
- String dataflowId) throws SQLException {
- String newParentCollectionId = null;
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO Collection (PNameRef, wfInstanceRef, varNameRef, iteration, parentCollIdRef, collId) VALUES(?,?,?,?,?,?)");
-
- if (parentCollectionId == null) {
- // this is a top-level list
- parentCollectionId = "TOP";
- }
-
- newParentCollectionId = collId;
-
- ps.setString(1, processorId);
- ps.setString(2, dataflowId);
- ps.setString(3, portName);
- ps.setString(4, iteration);
- ps.setString(5, parentCollectionId);
- ps.setString(6, collId);
-
- ps.executeUpdate();
-
- } catch (InstantiationException e1) {
- logger.warn("Error inserting record for a collection", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error inserting record for a collection", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error inserting record for a collection", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
-
- return newParentCollectionId;
- }
-
- /**
- * OBSOLETE<p/>
- * adds (dataRef, data) pairs to the Data table (only for string data)
- */
- public void addData(String dataRef, String wfInstanceId, byte[] data)
- throws SQLException {
-
- Connection connection = null;
-
- try {
- connection = getConnection();
- PreparedStatement ps = null;
- ps = connection.prepareStatement(
- "INSERT INTO Data (dataReference,wfInstanceID,data) VALUES (?,?,?)");
- ps.setString(1, dataRef);
- ps.setString(2, wfInstanceId);
- ps.setBytes(3, data);
-
- ps.executeUpdate();
-
- cnt++;
-
- } catch (SQLException e) {
- // the same ID will come in several times -- duplications are
- // expected, don't panic
- } catch (InstantiationException e) {
- logger.warn("Error inserting record for a data", e);
- } catch (IllegalAccessException e) {
- logger.warn("Error inserting record for a data", e);
- } catch (ClassNotFoundException e) {
- logger.warn("Error inserting record for a data", e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- /**
- *
- * @param dataRef
- * @param wfInstanceId
- * @param data the data in bytearray form, untyped
- * @param dve an instance of a DataExtractor. This maps the data bytearray to a string according to the
- * semantics of the data prior to inserting the data into the DB. It's a bit of a hack used in this impl. to extract significant parts of an XMLEncoded bean
- * that can be then used in other contexts (mainly, in OPM graphs, where a raw byte array would not be interpreted).
- * @throws SQLException
- */
- public void addVarBinding(VarBinding vb) throws SQLException {
- PreparedStatement ps = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "INSERT INTO VarBinding (wfNameRef, pnameRef, wfInstanceRef, varNameRef, valueType, value, ref, collIdRef, iteration,positionInColl) VALUES(?,?,?,?,?,?,?,?,?,?)");
-
- ps.setString(1, vb.getWfNameRef());
- ps.setString(2, vb.getPNameRef());
- ps.setString(3, vb.getWfInstanceRef());
- ps.setString(4, vb.getVarNameRef());
- ps.setString(5, vb.getValueType());
- ps.setString(6, vb.getValue());
- ps.setString(7, vb.getRef());
- ps.setString(8, vb.getCollIDRef());
- ps.setString(9, vb.getIteration());
- ps.setInt(10, vb.getPositionInColl());
-
- logger.debug("addVarBinding query: \n"+ps.toString());
- ps.executeUpdate();
- logger.debug("insert done");
-
- cnt++; // who uses this?
-
- } catch (InstantiationException e1) {
- logger.warn("Error inserting record for a varBinding", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error inserting record for a varBinding", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error inserting record for a varBinding", e1);
-// } catch (SQLException e) {
-// logger.warn("Var binding insert failed", e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- }
-
- /**
- * persists var v back to DB
- *
- * @param v
- * @throws SQLException
- */
- public void updateVar(Var v) throws SQLException {
- // Statement stmt;
- PreparedStatement ps = null;
-
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "UPDATE Var SET type = ?, inputOrOutput=?, nestingLevel = ?," + "actualNestingLevel = ?, anlSet = ? , Var.order = ? WHERE varName = ? AND pnameRef = ? AND wfInstanceRef = ?");
- ps.setString(1, v.getType());
- int i = v.isInput() ? 1 : 0;
- ps.setInt(2, i);
- ps.setInt(3, v.getTypeNestingLevel());
- ps.setInt(4, v.getActualNestingLevel());
- int j = v.isANLset() ? 1 : 0;
- ps.setInt(5, j);
- ps.setInt(6, v.getPortNameOrder());
- ps.setString(7, v.getVName());
- ps.setString(8, v.getPName());
- ps.setString(9, v.getWfInstanceRef());
-
-
- ps.execute();
- } catch (InstantiationException e) {
- logger.warn("Could not execute query: " + e);
- } catch (IllegalAccessException e) {
- logger.warn("Could not execute query: " + e);
- } catch (ClassNotFoundException e) {
- logger.warn("Could not execute query: " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- }
-
- public void updateVarBinding(VarBinding vb) {
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "UPDATE VarBinding SET valueType = ?, value = ?, ref = ?, collIdRef = ?, positionInColl = ? "+
- "WHERE varNameRef = ? AND wfInstanceRef = ? AND pnameRef = ? AND iteration = ?");
-
- ps.setString(1, vb.getValueType());
- ps.setString(2, vb.getValue());
- ps.setString(3, vb.getRef());
- ps.setString(4, vb.getCollIDRef());
- ps.setInt(5, vb.getPositionInColl());
- ps.setString(6, vb.getVarNameRef());
- ps.setString(7, vb.getWfInstanceRef());
- ps.setString(8, vb.getPNameRef());
- ps.setString(9, vb.getIteration());
-
- ps.executeUpdate();
-
- cnt++;
-
- } catch (SQLException e) {
- logger.warn("**** insert failed for query ", e);
- } catch (InstantiationException e) {
- logger.warn("**** insert failed ", e);
- } catch (IllegalAccessException e) {
- logger.warn("**** insert failed ", e);
- } catch (ClassNotFoundException e) {
- logger.warn("**** insert failed ", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
- }
-
- public void replaceCollectionRecord(NestedListNode nln, String prevPName,
- String prevVarName) {
-
- // Statement stmt;
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "DELETE FROM Collection WHERE collId = ? and wfInstanceRef = ?" + " and varNameRef = ? and pnameRef = ? and iteration = ?");
- ps.setString(1, nln.getCollId());
- ps.setString(2, nln.getWfInstanceRef());
- ps.setString(3, prevVarName);
- ps.setString(4, prevPName);
- ps.setString(5, nln.getIteration());
-
- int result = ps.executeUpdate();
-
- } catch (SQLException e) {
- logger.warn("Error replacing collection record", e);
- } catch (InstantiationException e) {
- logger.warn("Error replacing collection record", e);
- } catch (IllegalAccessException e) {
- logger.warn("Error replacing collection record", e);
- } catch (ClassNotFoundException e) {
- logger.warn("Error replacing collection record", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection", ex);
- }
- }
- }
-
- try {
- addCollection(prevPName, nln.getCollId(), nln.getParentCollIdRef(),
- nln.getIteration(), prevVarName, nln.getWfInstanceRef());
- } catch (SQLException e) {
- logger.warn("insert failed due to [" + e.getMessage() + "]");
- }
- }
-
- /**
- * deletes DB contents for the static structures -- called prior to each run
- *
- * @throws SQLException
- */
- public void clearDBStatic() throws SQLException {
- String q = null;
-
- Statement stmt = null;
- Connection connection = null;
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- } catch (InstantiationException e1) {
- logger.error("Problem clearing static DB: " + e1);
- } catch (IllegalAccessException e1) {
- logger.error("Problem clearing static DB: " + e1);
- } catch (ClassNotFoundException e1) {
- logger.error("Problem clearing static DB: " + e1);
- }
- try {
- q = "DELETE FROM Workflow";
-
- stmt.executeUpdate(q);
-
- q = "DELETE FROM Processor";
- stmt.executeUpdate(q);
-
- q = "DELETE FROM Arc";
- stmt.executeUpdate(q);
-
- q = "DELETE FROM Var";
-
- stmt.executeUpdate(q);
- } catch (SQLException e) {
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- logger.info("DB cleared STATIC");
- }
-
- /**
- * deletes DB contents for the static structures -- called prior to each run
- *
- * @throws SQLException
- */
- public void clearDBStatic(String wfID) throws SQLException {
- String q = null;
-
-
- PreparedStatement ps = null;
- Connection connection = null;
- try {
- connection = getConnection();
- ps = connection.prepareStatement(
- "DELETE FROM Workflow WHERE wfname = ?");
- ps.setString(1, wfID);
- ps.executeUpdate();
- ps = connection.prepareStatement(
- "DELETE FROM Processor WHERE wfInstanceRef = ?");
- ps.setString(1, wfID);
- ps.executeUpdate();
- ps = connection.prepareStatement(
- "DELETE FROM Arc WHERE wfInstanceRef = ?");
- ps.setString(1, wfID);
- ps.executeUpdate();
- ps = connection.prepareStatement(
- "DELETE FROM Var WHERE wfInstanceRef = ?");
- ps.setString(1, wfID);
- ps.executeUpdate();
-
- } catch (InstantiationException e1) {
- logger.warn("Error deleting provenance records", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error deleting provenance records", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error deleting provenance records", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
-
- logger.info("DB cleared STATICfor wfID " + wfID);
- }
-
-
- public Set<String> clearDBDynamic() throws SQLException {
- return clearDBDynamic(null);
- }
-
- /**
- * deletes DB contents for all runs -- for testing purposes
- *
- * @throws SQLException
- */
- public Set<String> clearDBDynamic(String runID) throws SQLException {
- String q = null;
-
- Set<String> refsToRemove = collectValueReferences(runID); // collect all relevant refs from VarBinding and Collection
-
- Connection connection = null;
- PreparedStatement ps = null;
- try {
- connection = getConnection();
-
- if (runID != null) {
- ps = connection.prepareStatement("DELETE FROM WfInstance WHERE instanceID = ?");
- ps.setString(1, runID);
- } else
- ps = connection.prepareStatement("DELETE FROM WfInstance");
- ps.executeUpdate();
-
- if (runID != null) {
- ps = connection.prepareStatement("DELETE FROM ProcBinding WHERE execIDRef = ?");
- ps.setString(1, runID);
- } else
- ps = connection.prepareStatement("DELETE FROM ProcBinding");
- ps.executeUpdate();
-
- if (runID != null) {
- ps = connection.prepareStatement("DELETE FROM Data WHERE wfInstanceID = ?");
- ps.setString(1, runID);
- } else
- ps = connection.prepareStatement("DELETE FROM Data");
- ps.executeUpdate();
-
- if (runID != null) {
- ps = connection.prepareStatement("DELETE FROM VarBinding WHERE wfInstanceRef = ?");
- ps.setString(1, runID);
- } else
- ps = connection.prepareStatement("DELETE FROM VarBinding");
- ps.executeUpdate();
-
- if (runID != null) {
- ps = connection.prepareStatement("DELETE FROM Collection WHERE wfInstanceRef = ?");
- ps.setString(1, runID);
- } else
- ps = connection.prepareStatement("DELETE FROM Collection");
- ps.executeUpdate();
-
-
- } catch (InstantiationException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- logger.info("DB cleared DYNAMIC");
- return refsToRemove;
- }
-
-
-
- private Set<String> collectValueReferences(String runID) throws SQLException {
-
- Set<String> refs = new HashSet<String>();
-
- Connection connection = null;
- PreparedStatement ps = null;
-
- try {
- connection = getConnection();
-
- if (runID != null) {
- ps = connection.prepareStatement("SELECT value FROM VarBinding WHERE wfInstanceRef = ?");
- ps.setString(1, runID);
- } else {
- ps = connection.prepareStatement("SELECT value FROM VarBinding");
- }
- boolean success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
- refs.add(rs.getString("value"));
- }
- }
-
- if (runID != null) {
- ps = connection.prepareStatement("SELECT collId FROM Collection WHERE wfInstanceRef = ?");
- ps.setString(1, runID);
- } else {
- ps = connection.prepareStatement("SELECT collId FROM Collection");
- }
- success = ps.execute();
-
- if (success) {
- ResultSet rs = ps.getResultSet();
- while (rs.next()) {
- refs.add(rs.getString("collId"));
- }
- }
-
- } catch (InstantiationException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (SQLException e) {
- logger.error("Problem collecting value references for: " + runID + " : " + e);
- } finally {
- if (connection != null) {
- connection.close();
- }
- }
- return refs;
- }
-
-
-
- public void clearDD() {
-
- Statement stmt = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- String q = "DELETE FROM DD";
- stmt.executeUpdate(q);
- } catch (InstantiationException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error execting delete query for provenance records", e1);
- } catch (SQLException e) {
- logger.warn("Error execting delete query for provenance records", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection.", ex);
- }
- }
- }
- }
-
- /**
- * used to support the implementation of
- *
- * @param pname
- * @param vFrom
- * @param valFrom
- * @param vTo
- * @param valTo
- * @param iteration
- * @param wfInstanceID
- */
- // FIXME needs the db statement corrected
- public void writeDDRecord(String pFrom, String vFrom, String valFrom,
- String pTo, String vTo, String valTo, String iteration,
- String wfInstanceID) {
-
- Statement stmt = null;
- Connection connection = null;
-
- try {
- connection = getConnection();
- stmt = connection.createStatement();
- String q = "INSERT INTO DD (PFrom,VFrom,valFrom,PTo,VTo,valTo,iteration,wfInstance) VALUES (" + "\'" + pFrom + "\'," + "\'" + vFrom + "\", " + "valFrom = \"" + valFrom + "\", " + "PTo = \"" + pTo + "\", " + "VTo = \"" + vTo + "\", " + "valTo = \"" + valTo + "\", " + "iteration = \"" + iteration + "\", " + "wfInstance = \"" + wfInstanceID + "\"; ";
-
- stmt.executeUpdate(q);
- } catch (InstantiationException e1) {
- logger.warn("Error inserting record into DD", e1);
- } catch (IllegalAccessException e1) {
- logger.warn("Error inserting record into DD", e1);
- } catch (ClassNotFoundException e1) {
- logger.warn("Error inserting record into DD", e1);
- } catch (SQLException e) {
- logger.warn("Error inserting record into DD", e);
- } finally {
- if (connection != null) {
- try {
- connection.close();
- } catch (SQLException ex) {
- logger.error("There was an error closing the database connection.", ex);
- }
- }
- }
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java
deleted file mode 100644
index 72913fa..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/WorkflowDataProcessor.java
+++ /dev/null
@@ -1,338 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.lineageservice;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowDataProvenanceItem;
-import net.sf.taverna.t2.provenance.lineageservice.utils.ProvenanceUtils;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-
-/**
- * @author paolo
- * this class manages the outputs from a workflow, as they come along through WorkflowData events
- */
-public class WorkflowDataProcessor {
-
- private static Logger logger = Logger.getLogger(WorkflowDataProcessor.class);
-
- // set of trees (impl as lists), one for each varname
- // PM varname not enough must use the WFID as context as well, because the same output varname
- // may occur in multiple nested workflows
- Map<String, List<WorkflowDataNode>> workflowDataTrees = new HashMap<String, List<WorkflowDataNode>>();
-
- ProvenanceQuery pq=null;
- ProvenanceWriter pw = null;
-
- /**
- * adds the input ProvenanceItem event to the tree structure corresponding to the varname found in the item.
- * Repeated invocations of this method incrementally reconstruct the tree structure for each of the workflow outputs
- * @param root
- */
- public void addWorkflowDataItem(ProvenanceItem provenanceItem) {
-
- WorkflowDataNode wdn = new WorkflowDataNode();
- wdn.setVarName(((WorkflowDataProvenanceItem)provenanceItem).getPortName());
- wdn.setValue(((WorkflowDataProvenanceItem)provenanceItem).getData().toString());
- int[] index = ((WorkflowDataProvenanceItem)provenanceItem).getIndex();
- String iterationToString = ProvenanceUtils.iterationToString(index);
- wdn.setIndex(iterationToString);
- wdn.setWorkflowID(((WorkflowDataProvenanceItem)provenanceItem).getWorkflowId());
-
- if (wdn.getValue().contains("list")) wdn.setList(true); // HACK
- else wdn.setList(false);
-
- // position this wdn into the tree associated to its varname
- List<WorkflowDataNode> aTree = workflowDataTrees.get(wdn.getVarName());
-
- if (aTree == null) { // first item in the tree
- aTree = new ArrayList<WorkflowDataNode>();
- workflowDataTrees.put(wdn.getVarName(), aTree);
- } else {
- // update parent pointers
- for (WorkflowDataNode aNode: aTree) {
- if (isParent(wdn.getIndex(), aNode.getIndex())) {
- aNode.setParent(wdn);
-
- // set position in collection as the last index in the vector
- aNode.setRelativePosition(getPosition(aNode));
- }
- }
- }
- aTree.add(wdn);
- }
-
-
-
-
- /**
- * writes records to VarBinding or Collection by traversing the trees<br/>
- * expect this to be invoked after workflow completion
- * @param wfInstanceRef the runID
- * @param dataflowID the external name of the dataflow (not the UUID)
- */
- public void processTrees(String dataflowID, String wfInstanceRef) {
-
- logger.debug("processing output trees");
-
- for (Map.Entry<String, List<WorkflowDataNode>> entry:workflowDataTrees.entrySet()) {
-
- String varName = entry.getKey();
- List<WorkflowDataNode> tree = entry.getValue();
-
- VarBinding vb = null;
-
- try {
- logger.debug("storing tree for var "+varName+" in workflow with ID "+dataflowID+" and instance "+wfInstanceRef);
- for (WorkflowDataNode node:tree) {
-
- if (!node.getWorkflowID().equals(dataflowID)) continue;
-
- if (node.isList) {
-
- logger.debug("creating collection entry for "+
- node.value+" with index "+
- node.index);
-
- if (node.getParent()!=null) {
- logger.debug(" and parent "+node.parent.index);
- // write a collection record to DB
- getPw().addCollection(dataflowID,
- node.getValue(),
- node.getParent().getValue(),
- node.getIndex(),
- varName,
- wfInstanceRef);
- } else {
- getPw().addCollection(dataflowID,
- node.getValue(),
- null,
- node.getIndex(),
- varName,
- wfInstanceRef);
- }
-
- } else {
- logger.debug("creating VarBinding for "+node.value+" with index "+node.index);
-
- vb = new VarBinding();
-
- vb.setWfNameRef(dataflowID);
- vb.setWfInstanceRef(wfInstanceRef);
-
- vb.setPNameRef(pq.getWorkflow(dataflowID).getExternalName());
-
- // vb.setValueType(); // TODO not sure what to set this to
- vb.setVarNameRef(varName);
- vb.setIterationVector(node.getIndex());
- vb.setValue(node.getValue());
-
- if (node.getParent()!=null) {
- logger.debug(" in collection "+node.getParent().value+
- " with index "+node.getParent().getIndex());
-
- vb.setCollIDRef(node.getParent().getValue());
- vb.setPositionInColl(node.getRelativePosition());
-
- } else {
- vb.setPositionInColl(1); // default
- }
- getPw().addVarBinding(vb);
- }
- }
- } catch (SQLException e) {
- logger.debug("Problem processing trees for workflow: " +dataflowID + " instance: " + wfInstanceRef + " : "+
- " updating instead of inserting");
- getPw().updateVarBinding(vb);
- }
-
- }
-
- }
-
-
-
- /**
- * @param node
- * @return the last digit in the index
- */
- private int getPosition(WorkflowDataNode node) {
-
- String[] vector = node.getIndex().substring(1, node.getIndex().length()-1).split(",");
- //TODO need some logic here to avoid trying to parse "" as integer, this is my try
-
- //logger.debug("Vector length is " + vector.length);
- //logger.debug("get position is " + vector[vector.length-1]);
- if ((vector[vector.length-1]).equals("")) {
- return 1;
- }
- return Integer.parseInt(vector[vector.length-1]) +1;
- }
-
-
-
- private boolean isParent(String index1, String index2) {
-
- // strip first and last '[' ']'
- String index11 = index1.substring(1, index1.length()-1);
- String index22 = index2.substring(1, index2.length()-1);
-
- String[] tokens1 = index11.split(",");
- String[] tokens2 = index22.split(",");
-
- // [] cannot be parent of [x1,x2,...] with >= 2 elements
- if (index11.equals("") && tokens2.length>1) return false;
-
- // [] is parent of any [x]
- if (index11.equals("") && tokens2.length==1) return true;
-
- // [x1,x2, ...,xk] cannot be parent of [x1,x2,...xh] when k < h-1
- // because [x1,x2,...xh] is more than one level deeper than [x1,x2, ...,xk]
- if (tokens1.length != tokens2.length -1) return false;
-
- return (index22.startsWith(index11));
- }
-
-
- class WorkflowDataNode {
-
- String varName;
- String value;
- String index;
- String workflowID;
- int relativePosition;
- boolean isList;
- WorkflowDataNode parent;
-
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
- /**
- * @return the index
- */
- public String getIndex() {
- return index;
- }
- /**
- * @param index the index to set
- */
- public void setIndex(String index) {
- this.index = index;
- }
-
- /**
- * @return the varName
- */
- public String getVarName() {
- return varName;
- }
- /**
- * @param varName the varName to set
- */
- public void setVarName(String varName) {
- this.varName = varName;
- }
- /**
- * @return the isList
- */
- public boolean isList() {
- return isList;
- }
- /**
- * @param isList the isList to set
- */
- public void setList(boolean isList) {
- this.isList = isList;
- }
- /**
- * @return the parent
- */
- public WorkflowDataNode getParent() {
- return parent;
- }
- /**
- * @param parent the parent to set
- */
- public void setParent(WorkflowDataNode parent) {
- this.parent = parent;
- }
- /**
- * @return the relativePosition
- */
- public int getRelativePosition() {
- return relativePosition;
- }
- /**
- * @param relativePosition the relativePosition to set
- */
- public void setRelativePosition(int relativePosition) {
- this.relativePosition = relativePosition;
- }
- /**
- * @return the workflowID
- */
- public String getWorkflowID() {
- return workflowID;
- }
- /**
- * @param workflowID the workflowID to set
- */
- public void setWorkflowID(String workflowID) {
- this.workflowID = workflowID;
- }
-
- }
-
-
-
- /**
- * @return the pq
- */
- public ProvenanceQuery getPq() {
- return pq;
- }
-
-
-
- /**
- * @param pq the pq to set
- */
- public void setPq(ProvenanceQuery pq) {
- this.pq = pq;
- }
-
-
-
- /**
- * @return the pw
- */
- public ProvenanceWriter getPw() {
- return pw;
- }
-
-
-
- /**
- * @param pw the pw to set
- */
- public void setPw(ProvenanceWriter pw) {
- this.pw = pw;
- }
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ActivityType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ActivityType.java
deleted file mode 100644
index b466291..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ActivityType.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-import net.sf.taverna.t2.provenance.lineageservice.types.ProvenanceEventType;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class ActivityType implements ProvenanceEventType {
- private IterationType[] iteration;
-
- private java.lang.String id; // attribute
-
- public ActivityType() {
- }
-
- public ActivityType(
- IterationType[] iteration,
- java.lang.String id) {
- this.iteration = iteration;
- this.id = id;
- }
-
-
- /**
- * Gets the iteration value for this ActivityType.
- *
- * @return iteration
- */
- public IterationType[] getIteration() {
- return iteration;
- }
-
-
- /**
- * Sets the iteration value for this ActivityType.
- *
- * @param iteration
- */
- public void setIteration(IterationType[] iteration) {
- this.iteration = iteration;
- }
-
- public IterationType getIteration(int i) {
- return this.iteration[i];
- }
-
- public void setIteration(int i, IterationType _value) {
- this.iteration[i] = _value;
- }
-
-
- /**
- * Gets the id value for this ActivityType.
- *
- * @return id
- */
- public java.lang.String getId() {
- return id;
- }
-
-
- /**
- * Sets the id value for this ActivityType.
- *
- * @param id
- */
- public void setId(java.lang.String id) {
- this.id = id;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/DataDocumentType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/DataDocumentType.java
deleted file mode 100644
index fcbfa58..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/DataDocumentType.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class DataDocumentType implements ProvenanceEventType {
- private java.lang.String reference;
-
- private java.lang.String id; // attribute
-
- public DataDocumentType() {
- }
-
- public DataDocumentType(
- java.lang.String reference,
- java.lang.String id) {
- this.reference = reference;
- this.id = id;
- }
-
-
- /**
- * Gets the reference value for this DataDocumentType.
- *
- * @return reference
- */
- public java.lang.String getReference() {
- return reference;
- }
-
-
- /**
- * Sets the reference value for this DataDocumentType.
- *
- * @param reference
- */
- public void setReference(java.lang.String reference) {
- this.reference = reference;
- }
-
-
- /**
- * Gets the id value for this DataDocumentType.
- *
- * @return id
- */
- public java.lang.String getId() {
- return id;
- }
-
-
- /**
- * Sets the id value for this DataDocumentType.
- *
- * @param id
- */
- public void setId(java.lang.String id) {
- this.id = id;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/IterationType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/IterationType.java
deleted file mode 100644
index 8074c47..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/IterationType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class IterationType implements ProvenanceEventType {
- private PortsSequenceType inputdata;
-
- private PortsSequenceType outputdata;
-
- private java.lang.String id; // attribute
-
- public IterationType() {
- }
-
- public IterationType(
- PortsSequenceType inputdata,
- PortsSequenceType outputdata,
- java.lang.String id) {
- this.inputdata = inputdata;
- this.outputdata = outputdata;
- this.id = id;
- }
-
-
- /**
- * Gets the inputdata value for this IterationType.
- *
- * @return inputdata
- */
- public PortsSequenceType getInputdata() {
- return inputdata;
- }
-
-
- /**
- * Sets the inputdata value for this IterationType.
- *
- * @param inputdata
- */
- public void setInputdata(PortsSequenceType inputdata) {
- this.inputdata = inputdata;
- }
-
-
- /**
- * Gets the outputdata value for this IterationType.
- *
- * @return outputdata
- */
- public PortsSequenceType getOutputdata() {
- return outputdata;
- }
-
-
- /**
- * Sets the outputdata value for this IterationType.
- *
- * @param outputdata
- */
- public void setOutputdata(PortsSequenceType outputdata) {
- this.outputdata = outputdata;
- }
-
-
- /**
- * Gets the id value for this IterationType.
- *
- * @return id
- */
- public java.lang.String getId() {
- return id;
- }
-
-
- /**
- * Sets the id value for this IterationType.
- *
- * @param id
- */
- public void setId(java.lang.String id) {
- this.id = id;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/LiteralType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/LiteralType.java
deleted file mode 100644
index aad5ea1..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/LiteralType.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class LiteralType implements ProvenanceEventType {
- private java.lang.String id; // attribute
-
- public LiteralType() {
- }
-
- public LiteralType(
- java.lang.String id) {
- this.id = id;
- }
-
-
- /**
- * Gets the id value for this LiteralType.
- *
- * @return id
- */
- public java.lang.String getId() {
- return id;
- }
-
-
- /**
- * Sets the id value for this LiteralType.
- *
- * @param id
- */
- public void setId(java.lang.String id) {
- this.id = id;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortType.java
deleted file mode 100644
index 5e0d1a4..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortType.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class PortType implements ProvenanceEventType {
- private DataDocumentType dataDocument;
-
- private LiteralType literal;
-
- private java.lang.String name; // attribute
-
- public PortType() {
- }
-
- public PortType(
- DataDocumentType dataDocument,
- LiteralType literal,
- java.lang.String name) {
- this.dataDocument = dataDocument;
- this.literal = literal;
- this.name = name;
- }
-
-
- /**
- * Gets the dataDocument value for this PortType.
- *
- * @return dataDocument
- */
- public DataDocumentType getDataDocument() {
- return dataDocument;
- }
-
-
- /**
- * Sets the dataDocument value for this PortType.
- *
- * @param dataDocument
- */
- public void setDataDocument(DataDocumentType dataDocument) {
- this.dataDocument = dataDocument;
- }
-
-
- /**
- * Gets the literal value for this PortType.
- *
- * @return literal
- */
- public LiteralType getLiteral() {
- return literal;
- }
-
-
- /**
- * Sets the literal value for this PortType.
- *
- * @param literal
- */
- public void setLiteral(LiteralType literal) {
- this.literal = literal;
- }
-
-
- /**
- * Gets the name value for this PortType.
- *
- * @return name
- */
- public java.lang.String getName() {
- return name;
- }
-
-
- /**
- * Sets the name value for this PortType.
- *
- * @param name
- */
- public void setName(java.lang.String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortsSequenceType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortsSequenceType.java
deleted file mode 100644
index 54c5844..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/PortsSequenceType.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class PortsSequenceType implements ProvenanceEventType {
- private PortType[] port;
-
- public PortsSequenceType() {
- }
-
- public PortsSequenceType(
- PortType[] port) {
- this.port = port;
- }
-
-
- /**
- * Gets the port value for this PortsSequenceType.
- *
- * @return port
- */
- public PortType[] getPort() {
- return port;
- }
-
-
- /**
- * Sets the port value for this PortsSequenceType.
- *
- * @param port
- */
- public void setPort(PortType[] port) {
- this.port = port;
- }
-
- public PortType getPort(int i) {
- return this.port[i];
- }
-
- public void setPort(int i, PortType _value) {
- this.port[i] = _value;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessType.java
deleted file mode 100644
index c33836a..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessType.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class ProcessType implements ProvenanceEventType {
- private ProcessorType[] processor;
-
- private java.lang.String dataflowID; // attribute
-
- private java.lang.String facadeID; // attribute
-
- public ProcessType() {
- }
-
- public ProcessType(
- ProcessorType[] processor,
- java.lang.String dataflowID,
- java.lang.String facadeID) {
- this.processor = processor;
- this.dataflowID = dataflowID;
- this.facadeID = facadeID;
- }
-
-
- /**
- * Gets the processor value for this ProcessType.
- *
- * @return processor
- */
- public ProcessorType[] getProcessor() {
- return processor;
- }
-
-
- /**
- * Sets the processor value for this ProcessType.
- *
- * @param processor
- */
- public void setProcessor(ProcessorType[] processor) {
- this.processor = processor;
- }
-
- public ProcessorType getProcessor(int i) {
- return this.processor[i];
- }
-
- public void setProcessor(int i, ProcessorType _value) {
- this.processor[i] = _value;
- }
-
-
- /**
- * Gets the dataflowID value for this ProcessType.
- *
- * @return dataflowID
- */
- public java.lang.String getDataflowID() {
- return dataflowID;
- }
-
-
- /**
- * Sets the dataflowID value for this ProcessType.
- *
- * @param dataflowID
- */
- public void setDataflowID(java.lang.String dataflowID) {
- this.dataflowID = dataflowID;
- }
-
-
- /**
- * Gets the facadeID value for this ProcessType.
- *
- * @return facadeID
- */
- public java.lang.String getFacadeID() {
- return facadeID;
- }
-
-
- /**
- * Sets the facadeID value for this ProcessType.
- *
- * @param facadeID
- */
- public void setFacadeID(java.lang.String facadeID) {
- this.facadeID = facadeID;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessorType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessorType.java
deleted file mode 100644
index 7de7a68..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProcessorType.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- *
- * @author Paolo Missier
- *
- */
-public class ProcessorType implements ProvenanceEventType {
- private ActivityType[] activity;
-
- private java.lang.String id; // attribute
-
- public ProcessorType() {
- }
-
- public ProcessorType(
- ActivityType[] activity,
- java.lang.String id) {
- this.activity = activity;
- this.id = id;
- }
-
-
- /**
- * Gets the activity value for this ProcessorType.
- *
- * @return activity
- */
- public ActivityType[] getActivity() {
- return activity;
- }
-
-
- /**
- * Sets the activity value for this ProcessorType.
- *
- * @param activity
- */
- public void setActivity(ActivityType[] activity) {
- this.activity = activity;
- }
-
- public ActivityType getActivity(int i) {
- return this.activity[i];
- }
-
- public void setActivity(int i, ActivityType _value) {
- this.activity[i] = _value;
- }
-
-
- /**
- * Gets the id value for this ProcessorType.
- *
- * @return id
- */
- public java.lang.String getId() {
- return id;
- }
-
-
- /**
- * Sets the id value for this ProcessorType.
- *
- * @param id
- */
- public void setId(java.lang.String id) {
- this.id = id;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProvenanceEventType.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProvenanceEventType.java
deleted file mode 100644
index 3dddb3e..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/types/ProvenanceEventType.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.types;
-
-/**
- * Used by an implementation of Provenance to identify the item type
- *
- * @author Paolo Missier
- *
- */
-public interface ProvenanceEventType {
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Arc.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Arc.java
deleted file mode 100644
index 524c9d8..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Arc.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-
-/**
- * @author paolo
- *
- */
-
-public class Arc {
- private
- String identifier;
-
- String wfInstanceRef;
- String sourcePnameRef;
- String sourceVarNameRef;
- String sinkPnameRef;
- String sinkVarNameRef;
-
- /**
- * @return the wfInstanceRef
- */
- public String getWfInstanceRef() {
- return wfInstanceRef;
- }
-
- /**
- * @param wfInstanceRef
- * the wfInstanceRef to set
- */
- public void setWfInstanceRef(String wfInstanceRef) {
- this.wfInstanceRef = wfInstanceRef;
- }
-
- /**
- * @return the sourcePnameRef
- */
- public String getSourcePnameRef() {
- return sourcePnameRef;
- }
-
- /**
- * @param sourcePnameRef
- * the sourcePnameRef to set
- */
- public void setSourcePnameRef(String sourcePnameRef) {
- this.sourcePnameRef = sourcePnameRef;
- }
-
- /**
- * @return the sourceVarNameRef
- */
- public String getSourceVarNameRef() {
- return sourceVarNameRef;
- }
-
- /**
- * @param sourceVarNameRef
- * the sourceVarNameRef to set
- */
- public void setSourceVarNameRef(String sourceVarNameRef) {
- this.sourceVarNameRef = sourceVarNameRef;
- }
-
- /**
- * @return the sinkPnameRef
- */
- public String getSinkPnameRef() {
- return sinkPnameRef;
- }
-
- /**
- * @param sinkPnameRef
- * the sinkPnameRef to set
- */
- public void setSinkPnameRef(String sinkPnameRef) {
- this.sinkPnameRef = sinkPnameRef;
- }
-
- /**
- * @return the sinkVarNameRef
- */
- public String getSinkVarNameRef() {
- return sinkVarNameRef;
- }
-
- /**
- * @param sinkVarNameRef
- * the sinkVarNameRef to set
- */
- public void setSinkVarNameRef(String sinkVarNameRef) {
- this.sinkVarNameRef = sinkVarNameRef;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Collection.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Collection.java
deleted file mode 100644
index c0d06dd..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Collection.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-
-public class Collection {
- private String identifier;
-
- private String parentIdentifier;
-
- private String workflowIdentifier;
-
- private String processorName;
-
- private String varName;
-
- private String iteration;
-
- private String collId;
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public String getParentIdentifier() {
- return parentIdentifier;
- }
-
- public void setParentIdentifier(String parentIdentifier) {
- this.parentIdentifier = parentIdentifier;
- }
-
- public String getWorkflowIdentifier() {
- return workflowIdentifier;
- }
-
- public void setWorkflowIdentifier(String workflowIdentifier) {
- this.workflowIdentifier = workflowIdentifier;
- }
-
- public String getProcessorName() {
- return processorName;
- }
-
- public void setProcessorName(String processorName) {
- this.processorName = processorName;
- }
-
- public String getVarName() {
- return varName;
- }
-
- public void setVarName(String varName) {
- this.varName = varName;
- }
-
- public String getIteration() {
- return iteration;
- }
-
- public void setIteration(String iteration) {
- this.iteration = iteration;
- }
-
- public void setCollId(String collId) {
- this.collId = collId;
- }
-
- public String getCollId() {
- return collId;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DDRecord.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DDRecord.java
deleted file mode 100644
index c835fd6..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DDRecord.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-/**
- * a simple bean to hold a database record from the DD table
- * @author paolo
- *
- */
-public class DDRecord {
-
- String PFrom;
- String PTo;
- String vTo;
- String valTo;
- String vFrom;
- String valFrom;
- String iteration;
- public boolean isInput;
-
- public String toString() {
- return new String("proc: "+PFrom+" vFrom: "+vFrom+" valFrom: "+valFrom+"PTo: "+PTo+" vTo: "+vTo+" valTo: "+valTo);
- }
-
-
- /**
- * @return the vTo
- */
- public String getVTo() {
- return vTo;
- }
- /**
- * @param to the vTo to set
- */
- public void setVTo(String to) {
- vTo = to;
- }
- /**
- * @return the valTo
- */
- public String getValTo() {
- return valTo;
- }
- /**
- * @param valTo the valTo to set
- */
- public void setValTo(String valTo) {
- this.valTo = valTo;
- }
- /**
- * @return the vFrom
- */
- public String getVFrom() {
- return vFrom;
- }
- /**
- * @param from the vFrom to set
- */
- public void setVFrom(String from) {
- vFrom = from;
- }
- /**
- * @return the valFrom
- */
- public String getValFrom() {
- return valFrom;
- }
- /**
- * @param valFrom the valFrom to set
- */
- public void setValFrom(String valFrom) {
- this.valFrom = valFrom;
- }
-
-
- /**
- * @return the isInput
- */
- public boolean isInput() {
- return isInput;
- }
-
-
- /**
- * @param isInput the isInput to set
- */
- public void setInput(boolean isInput) {
- this.isInput = isInput;
- }
-
-
- /**
- * @return the pFrom
- */
- public String getPFrom() {
- return PFrom;
- }
-
-
- /**
- * @param from the pFrom to set
- */
- public void setPFrom(String from) {
- PFrom = from;
- }
-
-
- /**
- * @return the pTo
- */
- public String getPTo() {
- return PTo;
- }
-
-
- /**
- * @param to the pTo to set
- */
- public void setPTo(String to) {
- PTo = to;
- }
-
-
- /**
- * @return the iteration
- */
- public String getIteration() {
- return iteration;
- }
-
-
- /**
- * @param iteration the iteration to set
- */
- public void setIteration(String iteration) {
- this.iteration = iteration;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DataValueExtractor.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DataValueExtractor.java
deleted file mode 100644
index be4179b..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/DataValueExtractor.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-/**
- * @author paolo
- *
- */
-public interface DataValueExtractor {
-
- /**
- * extracts a printable string from a more complex object. This is not the same as toString() as
- * it is applied to an object, rather than being a method on the object itself
- * @param complexContent should really be a byte array FIXME
- * @return
- */
- public String extractString(Object complexContent);
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/NestedListNode.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/NestedListNode.java
deleted file mode 100644
index 4c73f07..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/NestedListNode.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-/**
- * @author paolo
- *
- */
-public class NestedListNode {
-
- String collId;
- String parentCollIdRef;
- String wfInstanceRef;
- String PNameRef;
- String varNameRef;
- String iteration;
- /**
- * @return the collId
- */
- public String getCollId() {
- return collId;
- }
- /**
- * @param collId the collId to set
- */
- public void setCollId(String collId) {
- this.collId = collId;
- }
- /**
- * @return the parentCollIdRef
- */
- public String getParentCollIdRef() {
- return parentCollIdRef;
- }
- /**
- * @param parentCollIdRef the parentCollIdRef to set
- */
- public void setParentCollIdRef(String parentCollIdRef) {
- this.parentCollIdRef = parentCollIdRef;
- }
- /**
- * @return the wfInstanceRef
- */
- public String getWfInstanceRef() {
- return wfInstanceRef;
- }
- /**
- * @param wfInstanceRef the wfInstanceRef to set
- */
- public void setWfInstanceRef(String wfInstanceRef) {
- this.wfInstanceRef = wfInstanceRef;
- }
- /**
- * @return the pNameRef
- */
- public String getPNameRef() {
- return PNameRef;
- }
- /**
- * @param nameRef the pNameRef to set
- */
- public void setPNameRef(String nameRef) {
- PNameRef = nameRef;
- }
- /**
- * @return the varNameRef
- */
- public String getVarNameRef() {
- return varNameRef;
- }
- /**
- * @param varNameRef the varNameRef to set
- */
- public void setVarNameRef(String varNameRef) {
- this.varNameRef = varNameRef;
- }
- /**
- * @return the iteration
- */
- public String getIteration() {
- return iteration;
- }
- /**
- * @param iteration the iteration to set
- */
- public void setIteration(String iteration) {
- this.iteration = iteration;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProcBinding.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProcBinding.java
deleted file mode 100644
index 2514fbe..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProcBinding.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-
-
-/**
- * @author Paolo Missier
- *
- */
-public class ProcBinding {
- private String identifier;
-
- private String pNameRef;
- private String execIDRef;
- private String wfNameRef;
- private String actName;
- private String iterationVector;
-
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
-
- sb.append("**** ProcBinding: \n").
- append("execIDRef = "+execIDRef+"\n").
- append("wfNameRef = "+wfNameRef+"\n").
- append("PNameRef = "+pNameRef+"\n").
- append("actName = "+actName+"\n").
- append("iteration = "+iterationVector+"\n");
-
- return sb.toString();
- }
-
- /**
- * @return the pNameRef
- */
- public String getPNameRef() {
- return pNameRef;
- }
- /**
- * @param nameRef the pNameRef to set
- */
- public void setPNameRef(String nameRef) {
- pNameRef = nameRef;
- }
- /**
- * @return the execIDRef
- */
- public String getExecIDRef() {
- return execIDRef;
- }
- /**
- * @param execIDRef the execIDRef to set
- */
- public void setExecIDRef(String execIDRef) {
- this.execIDRef = execIDRef;
- }
- /**
- * @return the actName
- */
- public String getActName() {
- return actName;
- }
- /**
- * @param actName the actName to set
- */
- public void setActName(String actName) {
- this.actName = actName;
- }
- /**
- * @return the iteration
- */
- public String getIterationVector() {
- return iterationVector;
- }
- /**
- * @param iterationVector the iteration to set
- */
- public void setIterationVector(String iterationVector) {
- this.iterationVector = iterationVector;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- /**
- * @return the wfNameRef
- */
- public String getWfNameRef() {
- return wfNameRef;
- }
-
- /**
- * @param wfNameRef the wfNameRef to set
- */
- public void setWfNameRef(String wfNameRef) {
- this.wfNameRef = wfNameRef;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceProcessor.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceProcessor.java
deleted file mode 100644
index d8f4bd5..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceProcessor.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-
-/**
- * a Var that has no pName is either a WF input or output, depending on isInput
- * @author Paolo Missier
- */
-public class ProvenanceProcessor {
-
- String identifier;
- String pname;
- String wfInstanceRef;
- String workflowExternalName;
- String type;
-
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
- sb.append("PROCESSOR: ****").
- append("\nworkflow: "+getWfInstanceRef()).
- append("\nworkflow name "+getWorkflowExternalName()).
- append("\nprocessor name: "+getPname()).
- append("\ntype: "+getType());
-
- return sb.toString();
- }
-
-
- /**
- * @return the wfInstanceRef
- */
- public String getWfInstanceRef() {
- return wfInstanceRef;
- }
- /**
- * @param wfInstanceRef the wfInstanceRef to set
- */
- public void setWfInstanceRef(String wfInstanceRef) {
- this.wfInstanceRef = wfInstanceRef;
- }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
- /**
- * @return the pname
- */
- public String getPname() {
- return pname;
- }
- /**
- * @param pname the pname to set
- */
- public void setPname(String pname) {
- this.pname = pname;
- }
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
- public String getIdentifier() {
- return identifier;
- }
-
-
- /**
- * @return the workflowExternalName
- */
- public String getWorkflowExternalName() {
- return workflowExternalName;
- }
-
-
- /**
- * @param workflowExternalName the workflowExternalName to set
- */
- public void setWorkflowExternalName(String workflowExternalName) {
- this.workflowExternalName = workflowExternalName;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceUtils.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceUtils.java
deleted file mode 100644
index 713c670..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/ProvenanceUtils.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.provenance.item.DataProvenanceItem;
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-import org.jdom.Element;
-
-public class ProvenanceUtils {
-
- public static String iterationToString(int[] iteration) {
- String result = "[";
- for (int i = 0; i < iteration.length; i++) {
- result += iteration[i];
- if (i < (iteration.length - 1))
- result += ",";
- }
- result += "]";
- return result;
- }
-
- /**
- * Returns an Element representing the data item, identfied as either input
- * or output. References to data are currently resolved to their actual
- * values
- */
- public static Element getDataItemAsXML(DataProvenanceItem provenanceItem) {
- String name;
- if (provenanceItem.getEventType().equals(SharedVocabulary.INPUTDATA_EVENT_TYPE)) {
- name = "inputdata";
- } else {
- name = "outputdata";
- }
- Element result = new Element(name);
- result.setAttribute("identifier", provenanceItem.getIdentifier());
- result.setAttribute("processID", provenanceItem.getProcessId());
- result.setAttribute("parent", provenanceItem.getParentId());
- for (String port : provenanceItem.getDataMap().keySet()) {
- Element portElement = new Element("port");
- portElement.setAttribute("name", port);
- portElement.setAttribute("depth", Integer.toString(provenanceItem.getDataMap()
- .get(port).getDepth()));
- result.addContent(portElement);
- portElement.addContent(resolveToElement(provenanceItem.getDataMap().get(port), provenanceItem.getReferenceService()));
- Element element = new Element("some_stuff");
- portElement.addContent(element);
- }
- return result;
- }
-
- /**
- * Given a {@link T2Reference} return all the other {@link T2Reference}s
- * which it contains as an XML Element.
- *
- * @param entityIdentifier
- * @return
- * @throws NotFoundException
- * @throws RetrievalException
- */
- private static org.jdom.Element resolveToElement(T2Reference reference, ReferenceService referenceService) {
-
- org.jdom.Element element = new org.jdom.Element("resolvedReference");
- if (reference.getReferenceType().equals(T2ReferenceType.ErrorDocument)) {
- ErrorDocument error = referenceService.getErrorDocumentService()
- .getError(reference);
-
- element.setName("error");
- element.setAttribute("id", reference.toString());
- org.jdom.Element messageElement = new org.jdom.Element("message");
- messageElement.addContent(error.getExceptionMessage());
- element.addContent(messageElement);
- } else if (reference.getReferenceType().equals(
- T2ReferenceType.ReferenceSet)) {
- element.setName("referenceSet");
- element.setAttribute("id", reference.toString());
- ReferenceSet referenceSet = referenceService
- .getReferenceSetService().getReferenceSet(reference);
- Set<ExternalReferenceSPI> externalReferences = referenceSet
- .getExternalReferences();
- for (ExternalReferenceSPI externalReference : externalReferences) {
- // FIXME does this make sense? No!! Should get the actual value
- // not what it is (TEXT etc)
- org.jdom.Element refElement = new org.jdom.Element("reference");
- refElement.addContent(externalReference.getDataNature()
- .toString());
- element.addContent(refElement);
- }
-
- } else if (reference.getReferenceType().equals(
- T2ReferenceType.IdentifiedList)) {
- IdentifiedList<T2Reference> list = referenceService
- .getListService().getList(reference);
-
- element.setName("list");
- element.setAttribute("id", reference.toString());
- for (T2Reference ref : list) {
- element.addContent(resolveToElement(ref, referenceService));
- }
- } else {
- // throw something (maybe a tantrum)
- }
- return element;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/QueryVar.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/QueryVar.java
deleted file mode 100644
index 00f6458..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/QueryVar.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-/**
- * @author Paolo Missier<p/>
- *
- */
-public class QueryVar {
-
- String wfInstanceId;
- String wfName;
- String pname;
- String vname;
- String path;
- String value;
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
- sb.append("PORT: ****").
- append("\nworkflow: "+getWfName()).
- append("\nprocessor: "+getPname()).
- append("\nport: "+getVname()).
- append("\npath to value: "+getPath());
-
- return sb.toString();
- }
-
-
- /**
- * @return the pname
- */
- public String getPname() {
- return pname;
- }
- /**
- * @param pname the pname to set
- */
- public void setPname(String pname) {
- this.pname = pname;
- }
- /**
- * @return the vname
- */
- public String getVname() {
- return vname;
- }
- /**
- * @param vname the vname to set
- */
- public void setVname(String vname) {
- this.vname = vname;
- }
- /**
- * @return the path
- */
- public String getPath() {
- return path;
- }
- /**
- * @param path the path to set
- */
- public void setPath(String path) {
- this.path = path;
- }
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
- /**
- * @return the wfInstanceId
- */
- public String getWfInstanceId() {
- return wfInstanceId;
- }
- /**
- * @param wfInstanceId the wfInstanceId to set
- */
- public void setWfInstanceId(String wfInstanceId) {
- this.wfInstanceId = wfInstanceId;
- }
- /**
- * @return the wfName
- */
- public String getWfName() {
- return wfName;
- }
- /**
- * @param wfName the wfName to set
- */
- public void setWfName(String wfName) {
- this.wfName = wfName;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Var.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Var.java
deleted file mode 100644
index 8900d58..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Var.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-
-/**
- * a Var that has no pName is either a WF input or output, depending on isInput
- * @author Paolo Missier
- */
-public class Var {
-
- private String identifier;
- private String vName, pName;
- private boolean isInput;
- private String wfInstanceRef;
- private String type;
- private int typeNestingLevel = 0;
- private int actualNestingLevel = 0;
- private boolean isANLset = false; // set to true when the ANL has been set
- private int portNameOrder = 0;
-
- /**
- * @return the wfInstanceRef
- */
- public String getWfInstanceRef() {
- return wfInstanceRef;
- }
- /**
- * @param wfInstanceRef the wfInstanceRef to set
- */
- public void setWfInstanceRef(String wfInstanceRef) {
- this.wfInstanceRef = wfInstanceRef;
- }
- /**
- * @return the vName
- */
- public String getVName() {
- return vName;
- }
- /**
- * @param name the vName to set
- */
- public void setVName(String name) {
- vName = name;
- }
- /**
- * @return the pName
- */
- public String getPName() {
- return pName;
- }
- /**
- * @param name the pName to set
- */
- public void setPName(String name) {
- pName = name;
- }
- /**
- * @return the isInput
- */
- public boolean isInput() {
- return isInput;
- }
- /**
- * @param isInput the isInput to set
- */
- public void setInput(boolean isInput) {
- this.isInput = isInput;
- }
- /**
- * @return the type
- */
- public String getType() {
- return type;
- }
- /**
- * @param type the type to set
- */
- public void setType(String type) {
- this.type = type;
- }
- /**
- * @return the typeNestingLevel
- */
- public int getTypeNestingLevel() {
- return typeNestingLevel;
- }
- /**
- * @param typeNestingLevel the typeNestingLevel to set
- */
- public void setTypeNestingLevel(int typeNestingLevel) {
- this.typeNestingLevel = typeNestingLevel;
- }
- /**
- * @return the actualNestingLevel
- */
- public int getActualNestingLevel() {
- return actualNestingLevel;
- }
- /**
- * @param actualNestingLevel the actualNestingLevel to set
- */
- public void setActualNestingLevel(int actualNestingLevel) {
- this.actualNestingLevel = actualNestingLevel;
- }
- /**
- * @return the isANLset
- */
- public boolean isANLset() {
- return isANLset;
- }
- /**
- * @param isANLset the isANLset to set
- */
- public void setANLset(boolean isANLset) {
- this.isANLset = isANLset;
- }
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
- public String getIdentifier() {
- return identifier;
- }
- /**
- * @return the portNameOrder
- */
- public int getPortNameOrder() {
- return portNameOrder;
- }
- /**
- * @param portNameOrder the portNameOrder to set
- */
- public void setPortNameOrder(int portNameOrder) {
- this.portNameOrder = portNameOrder;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/VarBinding.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/VarBinding.java
deleted file mode 100644
index 02d9c63..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/VarBinding.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-/**
- * @author Paolo Missier
- *
- */
-public class VarBinding {
-
- String wfNameRef;
- String varNameRef;
- String wfInstanceRef;
- String value;
- String collIDRef;
- int positionInColl;
- String PNameRef;
- String valueType;
- String ref;
- String iterationVector;
- String resolvedValue;
-
-
- public String toString() {
-
- StringBuffer sb = new StringBuffer();
-
- sb.append("**** VarBinding: \n").
- append("wfInstanceRef = "+wfInstanceRef+"\n").
- append("wfNameRef = "+wfNameRef+"\n").
- append("PNameRef = "+PNameRef+"\n").
- append("varNameRef = "+varNameRef+"\n").
- append("iteration = "+iterationVector+"\n").
- append("collIdef " +collIDRef+"\n").
- append("positionInColl = "+positionInColl+"\n").
- append("value = "+value+"\n").
- append("ref = "+ref+"\n").
- append("resolvedValue = "+resolvedValue+"\n");
-
-
- return sb.toString();
- }
-
-
- /**
- * @return the positionInColl
- */
- public int getPositionInColl() {
- return positionInColl;
- }
- /**
- * @param positionInColl the positionInColl to set
- */
- public void setPositionInColl(int positionInColl) {
- this.positionInColl = positionInColl;
- }
- /**
- * @return the valueType
- */
- public String getValueType() {
- return valueType;
- }
- /**
- * @param valueType the valueType to set
- */
- public void setValueType(String valueType) {
- this.valueType = valueType;
- }
- /**
- * @return the varNameRef
- */
- public String getVarNameRef() {
- return varNameRef;
- }
- /**
- * @param varNameRef the varNameRef to set
- */
- public void setVarNameRef(String varNameRef) {
- this.varNameRef = varNameRef;
- }
- /**
- * @return the wfInstanceRef
- */
- public String getWfInstanceRef() {
- return wfInstanceRef;
- }
- /**
- * @param wfInstanceRef the wfInstanceRef to set
- */
- public void setWfInstanceRef(String wfInstanceRef) {
- this.wfInstanceRef = wfInstanceRef;
- }
- /**
- * @return the pNameRef
- */
- public String getPNameRef() {
- return PNameRef;
- }
- /**
- * @param nameRef the pNameRef to set
- */
- public void setPNameRef(String nameRef) {
- PNameRef = nameRef;
- }
- /**
- * @return the collIDRef
- */
- public String getCollIDRef() {
- return collIDRef;
- }
- /**
- * @param collIDRef the collIDRef to set
- */
- public void setCollIDRef(String collIDRef) {
- this.collIDRef = collIDRef;
- }
- /**
- * @return the iteration
- */
- public String getIteration() {
- return iterationVector;
- }
- /**
- * @param iterationVector the iteration to set
- */
- public void setIterationVector(String iterationVector) {
- this.iterationVector = iterationVector;
- }
- /**
- * @return the value
- */
- public String getValue() {
- return value;
- }
- /**
- * @param value the value to set
- */
- public void setValue(String value) {
- this.value = value;
- }
- /**
- * @return the ref
- */
- public String getRef() {
- return ref;
- }
- /**
- * @param ref the ref to set
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
-
-
- /**
- * @return the resolvedValue
- */
- public String getResolvedValue() {
- return resolvedValue;
- }
-
-
- /**
- * @param resolvedValue the resolvedValue to set
- */
- public void setResolvedValue(String resolvedValue) {
- this.resolvedValue = resolvedValue;
- }
-
-
- /**
- * @return the wfNameRef
- */
- public String getWfNameRef() {
- return wfNameRef;
- }
-
-
- /**
- * @param wfNameRef the wfNameRef to set
- */
- public void setWfNameRef(String wfNameRef) {
- this.wfNameRef = wfNameRef;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Workflow.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Workflow.java
deleted file mode 100644
index 9878a6e..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/Workflow.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-public class Workflow {
-
- private String wfname;
- private String parentWFname;
- private String externalName;
-
- public void setWfName(String identifier) {
- this.wfname = identifier;
- }
-
- public String getWfname() {
- return wfname;
- }
-
- public void setParentWFname(String parentIdentifier) {
- this.parentWFname = parentIdentifier;
- }
-
- public String getParentWFname() {
- return parentWFname;
- }
-
- /**
- * @return the externalName
- */
- public String getExternalName() {
- return externalName;
- }
-
- /**
- * @param externalName the externalName to set
- */
- public void setExternalName(String externalName) {
- this.externalName = externalName;
- }
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/WorkflowInstance.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/WorkflowInstance.java
deleted file mode 100644
index 9a07bd6..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/lineageservice/utils/WorkflowInstance.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package net.sf.taverna.t2.provenance.lineageservice.utils;
-
-import java.sql.Blob;
-
-public class WorkflowInstance {
-
- private String instanceID;
- private String wfnameRef; // this is the wfnameRef for the TOP LEVEL workflow for this run CHECK
- private String timestamp;
- private String workflowExternalName;
- private byte[] dataflowBlob;
-
- public void setWorkflowIdentifier(String workflowIdentifier) {
- this.wfnameRef = workflowIdentifier;
- }
-
- public String getWorkflowIdentifier() {
- return wfnameRef;
- }
-
- public void setTimestamp(String timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getTimestamp() {
- return timestamp;
- }
-
- /**
- * @return the instanceID
- */
- public String getInstanceID() {
- return instanceID;
- }
-
- /**
- * @param instanceID the instanceID to set
- */
- public void setInstanceID(String instanceID) {
- this.instanceID = instanceID;
- }
-
- /**
- * @return the workflowExternalName
- */
- public String getWorkflowExternalName() {
- return workflowExternalName;
- }
-
- /**
- * @param workflowExternalName the workflowExternalName to set
- */
- public void setWorkflowExternalName(String workflowExternalName) {
- this.workflowExternalName = workflowExternalName;
- }
-
- /**
- * A {@link Blob} object representing the dataflow
- * @param bs
- */
- public void setDataflowBlob(byte[] bs) {
- this.dataflowBlob = bs;
- }
-
- public byte[] getDataflowBlob() {
- return dataflowBlob;
- }
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMImporter.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMImporter.java
deleted file mode 100644
index 6f0947b..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMImporter.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.opm;
-
-import java.io.File;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.xml.bind.JAXBException;
-
-import net.sf.taverna.t2.provenance.lineageservice.ProvenanceWriter;
-import net.sf.taverna.t2.provenance.lineageservice.utils.Var;
-import net.sf.taverna.t2.provenance.lineageservice.utils.VarBinding;
-
-import org.apache.log4j.Logger;
-import org.openprovenance.model.Account;
-import org.openprovenance.model.AccountId;
-import org.openprovenance.model.Accounts;
-import org.openprovenance.model.Artifact;
-import org.openprovenance.model.ArtifactId;
-import org.openprovenance.model.Artifacts;
-import org.openprovenance.model.CausalDependencies;
-import org.openprovenance.model.OPMDeserialiser;
-import org.openprovenance.model.OPMGraph;
-import org.openprovenance.model.ProcessId;
-import org.openprovenance.model.Role;
-import org.openprovenance.model.Used;
-import org.openprovenance.model.WasControlledBy;
-import org.openprovenance.model.WasDerivedFrom;
-import org.openprovenance.model.WasGeneratedBy;
-import org.openprovenance.model.WasTriggeredBy;
-
-/**
- * @author paolo
- * imports foreign XML-serialized OPM graphs into the native Taverna provenance DB, so they can be queried using
- *
- * {@link net.sf.taverna.t2.provenance.lineageservice.ProvenanceAnalysis}
- */
-public class OPMImporter {
-
- private static final String PROC_NAME = "P";
- private static final String OPM_DEF_ACCOUNT = "OPMDefaultAccount";
- ProvenanceWriter pw;
- OPMGraph graph;
-
- private static Logger logger = Logger.getLogger(OPMImporter.class);
-
- // Maps Account names to Taverna workflows
- Map<String, String> accountToWorkflow = new HashMap<String, String>();
- Map<String, String> workflowToInstance = new HashMap<String, String>();
-
- // maps wfName --> (wfName --> List(Var))
- private Map<String, Map<String, List<Var>>> usedVarsByAccount = new HashMap<String, Map<String, List<Var>>>();
- private Map<String, Map<String, List<Var>>> wgbVarsByAccount = new HashMap<String, Map<String, List<Var>>>();
-
- // maps accountname --> (artifact -> List(Process))
- private Map<String, Map<String,List<String>>> wgbArtifactsByAccount = new HashMap<String, Map<String,List<String>>>();
-
- // maps accountname --> (artifact -> List(Process))
- private Map<String, Map<String,List<String>>> usedArtifactsByAccount = new HashMap<String, Map<String,List<String>>>();
-
- int procNameCounter;
- private String masterAccount = OPM_DEF_ACCOUNT;
-
- public OPMImporter(ProvenanceWriter pw) {
- this.pw = pw;
- }
-
- /**
- * orphan artifacts are those that are in the graph but are never used neither generated. this
- * indicates some problem with the graph structure. this method is used for diagnostics after import has finished
- * @return
- */
- public List<String> getOrphanArtifacts() {
-
- List<String> allwgb = new ArrayList<String>();
- List<String> allUsed = new ArrayList<String>();
- List<String> orphans = new ArrayList<String>();
-
- if (graph == null) {
- logger.warn("null graph while attempting to count orphan artifacts -- giving up");
- return orphans;
- }
-
- Artifacts allArtifacts = graph.getArtifacts();
-
- for ( Map.Entry<String, Map<String,List<String>>>entry: wgbArtifactsByAccount.entrySet()) {
- allwgb.addAll(entry.getValue().keySet());
- }
-
- for ( Map.Entry<String, Map<String,List<String>>>entry: usedArtifactsByAccount.entrySet()) {
- allUsed.addAll(entry.getValue().keySet());
- }
-
- List<Artifact> artifacts = allArtifacts.getArtifact();
-
- for (Artifact a:artifacts) {
- if (!allwgb.contains(a.getId()) && !allUsed.contains(a.getId())) {
- orphans.add(a.getId());
- }
- }
- return orphans;
- }
-
-
- public void importGraph(String XMLOPMGraphFilename) throws JAXBException, SQLException {
-
- try {
- logger.info("Importing OPM XML from file "+XMLOPMGraphFilename);
-
- // deserialize an XML OPM graph from file
- OPMDeserialiser deser = new OPMDeserialiser();
- graph = deser.deserialiseOPMGraph(new File(XMLOPMGraphFilename));
-
- } catch (Exception e) {
- logger.fatal("exception while deserializing -- unable to continue");
- logger.fatal(e.getMessage());
- return;
- }
-
- logger.debug("XML graph deserialized");
-
- //
- // generates one pair <wfName, wfInstance> for each account in the graph
- //
- List<Account> allAccounts = null;
- try {
- Accounts accounts = graph.getAccounts();
-
- // use this global account alongside any other that may be defined in the graph
- generateWFFromAccount(OPM_DEF_ACCOUNT);
-
- if (accounts == null) {
- logger.warn("this graph contains no accounts -- using only the default");
- } else {
- for (Account acc:accounts.getAccount()) {
- // writes both workflow and instance into the DB, updates accountToWorkflow
- generateWFFromAccount(acc.getId());
- }
- }
- } catch (Exception e) {
- logger.warn("exception while getting accounts for this graph");
- }
-
- //
- // associates processes and ports to workflows and varbindings to corresponding wfInstances
- //
- List<Object> allDeps;
-
- // what have we got?
- // retrieve all OPM relations from the graph
- CausalDependencies cd = graph.getCausalDependencies();
- allDeps = cd.getUsedOrWasGeneratedByOrWasTriggeredBy();
-
- // make sure these are processed in the right order: used, wgby, THEN wdf because this latter is derived from the first 2!
- // so collect them into sets and process them separately
-
- Set<WasGeneratedBy> wgbSet = new HashSet<WasGeneratedBy>();
- Set<Used> usedSet = new HashSet<Used>();
- Set<WasDerivedFrom> wdfSet = new HashSet<WasDerivedFrom>();
- Set<WasControlledBy> wcbSet = new HashSet<WasControlledBy>();
- Set<WasTriggeredBy> wtbSet = new HashSet<WasTriggeredBy>();
-
- for (Object dep:allDeps) {
- logger.info("dependency of type: "+dep.getClass().getName());
-
- if (dep instanceof org.openprovenance.model.WasGeneratedBy) {
- wgbSet.add((WasGeneratedBy) dep);
- } else if (dep instanceof org.openprovenance.model.Used) {
- usedSet.add((Used) dep);
- } else if (dep instanceof org.openprovenance.model.WasDerivedFrom) {
- wdfSet.add((WasDerivedFrom) dep);
- } else if (dep instanceof org.openprovenance.model.WasControlledBy) {
- wcbSet.add((WasControlledBy) dep);
- } else if (dep instanceof org.openprovenance.model.WasTriggeredBy) {
- wtbSet.add((WasTriggeredBy) dep);
- }
- }
-
- // process these in the correct order
- int cnt =0; // used to debug a nasty outofmemory error
- for (WasGeneratedBy dep: wgbSet) {
-// logger.debug(cnt++);
- processWGBy(dep);
- }
-
- for (Used dep:usedSet) processUsed(dep);
-
- for (WasDerivedFrom dep: wdfSet) processWDF(dep);
-
- // we actually ignore the others...
-
- // *********
- // complete the induced graph by building arcs using the Artifact -> [Var] maps
- // *********
-
- List<String> accountNames = new ArrayList<String>();
-
- accountNames.add(OPM_DEF_ACCOUNT);
-
- if (allAccounts != null)
- for (Account acc:allAccounts) { accountNames.add(acc.getId()); }
-
- for (String acc:accountNames) {
-
- String wfName = accountToWorkflow.get(acc);
-
- Map<String, List<Var>> usedVars = usedVarsByAccount.get(wfName);
- Map<String, List<Var>> wgbVars = wgbVarsByAccount.get(wfName);
-
- if (usedVars == null || wgbVars == null) continue;
-
- // install an Arc from each wgb var to each used var when the artifact is the same
- for (Map.Entry<String, List<Var>> entry:wgbVars.entrySet()) {
-
- // all Vars for this artifact get connected to all corresponding Vars in used
- List<Var> sourceVars = entry.getValue();
- List<Var> targetVars = usedVars.get(entry.getKey());
-
- if (sourceVars == null || targetVars == null) continue;
-
- // create an arc from each sourceVar to each targetVar
- // note that we expect a single targetVar, but this is not guaranteed
- for (Var sourceVar:sourceVars) {
- for (Var targetVar:targetVars) {
- pw.addArc(sourceVar.getVName(), sourceVar.getPName(), targetVar.getVName(), targetVar.getPName(), wfName);
- }
- }
- }
- }
- }
-
- private void generateWFFromAccount(String accName) throws SQLException {
-
- String wfName = accName+"-"+UUID.randomUUID().toString();
- String wfInstance = accName+"-"+UUID.randomUUID().toString();
-
- pw.addWFId(wfName);
- pw.addWFInstanceId(wfName, wfInstance);
- accountToWorkflow.put(accName, wfName);
- workflowToInstance.put(wfName, wfInstance);
-
- logger.info("generated wfName "+wfName+" and instance "+wfInstance+" for account "+accName);
- }
-
-
- private Var processProcessArtifactDep(String procName, String value, String varName,
- String wfName, String wfInstance, boolean artifactIsInput) {
-
- // generate Process
- try {
- pw.addProcessor(procName, wfName, false);
- logger.debug("added processor "+procName+" to workflow "+wfName);
- } catch (SQLException e) { // no panic -- just catch duplicates
- logger.warn(e.getMessage());
- }
-
- // generate Var
- Var outputVar = new Var();
-
- outputVar.setPName(procName);
- outputVar.setWfInstanceRef(wfName);
- outputVar.setVName(varName);
- outputVar.setTypeNestingLevel(0);
- outputVar.setInput(artifactIsInput); // wgby is an output var
-
- List<Var> vars = new ArrayList<Var>(); // only one Var in the list
- vars.add(outputVar);
-
- try {
- pw.addVariables(vars, wfName);
- logger.debug("added var "+varName+" to workflow "+wfName);
- } catch (SQLException e) { // no panic -- just catch duplicates
- logger.warn(e.getMessage());
- }
-
- // generate VarBindings (wfInstance, procName, varname, value)
- VarBinding vb = new VarBinding();
-
- vb.setWfInstanceRef(wfInstance);
- vb.setPNameRef(procName);
- vb.setVarNameRef(varName);
- vb.setValue(value);
- vb.setIterationVector("[]");
-
- try {
- pw.addVarBinding(vb);
- logger.debug("added var binding with value "+value+" to workflow instance "+wfInstance);
- } catch (SQLException e) { // no panic -- just catch duplicates
- logger.error("Failed to add var binding: " + e.getMessage());
- }
-
- return outputVar;
- }
-
-
- /**
- * generic processing of a process-artifact dependency
- * @param procID
- * @param artId
- * @param role
- * @param wfName
- * @param wfInstance
- * @param artifactIsInput
- */
- private Var processProcessArtifactDep(ProcessId procID, ArtifactId artId, Role role,
- String wfName, String wfInstance, boolean artifactIsInput) {
-
- String procName = ((org.openprovenance.model.Process) procID.getId()).getId();
- String varName = role.getValue();
- String value = ((Artifact) artId.getId()).getId();
-
- varName = removeBlanks(varName);
-
- return processProcessArtifactDep(procName, value, varName, wfName, wfInstance, artifactIsInput);
- }
-
-
-
- private String removeBlanks(String varName) {
- return varName.replace(" ", "_");
- }
-
-
- /**
- * used(A,R,P,acc): generates a process for P, a Var for (P,R) an <em>input</em> VarBinding for (P,R,A)
- * <br/> this is very similar to {@link #processWGBy(WasGeneratedBy)}
- * @param dep
- */
- private void processUsed(Used dep) {
-
- // Acc determines the scope -- this dep may belong to > 1 account, deal with all of them
- List<AccountId> accountIDs = dep.getAccount();
- ProcessId procID = dep.getEffect();
- ArtifactId artId = dep.getCause();
- Role role = dep.getRole();
-
- List<String> accNames = new ArrayList<String>();
-
- for (AccountId accId:accountIDs) {
- accNames.add(((Account) accId.getId()).getId());
- }
-
- accNames.add(OPM_DEF_ACCOUNT);
-
- for (String accName: accNames) {
- String wfName = accountToWorkflow.get(accName);
- String wfInstance = workflowToInstance.get(wfName);
-
- Var v = processProcessArtifactDep(procID, artId, role, wfName, wfInstance, true); // true -> input var
-
- // save the mapping from artifact to var for this account
- Map<String, List<Var>> usedVars = usedVarsByAccount.get(wfName);
- if (usedVars == null) {
- usedVars = new HashMap<String, List<Var>>();
- usedVarsByAccount.put(wfName, usedVars);
- }
- List<Var> vars = usedVars.get(((Artifact) artId.getId()).getId());
-
- if (vars == null) {
- vars = new ArrayList<Var>();
- usedVars.put(((Artifact) artId.getId()).getId(), vars);
- }
- vars.add(v);
-
- // record the fact that (procID used artId) within this account
- Map<String, List<String>> usedArtifacts = usedArtifactsByAccount.get(accName);
- if (usedArtifacts == null) {
- usedArtifacts = new HashMap<String, List<String>>();
- usedArtifactsByAccount.put(accName, usedArtifacts);
- }
-
- String artifactName = ((Artifact) artId.getId()).getId();
- List<String> processes = usedArtifacts.get(artifactName);
- if (processes == null) {
- processes = new ArrayList<String>();
- usedArtifacts.put(artifactName, processes);
- }
- processes.add(((org.openprovenance.model.Process) procID.getId()).getId());
- }
- }
-
-
-
- /**
- * wgb(A,R,P,Acc): generates a Process for P, a Var for (P,R), an <em>output</em> VarBinding for (P,R,A)
- * This is all relative to the workflow corresponding to account Acc. <br/>
- *
- * @param dep
- * @throws SQLException
- */
- private void processWGBy(WasGeneratedBy dep) {
-
- // Acc determines the scope -- this dep may belong to > 1 account, deal with all of them
- List<AccountId> accountIDs = dep.getAccount();
- ProcessId procID = dep.getCause();
- ArtifactId artId = dep.getEffect();
- Role role = dep.getRole();
-
- List<String> accNames = new ArrayList<String>();
-
- for (AccountId accId:accountIDs) {
- accNames.add(((Account) accId.getId()).getId());
- }
-
- accNames.add(OPM_DEF_ACCOUNT);
-
- for (String accName:accNames) {
-
- String wfName = accountToWorkflow.get(accName);
- String wfInstance = workflowToInstance.get(wfName);
-
- Var v = processProcessArtifactDep(procID, artId, role, wfName, wfInstance, false); // false -> output var
-
- Map<String, List<Var>> wgbVars = wgbVarsByAccount.get(wfName);
- if (wgbVars == null) {
- wgbVars = new HashMap<String, List<Var>>();
- wgbVarsByAccount.put(wfName, wgbVars);
- }
-
- List<Var> vars = wgbVars.get(((Artifact) artId.getId()).getId());
- if (vars == null) {
- vars = new ArrayList<Var>();
- wgbVars.put(((Artifact) artId.getId()).getId(), vars);
- }
- vars.add(v);
-
- // record the fact that (artId wgby procID) within this account
- Map<String, List<String>> wgbArtifacts = wgbArtifactsByAccount.get(accName);
- if (wgbArtifacts == null) {
- wgbArtifacts = new HashMap<String, List<String>>();
- wgbArtifactsByAccount.put(accName, wgbArtifacts);
- }
-
- String artifactName = ((Artifact) artId.getId()).getId();
- List<String> processes = wgbArtifacts.get(artifactName);
- if (processes == null) {
- processes = new ArrayList<String>();
- wgbArtifacts.put(artifactName, processes);
- }
- processes.add(((org.openprovenance.model.Process) procID.getId()).getId());
- }
- }
-
-
- /**
- * this is a dep between two artifacts A1 and A2.
- * In Taverna we need to postulate the existence of a Process to mediate this dependency.
- * <br/> However, we only need to account for this dep if it cannot be inferred from a combination of used and wgby that
- * involve A1 and A2: if there exists P s.t. A1 wgby P and P used A2, then this dep. is redundant in the DB and we can safely ignore it.
- * <br/> note that this analysis is conducted regardless of the accounts in which the wgby and used properties appear, as one account could
- * be used deliberately to
- * This will unclutter the DB.
- * @param dep
- */
- private void processWDF(WasDerivedFrom dep) {
- List<AccountId> accountIDs = dep.getAccount();
- ArtifactId fromArtId = dep.getCause();
- ArtifactId toArtId = dep.getEffect();
-
- List<String> accNames = new ArrayList<String>();
-
- for (AccountId accId:accountIDs) {
- accNames.add(((Account) accId.getId()).getId());
- }
-
- accNames.add(OPM_DEF_ACCOUNT);
-
- for (String accName:accNames) {
-
- int varCounter = 0;
-
- String wfName = accountToWorkflow.get(accName);
- String wfInstance = workflowToInstance.get(wfName);
-
- List<String> generatingProcesses=null, usingProcesses=null;
-
- // look for any triple fromArtId wasGeneratedBy P within this account
- Map<String, List<String>> wgbArtifacts = wgbArtifactsByAccount.get(accName);
-
- if (wgbArtifacts != null) {
- String toArtifactName = ((Artifact) toArtId.getId()).getId();
- generatingProcesses = wgbArtifacts.get(toArtifactName);
- if (generatingProcesses != null) {
- logger.debug("artifact "+toArtifactName+" wgby one or more processes...");
- }
- }
-
- // look for any triple (P used toArtId) within this account
-
- // get map for this account
- Map<String, List<String>> usedArtifacts = usedArtifactsByAccount.get(accName);
-
- if (usedArtifacts != null) {
- String fromArtifactName = ((Artifact) fromArtId.getId()).getId();
- usingProcesses = usedArtifacts.get(fromArtifactName);
- if (usingProcesses != null) {
- logger.debug("artifact "+fromArtifactName+" was used by one or more processes...");
- }
- }
-
- boolean found = false;
- if (generatingProcesses != null && usingProcesses != null) {
- for (String gp:generatingProcesses) {
- if (usingProcesses.contains(gp)) {
- logger.debug("intersection between process sets not empty, this WDF is redundant");
- found = true;
- break;
- }
- }
- }
-
- // only postulate a new process if the native one has not been found
- if (found) return;
-
- String procName = PROC_NAME+"_"+procNameCounter++;
-
- try {
- pw.addProcessor(procName, wfName, false);
- logger.info("created non-native added processor "+procName+" to workflow "+wfName);
- } catch (SQLException e) { // no panic -- just catch duplicates
- logger.warn(e.getMessage());
- }
-
- // create a role for fromArtId from the procName
- String inputVarName = procName+"_"+varCounter++;
- String inputValue = ((Artifact) fromArtId.getId()).getId();
-
- // add to DB
- processProcessArtifactDep(procName, inputValue, inputVarName, wfName, wfInstance, true);
-
- // create a role for toArtId
- String outputVarName = procName+"_"+varCounter++;
- String outputValue = ((Artifact) toArtId.getId()).getId();
-
- // add to DB
- processProcessArtifactDep(procName, outputValue, outputVarName, wfName, wfInstance, false);
- }
- }
-
-
-
- /**
- * there is no counterpart in Taverna provenance for this dependency. This is translated into
- * a control link but this is not part of the provenance model
- * @param dep
- */
- private void processWTBy(WasTriggeredBy dep) {
-
- }
-
-
- /**
- * there is no counterpart in Taverna for this dependency, as it involves agents which we don't support
- * @param dep
- */
- private void processWCBy(WasControlledBy dep) {
- // TODO Auto-generated method stub
- }
-
-
-
-}
diff --git a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMManager.java b/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMManager.java
deleted file mode 100644
index 08477b6..0000000
--- a/trunk/provenanceconnector/src/main/java/net/sf/taverna/t2/provenance/opm/OPMManager.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/**
- *
- */
-package net.sf.taverna.t2.provenance.opm;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.bind.JAXBException;
-
-import net.sf.taverna.t2.provenance.lineageservice.utils.DataValueExtractor;
-
-import org.apache.log4j.Logger;
-import org.openprovenance.model.Artifact;
-import org.openprovenance.model.OPMGraph;
-import org.openprovenance.model.OPMToDot;
-import org.openprovenance.model.Process;
-import org.openprovenance.rdf.OPMRdf2Xml;
-import org.tupeloproject.kernel.Context;
-import org.tupeloproject.kernel.OperatorException;
-import org.tupeloproject.kernel.UnionContext;
-import org.tupeloproject.kernel.impl.MemoryContext;
-import org.tupeloproject.kernel.impl.ResourceContext;
-import org.tupeloproject.provenance.ProvenanceAccount;
-import org.tupeloproject.provenance.ProvenanceArtifact;
-import org.tupeloproject.provenance.ProvenanceGeneratedArc;
-import org.tupeloproject.provenance.ProvenanceProcess;
-import org.tupeloproject.provenance.ProvenanceRole;
-import org.tupeloproject.provenance.ProvenanceUsedArc;
-import org.tupeloproject.provenance.impl.ProvenanceContextFacade;
-import org.tupeloproject.rdf.Literal;
-import org.tupeloproject.rdf.Resource;
-import org.tupeloproject.rdf.Triple;
-import org.tupeloproject.rdf.xml.RdfXmlWriter;
-
-
-/**
- * @author paolo
- *
- */
-public class OPMManager {
-
- private static Logger logger = Logger.getLogger(OPMManager.class);
-
- public static final String OPM_TAVERNA_NAMESPACE = "http://taverna.opm.org/";
- private static final String OPM_RDF_GRAPH_FILE = "src/test/resources/provenance-testing/OPM/OPMGraph.rdf";
- private static final String OPM_DOT_FILE = "src/test/resources/provenance-testing/OPM/OPMGraph.dot";
- private static final String VALUE_PROP = "value";
-
- ProvenanceContextFacade graph = null;
- Context context = null;
-
- ProvenanceAccount currentAccount = null;
- ProvenanceArtifact currentArtifact = null;
- ProvenanceRole currentRole = null;
- ProvenanceProcess currentProcess = null;
-
- private boolean isActive = true;
-
- public OPMManager() {
-
- // init Tupelo RDF provenance graph
- MemoryContext mc = new MemoryContext();
- ResourceContext rc = new ResourceContext("http://example.org/data/","/provenanceExample/");
- context = new UnionContext();
- context.addChild(mc);
- context.addChild(rc);
-
- graph = new ProvenanceContextFacade(mc);
- }
-
-
- /**
- * default implementation of this method returns null -- has no idea how to extract simple values from incoming artifact values
- * @return
- */
- public List<DataValueExtractor> getDataValueExtractor() { return null; }
-
-
- /**
- * create new account to hold the causality graph
- * and give it a Resource name
- * @param accountName
- */
- public void createAccount(String accountName) {
-
- currentAccount = graph.newAccount("OPM-"+
- accountName, Resource.uriRef(OPM_TAVERNA_NAMESPACE+accountName));
- graph.assertAccount(currentAccount);
- }
-
-
- /**
- *
- * @param aName
- * @param aValue actual value can be used optionally as part of a separate triple. Whether this is used or not
- * depends on the settings, see {@link OPMManager.addValueTriple}.
- * This also sets the currentArtifact to the newly created artifact
- */
- public void addArtifact(String aName, String aValue) {
-
- String artID=aName;
- // make sure artifact name is a good URI
- try {
- URI artURI = new URI(aName);
-
- if (artURI.getAuthority() == null) {
- artID = OPM_TAVERNA_NAMESPACE+aName;
- }
- } catch (URISyntaxException e1) {
- artID = OPM_TAVERNA_NAMESPACE+aName;
- }
-
-
- Resource r = Resource.uriRef(artID);
- currentArtifact = graph.newArtifact(artID, r);
- graph.assertArtifact(currentArtifact);
-
- if (false) {
-// following fragment commented out
-// if (aValue != null) {
-// System.out.println("OPMManager::addArtifact: aValue is NOT NULL");
-
- // if we have a valid DataValueExtractor, use it here
- List<DataValueExtractor> dveList;
- String extractedValue = aValue; // default is same value
- if ((dveList = getDataValueExtractor()) != null) {
-
- // try all available extractors... UGLY but data comes with NO TYPE at all!
- for (DataValueExtractor dve: dveList) {
- try {
-
-// System.out.println("OPMManager::addArtifact: trying extractor "+dve.getClass().getName());
- extractedValue = dve.extractString(aValue);
-// System.out.println("OPMManager::addArtifact: - extracted value = "+extractedValue);
- break; // extractor worked
- } catch (Exception e) {
- // no panic, reset value and try another extractor
-// System.out.println("OPMManager::addArtifact: extractor failed");
- extractedValue = aValue;
- }
- }
- }
-
-// System.out.println("OPMManager::addArtifact: using value "+extractedValue);
- try {
- Literal lValue = Resource.literal(extractedValue);
- context.addTriple(r, Resource.uriRef(OPM_TAVERNA_NAMESPACE+VALUE_PROP), lValue);
- } catch (OperatorException e) {
- logger.warn("OPM iteration triple creation exception: "+e.getMessage());
- }
- } else {
-// System.out.println("OPMManager::addArtifact: aValue for ["+aName+"] is NULL");
- }
- }
-
-
- /**
- * no actual value is recorded
- * @param aName
- */
- public void addArtifact(String aName) {
-
- Resource r = Resource.uriRef(aName);
- currentArtifact = graph.newArtifact(aName, r);
- graph.assertArtifact(currentArtifact);
- }
-
-
-
- public void createRole(String aRole) {
-
- Resource r = Resource.uriRef(OPM_TAVERNA_NAMESPACE+aRole);
- currentRole = graph.newRole(aRole, r);
- }
-
-
- public void addProcess(String proc, String iterationVector, String URIfriendlyIterationVector) {
-
- String processID;
-
- // PM added 5/09 -- a process name may already be a URI -- this happens for example when we export back OPM
- // after importing a workflow from our own OPM... in this case, do not pre-pend a new URI scheme
-
- try {
- URI procURI = new URI(proc);
-
- if (procURI.getAuthority() == null) {
- processID = OPM_TAVERNA_NAMESPACE+proc;
- } else {
- processID = proc;
- }
- } catch (URISyntaxException e1) {
- processID = OPM_TAVERNA_NAMESPACE+proc;
- }
- if (URIfriendlyIterationVector.length()>0) {
- processID = processID+"?it="+URIfriendlyIterationVector;
- }
-
- Resource processResource = Resource.uriRef(processID);
- currentProcess = graph.newProcess(processID, processResource);
- graph.assertProcess(currentProcess );
-
- // add a triple to specify the iteration vector for this occurrence of Process, if it is available
- if (URIfriendlyIterationVector.length() > 0) {
-// Resource inputProcessSubject = ((RdfProvenanceProcess) process).getSubject();
- try {
- context.addTriple(processResource, Resource.uriRef(OPM_TAVERNA_NAMESPACE+"iteration"), iterationVector);
- } catch (OperatorException e) {
- logger.warn("OPM iteration triple creation exception: "+e.getMessage());
- }
- }
- }
-
-
- public void assertGeneratedBy(ProvenanceArtifact artifact,
- ProvenanceProcess process,
- ProvenanceRole role,
- ProvenanceAccount account,
- boolean noDuplicates) {
-
- boolean found = false;
- if (noDuplicates && artifact != null) {
- Collection<ProvenanceGeneratedArc> generatedBy = graph.getGeneratedBy(artifact);
-
- for (ProvenanceGeneratedArc arc:generatedBy) {
- ProvenanceProcess pp = arc.getProcess();
- if (pp.getName().equals(process.getName())) { found = true; break; }
- }
- }
-
- if (!noDuplicates || (noDuplicates && !found) && artifact != null)
- graph.assertGeneratedBy(artifact, process, role, account);
- }
-
-
-
- public void assertUsed(ProvenanceArtifact artifact,
- ProvenanceProcess process,
- ProvenanceRole role,
- ProvenanceAccount account,
- boolean noDuplicates) {
-
- boolean found = false;
-
- if (noDuplicates) {
- Collection<ProvenanceUsedArc> used = graph.getUsed(process);
-
- for (ProvenanceUsedArc arc:used) {
- ProvenanceArtifact pa = arc.getArtifact();
- if (pa.getName().equals(artifact.getName())) { found = true; break; }
- }
- }
-
- if (!noDuplicates || (noDuplicates && !found) )
- graph.assertUsed(process, artifact, role, account);
- }
-
-
- public ProvenanceContextFacade getGraph() { return graph; }
-
-
- /**
- * @return the account
- */
- public ProvenanceAccount getAccount() { return currentAccount; }
-
-
- /**
- * @param account the account to set
- */
- public void setAccount(ProvenanceAccount account) { this.currentAccount = account; }
-
- /**
- * @return the currentRole
- */
- public ProvenanceRole getCurrentRole() { return currentRole; }
-
- /**
- * @param currentRole the currentRole to set
- */
- public void setCurrentRole(ProvenanceRole currentRole) { this.currentRole = currentRole; }
-
- /**
- * @return the currentArtifact
- */
- public ProvenanceArtifact getCurrentArtifact() { return currentArtifact; }
-
- /**
- * @param currentArtifact the currentArtifact to set
- */
- public void setCurrentArtifact(ProvenanceArtifact currentArtifact) { this.currentArtifact = currentArtifact; }
-
- /**
- * @return the currentAccount
- */
- public ProvenanceAccount getCurrentAccount() { return currentAccount; }
-
- /**
- * @param currentAccount the currentAccount to set
- */
- public void setCurrentAccount(ProvenanceAccount currentAccount) { this.currentAccount = currentAccount; }
-
- /**
- * @return the currentProcess
- */
- public ProvenanceProcess getCurrentProcess() { return currentProcess; }
-
- /**
- * @param currentProcess the currentProcess to set
- */
- public void setCurrentProcess(ProvenanceProcess currentProcess) { this.currentProcess = currentProcess; }
-
- public String writeGraph() {
-
- // print out OPM graph in RDF/XML form
- try {
- Set<Triple> allTriples = context.getTriples();
-
- RdfXmlWriter writer = new RdfXmlWriter();
- StringWriter sw = new StringWriter();
- writer.write(allTriples, sw);
- return sw.toString();
-
- } catch (OperatorException e) {
- logger.error("Could not write graph: " + e);
- } catch (IOException e) {
- logger.error("Could not write graph: " + e);
- }
- return null;
- }
-
-
-
- /**
- * IN THE RELEASE WE DO NOT SUPPORT XML -- ONE CAN CONVERT THE RDF TO XML OUT-OF-BAND
- * simply invokes the org.openprovenance for converting an RDF OPM graph to an XML OPM graph
- * @return a hard-coded filename for the converted XML OPM graph
- * @throws OperatorException
- * @throws IOException
- * @throws JAXBException
- */
-// public String Rdf2Xml() throws OperatorException, IOException, JAXBException {
-//
-// OPMRdf2Xml converter = new OPMRdf2Xml();
-// converter.convert(OPM_RDF_GRAPH_FILE, OPM_XML_GRAPH_FILE);
-// return OPM_XML_GRAPH_FILE;
-// }
-
-
- /**
- * creates a dot file from the current OPMGraph. <br/>
- * DOT NOT USE NEEDS FIXING
- * @return
- * @throws IOException
- * @throws OperatorException
- */
- public String Rdf2Dot() throws OperatorException, IOException {
-
- OPMRdf2Xml converter = new OPMRdf2Xml();
- OPMGraph graph = converter.convert(OPM_RDF_GRAPH_FILE);
-
- List<Process> processes = graph.getProcesses().getProcess();
- for (Process p:processes) { p.setId("\""+p.getId()+"\""); }
-
- List<Artifact> artifacts = graph.getArtifacts().getArtifact();
- for (Artifact a:artifacts) { a.setId("\""+a.getId()+"\""); }
-
-// OPMToDot aOPMToDot = new OPMToDot(DOT_CONFIG_FILE);
- OPMToDot aOPMToDot = new OPMToDot();
-
- aOPMToDot.convert(graph, new File(OPM_DOT_FILE));
- return OPM_DOT_FILE;
-
- }
-
-
- /**
- * @param graph the graph to set
- */
- public void setGraph(ProvenanceContextFacade graph) { this.graph = graph; }
-
- public void setActive(boolean active) { isActive = active; }
-
- public boolean isActive() { return isActive; }
-
-}
diff --git a/trunk/reference-api/pom.xml b/trunk/reference-api/pom.xml
deleted file mode 100644
index 281e01f..0000000
--- a/trunk/reference-api/pom.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <name>API package for the T2 reference manager</name>
- <description>
- Core APIs and extension points for the T2 reference manager.
- This includes the SPIs for external references, translators and
- publishers.
- </description>
- <dependencies>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-tx</artifactId>
- <version>2.5.4</version>
- <scope>compile</scope>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/AbstractExternalReference.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/AbstractExternalReference.java
deleted file mode 100644
index 2ad1f1d..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/AbstractExternalReference.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import static net.sf.taverna.t2.reference.ReferencedDataNature.*;
-
-/**
- * A trivial implementation of ExternalReference. This abstract class should be
- * used as the superclass of any ExternalReference implementations as it
- * provides base metadata for the hibernate-based persistence system used by the
- * main reference manager implementation. While the interface contract cannot
- * require this your extensions will likely not work properly unless you use
- * this class.
- *
- * @author Tom Oinn
- */
-public abstract class AbstractExternalReference implements ExternalReferenceSPI {
-
- // Used internally by Hibernate for this class and subclasses
- private int primaryKey;
-
- /**
- * Used by Hibernate internally to establish a foreign key relationship
- * between this abstract superclass and tables corresponding to
- * implementations of the ExternalReference interface. Has no impact on any
- * application level code, this method is only ever used by the internals of
- * the hibernate framework.
- */
- public final void setPrimaryKey(int newKey) {
- this.primaryKey = newKey;
- }
-
- /**
- * Used by Hibernate internally to establish a foreign key relationship
- * between this abstract superclass and tables corresponding to
- * implementations of the ExternalReference interface. Has no impact on any
- * application level code, this method is only ever used by the internals of
- * the hibernate framework.
- */
- public final int getPrimaryKey() {
- return this.primaryKey;
- }
-
- /**
- * Default to returning DataReferenceNature.UNKNOWN
- */
- public ReferencedDataNature getDataNature() {
- return UNKNOWN;
- }
-
- /**
- * Default to returning null for charset
- */
- public String getCharset() {
- return null;
- }
-
- /**
- * Default to a value of 0.0f for the resolution cost, but implementations
- * should at least attempt to set this to a more sensible level!
- */
- public float getResolutionCost() {
- return 0.0f;
- }
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ContextualizedT2Reference.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ContextualizedT2Reference.java
deleted file mode 100644
index 532a9ba..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ContextualizedT2Reference.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Used by the {@link ReferenceService#traverseFrom(T2Reference, int)} when
- * traversing a collection structure. Each contextualized t2reference contains
- * the {@link T2Reference} along with an integer array index representing the
- * position of that reference within the traversal structure. The index [i<sub>0</sub>,i<sub>1</sub>,i<sub>2</sub>
- * ... i<sub>n</sub>] is interpreted such that the reference is located at
- * parent.get(i<sub>0</sub>).get(i<sub>1</sub>).get(i<sub>2</sub>)....get(i<sub>n</sub>).
- * If the index is empty then the T2Reference <em>is</em> the original
- * reference supplied to the {@link ReferenceService#traverseFrom(T2Reference, int) traverseFrom} method.
- *
- * @author Tom Oinn
- *
- */
-public interface ContextualizedT2Reference {
-
- /**
- * @return the T2Reference to which the associated index applies.
- */
- public T2Reference getReference();
-
- /**
- * @return the index of this T2Reference
- */
- public int[] getIndex();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DaoException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DaoException.java
deleted file mode 100644
index 1cd3a20..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DaoException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown by the Data Access Object interface methods, wrapping any underlying
- * exception.
- *
- * @author Tom Oinn
- *
- */
-public class DaoException extends RuntimeException {
-
- static final long serialVersionUID = 8496141798637577803L;
-
- public DaoException() {
- super();
- }
-
- public DaoException(String message) {
- super(message);
- }
-
- public DaoException(Throwable cause) {
- super(cause);
- }
-
- public DaoException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DereferenceException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DereferenceException.java
deleted file mode 100644
index ef811c4..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/DereferenceException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown when a problem occurs during de-reference of an ExternalReferenceSPI
- * implementation. This include operations which implicitly de-reference the
- * reference such as those infering character set or data natures.
- *
- * @author Tom Oinn
- *
- */
-public class DereferenceException extends RuntimeException {
-
- private static final long serialVersionUID = 8054381613840005541L;
-
- public DereferenceException() {
- //
- }
-
- public DereferenceException(String message) {
- super(message);
- }
-
- public DereferenceException(Throwable cause) {
- super(cause);
- }
-
- public DereferenceException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocument.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocument.java
deleted file mode 100644
index 9cf14b8..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocument.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * Contains the definition of an error token within the workflow system.
- *
- * @author Tom Oinn
- * @author David Withers
- */
-public interface ErrorDocument extends Identified {
-
- /**
- * If the error document is created from a Throwable it will have a stack
- * trace, in this case the stack trace is represented as a list of
- * StackTraceElement beans
- */
- public List<StackTraceElementBean> getStackTraceStrings();
-
- /**
- * If the error document is created from a Throwable this contains the
- * message part of the Throwable
- */
- public String getExceptionMessage();
-
- /**
- * Error documents can carry an arbitrary string message, this returns it.
- */
- public String getMessage();
-
- /**
- * If the error document is created from set of references that contain error
- * documents, this method returns them.
- */
- public Set<T2Reference> getErrorReferences();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentDao.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentDao.java
deleted file mode 100644
index a735015..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentDao.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Data access object handling ErrorDocument instances.
- *
- * @author Tom Oinn
- */
-public interface ErrorDocumentDao {
-
- /**
- * Store a named ErrorDocument to the database.
- *
- * @param errorDoc
- * error document to store
- * @throws DaoException
- * if any exception is thrown when connecting to the underlying
- * store or when storing the error document
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void store(ErrorDocument errorDoc) throws DaoException;
-
- /**
- * Retrieves a named and populated ErrorDocument
- *
- * @param reference
- * id of the error document to retrieve
- * @return a previously stored ErrorDocument instance
- * @throws DaoException
- * if any exception is thrown when connecting to the underlying
- * data store or when attempting retrieval of the error document
- */
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
- public ErrorDocument get(T2Reference reference) throws DaoException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(ErrorDocument errorDoc) throws DaoException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentService.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentService.java
deleted file mode 100644
index de9881a..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentService.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.Set;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Provides facilities to register list of T2References, register empty lists at
- * any given depth and to resolve appropriate T2Reference instances back to
- * these lists. Registration operations assign names and lock the list contents
- * as a result. This service operates strictly on T2References, it neither tries
- * to nor is capable of any form of reference resolution, so aspects such as
- * collection traversal are not handled here (these are performed by the top
- * level reference service)
- *
- * @author Tom Oinn
- */
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
-public interface ErrorDocumentService {
-
- /**
- * Register a new error document
- *
- * @param message
- * a free text message describing the error, if available. If
- * there is no message use the empty string here.
- * @param t
- * a Throwable describing the underlying fault causing this error
- * document to be registered, if any. If there is no Throwable
- * associated use null.
- * @param depth
- * depth of the error, used when returning an error document
- * instead of an identified list.
- * @return a new ErrorDocument instance, constructed fully and stored in the
- * underlying storage system
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ErrorDocument registerError(String message, Throwable t, int depth)
- throws ErrorDocumentServiceException;
-
- /**
- * Equivalent to <code>registerError(message, null, depth)</code>
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ErrorDocument registerError(String message, int depth)
- throws ErrorDocumentServiceException;
-
- /**
- * Equivalent to <code>registerError("",t, depth)</code>
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ErrorDocument registerError(Throwable t, int depth)
- throws ErrorDocumentServiceException;
-
- /**
- * Register a new error document
- *
- * @param message
- * a free text message describing the error, if available. If
- * there is no message use the empty string here.
- * @param errors
- * a set of references that contain error documents.
- * @param depth
- * depth of the error, used when returning an error document
- * instead of an identified list.
- * @return a new ErrorDocument instance, constructed fully and stored in the
- * underlying storage system
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ErrorDocument registerError(String message, Set<T2Reference> errors, int depth)
- throws ErrorDocumentServiceException;
-
- /**
- * Retrieve a previously named and registered ErrorDocument from the backing
- * store
- *
- * @param id
- * identifier of the error document to retrieve
- * @return an ErrorDocument
- * @throws ErrorDocumentServiceException
- * if anything goes wrong with the retrieval process or if there
- * is something wrong with the reference (such as it being of
- * the wrong reference type).
- */
- public ErrorDocument getError(T2Reference id)
- throws ErrorDocumentServiceException;
-
- /**
- * Functionality the same as {@link #getError(T2Reference) getError} but in
- * asynchronous mode, returning immediately and using the supplied callback
- * to communicate its results.
- *
- * @param id
- * a {@link T2Reference} identifying an {@link ErrorDocument} to
- * retrieve
- * @param callback
- * a {@link ErrorDocumentServiceCallback} used to convey the
- * results of the asynchronous call
- * @throws ErrorDocumentServiceException
- * if the reference set service is not correctly configured.
- * Exceptions encountered when performing the asynchronous call
- * are not returned here, for obvious reasons, and are instead
- * messaged through the callback interface.
- */
- public void getErrorAsynch(T2Reference id,
- ErrorDocumentServiceCallback callback)
- throws ErrorDocumentServiceException;
-
- /**
- * Return the T2Reference for the sole child of an error document
- * identifier.
- */
- public T2Reference getChild(T2Reference errorId)
- throws ErrorDocumentServiceException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(T2Reference reference) throws ReferenceServiceException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceCallback.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceCallback.java
deleted file mode 100644
index 0aa58c8..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceCallback.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Callback interface used by asynchronous methods in the
- * {@link ErrorDocumentService} interface
- *
- * @author Tom Oinn
- *
- */
-public interface ErrorDocumentServiceCallback {
-
- /**
- * Called when the requested {@link ReferenceSet} has been successfully
- * retrieved.
- *
- * @param errorDoc
- * the ErrorDocument requested
- */
- public void errorRetrieved(ErrorDocument errorDoc);
-
- /**
- * Called if the retrieval failed for some reason
- *
- * @param cause
- * an ErrorDocumentServiceException explaining the retrieval
- * failure
- */
- public void errorRetrievalFailed(ErrorDocumentServiceException cause);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceException.java
deleted file mode 100644
index e47fd35..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ErrorDocumentServiceException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * RuntimeException subclass thrown by the error document service layer
- * interfaces. All underlying exceptions are either handled by the service layer
- * or wrapped in this exception (or a subclass) and rethrown.
- *
- * @author Tom Oinn
- *
- */
-public class ErrorDocumentServiceException extends RuntimeException {
-
- private static final long serialVersionUID = 5556399589785258956L;
-
- public ErrorDocumentServiceException() {
- super();
- }
-
- public ErrorDocumentServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ErrorDocumentServiceException(String message) {
- super(message);
- }
-
- public ErrorDocumentServiceException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceBuilderSPI.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceBuilderSPI.java
deleted file mode 100644
index ae9a129..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceBuilderSPI.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.io.InputStream;
-
-/**
- * Constructs an ExternalReferenceSPI instance from a byte stream. Used by the
- * {@link ReferenceSetAugmentor} when there isn't a direct reference to
- * reference translation path available for a desired target type, but available
- * for external use wherever this functionality is needed.
- * <p>
- * Where an underlying resource is required this is extracted from the supplied
- * ReferenceContext, this implies that all methods in implementations of this
- * interface should be thread safe, allowing multiple concurrent threads
- * cleanly. For SPI purposes implementations should be java beans with default
- * constructors.
- *
- * @author Tom Oinn
- */
-public interface ExternalReferenceBuilderSPI<TargetType extends ExternalReferenceSPI> {
-
- /**
- * Given a stream of bytes, build the appropriate target
- * ExternalReferenceSPI implementation which would de-reference to the value
- * of that stream and return it.
- *
- * @param existingReferences
- * the references to be used as sources for the translation. In
- * general the implementation will use one of these references.
- * @param context
- * a reference resolution context, needed potentially to
- * construct the new ExternalReferenceSchemeSPI, especially in
- * cases where the context contains security agents giving access
- * to a remote data staging system *
- * @throws ExternalReferenceConstructionException
- * if an error occurs instantiating the new reference.
- * @return the newly constructed ExternalReferenceSPI instance.
- */
- public TargetType createReference(InputStream byteStream,
- ReferenceContext context);
-
- /**
- * Expose the type of the ExternalReferenceSPI that this builder can
- * construct
- *
- * @return the class of ExternalReferenceSPI returned by the create
- * reference methods.
- */
- public Class<TargetType> getReferenceType();
-
- /**
- * Because the reference builder may rely on facilities provided to it
- * through the context this method is available to check whether these
- * facilities are sufficient.
- *
- * @param context
- * the reference context that will be used to construct new
- * references
- * @return whether the context contains necessary resources for the
- * reference construction process
- */
- public boolean isEnabled(ReferenceContext context);
-
- /**
- * Return an approximate complexity cost of the reference construction. In
- * general we can't make any guarantees about this because the complexity of
- * the construction depends on more than just the type involved - it can
- * depend on local configuration, network location relative to the data
- * stores referenced and in some cases on the data themselves. For now
- * though we assign an approximation, the default value is 1.0f and lower
- * values represent less costly operations.
- */
- public float getConstructionCost();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceConstructionException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceConstructionException.java
deleted file mode 100644
index 15e6964..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceConstructionException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown when an exception occurs during construction of an
- * ExternalReferenceSPI instance. This includes construction through direct
- * method invocation, through the ExternalReferenceBuilderSPI interface and
- * through the ExternalReferenceTranslatorSPI interface.
- *
- * @author Tom Oinn
- *
- */
-public class ExternalReferenceConstructionException extends RuntimeException {
-
- private static final long serialVersionUID = 8334725795238353354L;
-
- public ExternalReferenceConstructionException() {
- super();
- }
-
- public ExternalReferenceConstructionException(String message) {
- super(message);
- }
-
- public ExternalReferenceConstructionException(Throwable cause) {
- super(cause);
- }
-
- public ExternalReferenceConstructionException(String message,
- Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceSPI.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceSPI.java
deleted file mode 100644
index bb0286b..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceSPI.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.io.InputStream;
-
-/**
- * A reference to a single piece of data. This may or may not be within the
- * enactment infrastructure, it could refer to data held in a file, a URL, a
- * grid storage system or anything of that nature. Ideally the data this
- * reference points to should not change - we'd like to say 'must not change' at
- * this point but this isn't always possible, implementations should aim to
- * provide the appearance that data are immutable.
- * <p>
- * When used within the workflow engine implementations of this interface are
- * always contained in a ReferenceSet instance.
- * <p>
- * Implementors of this interface are strongly advised to use the
- * AbstractExternalReference superclass - this provides the necessary primary
- * key information used by hibernate-based implementations of the reference
- * manager. Technically we don't require it as it's possible that other backend
- * stores may exist, but the core store used by T2 is based on hibernate so it's
- * a very good idea to follow this! Basically if you don't your code won't work
- * in the current system.
- * <p>
- * This interface is an SPI - while implementations are never constructed based
- * on the SPI registry it is used to discover all implementing classes and
- * automatically register their hibernate mapping files. Implementors should add
- * their implementation class name to a
- * META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI file in
- * the implementation artifact. For examples please refer to the
- * t2reference-core-extensions module, this contains implementations of this
- * interface for common basic reference types.
- * <p>
- * Note - if your implementation class has a complex hibernate mapping that uses
- * components which are themselves mapped into the database (perfectly legal to
- * do) then you must mark those components as instances of HibernateMappedEntity
- * so their corresponding mapping and class definitions are loaded by the
- * Hibernate backed reference set dao. If your implementation class uses inline
- * compound keys or other component types where you reference another class but
- * the other class is not mapped itself in hibernate you must instead make the
- * component class an instance of HibernateComponentClass - a marker interface -
- * for the same reason. Both of these are SPIs themselves, and require the
- * appropriate entries to be added to their service metadata files in your
- * extension jar.
- *
- * @author Tom Oinn
- */
-public interface ExternalReferenceSPI {
-
- /**
- * Determine, if possible, whether the data this reference refers to is
- * textual or binary in nature. If this determination is impossible, either
- * because the ExternalReference implementation does not know or because the
- * data is not accessible for some reason then this should return
- * ReferenceDataNature.UNKNOWN
- *
- * @return the nature of the referenced data
- */
- public ReferencedDataNature getDataNature();
-
- /**
- * For textual data return the character set that should be used to pull
- * data into a java String object. Callers must deal with a null return
- * value in the event of either unknown charset or unknown or binary data
- * types.
- *
- * @return string character set, for example 'utf-8', or <code>null</code>
- * if binary or unknown type.
- */
- public String getCharset();
-
- /**
- * Open and return an InputStream to the data referenced using, if required,
- * any facilities within the supplied context.
- *
- * @param context
- * the ReferenceContext object used to obtain e.g. security
- * agents or other facilities required when de-referencing this
- * reference.
- * @return an InputStream providing access to the referenced data
- * @throws DereferenceException
- * if the reference cannot be de-referenced. This may be because
- * of problems with the context such as security failures, or it
- * may be because the reference is inherently not possible to
- * de-reference (as in the case of a non-serializable API
- * consumer reference).
- */
- public InputStream openStream(ReferenceContext context)
- throws DereferenceException;
-
- /**
- * Resolution cost is an informal guide to how costly the process of
- * de-referencing this reference would be. It's used when assessing which
- * out of a set of ExternalReferenceSPI implementations to use to get the
- * value of the reference(s), in particular when rendering to POJOs or when
- * translating throught the de-reference / construct from stream route. As
- * this property is highly complex and potentially expensive in itself to
- * evaluate there's no requirement for it to be absolutely correct, it's
- * just used as a guide that, for example, it is easier to get bytes from a
- * file on the local disk than to get them from a resource held on a grid on
- * the other side of the planet.
- *
- * @return a float representing some notion of resolution cost, lower values
- * represent cheaper de-reference paths.
- */
- public float getResolutionCost();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceTranslatorSPI.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceTranslatorSPI.java
deleted file mode 100644
index ef9d31d..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceTranslatorSPI.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Constructs an ExternalReference instance from an existing ExternalReference,
- * most usually of a different type. Used by the {@link ReferenceSetAugmentor}.
- * This SPI should not be used for cases where an ExternalReferenceSPI is
- * constructed from a stream of bytes, this is intended for direct reference to
- * reference translation with the assumption that this is more efficient for
- * whatever reason. For cases where the reference is constructed from a byte
- * stream you should implement {@link ExternalReferenceBuilder} instead.
- * <p>
- * For SPI purposes implementations should be java beans with default
- * constructors, any required state such as the location of remote repositories
- * to which data can be staged will be passed in in the ReferenceContext.
- *
- * @author Tom Oinn
- */
-public interface ExternalReferenceTranslatorSPI<SourceType extends ExternalReferenceSPI, TargetType extends ExternalReferenceSPI> {
-
- /**
- * Given an existing ExternalReferenceSPI, build the appropriate target
- * ExternalReferenceSPI implementation and return it.
- *
- * @param sourceReference
- * the reference to be used as source for the translation.
- * @param context
- * a reference resolution context, needed potentially to access
- * the existing external references or to construct the new one,
- * especially in cases where the context contains security agents
- * giving access to a remote data staging system
- * @throws ExternalReferenceConstructionException
- * if an error occurs instantiating the new reference.
- * @return the newly constructed ExternalReferenceSPI instance.
- */
- public TargetType createReference(SourceType sourceReference,
- ReferenceContext context);
-
- /**
- * Return the type of external reference that this translator consumes.
- *
- * @return ExternalReferenceSPI class corresponding to the reference type
- * used as a source by this translator.
- */
- public Class<SourceType> getSourceReferenceType();
-
- /**
- * Return the type of external reference this translator constructs.
- *
- * @return ExternalReferenceSPI class corresponding to the reference type
- * emitted by this translator.
- */
- public Class<TargetType> getTargetReferenceType();
-
- /**
- * Because the reference translator may rely on facilities provided to it
- * through the context this method is available to check whether these
- * facilities are sufficient.
- *
- * @param context
- * the reference context that will be used to construct new
- * references during the translation process
- * @return whether the context contains necessary resources for the
- * reference construction process
- */
- public boolean isEnabled(ReferenceContext context);
-
- /**
- * Return an approximate complexity cost of the translation. In general we
- * can't make any guarantees about this because the complexity of the
- * translation depends on more than just the types involved - it can depend
- * on local configuration, network location relative to the data stores
- * referenced and in some cases on the data themselves. For now though we
- * assign an approximation, the default value is 1.0f and lower values
- * represent less costly operations.
- */
- public float getTranslationCost();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceValidationException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceValidationException.java
deleted file mode 100644
index c5f2687..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ExternalReferenceValidationException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown by setter methods and constructors of ExternalReferenceSPI
- * implementations when fed parameters which cause some kind of format or
- * validation error. These might include badly formed URL or file paths or any
- * other property that fails to validate against some reference type specific
- * scheme.
- *
- * @author Tom Oinn
- *
- */
-public class ExternalReferenceValidationException extends RuntimeException {
-
- private static final long serialVersionUID = 3031393671457773057L;
-
- public ExternalReferenceValidationException() {
- //
- }
-
- public ExternalReferenceValidationException(String message) {
- super(message);
- }
-
- public ExternalReferenceValidationException(Throwable cause) {
- super(cause);
- }
-
- public ExternalReferenceValidationException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/Identified.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/Identified.java
deleted file mode 100644
index 214b828..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/Identified.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Interface for any object that has an associated T2Reference
- *
- * @author Tom Oinn
- *
- */
-public interface Identified {
-
- /**
- * Return an appropriately configured instance of T2Reference for this
- * identified object.
- *
- * @return the id of this object in the form of a T2Reference
- */
- public T2Reference getId();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/IdentifiedList.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/IdentifiedList.java
deleted file mode 100644
index dde8fa5..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/IdentifiedList.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.List;
-
-/**
- * An identified list is a list which is identified by a T2Reference. Lists are
- * immutable once named - if getId() returns a non null value all list methods
- * modifying the underlying list data will throw IllegalStateException. In the
- * reference management API this list sub-interface is used to represent both
- * collections of identifiers (i.e. 'raw' stored lists) and more fully resolved
- * structures where the types in the list can be reference sets, error documents
- * and other lists of such. The ListDao interface uses only the 'raw' form
- * consisting of flat lists of identifiers.
- * <p>
- * The IdentifiedList has a unique T2Reference associated with it. If this is
- * null the contents of the list may be modified, otherwise all modification
- * operations throw IllegalStateException. Lists in T2, once named, are
- * immutable.
- *
- * @author Tom Oinn
- *
- * @param <T>
- */
-public interface IdentifiedList<T> extends List<T>, Identified {
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListDao.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListDao.java
deleted file mode 100644
index d670c59..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListDao.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Data access object handling NamedLists of T2Reference instances.
- *
- * @author Tom Oinn
- */
-public interface ListDao {
-
- /**
- * Store a named and populated IdentifiedList of T2Reference to the
- * database.
- *
- * @param theList
- * list to store
- * @throws DaoException
- * if any exception is thrown when connecting to the underlying
- * store or when storing the list
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void store(IdentifiedList<T2Reference> theList) throws DaoException;
-
- /**
- * Retrieves a named and populated IdentifiedList of T2Reference from the
- * database by T2Reference
- *
- * @param reference
- * id of the list to retrieve
- * @return a previously stored list of T2References
- * @throws DaoException
- * if any exception is thrown when connecting to the underlying
- * data store or when attempting retrieval of the list
- */
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
- public IdentifiedList<T2Reference> get(T2Reference reference)
- throws DaoException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(IdentifiedList<T2Reference> theList)
- throws DaoException;
-
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListService.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListService.java
deleted file mode 100644
index 448ab0b..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListService.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.List;
-
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.transaction.annotation.Propagation;
-
-/**
- * Provides facilities to register list of T2References, register empty lists at
- * any given depth and to resolve appropriate T2Reference instances back to
- * these lists. Registration operations assign names and lock the list contents
- * as a result. This service operates strictly on T2References, it neither tries
- * to nor is capable of any form of reference resolution, so aspects such as
- * collection traversal are not handled here (these are performed by the top
- * level reference service)
- *
- * @author Tom Oinn
- */
-@Transactional(propagation=Propagation.SUPPORTS, readOnly=true)
-public interface ListService {
-
- /**
- * Register a new list of T2References. The depth of the list will be
- * calculated based on the depth of the references within it - if these are
- * not uniform the list won't be created (all children of a list in T2 must
- * have the same depth as their siblings). Provided this constraint is
- * satisfied the list is named and stored in the backing store. The returned
- * list is at this point immutable, operations modifying it either directly
- * or through the ListIterator will fail with an IllegalStateException.
- * Implementations should copy the input list rather than keeping a
- * reference to it to preserve this property.
- *
- * @param items
- * the T2Reference instances to store as a list.
- * @return a new IdentifiedList of T2Reference instances allocated with a
- * T2Reference itself as the unique name and cached by the backing
- * store.
- * @throws ListServiceException
- * if there is a problem either with the specified list of
- * references or with the storage subsystem.
- */
- @Transactional(propagation=Propagation.REQUIRED, readOnly=false)
- public IdentifiedList<T2Reference> registerList(List<T2Reference> items)
- throws ListServiceException;
-
- /**
- * Register a new empty list with the specified depth. This is needed
- * because in the case of empty lists we can't calculate the depth from the
- * list items (what with there not being any!), but the depth property is
- * critical for the T2 iteration and collection management system in the
- * enactor - we need to know that this is an empty list that
- * <em>would have</em> contained lists, for example.
- *
- * @param depth
- * the depth of the empty list, must be >=1
- * @return a new empty IdentifiedList allocated with a T2Reference itself as
- * the unique name and cached by the backing store.
- * @throws ListServiceException
- * if there is a problem with the storage subsystem or if called
- * with an invalid depth argument
- */
- @Transactional(propagation=Propagation.REQUIRED, readOnly=false)
- public IdentifiedList<T2Reference> registerEmptyList(int depth)
- throws ListServiceException;
-
- /**
- * Retrieve a previously named and registered list of T2Reference instances
- * identified by the specified T2Reference (which must be of type
- * T2ReferenceType.IdentifiedList)
- *
- * @param id
- * identifier of the list of reference to retrieve
- * @return an IdentifiedList of T2References. Note that because this list is
- * named it is effectively immutable, if you want to modify the list
- * you have to create and register a new list, you cannot modify the
- * returned value of this directly. This is why there is no update
- * method in the service or dao for reference lists.
- * @throws ListServiceException
- * if anything goes wrong with the retrieval process or if there
- * is something wrong with the reference (such as it being of
- * the wrong reference type).
- */
- public IdentifiedList<T2Reference> getList(T2Reference id)
- throws ListServiceException;
-
- /**
- * Functionality the same as {@link #getList(T2Reference) getList} but in
- * asynchronous mode, returning immediately and using the supplied callback
- * to communicate its results.
- *
- * @param id
- * a {@link T2Reference} identifying an {@link IdentifiedList} to
- * retrieve
- * @param callback
- * a {@link ListServiceCallback} used to convey the results of
- * the asynchronous call
- * @throws ListServiceException
- * if the reference set service is not correctly configured.
- * Exceptions encountered when performing the asynchronous call
- * are not returned here, for obvious reasons, and are instead
- * messaged through the callback interface.
- */
- public void getListAsynch(T2Reference id, ListServiceCallback callback)
- throws ListServiceException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(T2Reference reference) throws ReferenceServiceException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceCallback.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceCallback.java
deleted file mode 100644
index df73d76..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceCallback.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Callback interface used by asynchronous methods in the
- * {@link ListService} interface
- *
- * @author Tom Oinn
- *
- */
-public interface ListServiceCallback {
-
- /**
- * Called when the requested {@link ReferenceSet} has been successfully
- * retrieved.
- *
- * @param references
- * the ReferenceSet requested
- */
- public void listRetrieved(IdentifiedList<T2Reference> references);
-
- /**
- * Called if the retrieval failed for some reason
- *
- * @param cause
- * a ListServiceException explaining the retrieval
- * failure
- */
- public void listRetrievalFailed(ListServiceException cause);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceException.java
deleted file mode 100644
index 22bd91c..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ListServiceException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown by methods in the ListService interface if anything goes wrong with
- * list registration or retrieval. Any underlying exceptions that can't be
- * handled in the service layer are wrapped in this and re-thrown.
- *
- * @author Tom Oinn
- */
-public class ListServiceException extends RuntimeException {
-
- private static final long serialVersionUID = 5049346991071587866L;
-
- public ListServiceException() {
- super();
- }
-
- public ListServiceException(String message) {
- super(message);
- }
-
- public ListServiceException(Throwable cause) {
- super(cause);
- }
-
- public ListServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceContext.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceContext.java
deleted file mode 100644
index d2496ee..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceContext.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.List;
-
-/**
- * Many operations over the reference manager require access to an appropriate
- * context. The context contains hooks out to platform level facilities such as
- * the security agent framework (when used in conjunction with the enactor).
- * <p>
- * This interface is also used to pass in resources required by the external
- * reference translation and construction SPIs. An example might be a translator
- * from File to URL could work by copying the source file to a web share of some
- * kind, but obviously this can't happen unless properties such as the location
- * of the web share folder are known. These properties tend to be properties of
- * the installation rather than of the code, referring as they do to resources
- * on the machine hosting the reference manager (and elsewhere).
- * <p>
- * Where entities in the context represent properties of the platform rather
- * than the 'session' they are likely to be configured in a central location
- * such as a Spring context definition, this interface is neutral to those
- * concerns.
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceContext {
-
- /**
- * Return a list of all entities in the resolution context which match the
- * supplied entity type argument.
- *
- * @param <T>
- * The generic type of the returned entity list. In general the
- * compiler is smart enough that you don't need to specify this,
- * it can pick it up from the entityType parameter.
- * @param entityType
- * Class of entity to return. Use Object.class to return all
- * entities within the resolution context
- * @return a list of entities from the resolution context which can be cast
- * to the specified type.
- */
- public <T extends Object> List<? extends T> getEntities(Class<T> entityType);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceService.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceService.java
deleted file mode 100644
index 7f7c68b..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceService.java
+++ /dev/null
@@ -1,289 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Top level access point to the reference manager for client code which is
- * aware of references and error documents. Provides methods to store and
- * retrieve instances of ReferenceSet, IdentifiedList<T2Reference> and
- * ErrorDocument. Acts as an integration layer for the three sub-component
- * service, providing in addition collection traversal and retrieval of lists of
- * identified entities (ReferenceSet, IdentifiedList<Identified> and
- * ErrorDocument) from a T2Reference identifying a list.
- * <p>
- * Also provides registration and retrieval logic for POJOs where supported by
- * appropriate plug-in instances, these methods can be used by code which is not
- * 'reference aware' to store and retrieve value types transparently.
- * <p>
- * Resolution of collections can happen at three different levels:
- * <ol>
- * <li>The embedded {@link ListService} resolves the collection ID to a list of
- * child IDs, and doesn't traverse these children if they are themselves lists.
- * Use the {@link #getListService()}.{@link ListService#getList(T2Reference) getList()}
- * to call this method directly on the list service if you need this
- * functionality, returning a list of {@link T2Reference}</li>
- * <li>The
- * {@link #resolveIdentifier(T2Reference, Set, ReferenceContext) resolveIdentifier}
- * method in this service instead resolves to a fully realized collection of the
- * entities which those IDs reference, and does recursively apply this to child
- * lists, resulting in a nested collection structure where the leaf nodes are
- * ReferenceSet and ErrorDocument instances and non-leaf are IdentifiedList of
- * Identified (the super-interface for IdentifiedList, ReferenceSet and
- * ErrorDocument). Use this method if you want to access the
- * ExternalReferenceSPI and ErrorDocument entities directly because your code
- * can act on a particular reference type - in general in these cases you would
- * also be using the augmentation system to ensure that the required reference
- * type was actually present in the collection structure.</li>
- * <li>The third level of resolution is to render the identifier through
- * {@link #renderIdentifier(T2Reference, Class, ReferenceContext) renderIdentifier}
- * to a nested structure as in
- * {@link #resolveIdentifier(T2Reference, Set, ReferenceContext) resolveIdentifier}
- * but where the structure consists of POJOs of the specified type and lists or
- * either list or the leaf type. This is used when your code is reference
- * agnostic and just requires the values in an easy to consume fashion. Note
- * that because this involves pulling the entire structure into memory it may
- * not be suitable for large data, use with caution. This method will, unlike
- * {@link #resolveIdentifier(T2Reference, Set, ReferenceContext) resolveIdentifier},
- * fail if the reference contains or is an error.</li>
- * </ol>
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceService {
-
- /**
- * Perform recursive identifier resolution, building a collection structure
- * of Identified objects, any collection elements being IdentifiedLists of
- * Identified subclasses. If the id has depth 0 this will just return the
- * Identified to which that id refers.
- *
- * @param id
- * the T2Reference to resolve
- * @param ensureTypes
- * a set of ExternalReferenceSPI classes, this is used to augment
- * any resolved ReferenceSet instances to ensure that each one
- * has at least one of the specified types. If augmentation is
- * not required this can be set to null.
- * @param context
- * the ReferenceContext to use to resolve this and any
- * recursively resolved identifiers <br/> If null the
- * implementation should insert a new empty context and proceed.
- * @return fully resolved Identified subclass - this is either a (recursive)
- * IdentifiedList of Identified, a ReferenceSet or an ErrorDocument
- * @throws ReferenceServiceException
- * if any problems occur during resolution
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public Identified resolveIdentifier(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context) throws ReferenceServiceException;
-
- /**
- * As resolveIdentifier but using a callback object and returning
- * immediately
- *
- * @throws ReferenceServiceException
- * if anything goes wrong with the setup of the resolution job.
- * Any exceptions during the resolution process itself are
- * communicated through the callback object.
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void resolveIdentifierAsynch(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context,
- ReferenceServiceResolutionCallback callback)
- throws ReferenceServiceException;
-
- /**
- * Resolve the given identifier, building a POJO structure where the
- * non-list items are of the desired class. This makes of any external
- * references that can directly expose the appropriate object type, then, if
- * none are present in a given reference set, it attempts to locate a POJO
- * builder and uses the cheapest available reference to get an InputStream
- * and build the target object. If no appropriate builder or embedded value
- * can be found the process throws ReferenceServiceException, it also does
- * this if any error occurs during retrieval of a (potentially nested)
- * identifier.
- * <p>
- * This method will return a collection structure mirroring that of the
- * specified T2Reference, client code should use T2Reference.getDepth() to
- * determine the depth of this structure; a reference with depth of 0 means
- * that the object returned is of the specified class, one of depth 1 is a
- * list of this class and so on.
- * <p>
- * If the T2Reference contains or is an error this method will not retrieve
- * it, and instead throws ReferenceServiceException
- *
- * @see StreamToValueConverterSPI
- * @see ValueCarryingExternalReference
- * @param id
- * the T2Reference to render to a POJO
- * @param leafClass
- * the java class for leaves in the resulting POJO structure
- * @param context
- * a reference context, potentially used if required by the
- * openStream methods of ExternalReferenceSPI implementations
- * used as sources for the POJO construction <br/> If null the
- * implementation should insert a new empty context and proceed.
- * @return a java structure as defined above
- * @throws ReferenceServiceException
- * if anything fails during this process
- */
- public Object renderIdentifier(T2Reference id, Class<?> leafClass,
- ReferenceContext context) throws ReferenceServiceException;
-
- /**
- * The top level registration method is used to register either as yet
- * unregistered ErrorDocuments and ReferenceSets (if these are passed in and
- * already have an identifier this call does nothing) and arbitrarily nested
- * Lists of the same. In addition any ExternalReferenceSPI instances found
- * will be wrapped in a single item ReferenceSet and registered, and any
- * Throwables will be wrapped in an ErrorDocument and registered. Lists will
- * be converted to IdentifiedList<T2Reference> and registered if all
- * children can be (or were already) appropriately named.
- * <p>
- * This method is only valid on parameters of the following type :
- * <ol>
- * <li>{@link T2Reference} - returned immediately as itself, this is needed
- * because it means we can register lists of existing T2Reference</li>
- * <li>{@link ReferenceSet} - registered if not already registered,
- * otherwise returns existing T2Reference</li>
- * <li>{@link ErrorDocument} - same behaviour as ReferenceSet</li>
- * <li>{@link ExternalReferenceSPI} - wrapped in ReferenceSet, registered
- * and ID returned</li>
- * <li>Throwable - wrapped in {@link ErrorDocument} with no message,
- * registered and ID returned</li>
- * <li>List - all children are first registered, if this succeeds the list
- * is itself registered as an {@link IdentifiedList} of {@link T2Reference}
- * and its reference returned.</li>
- * </ol>
- * The exception to this is if the useConvertorSPI parameter is set to true -
- * in this case any objects which do not match the above allowed list will
- * be run through any available ValueToReferenceConvertorSPI instances in
- * turn until one succeeds or all fail, which may result in the creation of
- * ExternalReferenceSPI instances. As these can be registered such objects
- * will not cause an exception to be thrown.
- *
- * @see ValueToReferenceConverterSPI
- * @param o
- * the object to register with the reference system, must comply
- * with and will be interpreted as shown in the type list above.
- * @param targetDepth
- * the depth of the top level object supplied. This is needed
- * when registering empty collections and error documents,
- * whether as top level types or as members of a collection
- * within the top level type. If registering a collection this is
- * the collection depth, so a List of ReferenceSchemeSPI would be
- * depth 1. Failing to specify this correctly will result in
- * serious problems downstream so be careful! We can't catch all
- * potential problems in this method (although some errors will
- * be trapped).
- * @param useConverterSPI
- * whether to attempt to use the ValueToReferenceConvertorSPI
- * registry (if defined and available) to map arbitrary objects
- * to ExternalReferenceSPI instances on the fly. The registry of
- * converters is generally injected into the implementation of
- * this service.
- * @param context
- * ReferenceContext to use if required by component services,
- * this is most likely to be used by the object to reference
- * converters if engaged. <br/> If null the implementation should
- * insert a new empty context and proceed.
- * @return a T2Reference to the registered object
- * @throws ReferenceServiceException
- * if the object type (or, for collections, the recursive type
- * of its contents) is not in the allowed list or if a problem
- * occurs during registration. Also thrown if attempting to use
- * the converter SPI without an attached registry.
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public T2Reference register(Object o, int targetDepth,
- boolean useConverterSPI, ReferenceContext context)
- throws ReferenceServiceException;
-
- /**
- * Given a string representation of a T2Reference create a new T2Reference with
- * the correct depth etc.
- * @param reference
- * @return a new T2Reference parsed from the original
- */
- public T2Reference referenceFromString(String reference);
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(T2Reference reference) throws ReferenceServiceException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(List<T2Reference> references) throws ReferenceServiceException;
-
- /**
- * Returns the {@link ErrorDocumentService} this ReferenceService uses, use
- * this when you need functionality from that service explicitly.
- */
- public ErrorDocumentService getErrorDocumentService();
-
- /**
- * Returns the {@link ReferenceSetService} this ReferenceService uses, use
- * this when you need functionality from that service explicitly.
- */
- public ReferenceSetService getReferenceSetService();
-
- /**
- * Returns the {@link ListService} this ReferenceService uses, use this when
- * you need functionality from that service explicitly.
- */
- public ListService getListService();
-
- /**
- * Initiates a traversal of the specified t2reference, traversing to
- * whatever level of depth is required such that all identifiers returned
- * within the iterator have the specified depth. The context (i.e. the index
- * path from the originally specified reference to each reference within the
- * iteration) is included through use of the ContextualizedT2Reference
- * wrapper class
- *
- * @param source
- * the T2Reference from which to traverse. In general this is the
- * root of a collection structure.
- * @param desiredDepth
- * the desired depth of all returned T2References, must be less
- * than or equal to that of the source reference.
- * @throws ReferenceServiceException
- * if unable to create the iterator for some reason. Note that
- * implementations are free to lazily perform the iteration so
- * this method may succeed but the iterator produced can fail
- * when used. If the iterator fails it will do so by throwing
- * one of the underlying sub-service exceptions.
- */
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
- public Iterator<ContextualizedT2Reference> traverseFrom(T2Reference source,
- int desiredDepth);
-
-
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceCacheProvider.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceCacheProvider.java
deleted file mode 100644
index 50b7686..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceCacheProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * A simple interface to be implemented by data access object cache providers,
- * intended to be used to inject cache implementations through AoP
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceServiceCacheProvider {
-
- /**
- * Called after an Identified has been written to the backing store, either
- * for the first time or after modification. In our model ReferenceSet is
- * the only Identified that is modifiable, specifically only by the addition
- * of ExternalReferenceSPI instances to its reference set.
- *
- * @param i
- * the Identified written to the backing store
- */
- void put(Identified i);
-
- /**
- * Called before an attempt is made to retrieve an item from the backing
- * store
- *
- * @param id
- * the T2Reference of the item to retrieve
- * @return a cached item with matching T2Reference, or null if the cache
- * does not contain that item
- */
- Identified get(T2Reference id);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceException.java
deleted file mode 100644
index ebcc836..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown by methods in the ReferenceService, used to wrap any underlying
- * exceptions from lower layers.
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceServiceException extends RuntimeException {
-
- private static final long serialVersionUID = -2607675495513408333L;
-
- public ReferenceServiceException() {
- //
- }
-
- public ReferenceServiceException(String message) {
- super(message);
- }
-
- public ReferenceServiceException(Throwable cause) {
- super(cause);
- }
-
- public ReferenceServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceResolutionCallback.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceResolutionCallback.java
deleted file mode 100644
index be52d8f..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceServiceResolutionCallback.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Used by the asynchronous form of the resolveIdentifier method in
- * ReferenceService
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceServiceResolutionCallback {
-
- /**
- * Called when the resolution process has completed
- *
- * @param result
- * the Identified that corresponds to the T2Reference specified
- * in the call to resolveIdentifierAsynch in ReferenceService
- */
- public void identifierResolved(Identified result);
-
- /**
- * Called when the resolution process has failed
- *
- * @param cause
- * a ReferenceServiceException describing the failure
- */
- public void resolutionFailed(ReferenceServiceException cause);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSet.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSet.java
deleted file mode 100644
index ecb6cdc..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSet.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.Set;
-
-/**
- * A set of ExternalReferenceSPI instances, all of which point to the same (byte
- * equivalent) data. The set is identified by a T2Reference. This interface is
- * read-only, as are most of the interfaces in this package. Rather than
- * modifying properties of the reference set directly the client code should use
- * the reference manager functionality.
- * <p>
- * It is technically okay, but rather unhelpful, to have a ReferenceSet with no
- * ExternalReferenceSPI implementations. In general this is a sign that
- * something has gone wrong somewhere as the reference set will not be
- * resolvable in any way, but it would still retain its unique identifier so
- * there may be occasions where this is the desired behaviour.
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceSet extends Identified {
-
- /**
- * The reference set contains a set of ExternalReferenceSPI instances, all
- * of which point to byte equivalent data.
- *
- * @return the set of references to external data
- */
- public Set<ExternalReferenceSPI> getExternalReferences();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentationException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentationException.java
deleted file mode 100644
index 2545f80..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentationException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown when the reference set augmentor is unable to provide at least one of
- * the desired types for any reason.
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceSetAugmentationException extends RuntimeException {
-
- private static final long serialVersionUID = -6156508424485682266L;
-
- public ReferenceSetAugmentationException() {
- //
- }
-
- public ReferenceSetAugmentationException(String message) {
- super(message);
- }
-
- public ReferenceSetAugmentationException(Throwable cause) {
- super(cause);
- }
-
- public ReferenceSetAugmentationException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentor.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentor.java
deleted file mode 100644
index 0d62bbb..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentor.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.Set;
-
-/**
- * Provides a framework to find and engage appropriate instances of
- * {@link ExternalReferenceTranslatorSPI} and
- * {@link ExternalReferenceBuilderSPI} to build external references from,
- * respectively, other external references and from streams. These are then used
- * to augment the contents of implementations of {@link ReferenceSet} with
- * additional {@link ExternalReferenceSPI} implementations.
- * <p>
- * Methods in this interface throw the runtime exception
- * {@link ReferenceSetAugmentationException} for all problems, other exceptions
- * are wrapped in this type and re-thrown.
- *
- * @author Tom Oinn
- */
-public interface ReferenceSetAugmentor {
-
- /**
- * Attempts to modify the supplied ReferenceSet such that it contains an
- * implementation of at least one of the ExternalReferenceSPI classes
- * specified. Uses the supplied context if required to build or translate
- * existing references within the reference set.
- *
- * @param references
- * reference set object to augment
- * @param targetReferenceTypes
- * a set of Class objects, this method succeeds if it can create
- * an instance of at least one of these pointing to the same data
- * as the other external references in the supplied reference set
- * @param context
- * a reference resolution context, potentially required for
- * access to the existing references or for creation of the
- * augmentations
- * @return a set of new ExternalReferenceSPI instances such that the union
- * of this set with the pre-existing reference set satisfies the
- * target reference constraint. It is the responsibility of the
- * caller to re-integrate these references into the original
- * ReferenceSet if so desired.
- * @throws ReferenceSetAugmentationException
- * if a problem occurs either in configuration of the
- * ReferenceSetAugmentor or in the augmentation process itself.
- * Any other exception types are wrapped in this and re-thrown.
- */
- public Set<ExternalReferenceSPI> augmentReferenceSet(ReferenceSet references,
- Set<Class<ExternalReferenceSPI>> targetReferenceTypes,
- ReferenceContext context) throws ReferenceSetAugmentationException;
-
- /**
- * As with {@link #augmentReferenceSet(ReferenceSet, Set, ReferenceContext)}
- * but called in an asynchronous fashion. Returns immediately and uses the
- * supplied instance of {@link ReferenceSetAugmentorCallback} to provide
- * either the augmented {@link ReferenceSet} or an exception indicating a
- * failure in the augmentation process.
- *
- * @param callback
- * callback object used to indicate failure or to return the
- * modified reference set
- * @throws ReferenceSetAugmentationException
- * if the ReferenceSetAugmentor is missing critical
- * configuration. Exceptions that happen during augmentation or
- * as a result of a failure to find an appropriate augmentation
- * path are signalled by calls to the callback object, this
- * method only throws the exception if it can't even try to do
- * the augmentation for some reason.
- */
- public void augmentReferenceSetAsynch(ReferenceSet references,
- Set<Class<ExternalReferenceSPI>> targetReferenceTypes,
- ReferenceContext context, ReferenceSetAugmentorCallback callback)
- throws ReferenceSetAugmentationException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentorCallback.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentorCallback.java
deleted file mode 100644
index 2bde7c9..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetAugmentorCallback.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.Set;
-
-/**
- * Callback interface used when augmenting a ReferenceSet in an asynchronous
- * fashion through
- * {@link ReferenceSetAugmentor#augmentReferenceSetAsynch(ReferenceSet, Set, ReferenceContext, ReferenceSetAugmentorCallback) augmentReferenceSetAsynch}
- * in {@link ReferenceSetAugmentor}.
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceSetAugmentorCallback {
-
- /**
- * Called when the augmentation has succeeded
- *
- * @param newReferences
- * a set of ExternalReferenceSPI instances created during the
- * augmentation process. It is the responsibility of the caller
- * to re-integrate these back into the ReferenceSet used in the
- * translation
- */
- public void augmentationCompleted(Set<ExternalReferenceSPI> newReferences);
-
- /**
- * Called when the augmentation has failed for some reason
- *
- * @param cause
- * a {@link ReferenceSetAugmentationException} object describing
- * the failure.
- */
- public void augmentationFailed(ReferenceSetAugmentationException cause);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetDao.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetDao.java
deleted file mode 100644
index 9ccd254..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetDao.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Data Access Object interface for {@link ReferenceSet}. Used by the
- * {@link ReferenceSetService} to store and retrieve implementations of
- * reference set to and from the database. Client code should use the reference
- * set service rather than using this Dao directly.
- * <p>
- * All methods throw DaoException, and nothing else. Where a deeper error is
- * propagated it is wrapped in a DaoException and passed on to the caller.
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceSetDao {
-
- /**
- * Store the specified new reference set
- *
- * @param rs
- * a reference set, must not already exist in the database.
- * @throws DaoException
- * if the entry already exists in the database or some other
- * database related problem occurs
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void store(ReferenceSet rs) throws DaoException;
-
- /**
- * Update a pre-existing entry in the database
- *
- * @param rs
- * the reference set to update. This must already exist in the
- * database
- * @throws DaoException
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void update(ReferenceSet rs) throws DaoException;
-
- /**
- * Fetch a reference set by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved ReferenceSet
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
- public ReferenceSet get(T2Reference ref) throws DaoException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(ReferenceSet rs) throws DaoException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetService.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetService.java
deleted file mode 100644
index ec60eeb..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetService.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.util.List;
-import java.util.Set;
-
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * Provides facilities to register sets of ExternalReferenceSPI implementations
- * within the reference manager and to retrieve these sets by T2Reference either
- * as stored or with translation support. In general applications should be
- * using this interface (where only ReferenceSet functionality is required) or
- * the support classes which in turn use this and the collection and error
- * handling interfaces to present a unified view over the various components of
- * the reference management system.
- *
- * @author Tom Oinn
- */
-@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
-public interface ReferenceSetService {
-
- /**
- * Register a set of {@link ExternalReferenceSPI} instances, all of which
- * should point to byte equivalent data, and return the newly created
- * {@link ReferenceSet}. This method blocks on the underlying store, but
- * guarantees that the returned value has been persisted.
- *
- * @param references
- * a set of {@link ExternalReferenceSPI} implementations to
- * register as a {@link ReferenceSet}
- * @return the registered {@link ReferenceSet}
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ReferenceSet registerReferenceSet(
- Set<ExternalReferenceSPI> references)
- throws ReferenceSetServiceException;
-
- /**
- * Get a previously registered {@link ReferenceSet} by {@link T2Reference}.
- * Note that this method blocks and may take some time to return in the case
- * of distributed reference managers; if this is likely to be an issue then
- * you should use the asynchronous form
- * {@link #getReferenceSetAsynch(T2Reference, ReferenceSetServiceCallback) getReferenceSetAsynch}
- * instead of this method.
- *
- * @param id
- * a {@link T2Reference} identifying a {@link ReferenceSet} to
- * retrieve
- * @return the requested {@link ReferenceSet}
- */
- public ReferenceSet getReferenceSet(T2Reference id)
- throws ReferenceSetServiceException;
-
- /**
- * Functionality the same as
- * {@link #getReferenceSet(T2Reference) getReferenceSet} but in asynchronous
- * mode, returning immediately and using the supplied callback to
- * communicate its results.
- *
- * @param id
- * a {@link T2Reference} identifying a {@link ReferenceSet} to
- * retrieve
- * @param callback
- * a {@link ReferenceSetServiceCallback} used to convey the
- * results of the asynchronous call
- * @throws ReferenceSetServiceException
- * if the reference set service is not correctly configured.
- * Exceptions encountered when performing the asynchronous call
- * are not returned here, for obvious reasons, and are instead
- * messaged through the callback interface.
- */
- public void getReferenceSetAsynch(T2Reference id,
- ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException;
-
- /**
- * Functionality the same as
- * {@link #getReferenceSet(T2Reference) getReferenceSet} but with the
- * additional option to specify a set of {@link ExternalReferenceSPI}
- * classes. The reference set manager will attempt to ensure that the
- * returned {@link ReferenceSet} contains an instance of at least one of the
- * specified classes. This method blocks, and may potentially incur both the
- * remote lookup overhead of the simpler version of this call and any
- * translation logic. It is <em>strongly</em> recommended that you do not
- * use this version of the call and instead use the asynchronous form
- * {@link #getReferenceSetWithAugmentationAsynch(T2Reference, Set, ReferenceContext, ReferenceSetServiceCallback) getReferenceSetWithAugmentationAsynch}
- * instead.
- * <p>
- * If the translation logic cannot provide at least one of the required
- * types this call will fail, even if the {@link ReferenceSet} requested is
- * otherwise available.
- *
- * @param id
- * a {@link T2Reference} identifying a {@link ReferenceSet} to
- * retrieve
- * @param ensureTypes
- * a set of {@link ExternalReferenceSPI} classes. The framework
- * will attempt to ensure there is an instance of at least one of
- * these classes in the returned {@link ReferenceSet}
- * @param context
- * if translation of references is required the translation
- * infrastructure will need information in this
- * {@link ReferenceContext} parameter.
- * <p>
- * If null the implementation should insert a new empty context
- * and proceed.
- * @return the requested {@link ReferenceSet}
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public ReferenceSet getReferenceSetWithAugmentation(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context) throws ReferenceSetServiceException;
-
- /**
- * Functionality as
- * {@link #getReferenceSetWithAugmentation(T2Reference, Set, ReferenceContext) getReferenceSetWithAugmentation}
- * but with the addition of a callback interface to report the result or
- * failure of the method.
- *
- * @param id
- * a {@link T2Reference} identifying a {@link ReferenceSet} to
- * retrieve
- * @param ensureTypes
- * a set of {@link ExternalReferenceSPI} classes. The framework
- * will attempt to ensure there is an instance of at least one of
- * these classes in the returned {@link ReferenceSet}
- * @param context
- * if translation of references is required the translation
- * infrastructure will need information in this
- * {@link ReferenceContext} parameter.
- * <p>
- * If null the implementation should insert a new empty context
- * and proceed.
- * @param callback
- * a {@link ReferenceSetServiceCallback} used to convey the
- * results of the asynchronous call *
- * @throws ReferenceSetServiceException
- * if the reference set service is not correctly configured.
- * Exceptions encountered when performing the asynchronous call
- * are not returned here, for obvious reasons, and are instead
- * messaged through the callback interface.
- */
- @Transactional(propagation = Propagation.REQUIRED, readOnly = false)
- public void getReferenceSetWithAugmentationAsynch(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context, ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException;
-
- @Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
- public boolean delete(T2Reference reference) throws ReferenceServiceException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceCallback.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceCallback.java
deleted file mode 100644
index 4f6701a..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceCallback.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Callback interface used by asynchronous methods in the
- * {@link ReferenceSetService} interface
- *
- * @author Tom Oinn
- *
- */
-public interface ReferenceSetServiceCallback {
-
- /**
- * Called when the requested {@link ReferenceSet} has been successfully
- * retrieved.
- *
- * @param references
- * the ReferenceSet requested
- */
- public void referenceSetRetrieved(ReferenceSet references);
-
- /**
- * Called if the retrieval failed for some reason
- *
- * @param cause
- * a ReferenceSetServiceException explaining the retrieval
- * failure
- */
- public void referenceSetRetrievalFailed(ReferenceSetServiceException cause);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceException.java
deleted file mode 100644
index 8825439..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferenceSetServiceException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * RuntimeException subclass thrown by the reference set service layer
- * interfaces. All underlying exceptions are either handled by the service layer
- * or wrapped in this exception (or a subclass) and rethrown.
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceSetServiceException extends RuntimeException {
-
- private static final long serialVersionUID = -2762995062729638168L;
-
- public ReferenceSetServiceException() {
- //
- }
-
- public ReferenceSetServiceException(String message) {
- super(message);
- }
-
- public ReferenceSetServiceException(Throwable cause) {
- super(cause);
- }
-
- public ReferenceSetServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferencedDataNature.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferencedDataNature.java
deleted file mode 100644
index 5bb30fe..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ReferencedDataNature.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Where possible ExternalReferenceSPI implementations should be able to
- * determine whether the data they refer to is textual or binary in nature. This
- * enumeration contains values for textual, binary and unknown data natures.
- *
- * @author Tom Oinn
- *
- */
-public enum ReferencedDataNature {
-
- /**
- * The data is binary, no character encoding will be specified.
- */
- BINARY,
-
- /**
- * The data is textual, character encoding may be defined.
- */
- TEXT,
-
- /**
- * Unknown data nature.
- */
- UNKNOWN;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StackTraceElementBean.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StackTraceElementBean.java
deleted file mode 100644
index c6e1ac0..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StackTraceElementBean.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Used by the {@link ErrorDocument} interface to represent a frame within a
- * stack trace
- *
- * @author Tom Oinn
- *
- */
-public interface StackTraceElementBean {
-
- /**
- * Returns the fully qualified name of the class containing the execution
- * point represented by this stack trace element.
- */
- public String getClassName();
-
- /**
- * Returns the name of the source file containing the execution point
- * represented by this stack trace element.
- */
- public String getFileName();
-
- /**
- * Returns the line number of the source line containing the execution point
- * represented by this stack trace element.
- */
- public int getLineNumber();
-
- /**
- * Returns the name of the method containing the execution point represented
- * by this stack trace element.
- */
- public String getMethodName();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StreamToValueConverterSPI.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StreamToValueConverterSPI.java
deleted file mode 100644
index 9e77671..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/StreamToValueConverterSPI.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.io.InputStream;
-
-/**
- * SPI for objects that can render a POJO from an InputStream
- *
- * @author Tom Oinn
- *
- */
-public interface StreamToValueConverterSPI<T> {
-
- /**
- * The class of objects which this builder can construct from a stream
- */
- public Class<T> getPojoClass();
-
- /**
- * Render the stream to the target object type
- *
- * @param stream
- * input stream of data to render to the object
- * @return the newly created object
- */
- public T renderFrom(InputStream stream);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2Reference.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2Reference.java
deleted file mode 100644
index 5c63eba..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2Reference.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-import java.net.URI;
-
-/**
- * The T2Reference is used within the workflow system to refer to any entity
- * within the reference management system, whether reference set, list or error
- * document. The reference carries certain properties which can be evaluated
- * without resolution, these include a depth property and whether the reference
- * either is or contains an error document at any point in its structure.
- *
- * @author Tom Oinn
- *
- */
-public interface T2Reference {
-
- /**
- * To determine the entity that this reference points to we use an
- * enumeration of possible entity types
- *
- * @return the type of entity to which this reference refers.
- */
- public T2ReferenceType getReferenceType();
-
- /**
- * All entities identified by a T2Reference have a conceptual depth. In the
- * case of lists the depth is the (uniform) depth of any item in the list
- * plus one, in the case of reference sets the depth is 0. Error documents
- * and empty lists may also have non zero depth; error documents in
- * particular have a depth corresponding to the depth of the list or
- * reference set that would have been created if there was no error.
- *
- * @return the depth of the entity identified by this T2Reference
- */
- public int getDepth();
-
- /**
- * Error documents always return true, as do any lists where at least one
- * immediate child of the list returns true when this property is evaluated.
- * As lists are immutable this property is actually set on list
- * registration. This is used to determine whether to allow POJO resolution
- * of the entity identified by this T2Reference - this is configurable by
- * the caller but there will be some cases where an attempt to render a
- * collection containing errors to a POJO should return an error and other
- * occasions when it should return a collection containing error objects.
- * <p>
- * ReferenceSet implementations always return false.
- *
- * @return whether the entity identified by this T2Reference either is or
- * contains an error document. Containment is transitive, so a list
- * containing a list that contained an error would return true.
- */
- public boolean containsErrors();
-
- /**
- * T2Reference instances retain a reference to the reference manager which
- * created them in the form of a namespace. This is an opaque string
- * matching the regular expression [a-zA-Z_0-9]+, and is immutable once
- * assigned (as are the other properties of this interface). The reference
- * manager infrastructure uses this namespace property primarily to
- * differentiate between cases where a reference cannot be resolved because
- * of a lack of connection to the appropriate remote reference manager and
- * those where the reference simply does not exist anywhere.
- *
- * @return the namespace of this T2Reference as a string.
- */
- public String getNamespacePart();
-
- /**
- * In addition to the namespace the T2Reference contains a local identifier.
- * This identifier is unique in the context of the namespace and is also
- * represented as a string matching the regular expression [a-z_A-Z0-9]+
- *
- * @return the local part of this T2Reference as a string.
- */
- public String getLocalPart();
-
- /**
- * All T2Reference instances can be represented as a URI.
- *
- * @return representation of this T2Reference as a URI
- */
- public URI toUri();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceGenerator.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceGenerator.java
deleted file mode 100644
index 73d131a..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceGenerator.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Provides new unique T2Reference instances. Used by and injected into the
- * various service interface implementations when registering new reference
- * sets, error documents and lists.
- *
- * @author Tom Oinn
- *
- */
-public interface T2ReferenceGenerator {
-
- /**
- * All T2Reference objects will have this namespace
- *
- * @return the namespace as a string
- */
- public String getNamespace();
-
- /**
- * Create a new and otherwise unused T2Reference to a ReferenceSet
- *
- * @return new T2Reference for a ReferenceSet, namespace and local parts
- * will be initialized and the reference is ready to use when
- * returned.
- */
- public T2Reference nextReferenceSetReference();
-
- /**
- * Create a new and otherwise unused T2Reference to an IdentifiedList
- *
- * @param containsErrors
- * whether the list this reference is generated for contains
- * t2references with their containsErrors property set to true.
- * Returns true if <em>any</em> reference in the list is or
- * contains an error.
- * @param listDepth
- * depth of the list to which this identifier will be applied
- * @return a new T2Reference for an IdentifiedList. Namespace, type and
- * local parts will be initialized but depth and error content will
- * still be at their default values of '0' and 'false' respectively,
- * these will need to be re-set before the reference is viable.
- */
- public T2Reference nextListReference(boolean containsErrors, int listDepth);
-
- /**
- * Create a new and otherwise unused T2Reference to an ErrorDocument
- *
- * @param depth
- * the depth of the error document to which this identifier will
- * refer
- * @return a new T2Reference for an ErrorDocument
- */
- public T2Reference nextErrorDocumentReference(int depth);
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java
deleted file mode 100644
index 9d9b0fa..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * The T2Reference interface is used to identify several different kinds of
- * information, namely ReferenceSet, IdentifiedList and ErrorDocument. Because
- * the top level reference service needs to determine which sub-service to
- * delegate to when resolving references we carry this information in each
- * T2Reference in the form of one of these enumerated types.
- *
- * @author Tom Oinn
- *
- */
-public enum T2ReferenceType {
-
- /**
- * A reference to a ReferenceSet
- */
- ReferenceSet,
-
- /**
- * A reference to an IdentifiedList of other T2References
- */
- IdentifiedList,
-
- /**
- * A reference to an ErrorDocument
- */
- ErrorDocument;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java
deleted file mode 100644
index 2f19000..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Specialization of ExternalReferenceSPI for reference types which carry a
- * value type internally. Such references can be de-referenced to the specified
- * object type very cheaply. Note that this is not to be used to get an object
- * property of a reference, the returned object must correspond to the value of
- * the referenced data - this means that the HttpUrlReference does not use this
- * to return a java.net.URL, but that the InlineStringReference does use it to
- * return a java.lang.String
- *
- * @author Tom Oinn
- *
- */
-public interface ValueCarryingExternalReference<T> extends ExternalReferenceSPI {
-
- /**
- * Returns the type of the inlined value
- */
- public Class<T> getValueType();
-
- /**
- * Returns the value
- */
- public T getValue();
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java
deleted file mode 100644
index 2c7417a..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * Thrown by instances of ValueToReferenceConvertor when trying to convert an
- * object to an instance of ExternalReferenceSPI if the conversion process fails
- * for some reason.
- *
- * @author Tom Oinn
- *
- */
-public class ValueToReferenceConversionException extends RuntimeException {
-
- private static final long serialVersionUID = 3259959719223191820L;
-
- public ValueToReferenceConversionException() {
- //
- }
-
- public ValueToReferenceConversionException(String message) {
- super(message);
- }
-
- public ValueToReferenceConversionException(Throwable cause) {
- super(cause);
- }
-
- public ValueToReferenceConversionException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java
deleted file mode 100644
index de8f480..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference;
-
-/**
- * SPI for components that can convert an arbitrary object to an
- * ExternalReferenceSPI representing the value of that object. Used by
- * implementations of {@link ReferenceService#register(Object, int, boolean)} to
- * map arbitrary objects to ExternalReferenceSPI instances if encountered during
- * the registration process. This SPI is only used if the boolean
- * useConverterSPI parameter is set to true on that method.
- *
- * @author Tom Oinn
- *
- */
-public interface ValueToReferenceConverterSPI {
-
- /**
- * Can this SPI implementation convert the specified object to an
- * ExternalReferenceSPI? This test should be as lightweight as possible, and
- * will usually be based on the Class of the object supplied.
- *
- * @param context
- * a ReferenceContext to use if required by the plugin, the
- * ability to convert should be interpreted in the scope of this
- * context. In general the context probably not used by most
- * implementations but it's here if required.
- *
- * @return whether this converter is applicable to the specified object
- */
- public boolean canConvert(Object o, ReferenceContext context);
-
- /**
- * Construct and return a new ExternalReferenceSPI implementation which is
- * in some way equivalent to the supplied object. This is not intended to be
- * a two-way process necessarily, although the conversion should attempt to
- * be conservative (so not actually changing the data!).
- *
- * @param context
- * a ReferenceContext to use, if required, during construction of
- * the new external reference
- * @return A new instance of ExternalReferenceSPI which references, as far
- * as possible, the value represented by the specified object
- * @throws ValueToReferenceConversionException
- * if any problem occurs during the conversion
- */
- public ExternalReferenceSPI convert(Object o, ReferenceContext context)
- throws ValueToReferenceConversionException;
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java
deleted file mode 100644
index f8e2477..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.sf.taverna.t2.reference.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Applied to methods in Dao implementations which delete data in the
- * backing store.
- *
- * @author Stuart Owen
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface DeleteIdentifiedOperation {
-
- //
-
-}
\ No newline at end of file
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java
deleted file mode 100644
index c7cff36..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * Applied to methods in Dao implementations which fetch data from the backing
- * store by ID
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface GetIdentifiedOperation {
-
- //
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java
deleted file mode 100644
index 844a407..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-
-/**
- * Applied to methods in Dao implementations which store or update data in the
- * backing store.
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-public @interface PutIdentifiedOperation {
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html
deleted file mode 100644
index 0d38e1e..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-Annotations to make methods in the data access object implementations
-for cache injection.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java
deleted file mode 100644
index 531ed3f..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.h3;
-
-/**
- * A marker used to denote that the class should be pre-loaded into hibernate's
- * class mapping. Used for component classes which are not going to be mapped to
- * the RDBMS but which must be loadable for mapped classes to instantiate
- * correctly. Basically if you refer to a class that isn't itself going to be
- * mapped in hibernate within a mapping definition you'll need to add that
- * component class to this SPI or hibernate won't be able to find it as it won't
- * know that it should associate it with the appropriate class loader.
- * <p>
- * This should be used as an SPI marker, and set as the first SPI registry in
- * the preloadRegistries property of the SpiRegistryAwareLocalSessionFactoryBean
- *
- * @author Tom Oinn
- *
- */
-public interface HibernateComponentClass {
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java
deleted file mode 100644
index 3b7e910..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.h3;
-
-/**
- * A marker interface used to denote that the component should be registered
- * with the Hibernate ORM system prior to any ExternalReferenceSPI
- * implementations. This is here to allow implementations of e.g. ReferenceSet
- * to be in the implementation package where they belong and still guarantee
- * that they are registered before any other plugins.
- * <p>
- * This should be used as an SPI marker, and set as the first SPI registry in
- * the spiRegistries property of the SpiRegistryAwareLocalSessionFactoryBean
- *
- * @author Tom Oinn
- *
- */
-public interface HibernateMappedEntity {
-
-}
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html
deleted file mode 100644
index 4ffba14..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<body>
-Contains the marker interfaces used by the implementation package to
-ensure that all appropriate classes are mapped in hibernate
-<em>before</em>
-implementations of classes that depend upon them, and to ensure that
-'static' classes such as the implementations of reference set etc are
-mapped correctly.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/package.html b/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/package.html
deleted file mode 100644
index 378f20d..0000000
--- a/trunk/reference-api/src/main/java/net/sf/taverna/t2/reference/package.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<body>
-<p>Interfaces for the Taverna 2 reference manager. This replaces the
-(badly named) DataManager and is, in effect, a version 2 of that system.
-While these APIs are implementation neutral the intent is heavily
-towards the use of an object relational mapping (ORM) tool such as
-Hibernate backed by a relational database to hold the various
-collection, external reference and error documents managed by the
-reference manager.</p>
-<p>For those familiar with the previous DataManager code the table
-below shows the old class names and the equivalent (where appropriate)
-in the new code:
-<table>
- <tr>
- <td>DataDocument</td>
- <td>{@link net.sf.taverna.t2.reference.ReferenceSet}</td>
- </tr>
- <tr>
- <td>ReferenceScheme</td>
- <td>{@link net.sf.taverna.t2.reference.ExternalReferenceSPI}</td>
- </tr>
- <tr>
- <td>EntityIdentifier</td>
- <td>{@link net.sf.taverna.t2.reference.T2Reference}</td>
- </tr>
- <tr>
- <td colspan="2">...</td>
- </tr>
-</table>
-</p>
-<p>One fundamental change is a move to runtime exceptions rather
-than checked exceptions. This follows the pattern used by Spring and
-Hibernate. The rationale is the same as in those systems - in general
-checked exceptions are not handled properly by client code. The loss of
-compiler level functionality from moving to runtime exceptions is
-countered by much higher readability of code which in itself leads to
-more robust and reliable systems.</p>
-<p>A second change is the availability of asynchronous versions of
-all the critical APIs. Reference construction or translation in
-particular can be a costly process taking substantial time to complete.
-Synchronous versions of the get methods still exist but in general the
-simple callback based asynchronous ones are recommended over them for
-most applications.</p>
-</body>
\ No newline at end of file
diff --git a/trunk/reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml b/trunk/reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
deleted file mode 100644
index e8851e9..0000000
--- a/trunk/reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for the abstract superclass of -->
-<!-- ExternalReferenceSPI implementations -->
-<hibernate-mapping>
- <class name="net.sf.taverna.t2.reference.AbstractExternalReference"
- abstract="true">
- <!-- Let hibernate choose the primary key generation strategy -->
- <id name="primaryKey" unsaved-value="0" column="bean_id">
- <generator class="native" />
- </id>
- </class>
-</hibernate-mapping>
\ No newline at end of file
diff --git a/trunk/reference-impl/pom.xml b/trunk/reference-impl/pom.xml
deleted file mode 100644
index 71ef238..0000000
--- a/trunk/reference-impl/pom.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-impl</artifactId>
- <name>Implementation package for the T2 reference manager</name>
- <description>
- Implementations of the core APIs, not including extension point
- implementations. The extension point implementations that can be
- considered as core functionality (files, URLs etc) are held in
- the t2reference-core-extensions package. This package contains
- implementations of the data access objects, translator
- infrastructure etc.
- </description>
- <properties>
- <spring.version>2.5.4</spring.version>
- <aspectj.version>1.6.0</aspectj.version>
- </properties>
-
- <dependencies>
-
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.infrastructure</groupId>
- <artifactId>raven</artifactId>
- <version>${t2.infrastructure.version}</version>
- </dependency>
-
- <dependency>
- <groupId>net.sf.taverna.t2.infrastructure</groupId>
- <artifactId>appconfig</artifactId>
- <version>${t2.infrastructure.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.derby</groupId>
- <artifactId>derby</artifactId>
- <version>10.5.3.0_1</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- <version>3.2.5.ga.raven</version>
- <exclusions>
- <exclusion>
- <groupId>javax.transaction</groupId>
- <artifactId>jta</artifactId>
- </exclusion>
- <exclusion>
- <groupId>net.sf.ehcache</groupId>
- <artifactId>ehcache</artifactId>
- </exclusion>
- <exclusion>
- <groupId>asm</groupId>
- <artifactId>asm-attrs</artifactId>
- </exclusion>
- <exclusion>
- <groupId>antlr</groupId>
- <artifactId>antlr</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
-
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.1</version>
- </dependency>
-
- <dependency>
- <groupId>geronimo-spec</groupId>
- <artifactId>geronimo-spec-jta</artifactId>
- <version>1.0-M1</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-orm</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-jdbc</artifactId>
- <version>${spring.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjrt</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.aspectj</groupId>
- <artifactId>aspectjweaver</artifactId>
- <version>${aspectj.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
-
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactDefinitionDecorator.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactDefinitionDecorator.java
deleted file mode 100644
index 93de073..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactDefinitionDecorator.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.RavenConstants.ARTIFACT_BEAN_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.ARTIFACT_XML_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.REPOSITORY_BEAN_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.REPOSITORY_XML_ATTRIBUTE_NAME;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.config.BeanDefinitionHolder;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.xml.BeanDefinitionDecorator;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Node;
-
-/**
- * Pulls artifact attributes out of beans and decorates the bean definitions
- * with an artifact property, this can then be used to intervene in the
- * classloading strategy in the modified raven aware application context
- * implementation.
- *
- * @author Tom Oinn
- *
- */
-public class ArtifactDefinitionDecorator implements BeanDefinitionDecorator {
-
- private Log log = LogFactory.getLog(ArtifactDefinitionDecorator.class);
-
- public BeanDefinitionHolder decorate(Node source,
- BeanDefinitionHolder holder, ParserContext context) {
- AbstractBeanDefinition definition = ((AbstractBeanDefinition) holder
- .getBeanDefinition());
- Attr attribute = (Attr) source;
- if (attribute.getLocalName().equals(ARTIFACT_XML_ATTRIBUTE_NAME)) {
- String artifactSpecifier = attribute.getValue();
- definition.setAttribute(ARTIFACT_BEAN_ATTRIBUTE_NAME,
- artifactSpecifier);
- } else if (attribute.getLocalName().equals(
- REPOSITORY_XML_ATTRIBUTE_NAME)) {
- String repositoryBeanName = attribute.getValue();
- definition.setAttribute(REPOSITORY_BEAN_ATTRIBUTE_NAME,
- repositoryBeanName);
- String[] dependsOn = definition.getDependsOn();
- if (dependsOn == null) {
- dependsOn = new String[] { repositoryBeanName };
- } else {
- List<String> dependencies = new ArrayList<String>(Arrays
- .asList(dependsOn));
- dependencies.add(repositoryBeanName);
- dependsOn = dependencies.toArray(new String[0]);
- }
- definition.setDependsOn(dependsOn);
- }
- log.debug("Decorated bean '"+holder.getBeanName()+"'");
- return holder;
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactSupportNamespaceHandler.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactSupportNamespaceHandler.java
deleted file mode 100644
index b98227c..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/ArtifactSupportNamespaceHandler.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.RavenConstants.ARTIFACT_XML_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.REPOSITORY_XML_ATTRIBUTE_NAME;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
-
-/**
- * Namespace handler to associate the artifact definition decorator with the
- * raven attributes, specifically the 'repository' and 'artifact' attributes on
- * raven-enabled bean definitions.
- *
- * @author Tom Oinn
- *
- */
-public class ArtifactSupportNamespaceHandler extends NamespaceHandlerSupport {
-
- private Log log = LogFactory.getLog(ArtifactSupportNamespaceHandler.class);
-
- public void init() {
- ArtifactDefinitionDecorator decorator = new ArtifactDefinitionDecorator();
- registerBeanDefinitionDecoratorForAttribute(
- ARTIFACT_XML_ATTRIBUTE_NAME, decorator);
- registerBeanDefinitionDecoratorForAttribute(
- REPOSITORY_XML_ATTRIBUTE_NAME, decorator);
- registerBeanDefinitionParser("repository",
- new RepositoryBeanDefinitionParser());
- log.debug("Registered handlers for raven support namespace");
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/InstanceRegistryFactoryBean.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/InstanceRegistryFactoryBean.java
deleted file mode 100644
index 556ce23..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/InstanceRegistryFactoryBean.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import java.util.List;
-
-import net.sf.taverna.raven.spi.InstanceRegistry;
-import net.sf.taverna.raven.spi.SpiRegistry;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.FactoryBean;
-
-/**
- * Factory bean for the SPI instance registry functionality in Raven. Inject an
- * SpiRegistry and a list of constructor arguments to initialize.
- *
- * @author Tom Oinn
- *
- */
-public class InstanceRegistryFactoryBean implements FactoryBean {
-
- private SpiRegistry classRegistry = null;
- private List<Object> constructorArgs = null;
- private Log log = LogFactory.getLog(InstanceRegistryFactoryBean.class);
-
- /**
- * Return a newly constructed InstanceRegistry. If the spi registry property
- * isn't defined this method throws a runtime exception and logs the problem
- * to the logging system.
- */
- @SuppressWarnings("unchecked")
- public Object getObject() throws Exception {
- if (classRegistry != null) {
- Object[] args;
- if (constructorArgs != null) {
- args = constructorArgs.toArray();
- } else {
- args = new Object[0];
- }
- return new InstanceRegistry(classRegistry, args);
- } else {
- log.error("Must specify spiRegistry property"
- + " to construct an InstanceRegistry");
- throw new RuntimeException();
- }
- }
-
- /**
- * Inject an SpiRegistry instance to provide classes to instantiate objects
- * from within the instance registry
- */
- public void setSpiRegistry(SpiRegistry registry) {
- this.classRegistry = registry;
- }
-
- /**
- * Optionally specify a list of arguments to the constructors of classes in
- * the spi registry. If this property is undefined it defaults to using an
- * empty constructor list, in general this is the required behaviour when
- * constructing beans as they'll always have a default constructor.
- */
- public void setConstructorArgs(List<Object> args) {
- this.constructorArgs = args;
- }
-
- /**
- * @return InstanceRegistry.class
- */
- @SuppressWarnings("unchecked")
- public Class getObjectType() {
- return InstanceRegistry.class;
- }
-
- /**
- * Singleton by default
- */
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/LoggingConfigurer.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/LoggingConfigurer.java
deleted file mode 100644
index b347a0e..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/LoggingConfigurer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * A simple bean that can be used to set logging options - not really worth
- * bothering with at the moment, use the log4j.xml instead.
- *
- * @author Tom Oinn
- *
- */
-public class LoggingConfigurer {
-
- @SuppressWarnings("unchecked")
- public LoggingConfigurer(Properties props) {
- Iterator i = props.keySet().iterator();
- while (i.hasNext()) {
- String loggerName = (String) i.next();
- String levelName = props.getProperty(loggerName);
- try {
- Level level = Level.parse(levelName);
- Logger l = Logger.getLogger(loggerName);
- l.setLevel(level);
- } catch (IllegalArgumentException e) {
- System.err.println("WARNING: Unable to parse '" + levelName
- + "' as a java.util.Level for logger " + loggerName
- + "; ignoring...");
- }
- }
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/PropertyInterpolator.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/PropertyInterpolator.java
deleted file mode 100644
index 54695a0..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/PropertyInterpolator.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Static utility to insert string properties from a Properties object in place
- * of ${property.name} parts of the supplied string.
- *
- * @author Tom Oinn
- *
- */
-public final class PropertyInterpolator {
-
- private static String regex = "\\$\\{([\\w\\.]+)\\}";
- private static Pattern pattern;
- private static Log log = LogFactory.getLog(PropertyInterpolator.class);
-
- static {
- pattern = Pattern.compile(regex);
- }
-
- /**
- * Perform property interpolation using the system properties object
- *
- * @param sourceString
- * a string containing zero or more ${...} elements corresponding
- * to properties to insert
- * @return the sourceString with property values inserted in place of
- * variables *
- * @throws RuntimeException
- * if a referenced property does not exist in the system
- * properties
- */
- public static String interpolate(String sourceString) {
- return interpolate(sourceString, System.getProperties());
- }
-
- /**
- * Perform property interpolation using the supplied properties object
- *
- * @param sourceString
- * a string containing zero or more ${...} elements corresponding
- * to properties to insert
- * @param props
- * the properties object from which property values should be
- * extracted
- * @return the sourceString with property values inserted in place of
- * variables
- * @throws RuntimeException
- * if a referenced property does not exist in the supplied
- * properties object
- */
- public static String interpolate(String sourceString, Properties props) {
- Matcher matcher = pattern.matcher(sourceString);
- StringBuffer sb = new StringBuffer();
- int cursor = 0;
- while (matcher.find()) {
- String propertyValue = props.getProperty(matcher.group(1));
- if (propertyValue == null) {
- log.warn("Attempt to interpolate an undefined property '"
- + matcher.group(1) + "'");
- throw new RuntimeException("Can't locate property '"
- + matcher.group(1) + "'");
- }
- sb.append(sourceString.substring(cursor, matcher.start()));
- sb.append(propertyValue);
- cursor = matcher.end();
- }
- sb.append(sourceString.substring(cursor));
- return sb.toString();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareClassPathXmlApplicationContext.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareClassPathXmlApplicationContext.java
deleted file mode 100644
index c35df48..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareClassPathXmlApplicationContext.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * A subclass of the ClassPathXmlApplicationContext which uses the raven aware
- * bean factory and therefore can cope with the presence of raven repository and
- * artifact attributes correctly on beans within the configuration file. Use in
- * place of ClassPathXmlApplicationContext to magically enable raven support.
- *
- * @author Tom Oinn
- *
- */
-public class RavenAwareClassPathXmlApplicationContext extends
- ClassPathXmlApplicationContext {
-
- private static DefaultListableBeanFactory factory = new RavenAwareListableBeanFactory();
-
- public RavenAwareClassPathXmlApplicationContext(String param) {
- super(param);
- }
-
- @Override
- protected DefaultListableBeanFactory createBeanFactory() {
- return factory;
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareListableBeanFactory.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareListableBeanFactory.java
deleted file mode 100644
index acec806..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenAwareListableBeanFactory.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.RavenConstants.ARTIFACT_BEAN_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.REPOSITORY_BEAN_ATTRIBUTE_NAME;
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.ArtifactNotFoundException;
-import net.sf.taverna.raven.repository.ArtifactStateException;
-import net.sf.taverna.raven.repository.ArtifactStatus;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.CannotLoadBeanClassException;
-import org.springframework.beans.factory.support.DefaultListableBeanFactory;
-import org.springframework.beans.factory.support.RootBeanDefinition;
-import org.springframework.core.DecoratingClassLoader;
-import org.springframework.util.ClassUtils;
-
-/**
- * A subclass of DefaultListableBeanFactory which is aware of raven. Overrides
- * the class resolution mechanism within the bean factory to use raven's
- * artifact class loading if the appropriate attributes are defined on the bean
- * definition. These attributes are set by the ArtifactDefinitionDecorator,
- * which is in turn driven by a trivial extension to spring's XML based
- * configuration schema.
- *
- * @author Tom Oinn
- *
- */
-public class RavenAwareListableBeanFactory extends DefaultListableBeanFactory {
-
- private Log log = LogFactory.getLog(RavenAwareListableBeanFactory.class);
-
- @SuppressWarnings("unchecked")
- @Override
- protected Class resolveBeanClass(RootBeanDefinition rbd, String beanName,
- Class[] typesToMatch) throws CannotLoadBeanClassException {
-
- try {
-
- if (rbd.hasBeanClass()) {
- return rbd.getBeanClass();
- }
-
- if (typesToMatch != null && getTempClassLoader() != null) {
- String className = rbd.getBeanClassName();
- ClassLoader tempClassLoader = getTempClassLoader();
- if (tempClassLoader instanceof DecoratingClassLoader) {
- DecoratingClassLoader dcl = (DecoratingClassLoader) tempClassLoader;
- for (int i = 0; i < typesToMatch.length; i++) {
- dcl.excludeClass(typesToMatch[i].getName());
- }
- }
- return (className != null ? ClassUtils.forName(className,
- tempClassLoader) : null);
- }
-
- if (rbd.hasAttribute(REPOSITORY_BEAN_ATTRIBUTE_NAME)
- && rbd.hasAttribute(ARTIFACT_BEAN_ATTRIBUTE_NAME)) {
- String repositoryBeanName = (String) rbd
- .getAttribute(REPOSITORY_BEAN_ATTRIBUTE_NAME);
- String artifact = (String) rbd
- .getAttribute(ARTIFACT_BEAN_ATTRIBUTE_NAME);
- Repository repository = (Repository) getBean(repositoryBeanName);
- if (repository == null) {
- log.error("No repository bean with name '"
- + repositoryBeanName + "' in this context");
- throw new CannotLoadBeanClassException(rbd
- .getResourceDescription(), beanName, rbd
- .getBeanClassName(), new ClassNotFoundException(
- "No such repository"));
- }
- synchronized (repository) {
- String[] s = artifact.split(":");
- if (s.length != 3) {
- log.error("Artifact specifier '" + artifact
- + "' is badly formed for bean '" + beanName
- + "'");
- throw new CannotLoadBeanClassException(rbd
- .getResourceDescription(), beanName, rbd
- .getBeanClassName(),
- new ClassNotFoundException(
- "Badly formed artifact specifier"));
- }
- Artifact a = new BasicArtifact(s[0], s[1], s[2]);
- log.debug("Artifact " + a + " for bean name " + beanName);
-
- if (repository.getStatus(a) != ArtifactStatus.Ready) {
- log.debug(" has state " + repository.getStatus(a));
- repository.addArtifact(a);
- repository.update();
- }
- log.debug(" has state (2) " + repository.getStatus(a));
- try {
- // ClassLoader cl = repository.getLoader(a,
- // this.getClass()
- // .getClassLoader());
- ClassLoader cl;
- try {
- cl = repository.getLoader(a, null);
- }
- catch (ArtifactStateException ex) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- log.error(e);
- }
- cl = repository.getLoader(a, null);
- }
- log.debug("Loading class " + rbd.getBeanClassName()
- + " from artifact " + a);
-
- return rbd.resolveBeanClass(cl);
-
- } catch (ArtifactNotFoundException ex) {
- log
- .error("No such artifact '" + a.toString()
- + "'", ex);
- throw new CannotLoadBeanClassException(rbd
- .getResourceDescription(), beanName, rbd
- .getBeanClassName(),
- new ClassNotFoundException(ex.getMessage(), ex));
- } catch (ArtifactStateException ex) {
- log.error("Artifact in incorrect state '"
- + a.toString() + "' is in state "
- + ex.getState()
- + " with reported state in repository "
- + repository.getStatus(a) + " for bean "
- + beanName, ex);
- throw new CannotLoadBeanClassException(rbd
- .getResourceDescription(), beanName, rbd
- .getBeanClassName(),
- new ClassNotFoundException(ex.getMessage(), ex));
- }
- }
- } else {
- return rbd.resolveBeanClass(getBeanClassLoader());
- }
- } catch (ClassNotFoundException ex) {
- throw new CannotLoadBeanClassException(
- rbd.getResourceDescription(), beanName, rbd
- .getBeanClassName(), ex);
- } catch (LinkageError err) {
- throw new CannotLoadBeanClassException(
- rbd.getResourceDescription(), beanName, rbd
- .getBeanClassName(), err);
- }
-
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenConstants.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenConstants.java
deleted file mode 100644
index 274ada5..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenConstants.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-/**
- * String constants used by the raven spring support package.
- *
- * @author Tom Oinn
- *
- */
-public class RavenConstants {
-
- /**
- * The name of the property defined on raven-enabled BeanDefinition
- * instances to point to the name of the repository bean within the bean
- * factory
- */
- public static String REPOSITORY_BEAN_ATTRIBUTE_NAME = "ravenRepositoryBean";
-
- /**
- * The name of the property defined on raven-enabled BeanDefinition
- * instances specifying the artifact that should be used to load this bean
- * definition's associated bean class. The artifact is specified as a
- * group:artifact:version string.
- */
- public static String ARTIFACT_BEAN_ATTRIBUTE_NAME = "ravenArtifact";
-
- /**
- * The XML attribute name used to decorate the raven-enabled bean definition
- * in the application context configuration to point to the repository bean
- * id within that definition
- */
- public static String REPOSITORY_XML_ATTRIBUTE_NAME = "repository";
-
- /**
- * The XML attribute name used to specify the artifact to be used by a
- * particular raven-enabled bean within the configuration xml.
- */
- public static String ARTIFACT_XML_ATTRIBUTE_NAME = "artifact";
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenEagerArtifactDownload.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenEagerArtifactDownload.java
deleted file mode 100644
index bd2dc21..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RavenEagerArtifactDownload.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.RavenConstants.ARTIFACT_BEAN_ATTRIBUTE_NAME;
-import static net.sf.taverna.platform.spring.RavenConstants.REPOSITORY_BEAN_ATTRIBUTE_NAME;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-
-/**
- * Include this bean in the application context to enumerate and force download
- * of any artifacts referenced by raven-enabled beans in the same context.
- * Doesn't do much other than print out the artifact list at the moment as it
- * appears the class definitions are loaded eagerly even if the beans themselves
- * aren't.
- *
- * @author Tom Oinn
- *
- */
-public class RavenEagerArtifactDownload implements BeanFactoryPostProcessor {
-
- private Log log = LogFactory.getLog(RavenEagerArtifactDownload.class);
-
- /**
- * Will use this method to automatically load all artifacts used by beans in
- * the repository prior to instantiation, more efficient than doing so on
- * initialization but something to leave for now.
- */
- public void postProcessBeanFactory(ConfigurableListableBeanFactory factory)
- throws BeansException {
- log.debug("Eager load of raven artifacts enabled, loading...");
- Map<String, Set<Artifact>> artifactsToLoad = new HashMap<String, Set<Artifact>>();
- for (String beanName : factory.getBeanDefinitionNames()) {
- BeanDefinition bd = factory.getBeanDefinition(beanName);
- if (bd.hasAttribute(REPOSITORY_BEAN_ATTRIBUTE_NAME)
- && bd.hasAttribute(ARTIFACT_BEAN_ATTRIBUTE_NAME)) {
- String repositoryBeanName = (String) bd
- .getAttribute(REPOSITORY_BEAN_ATTRIBUTE_NAME);
- String[] s = ((String) bd
- .getAttribute(ARTIFACT_BEAN_ATTRIBUTE_NAME)).split(":");
- Artifact a = new BasicArtifact(s[0], s[1], s[2]);
- if (!artifactsToLoad.containsKey(repositoryBeanName)) {
- artifactsToLoad.put(repositoryBeanName,
- new HashSet<Artifact>());
- }
- artifactsToLoad.get(repositoryBeanName).add(a);
- }
- }
- for (String repositoryBeanName : artifactsToLoad.keySet()) {
- Repository r = (Repository) factory.getBean(repositoryBeanName);
- log.debug("Repository : " + repositoryBeanName);
- for (Artifact a : artifactsToLoad.get(repositoryBeanName)) {
- r.addArtifact(a);
- log.debug(" " + a.toString());
- }
- r.update();
- }
- log.debug("Raven artifacts loaded");
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryBeanDefinitionParser.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryBeanDefinitionParser.java
deleted file mode 100644
index 2eb02f8..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryBeanDefinitionParser.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.springframework.beans.factory.support.BeanDefinitionBuilder;
-import org.springframework.beans.factory.xml.AbstractBeanDefinitionParser;
-import org.springframework.beans.factory.xml.ParserContext;
-import org.springframework.util.xml.DomUtils;
-import org.w3c.dom.Element;
-
-/**
- * Customized version of the configuration for the repository bean. This allows
- * a more compact form of the repository specification, and potentially error
- * checking through IDE schema support which is not available when we just
- * instantiate the helper factory bean directly.
- *
- * @author Tom Oinn
- *
- */
-public class RepositoryBeanDefinitionParser extends
- AbstractBeanDefinitionParser {
-
- /**
- * The overall intent here is to construct a bean definition to the
- * repository factory bean which will then allow it to produce a repository
- * object when fully instantiated. Really just a convenience method to avoid
- * having to set the bean manually. Not implemented yet!
- */
- @SuppressWarnings("unchecked")
- @Override
- protected AbstractBeanDefinition parseInternal(Element element,
- ParserContext context) {
- BeanDefinitionBuilder factory = BeanDefinitionBuilder
- .rootBeanDefinition(RepositoryFactoryBean.class);
- // Do the 'base' property
- factory.addPropertyValue("base", element.getAttribute("base"));
-
- Element systemArtifactElement = DomUtils.getChildElementByTagName(
- element, "system");
- List<Element> systemChildElements = DomUtils.getChildElementsByTagName(
- systemArtifactElement, "sys");
- if (systemChildElements != null && systemChildElements.size() > 0) {
- List<String> systemArtifactList = new ArrayList<String>();
- for (Element e : systemChildElements) {
- systemArtifactList.add(e.getAttribute("artifact"));
- }
- factory.addPropertyValue("systemArtifacts", systemArtifactList);
- }
-
- Element repositoriesElement = DomUtils.getChildElementByTagName(
- element, "repositories");
- List<Element> repositoriesElements = DomUtils
- .getChildElementsByTagName(repositoriesElement, "rep");
- if (repositoriesElements != null && systemChildElements.size() > 0) {
- List<String> repositoryList = new ArrayList<String>();
- for (Element e : repositoriesElements) {
- repositoryList.add(e.getAttribute("url"));
- }
- factory.addPropertyValue("remoteRepositoryList", repositoryList);
- }
-
- return factory.getBeanDefinition();
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryFactoryBean.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryFactoryBean.java
deleted file mode 100644
index 0f3a2a1..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/RepositoryFactoryBean.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.PropertyInterpolator.interpolate;
-
-import java.io.File;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-import net.sf.taverna.raven.repository.impl.LocalRepository;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.FactoryBean;
-
-/**
- * A FactoryBean used to configure and instantiate a raven Repository object.
- * Allows construction of file base path, remote repository list and system
- * artifact list through setter injection from within spring and delegates to
- * LocalRepository.getRepository(File, ClassLoader, List<Artifact>) to
- * construct the Repository object.
- * <p>
- * Because this implements FactoryBean, spring will return the result of the
- * getObject method rather than the bean itself.
- *
- * @author Tom Oinn
- */
-public class RepositoryFactoryBean implements FactoryBean {
-
- private Log log = LogFactory.getLog(RepositoryFactoryBean.class);
-
- private List<String> systemArtifactStrings = null;
- private String baseLocation = null;
- private List<String> remoteRepositories = null;
-
- public Object getObject() throws Exception {
- File base = new File(interpolate(baseLocation));
- Set<Artifact> systemArtifacts = new HashSet<Artifact>();
- for (String systemArtifactSpec : systemArtifactStrings) {
- String[] s = interpolate(systemArtifactSpec).split(":");
- Artifact a = new BasicArtifact(s[0], s[1], s[2]);
- systemArtifacts.add(a);
- }
- Repository r = LocalRepository.getRepository(base, this.getClass()
- .getClassLoader(), systemArtifacts);
-
- for (String repositoryLocationString : remoteRepositories) {
- try {
- r.addRemoteRepository(new URL(
- interpolate(repositoryLocationString)));
- } catch (RuntimeException ex) {
- // Don't add repositories which cause an error on instantiation,
- // this can be because the URL is invalid but can also occur if
- // the interpolation attempts to use a property that isn't
- // defined. This can be used intentionally to add repositories
- // only if a property is set.
- log
- .warn("Missing property in interpolation, ignoring remote repository entry "
- + repositoryLocationString);
- } catch (MalformedURLException mue) {
- log.error("Malformed remote repository URL",mue);
- }
- }
- r.update();
- log.info("Constructed raven repository at '" + base + "'");
- return r;
- }
-
- public void setSystemArtifacts(List<String> systemArtifacts) {
- this.systemArtifactStrings = systemArtifacts;
- }
-
- public void setBase(String baseLocation) {
- this.baseLocation = baseLocation;
- }
-
- public void setRemoteRepositoryList(List<String> remoteRepositories) {
- this.remoteRepositories = remoteRepositories;
- }
-
- @SuppressWarnings("unchecked")
- public Class getObjectType() {
- return Repository.class;
- }
-
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/SpiRegistryFactoryBean.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/SpiRegistryFactoryBean.java
deleted file mode 100644
index b4a07db..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/SpiRegistryFactoryBean.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import java.util.List;
-
-import net.sf.taverna.raven.repository.Repository;
-import net.sf.taverna.raven.spi.ArtifactFilter;
-import net.sf.taverna.raven.spi.SpiRegistry;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.FactoryBean;
-
-/**
- * Factory bean for the SpiRegistry functionality in Raven. Exposes the
- * repository, spi name and filter list properties. Initializes the spi registry
- * before returning it, constructed instances are ready to use.
- *
- * @author Tom Oinn
- *
- */
-public class SpiRegistryFactoryBean implements FactoryBean {
-
- List<ArtifactFilter> filterList = null;
- Repository repository = null;
- String spiClassName = null;
- private Log log = LogFactory.getLog(SpiRegistryFactoryBean.class);
-
- public Object getObject() throws Exception {
- if (repository != null && spiClassName != null) {
- SpiRegistry registry = new SpiRegistry(repository, spiClassName,
- null);
- if (filterList != null) {
- registry.setFilters(filterList);
- }
- registry.updateRegistry();
- return registry;
- }
- log
- .error("Must specify repository and spi class name for spi registry");
- throw new RuntimeException();
- }
-
- public void setFilterList(List<ArtifactFilter> filterList) {
- this.filterList = filterList;
- }
-
- public void setRepository(Repository repository) {
- this.repository = repository;
- }
-
- public void setSpiClassName(String spiClassName) {
- this.spiClassName = spiClassName;
- }
-
- /**
- * @return SpiRegistry.class
- */
- @SuppressWarnings("unchecked")
- public Class getObjectType() {
- return SpiRegistry.class;
- }
-
- /**
- * Singleton by default
- */
- public boolean isSingleton() {
- return true;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/DriverProxy.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/DriverProxy.java
deleted file mode 100644
index a4014d4..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/DriverProxy.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.SQLException;
-import java.util.Properties;
-
-/**
- * A proxy implementation of the java.sql.Driver interface, used to act as a
- * proxy in the platform classloading environment to a 'real' JDBC driver
- * registered from a different class loader. We need to do this because the
- * DriverManager implementation uses native methods to hide drivers loaded by
- * other classloaders than the one used to construct the caller, this way we can
- * have a real JDBC driver loaded from a raven artifact and have an instance of
- * the proxy loaded through the platform acting as a view over it.
- * <p>
- * To use this you should use the {@link ProxyDriverManager}.
- *
- * @author Tom Oinn
- *
- */
-public class DriverProxy implements Driver {
-
- /**
- * The driver being proxied
- */
- private final Driver target;
-
- /**
- * This is always constructed from ProxyDriverManager
- *
- * @param target
- * Driver to proxy
- */
- DriverProxy(java.sql.Driver target) {
- if (target == null) {
- throw new NullPointerException();
- }
- this.target = target;
- }
-
- /**
- * Get the proxied driver instance
- */
- public Driver getTarget() {
- return target;
- }
-
- /**
- * Retrieves whether the target driver thinks that it can open a connection
- * to the given URL.
- */
- public boolean acceptsURL(String url) throws SQLException {
- return target.acceptsURL(url);
- }
-
- /**
- * Uses the target Driver to attempt to make a database connection to the
- * given URL.
- */
- public Connection connect(String url, Properties info) throws SQLException {
- return target.connect(url, info);
- }
-
- /**
- * Retrieves the target driver's major version number.
- */
- public int getMajorVersion() {
- return target.getMajorVersion();
- }
-
- /**
- * Gets the target driver's minor version number.
- */
- public int getMinorVersion() {
- return target.getMinorVersion();
- }
-
- /**
- * Gets information about the possible properties for the target driver.
- */
- public java.sql.DriverPropertyInfo[] getPropertyInfo(String url,
- java.util.Properties info) throws SQLException {
- return target.getPropertyInfo(url, info);
- }
-
- /**
- * Reports whether the target driver is a genuine JDBC Compliant driver.
- */
- public boolean jdbcCompliant() {
- return target.jdbcCompliant();
- }
-
- /**
- * Wrap original string description to denote a proxy driver in debug output
- */
- @Override
- public String toString() {
- return "Proxy JDBC driver for : " + target;
- }
-
- /**
- * Pretend to be the target as far as hashcode is concerned.
- */
- @Override
- public int hashCode() {
- return target.hashCode();
- }
-
- /**
- * Equal if the other is also a DriverProxy and both have the same target
- */
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof DriverProxy)) {
- return false;
- }
- DriverProxy other = (DriverProxy) obj;
- return this.target.equals(other.target);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/InterpolatingDriverManagerDataSource.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/InterpolatingDriverManagerDataSource.java
deleted file mode 100644
index 98dcd70..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/InterpolatingDriverManagerDataSource.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import static net.sf.taverna.platform.spring.PropertyInterpolator.interpolate;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.springframework.jdbc.datasource.DriverManagerDataSource;
-import org.springframework.util.ClassUtils;
-
-/**
- * Subclass of the DriverManagerDataSource so we can use interpolated properties
- * in e.g. database URLs from the spring configuration. Interpolation is applied
- * to all set-able string properties.
- * <p>
- * In addition this class can be used to register JDBC drivers loaded from Raven
- * artifacts. If the optional 'repository' and 'driverArtifact' properties are
- * injected (of type Repository and String respectively) the specified driver
- * will be loaded from the artifact, including any download or other activity
- * needed to resolve it properly. The driver will be loaded in a temporary
- * classloader and a proxy to it loaded in the platform classloader, making it
- * visible to systems which can't see inside the artifact class loaders such as
- * Hibernate. If these properties are undefined the data source reverts to
- * default behaviour for a DriverManagerDataSource
- *
- * @author Tom Oinn
- *
- */
-public class InterpolatingDriverManagerDataSource extends
- DriverManagerDataSource {
-
- private Log log = LogFactory
- .getLog(InterpolatingDriverManagerDataSource.class);
-
- @Override
- public void setUrl(String newUrl) {
- super.setUrl(interpolate(newUrl));
- }
-
- @Override
- public void setUsername(String newUsername) {
- super.setUsername(interpolate(newUsername));
- }
-
- @Override
- public void setPassword(String newPassword) {
- super.setPassword(interpolate(newPassword));
- }
-
- private String myDriverClassName = null;
-
- @Override
- public void setDriverClassName(String newDriverClassName) {
- this.myDriverClassName = newDriverClassName.trim();
- }
-
- /**
- * Prevent automatic registration of class on load, defer until asked for so
- * we know whether we have an artifact specifier or not
- */
- @Override
- public String getDriverClassName() {
- return this.myDriverClassName;
- }
-
- private Repository repository = null;
- private Artifact driverArtifact = null;
-
- /**
- * Inject a raven repository object to fetch the driver artifact from if
- * specified
- *
- * @param rep
- */
- public void setRepository(Repository rep) {
- this.repository = rep;
- }
-
- /**
- * Inject a driver artifact specification, used if not null and as long as
- * there is an appropriate repository also injected.
- *
- * @param a
- */
- public void setDriverArtifact(String a) {
- String[] parts = a.split(":");
- driverArtifact = new BasicArtifact(parts[0], parts[1], parts[2]);
- }
-
- private boolean initialized = false;
-
- @Override
- protected synchronized Connection getConnectionFromDriverManager(
- String url, Properties props) throws SQLException {
- if (!initialized) {
- if (repository == null || driverArtifact == null) {
- // Perform regular style initialization through loading the
- // class by name
- try {
- Class.forName(getDriverClassName(), true, ClassUtils
- .getDefaultClassLoader());
- } catch (ClassNotFoundException cnfe) {
- log.error(
- "Can't fine the regular (non raven) JDBC driver class "
- + getDriverClassName(), cnfe);
- IllegalStateException ise = new IllegalStateException(
- "Could not load JDBC driver class ["
- + getDriverClassName() + "]");
- ise.initCause(cnfe);
- throw ise;
- }
- logger.info("Loaded non raven JDBC driver: "
- + getDriverClassName());
- } else {
- // Loading through raven using the funky proxied drivers
- ProxyDriverManager.registerDriver(repository, driverArtifact,
- getDriverClassName());
- }
- initialized = true;
- }
- return DriverManager.getConnection(url, props);
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyDriverManager.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyDriverManager.java
deleted file mode 100644
index be5f3e6..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyDriverManager.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import java.lang.reflect.Method;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Enumeration;
-
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.ArtifactStatus;
-import net.sf.taverna.raven.repository.Repository;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Supports registration of JDBC drivers with the DriverManager through Raven
- * artifact specified and classname. This internally causes Raven to download
- * the appropriate artifact if required.
- *
- * @author Tom Oinn
- *
- */
-public class ProxyDriverManager {
-
- private Log log = LogFactory.getLog(ProxyDriverManager.class);
-
- private static String proxyHelperClassName = "net.sf.taverna.platform.spring.jdbc.ProxyHelper";
-
- /**
- * Register a JDBC driver with the DriverManager, making it visible to the
- * platform's classloader.
- *
- * @param repository
- * a Raven repository to use when downloading and linking the
- * driver
- * @param driverArtifact
- * the maven artifact containing the JDBC driver
- * @param driverClassName
- * the JDBC driver class name
- */
- public static ProxyDriverManager registerDriver(Repository repository,
- Artifact driverArtifact, String driverClassName) {
- // First obtain the appropriate artifact...
- try {
- repository.addArtifact(driverArtifact);
- repository.update();
- if (repository.getStatus(driverArtifact).equals(
- ArtifactStatus.Ready) == false) {
- throw new RuntimeException("Cannot initialize artifact "
- + driverArtifact + " for JDBC driver "
- + driverClassName);
- }
- // Use the artifact class loader to infer the location of the
- // downloaded jar file.
- ClassLoader artifactLoader = repository.getLoader(driverArtifact,
- null);
-
- // URLs to use to populate the temporary class loader
- URL rootJarUrl = getRootJarUrl(driverClassName, artifactLoader);
- URL proxyHelperLocation = null;
- try {
- proxyHelperLocation = getProxyHelperLocation();
- } catch(IndexOutOfBoundsException e) {
- proxyHelperLocation = new URL(proxyHelperClassName);
- }
- ClassLoader loader;
- if (proxyHelperLocation != null) {
- loader = URLClassLoader.newInstance(new URL[] {rootJarUrl, proxyHelperLocation}, null);
- } else {
- loader = URLClassLoader.newInstance(new URL[] {rootJarUrl}, null);
- }
- URL[] loaderUrls = new URL[] {
- rootJarUrl,
- proxyHelperLocation };
- return new ProxyDriverManager(loader, driverClassName);
- } catch (Exception e) {
- throw new RuntimeException("Failed to register driver", e);
- }
- }
-
- private final ClassLoader loader;
- private final Method getClassLoader;
- private final Method deregisterDriver;
- private final Method getDrivers;
-
- private ProxyDriverManager(ClassLoader loader, String driverClassName)
- throws SQLException, ClassNotFoundException {
-
- this.loader = loader;
- Class<?> proxyHelperClass = null;
- // Get helper class
- try {
- proxyHelperClass = Class.forName(proxyHelperClassName, true, loader);
- } catch (ClassNotFoundException cnfe) {
- try {
- proxyHelperClass = Class.forName(proxyHelperClassName);
- }
- catch (ClassNotFoundException e) {
- log.error("Failed to locate proxy helper class", cnfe);
- throw new RuntimeException(e);
-}
- }
- final Class<?> helperClass = proxyHelperClass;
- // Find and store methods on helper class for later use
- try {
- this.deregisterDriver = helperClass.getMethod("deregisterDriver",
- Driver.class);
- this.getDrivers = helperClass.getMethod("getDrivers");
- this.getClassLoader = helperClass.getMethod("getClassLoader",
- Class.class);
- } catch (SecurityException se) {
- log.error("Can't access method in proxy helper", se);
- throw new RuntimeException(se);
- } catch (NoSuchMethodException nsme) {
- log.error("Can't locate method in proxy helper", nsme);
- throw new RuntimeException(nsme);
- }
- boolean registered = false;
- try {
- Class.forName(driverClassName, true, loader);
- registerProxyDrivers();
- registered = true;
- } finally {
- if (!registered) {
- deregister();
- }
- }
- }
-
- /**
- * Iterate over the drivers visible to the private classloader and register
- * proxy drivers for each one which are therefore visible to <em>this</em>
- * classloader.
- *
- * @throws SQLException
- */
- private void registerProxyDrivers() throws SQLException {
- for (Enumeration<?> en = getLoaderDrivers(); en.hasMoreElements();) {
- Driver driver = (Driver) en.nextElement();
- if (isLoaderClassLoader(driver.getClass())) {
- DriverProxy proxy = new DriverProxy(driver);
- DriverManager.registerDriver(proxy);
- }
- }
- }
-
- /**
- * De-register Drivers. Drivers in this context are de-registered. Some
- * cleanup of the dynamic class loader is required due to a memory leak in
- * JDBC.
- */
- public void deregister() throws SQLException {
- for (Enumeration<Driver> en = DriverManager.getDrivers(); en
- .hasMoreElements();) {
- Driver driver = en.nextElement();
- // If this is a DriverProxy then unload it from the DriverManager on
- // this side, also have to de-register the driver it's proxying on
- // the other side!
- if (driver instanceof DriverProxy) {
- DriverProxy proxy = (DriverProxy) driver;
- Driver target = proxy.getTarget();
- if (isLoaderClassLoader(target.getClass())) {
- DriverManager.deregisterDriver(proxy);
- }
- }
- }
- for (Enumeration<?> en = getLoaderDrivers(); en.hasMoreElements();) {
- Driver driver = (Driver) en.nextElement();
- try {
- deregisterDriver.invoke(null, driver);
- } catch (IllegalArgumentException exc) {
- throw new Error(exc);
- } catch (java.lang.reflect.InvocationTargetException exc) {
- Throwable cause = exc.getCause();
- if (cause instanceof SQLException) {
- throw (SQLException) cause;
- } else {
- throw new Error(exc);
- }
- } catch (java.lang.IllegalAccessException exc) {
- throw new Error(exc);
- }
- }
- }
-
- /**
- * Use reflection to call the DriverManager.getDrivers method through the
- * proxy helper. As this is in the same classloader as used to register the
- * JDBC driver from Raven we'll actually be able to see the registered
- * driver.
- *
- * @return enumeration of drivers in the DriverManager visible to the newly
- * created private classloader.
- */
- private Enumeration<?> getLoaderDrivers() {
- try {
- return (Enumeration<?>) getDrivers.invoke(null);
- } catch (IllegalArgumentException exc) {
- throw new Error(exc);
- } catch (java.lang.reflect.InvocationTargetException exc) {
- throw new Error(exc);
- } catch (java.lang.IllegalAccessException exc) {
- throw new Error(exc);
- }
- }
-
- /**
- * Indicates whether {@code clazz} was loaded by {@link #loader}.
- */
- private boolean isLoaderClassLoader(Class<?> clazz) {
- final ClassLoader clazzClassLoader;
- try {
- clazzClassLoader = (ClassLoader) getClassLoader.invoke(null, clazz);
- } catch (IllegalArgumentException exc) {
- throw new Error(exc);
- } catch (java.lang.reflect.InvocationTargetException exc) {
- Throwable cause = exc.getCause();
- if (cause instanceof SecurityException) {
- return false;
- } else {
- throw new Error(exc);
- }
- } catch (java.lang.IllegalAccessException exc) {
- throw new Error(exc);
- }
- return clazzClassLoader == this.loader;
- }
-
- private static URL getProxyHelperLocation() throws MalformedURLException {
- return getRootJarUrl(proxyHelperClassName, ProxyDriverManager.class
- .getClassLoader());
- }
-
- public static URL getRootJarUrl(String className, ClassLoader loader)
- throws MalformedURLException {
- if (loader == null) {
- loader = Thread.currentThread().getContextClassLoader();
- }
- String classAsResource = className.replaceAll("\\.", "/") + ".class";
- URL resourceURL = loader.getResource(classAsResource);
- String resourceFile = resourceURL.getFile();
- String result = "";
- if (resourceFile.contains(".jar")) {
- result = resourceURL.getFile().substring(0,
- resourceURL.getFile().indexOf(".jar"))
- + ".jar";
- } else {
- result = "file:" + resourceFile.substring(0, resourceFile.lastIndexOf("/")) + "/";
- }
- return new URL(result);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyHelper.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyHelper.java
deleted file mode 100644
index 860836e..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/ProxyHelper.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-
-/**
- * Acts as the bridge to the anonymous temporary classloader used to register
- * the real JDBC drivers. The ProxyDriverManager uses this to mediate access to
- * that anonymous class world and proxy it with a DriverProxy
- *
- * @author Tom Oinn
- */
-public class ProxyHelper {
-
- /**
- * Used to check whether we can 'see' the specified class.
- *
- * @throws SecurityException
- * generally thrown if class loaded by a different class loader
- * from us
- */
- public static ClassLoader getClassLoader(Class<?> theClass) {
- return theClass.getClassLoader();
- }
-
- /**
- * Calls the DriverManager.getDrivers method from the temporary classloader
- * environment.
- *
- * @return an enumeration of JDBC drivers visible to the temporary
- * classloader
- */
- public static java.util.Enumeration<Driver> getDrivers() {
- return DriverManager.getDrivers();
- }
-
- /**
- * Calls DriverManager.deregisterDriver on the DriverManager from the
- * temporary classloader environment, used along with deregistration of the
- * DriverProxy
- */
- public static void deregisterDriver(Driver driver) throws SQLException {
- DriverManager.deregisterDriver(driver);
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java
deleted file mode 100644
index ee79739..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Create JDBC connection strings for temporary use (ie. from tests)
- * <p>
- * {@link #getTemporaryDerbyJDBC()} creates a temporary directory that is used
- * to construct the JDBC connection string for a local Derby database.
- * </p>
- * <p>
- * This is most useful from a spring configuration, for example when using
- * {@link InterpolatingDriverManagerDataSource}:
- * </p>
- *
- * <pre>
- * <!-- Apache Derby rooted at a temporary directory -->
- * <bean id="t2reference.jdbc.temporaryjdbc"
- * class="net.sf.taverna.platform.spring.jdbc.TemporaryJDBC">
- * </bean>
- * <bean id="t2reference.jdbc.url" class="java.lang.String"
- * factory-bean="t2reference.jdbc.temporaryjdbc"
- * factory-method="getTemporaryDerbyJDBC" />
- * <bean id="t2reference.jdbc.datasource"
- * class="net.sf.taverna.platform.spring.jdbc.InterpolatingDriverManagerDataSource">
- * <property name="driverClassName">
- * <value>org.apache.derby.jdbc.EmbeddedDriver</value>
- * </property>
- * <property name="url">
- * <ref bean="t2reference.jdbc.url" />
- * </property>
- * <property name="repository">
- * <ref bean="raven.repository" />
- * </property>
- * <property name="driverArtifact">
- * <value>org.apache.derby:derby:10.4.1.3</value>
- * </property>
- * </bean>
- * </pre>
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class TemporaryJDBC {
- public String getTemporaryDerbyJDBC() throws IOException {
- File tmpDir = File.createTempFile("t2platform-", ".db");
- tmpDir.delete();
- if (!tmpDir.mkdir()) {
- throw new IOException("Could not create temporary directory "
- + tmpDir);
- }
- return "jdbc:derby:" + tmpDir.getPath() + "/database;create=true";
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html
deleted file mode 100644
index 2355a14..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<body>
-Extensions to the JDBC parts of Spring, and support for proxying of JDBC
-drivers so we can load them dynamically from raven artifacts. The proxy
-approach is inspired by http://www.jroller.com/tackline/entry/dynamically_loading_jdbc_drivers
-with additions to build from raven rather than from existing jar files.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/SpiRegistryAwareLocalSessionFactoryBean.java b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/SpiRegistryAwareLocalSessionFactoryBean.java
deleted file mode 100644
index 3495e00..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/SpiRegistryAwareLocalSessionFactoryBean.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.orm.hibernate3;
-
-import java.util.List;
-
-import net.sf.taverna.raven.spi.SpiRegistry;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.util.ReflectHelper;
-import org.springframework.orm.hibernate3.LocalSessionFactoryBean;
-
-/**
- * An extension to the regular spring hibernate session factory which allows an
- * additional property containing a list of SpiRegistry beans. If this is
- * defined then each SpiRegistry in the list is used to get a list of Class
- * objects and these are in turn used to add classes to the hibernate
- * configuration.
- *
- * @author Tom Oinn
- */
-public class SpiRegistryAwareLocalSessionFactoryBean extends
- LocalSessionFactoryBean {
-
- private Log log = LogFactory
- .getLog(SpiRegistryAwareLocalSessionFactoryBean.class);
- private List<SpiRegistry> spiRegistries = null;
- private List<SpiRegistry> preloadRegistries = null;
-
- /**
- * Set the list of SPI registries from which to pull class definitions for
- * mapped beans.
- *
- * @param spis
- */
- public void setSpiRegistries(List<SpiRegistry> spis) {
- log.debug("Set SPI registry list");
- this.spiRegistries = spis;
- }
-
- /**
- * Set the list of preload registries - classes from these registries are
- * not mapped to hibernate but are registered with the customized classname ->
- * classloader linkage. This is therefore used for any classes which mapped
- * classes will depend upon but which don't have a mapping themselves such
- * as component classes
- */
- public void setPreloadRegistries(List<SpiRegistry> spis) {
- log.debug("Set preload list");
- this.preloadRegistries = spis;
- }
-
- /**
- * Use any defined spiRegistries, adding any classes they contain to the
- * configuration before returning it. Initially delegates to the superclass,
- * so explicitly defined mappings will be mapped before those from the
- * SpiRegistry(s)
- */
- @Override
- protected Configuration newConfiguration() {
- Configuration conf = super.newConfiguration();
- log.trace("Starting SPI registry based configuration");
- if (preloadRegistries != null) {
- for (SpiRegistry spi : preloadRegistries) {
- for (Class<?> theClass : spi.getClasses()) {
- log.info("Preloading class '" + theClass.getCanonicalName()
- + "' from SPI to hibernate classloader mapping");
- ReflectHelper.registerClass(theClass);
- }
- }
- }
- if (spiRegistries != null) {
- for (SpiRegistry spi : spiRegistries) {
- for (Class<?> theClass : spi.getClasses()) {
- log.info("Added class '" + theClass.getCanonicalName()
- + "' from SPI to hibernate configuration");
- ReflectHelper.registerClass(theClass);
- conf.addClass(theClass);
- }
- }
- } else {
- log.info("No SPI registries defined");
- }
- log.trace("Done SPI registry based configuration");
- return conf;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/package.html b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/package.html
deleted file mode 100644
index c25615f..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/orm/hibernate3/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Extensions to Spring's support for Hibernate3 to allow it to interoperate with entities loaded through Raven.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/package.html b/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/package.html
deleted file mode 100644
index f932224..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/platform/spring/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<body>
-Extensions for Spring to allow it to access beans through Raven. When
-this extension is present and used through the
-RavenAwareClassPathXmlApplicationContext you can add artifact
-information to any bean definition in the spring application context.
-Provided you also define a reference to a raven repository through an
-instance of the RepositoryFactoryBean Spring will automatically handle
-the download of code to your specified repository cache and the various
-classloader management aspects involved.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java
deleted file mode 100644
index fd67ec8..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Abstract superclass of ReferenceSetImpl, IdentifiedArrayList and
- * ErrorDocumentImpl, manages the T2Reference field for these types and their
- * hibernate backing.
- *
- * @author Tom Oinn
- *
- */
-public class AbstractEntityImpl {
-
- private T2ReferenceImpl id;
-
- private String compactId = null;
-
- public T2Reference getId() {
- return id;
- }
-
- /**
- * This method is only ever called from within Hibernate, and is used to
- * initialize the unique ID of this reference set.
- */
- public void setTypedId(T2ReferenceImpl newId) {
- this.id = newId;
- }
-
- /**
- * Used because technically you can't accept and return implementation types
- * in the methods on a bean which implements an interface, but Hibernate
- * needs to construct concrete input and output types!
- */
- public T2ReferenceImpl getTypedId() {
- return this.id;
- }
-
- public void setInternalId(String newId) {
- this.compactId = newId;
- }
-
- public final String getInternalId() {
- if (this.compactId == null) {
- this.compactId = id.getCompactForm();
- }
- return this.compactId;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java
deleted file mode 100644
index 1b93425..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceCallback;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceException;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ErrorDocumentService, inject with an appropriate
- * ErrorDocumentDao and T2ReferenceGenerator to enable. Contains injectors for
- * id generation and dao along with other bookkeeping, leaving the
- * implementation of the actual service logic to the subclass.
- *
- * @author Tom Oinn
- */
-public abstract class AbstractErrorDocumentServiceImpl extends
- AbstractServiceImpl implements ErrorDocumentService {
-
- protected ErrorDocumentDao errorDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
-
- /**
- * Inject the error document data access object.
- */
- public final void setErrorDao(ErrorDocumentDao dao) {
- this.errorDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering ErrorDocuments
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- this.t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Check that the list dao is configured
- *
- * @throws ListServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ErrorDocumentServiceException {
- if (errorDao == null) {
- throw new ErrorDocumentServiceException(
- "ErrorDocumentDao not initialized, error document "
- + "service operations are not available");
- }
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ListServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ErrorDocumentServiceException {
- if (t2ReferenceGenerator == null) {
- throw new ErrorDocumentServiceException(
- "T2ReferenceGenerator not initialized, error document "
- + "service operations not available");
- }
- }
-
- public final void getErrorAsynch(final T2Reference id,
- final ErrorDocumentServiceCallback callback)
- throws ErrorDocumentServiceException {
- checkDao();
- Runnable r = new Runnable() {
- public void run() {
- try {
- ErrorDocument e = errorDao.get(id);
- callback.errorRetrieved(e);
- } catch (DaoException de) {
- callback
- .errorRetrievalFailed(new ErrorDocumentServiceException(
- de));
- }
- }
- };
- executeRunnable(r);
-
- }
-
- public final ErrorDocument registerError(String message, int depth)
- throws ErrorDocumentServiceException {
- return registerError(message, (Throwable) null, depth);
- }
-
- public final ErrorDocument registerError(Throwable t, int depth)
- throws ErrorDocumentServiceException {
- return registerError("", t, depth);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java
deleted file mode 100644
index 5fbbea8..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ListServiceCallback;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ListService, inject with an appropriate ListDao
- * and T2ReferenceGenerator to enable. Contains injectors for id generation and
- * dao along with other bookkeeping, leaving the implementation of the actual
- * service logic to the subclass.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractListServiceImpl extends AbstractServiceImpl
- implements ListService {
-
- protected ListDao listDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
-
- /**
- * Inject the list data access object.
- */
- public final void setListDao(ListDao dao) {
- this.listDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering lists of T2Reference
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- this.t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Check that the list dao is configured
- *
- * @throws ListServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ListServiceException {
- if (listDao == null) {
- throw new ListServiceException("ListDao not initialized, list "
- + "service operations are not available");
- }
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ListServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ListServiceException {
- if (t2ReferenceGenerator == null) {
- throw new ListServiceException(
- "T2ReferenceGenerator not initialized, list "
- + "service operations not available");
- }
- }
-
- public final void getListAsynch(final T2Reference id,
- final ListServiceCallback callback) throws ListServiceException {
- checkDao();
- Runnable r = new Runnable() {
- public void run() {
- try {
- callback.listRetrieved(getList(id));
- } catch (ListServiceException lse) {
- callback.listRetrievalFailed(lse);
- }
- }
- };
- executeRunnable(r);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java
deleted file mode 100644
index 7657714..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.raven.spi.InstanceRegistry;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.ReferenceServiceResolutionCallback;
-import net.sf.taverna.t2.reference.ReferenceSetService;
-import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
-
-/**
- * Implementation of ReferenceService, inject with ReferenceSetService,
- * ErrorDocumentService and ListService to enable. Inject with an instance
- * registry of ValueToReferenceConvertorSPI to enable on the fly registration of
- * otherwise illegal object types. This class contains the basic injection
- * functionality and the getters for the sub-services, mostly to isolate these
- * mundane bits of code from the more interesting actual implementation of the
- * reference service logic.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractReferenceServiceImpl extends AbstractServiceImpl
- implements ReferenceService {
-
- protected ErrorDocumentService errorDocumentService = null;
- protected ReferenceSetService referenceSetService = null;
- protected ListService listService = null;
- protected InstanceRegistry<ValueToReferenceConverterSPI> converterRegistry = null;
- @SuppressWarnings("unchecked")
- protected InstanceRegistry<StreamToValueConverterSPI> valueBuilderRegistry = null;
-
- /**
- * Inject value to reference convertor SPI
- */
- public final void setConverterRegistry(
- InstanceRegistry<ValueToReferenceConverterSPI> reg) {
- this.converterRegistry = reg;
- }
-
- /**
- * Inject stream to value converter SPI
- */
- @SuppressWarnings("unchecked")
- public final void setValueBuilderRegistry(
- InstanceRegistry<StreamToValueConverterSPI> reg) {
- this.valueBuilderRegistry = reg;
- }
-
- /**
- * Inject error document service
- */
- public final void setErrorDocumentService(ErrorDocumentService eds) {
- this.errorDocumentService = eds;
- }
-
- /**
- * Inject reference set service
- */
- public final void setReferenceSetService(ReferenceSetService rss) {
- this.referenceSetService = rss;
- }
-
- /**
- * Inject list service
- */
- public final void setListService(ListService ls) {
- this.listService = ls;
- }
-
- /**
- * Throw a ReferenceServiceException if methods in ReferenceService are
- * called without the necessary sub-services configured.
- */
- protected final void checkServices() throws ReferenceServiceException {
- if (errorDocumentService == null) {
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ErrorDocumentService to function");
- }
- if (referenceSetService == null) {
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ReferenceSetService to function");
- }
- if (listService == null) {
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ListService to function");
- }
- }
-
- /**
- * Check whether the converter registry has been defined, throw a
- * ReferenceServiceException if not
- */
- protected final void checkConverterRegistry()
- throws ReferenceServiceException {
- if (converterRegistry == null) {
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance registry of ValueToReferenceConvertorSPI "
- + "to enable on the fly mapping of arbitrary objects "
- + "during compound registration");
- }
- }
-
- public final ErrorDocumentService getErrorDocumentService() {
- checkServices();
- return this.errorDocumentService;
- }
-
- public final ListService getListService() {
- checkServices();
- return this.listService;
- }
-
- public final ReferenceSetService getReferenceSetService() {
- checkServices();
- return this.referenceSetService;
- }
-
- /**
- * Wraps the synchronous form, using the executeRunnable method to schedule
- * it.
- */
- public void resolveIdentifierAsynch(final T2Reference id,
- final Set<Class<ExternalReferenceSPI>> ensureTypes,
- final ReferenceContext context,
- final ReferenceServiceResolutionCallback callback)
- throws ReferenceServiceException {
- checkServices();
- Runnable r = new Runnable() {
- public void run() {
- try {
- callback.identifierResolved(resolveIdentifier(id,
- ensureTypes, context));
- } catch (ReferenceServiceException rse) {
- callback.resolutionFailed(rse);
- }
- }
- };
- executeRunnable(r);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java
deleted file mode 100644
index fe8c0cc..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentor;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.ReferenceSetService;
-import net.sf.taverna.t2.reference.ReferenceSetServiceCallback;
-import net.sf.taverna.t2.reference.ReferenceSetServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ReferenceSetService, inject with an appropriate
- * ReferenceSetDao to enable. Implements translation functionality as long as an
- * appropriate ReferenceSetAugmentor implementation is injected. Contains
- * injectors for id generation and dao along with other bookkeeping, leaving the
- * implementation of the actual service logic to the subclass.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractReferenceSetServiceImpl extends
- AbstractServiceImpl implements ReferenceSetService {
-
- protected ReferenceSetDao referenceSetDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
- protected ReferenceSetAugmentor referenceSetAugmentor = null;
-
- /**
- * Inject the reference set data access object.
- */
- public final void setReferenceSetDao(ReferenceSetDao dao) {
- this.referenceSetDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering sets of ExternalReferenceSPI
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- this.t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Inject the ReferenceSetAugmentor used to translate or construct new
- * ExternalReferenceSPI instances within a ReferenceSet
- */
- public final void setReferenceSetAugmentor(ReferenceSetAugmentor rse) {
- this.referenceSetAugmentor = rse;
- }
-
- /**
- * Check that the reference set dao is configured
- *
- * @throws ReferenceSetServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ReferenceSetServiceException {
- if (referenceSetDao == null) {
- throw new ReferenceSetServiceException(
- "ReferenceSetDao not initialized, reference set "
- + "service operations are not available");
- }
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ReferenceSetServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ReferenceSetServiceException {
- if (t2ReferenceGenerator == null) {
- throw new ReferenceSetServiceException(
- "T2ReferenceGenerator not initialized, reference "
- + "set service operations not available");
- }
- }
-
- /**
- * Check that the reference set augmentor is configured
- *
- * @throws ReferenceSetServiceException
- * if the reference set augmentor is still null
- */
- protected final void checkAugmentor() throws ReferenceSetServiceException {
- if (referenceSetAugmentor == null) {
- throw new ReferenceSetServiceException(
- "ReferenceSetAugmentor not initialized, reference "
- + "set service operations not available");
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public final void getReferenceSetAsynch(final T2Reference id,
- final ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException {
- checkDao();
- Runnable r = new Runnable() {
- public void run() {
- try {
- ReferenceSet rs = referenceSetDao.get(id);
- callback.referenceSetRetrieved(rs);
- } catch (DaoException de) {
- callback
- .referenceSetRetrievalFailed(new ReferenceSetServiceException(
- de));
- }
- }
- };
- executeRunnable(r);
- }
-
- /**
- * {@inheritDoc}
- */
- public final void getReferenceSetWithAugmentationAsynch(
- final T2Reference id,
- final Set<Class<ExternalReferenceSPI>> ensureTypes,
- final ReferenceContext context,
- final ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException {
- checkDao();
- checkAugmentor();
- Runnable r = new Runnable() {
- public void run() {
- try {
- callback
- .referenceSetRetrieved(getReferenceSetWithAugmentation(
- id, ensureTypes, context));
-
- } catch (ReferenceSetServiceException rsse) {
- callback.referenceSetRetrievalFailed(rsse);
- }
- }
- };
- executeRunnable(r);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java
deleted file mode 100644
index d8a419b..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-/**
- * Abstract superclass for all service implementation objects, will be used to
- * allow injection of thread pooling logic as and when we implement it.
- *
- * @author Tom Oinn
- */
-public class AbstractServiceImpl {
-
- /**
- * Schedule a runnable for execution - current naive implementation uses a
- * new thread and executes immediately, but this is where any thread pool
- * logic would go if we wanted to add that.
- *
- * @param r
- */
- protected void executeRunnable(Runnable r) {
- new Thread(r).start();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java
deleted file mode 100644
index 7cc965f..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-/**
- * An abstract class for implementing simple {@link T2ReferenceGenerator}s.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public abstract class AbstractT2ReferenceGenerator implements
- T2ReferenceGenerator {
-
- public AbstractT2ReferenceGenerator() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public synchronized T2Reference nextReferenceSetReference() {
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart(getNamespace());
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(T2ReferenceType.ReferenceSet);
- r.setDepth(0);
- r.setContainsErrors(false);
- return r;
- }
-
- /**
- * Generate a new local part for a new {@link T2Reference reference}. The
- * local part should be unique within this
- * {@link T2ReferenceGenerator#getNamespace() namespace}.
- *
- * @return A new, unique local part to identify a new reference.
- */
- protected abstract String getNextLocalPart();
-
- /**
- * {@inheritDoc}
- */
- public T2Reference nextListReference(boolean containsErrors, int listDepth) {
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart(getNamespace());
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(T2ReferenceType.IdentifiedList);
- r.setDepth(listDepth);
- r.setContainsErrors(containsErrors);
- return r;
- }
-
- /**
- * {@inheritDoc}
- */
- public T2Reference nextErrorDocumentReference(int depth) {
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart(getNamespace());
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(T2ReferenceType.ErrorDocument);
- r.setDepth(depth);
- // This is an error document, it contains errors by definition
- r.setContainsErrors(true);
- return r;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java
deleted file mode 100644
index 1231b6c..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.Identified;
-import net.sf.taverna.t2.reference.ReferenceServiceCacheProvider;
-import net.sf.taverna.t2.reference.T2Reference;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-
-/**
- * An aspect used to intercept calls to the various data access objects and
- * divert through a write-through cache provider
- *
- * @author Tom Oinn
- */
-public class CacheAspect {
-
- private ReferenceServiceCacheProvider cacheProvider;
-
- /**
- * Return an injected ReferenceServiceCacheProvider
- */
- private final ReferenceServiceCacheProvider getCacheProvider() {
- return cacheProvider;
- }
-
- /**
- * Inject an instance of ReferenceServiceCacheProvider
- *
- * @param cacheProvider
- * the cache provider to use
- */
- public final void setCacheProvider(
- final ReferenceServiceCacheProvider cacheProvider) {
- this.cacheProvider = cacheProvider;
- }
-
- /**
- * Handle a 'get by T2Reference' operation on a Dao
- *
- * @param pjp
- * the join point representing the ongoing method call to the dao
- * @return the entity identified by the T2Reference supplied to the method
- * to which this advice applies
- * @throws DaoException
- * if anything goes wrong
- */
- public final Identified getObject(final ProceedingJoinPoint pjp)
- throws DaoException {
-
- Identified result = null;
-
- // Get the T2Reference from the argument to the get method
- T2Reference id = (T2Reference) pjp.getArgs()[0];
- if (id != null) {
- result = getCacheProvider().get(id);
- if (result != null) {
- return result;
- }
- }
- // If we miss the cache then call the method as usual
- try {
- result = (Identified) pjp.proceed();
- } catch (Throwable e) {
- if (e instanceof DaoException) {
- throw ((DaoException) e);
- } else {
- throw new DaoException(
- "Unexpected exception type during aspect "
- + "based invocation", e);
- }
- }
-
- // Write back to the cache
- if (result != null) {
- getCacheProvider().put(result);
- }
-
- return result;
- }
-
- /**
- * Called around a write or update operation on the backing store, writes
- * through to the cache after modifying the state of the backing store and
- * before returning from the dao method
- *
- * @param pjp
- * join point representing the ongoing method invocation to cache
- * @throws DaoException
- * if anything goes wrong
- */
- public void putObject(final ProceedingJoinPoint pjp) throws DaoException {
-
- // Get the Identified being stored by the method we're advising
- Identified storedObject = (Identified) pjp.getArgs()[0];
-
- try {
- // Run the store or update method
- pjp.proceed();
- } catch (Throwable e) {
- if (e instanceof DaoException) {
- throw ((DaoException) e);
- } else {
- throw new DaoException(
- "Unexpected exception type during aspect "
- + "based invocation", e);
- }
- }
-
- // Assuming the method isn't null and has an identifier (which it will
- // if we haven't thrown an exception before now) write it back to the
- // cache provider
- if (storedObject != null && storedObject.getId() != null) {
- getCacheProvider().put(storedObject);
- }
-
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java
deleted file mode 100644
index ef8e7cf..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.ContextualizedT2Reference;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Simple implementation of ContextualizedT2Reference
- *
- * @author Tom Oinn
- *
- */
-public class ContextualizedT2ReferenceImpl implements ContextualizedT2Reference {
-
- private T2Reference reference;
- private int[] index;
-
- public ContextualizedT2ReferenceImpl(T2Reference ref, int[] context) {
- this.reference = ref;
- this.index = context;
- }
-
- public int[] getIndex() {
- return this.index;
- }
-
- public T2Reference getReference() {
- return this.reference;
- }
-
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("[");
- boolean doneFirst = false;
- for (int i = 0; i < index.length; i++) {
- if (doneFirst) {
- sb.append(",");
- }
- doneFirst = true;
- sb.append(index[i]);
- }
- sb.append("]");
- sb.append(reference.toString());
- return sb.toString();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java
deleted file mode 100644
index a629719..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ReferenceContext;
-
-/**
- * A trivial implementation of ReferenceContext, used if the context parameter
- * to any service method is null.
- *
- * @author Tom Oinn
- *
- */
-public class EmptyReferenceContext implements ReferenceContext {
-
- /**
- * Return an empty entity set for all queries.
- */
- public <T> List<? extends T> getEntities(Class<T> arg0) {
- return new ArrayList<T>();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java
deleted file mode 100644
index c0f5d01..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.StackTraceElementBean;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.h3.HibernateMappedEntity;
-
-/**
- * Simple bean implementation of ErrorDocument
- *
- * @author Tom Oinn
- *
- */
-public class ErrorDocumentImpl extends AbstractEntityImpl implements
- ErrorDocument, HibernateMappedEntity {
-
- private String exceptionMessage = "";
- private String message = "";
- List<StackTraceElementBean> stackTrace;
- Set<T2Reference> errorReferences = new HashSet<T2Reference>();
-
- public ErrorDocumentImpl() {
- this.stackTrace = new ArrayList<StackTraceElementBean>();
- }
-
- public String getExceptionMessage() {
- return this.exceptionMessage;
- }
-
- public void setExceptionMessage(String exceptionMessage) {
- this.exceptionMessage = exceptionMessage;
- }
-
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * From interface, not used by hibernate internally
- */
- public List<StackTraceElementBean> getStackTraceStrings() {
- return this.stackTrace;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("unchecked")
- public void setStackTraceList(List newList) {
- this.stackTrace = newList;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("unchecked")
- public List getStackTraceList() {
- return this.stackTrace;
- }
-
- public Set<T2Reference> getErrorReferences() {
- return errorReferences;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("unchecked")
- public void setErrorReferenceSet(Set errorReferenceSet) {
- this.errorReferences = errorReferenceSet;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("unchecked")
- public Set getErrorReferenceSet() {
- return this.errorReferences;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java
deleted file mode 100644
index e911696..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceException;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Implementation of ErrorDocumentService, inject with an appropriate
- * ErrorDocumentDao and T2ReferenceGenerator to enable.
- *
- * @author Tom Oinn
- *
- */
-public class ErrorDocumentServiceImpl extends AbstractErrorDocumentServiceImpl
- implements ErrorDocumentService {
-
- public ErrorDocument getError(T2Reference id)
- throws ErrorDocumentServiceException {
- checkDao();
- try {
- return errorDao.get(id);
- } catch (Throwable t) {
- throw new ErrorDocumentServiceException(t);
- }
- }
-
- /**
- * Register the specified error and any child errors (which have the same
- * namespace and local part but a lower depth, down to depth of zero
- */
- public ErrorDocument registerError(String message, Throwable t, int depth)
- throws ErrorDocumentServiceException {
- checkDao();
- checkGenerator();
-
- T2Reference ref = t2ReferenceGenerator
- .nextErrorDocumentReference(depth);
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(ref);
-
- ErrorDocument docToReturn = null;
- while (depth >= 0) {
- ErrorDocumentImpl edi = new ErrorDocumentImpl();
- if (docToReturn == null) {
- docToReturn = edi;
- }
- edi.setTypedId(typedId);
- if (message != null) {
- edi.setMessage(message);
- } else {
- edi.setMessage("");
- }
- if (t != null) {
- edi.setExceptionMessage(t.toString());
- for (StackTraceElement ste : t.getStackTrace()) {
- StackTraceElementBeanImpl stebi = new StackTraceElementBeanImpl();
- stebi.setClassName(ste.getClassName());
- stebi.setFileName(ste.getFileName());
- stebi.setLineNumber(ste.getLineNumber());
- stebi.setMethodName(ste.getMethodName());
- edi.stackTrace.add(stebi);
- }
- } else {
- edi.setExceptionMessage("");
- }
- try {
- errorDao.store(edi);
- } catch (Throwable t2) {
- throw new ErrorDocumentServiceException(t2);
- }
- if (depth > 0) {
- typedId = typedId.getDeeperErrorReference();
- }
- depth--;
- }
- return docToReturn;
-
- }
-
- public ErrorDocument registerError(String message, Set<T2Reference> errors, int depth)
- throws ErrorDocumentServiceException {
- checkDao();
- checkGenerator();
-
- T2Reference ref = t2ReferenceGenerator
- .nextErrorDocumentReference(depth);
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(ref);
-
- ErrorDocument docToReturn = null;
- while (depth >= 0) {
- ErrorDocumentImpl edi = new ErrorDocumentImpl();
- if (docToReturn == null) {
- docToReturn = edi;
- }
- edi.setTypedId(typedId);
- if (message != null) {
- edi.setMessage(message);
- } else {
- edi.setMessage("");
- }
- if (errors != null) {
- edi.setErrorReferenceSet(errors);
- }
- edi.setExceptionMessage("");
-
- try {
- errorDao.store(edi);
- } catch (Throwable t2) {
- throw new ErrorDocumentServiceException(t2);
- }
- if (depth > 0) {
- typedId = typedId.getDeeperErrorReference();
- }
- depth--;
- }
- return docToReturn;
- }
-
- public T2Reference getChild(T2Reference errorId)
- throws ErrorDocumentServiceException {
- T2ReferenceImpl refImpl = T2ReferenceImpl.getAsImpl(errorId);
- try {
- return refImpl.getDeeperErrorReference();
- } catch (Throwable t) {
- throw new ErrorDocumentServiceException(t);
- }
- }
-
- public boolean delete(T2Reference reference)
- throws ReferenceServiceException {
- checkDao();
- ErrorDocument doc = errorDao.get(reference);
- if (doc==null) return false;
- return errorDao.delete(doc);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java
deleted file mode 100644
index 0e593ef..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.DeleteIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-/**
- * An implementation of ErrorDocumentDao based on Spring's HibernateDaoSupport.
- * To use this in spring inject a property 'sessionFactory' with either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- *
- * @author Tom Oinn
- *
- */
-public class HibernateErrorDocumentDao extends HibernateDaoSupport implements
- ErrorDocumentDao {
-
- /**
- * Fetch an ErrorDocument list by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved identified list of T2 references
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public ErrorDocument get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType().equals(T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.ErrorDocument");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (ErrorDocumentImpl) getHibernateTemplate().get(
- ErrorDocumentImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @PutIdentifiedOperation
- public void store(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null) {
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theDocument.getId().getReferenceType().equals(
- T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theDocument instanceof ErrorDocumentImpl) {
- try {
- getHibernateTemplate().save(theDocument);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
- }
- }
-
- @DeleteIdentifiedOperation
- public boolean delete(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null) {
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theDocument.getId().getReferenceType().equals(
- T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theDocument instanceof ErrorDocumentImpl) {
- try {
- getHibernateTemplate().delete(theDocument);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
- }
- return true;
- }
-
-
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateListDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateListDao.java
deleted file mode 100644
index ecd3eb2..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateListDao.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-/**
- * An implementation of ListDao based on Spring's HibernateDaoSupport. To use
- * this in spring inject a property 'sessionFactory' with either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- *
- * @author Tom Oinn
- *
- */
-public class HibernateListDao extends HibernateDaoSupport implements ListDao {
-
- /**
- * Fetch a t2reference list by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved identified list of T2 references
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public IdentifiedList<T2Reference> get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType()
- .equals(T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.IdentifiedList");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (T2ReferenceListImpl) getHibernateTemplate().get(
- T2ReferenceListImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @PutIdentifiedOperation
- public void store(IdentifiedList<T2Reference> theList) throws DaoException {
- if (theList.getId() == null) {
- throw new DaoException("Supplied list set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theList.getId().getReferenceType().equals(
- T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.IdentifiedList, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theList instanceof T2ReferenceListImpl) {
- try {
- getHibernateTemplate().save(theList);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied identifier list not an instance of T2ReferenceList");
- }
- }
-
- public boolean delete(
- IdentifiedList<T2Reference> theList) throws DaoException {
- if (theList.getId() == null) {
- throw new DaoException("Supplied list set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theList.getId().getReferenceType().equals(
- T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.IdentifiedList, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theList instanceof T2ReferenceListImpl) {
- try {
- getHibernateTemplate().delete(theList);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied identifier list not an instance of T2ReferenceList");
- }
- return true;
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateReferenceSetDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateReferenceSetDao.java
deleted file mode 100644
index 73da81c..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateReferenceSetDao.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.DeleteIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-/**
- * An implementation of ReferenceSetDao based on Spring's HibernateDaoSupport.
- * To use this in spring inject a property 'sessionFactory' with either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- *
- * @author Tom Oinn
- *
- */
-public class HibernateReferenceSetDao extends HibernateDaoSupport implements
- ReferenceSetDao {
-
- /**
- * Store the specified new reference set
- *
- * @param rs
- * a reference set, must not already exist in the database.
- * @throws DaoException
- * if the entry already exists in the database, if the supplied
- * reference set isn't an instance of ReferenceSetImpl or if
- * something else goes wrong connecting to the database
- */
- @PutIdentifiedOperation
- public void store(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- getHibernateTemplate().save(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- }
-
- /**
- * Update a pre-existing entry in the database
- *
- * @param rs
- * the reference set to update. This must already exist in the
- * database
- * @throws DaoException
- */
- @PutIdentifiedOperation
- public void update(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- getHibernateTemplate().update(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- }
-
- /**
- * Fetch a reference set by id
- *
- * @param ref
- * the ReferenceSetT2ReferenceImpl to fetch
- * @return a retrieved ReferenceSetImpl
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public ReferenceSetImpl get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType().equals(T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.ReferenceSet");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (ReferenceSetImpl) getHibernateTemplate().get(
- ReferenceSetImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @DeleteIdentifiedOperation
- public boolean delete(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- getHibernateTemplate().delete(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- return true;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/IdentifiedArrayList.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/IdentifiedArrayList.java
deleted file mode 100644
index 94139ef..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/IdentifiedArrayList.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-
-import net.sf.taverna.t2.reference.IdentifiedList;
-
-/**
- * Implementation of IdentifiedList which delegates to an ArrayList for its
- * storage functionality.
- *
- * @author Tom Oinn
- *
- * @param <T>
- */
-public class IdentifiedArrayList<T> extends AbstractEntityImpl implements
- IdentifiedList<T> {
-
- protected List<T> listDelegate = null;
-
- // Constructors copied from ArrayList for convenience
- public IdentifiedArrayList() {
- super();
- this.listDelegate = new ArrayList<T>();
- }
-
- public IdentifiedArrayList(Collection<T> c) {
- super();
- this.listDelegate = new ArrayList<T>(c);
- }
-
- public IdentifiedArrayList(int initialCapacity) {
- super();
- this.listDelegate = new ArrayList<T>(initialCapacity);
- }
-
- private void checkUndefinedId() {
- if (this.getId() != null) {
- throw new IllegalStateException(
- "Attempt made to modify a list which has already been named");
- }
- }
-
- public boolean add(T e) {
- checkUndefinedId();
- return listDelegate.add(e);
- }
-
- public void add(int index, T element) {
- checkUndefinedId();
- listDelegate.add(index, element);
- }
-
- public boolean addAll(Collection<? extends T> c) {
- checkUndefinedId();
- return listDelegate.addAll(c);
- }
-
- public boolean addAll(int index, Collection<? extends T> c) {
- checkUndefinedId();
- return listDelegate.addAll(index, c);
- }
-
- public void clear() {
- checkUndefinedId();
- listDelegate.clear();
- }
-
- public boolean contains(Object o) {
- return listDelegate.contains(o);
- }
-
- public boolean containsAll(Collection<?> c) {
- return listDelegate.containsAll(c);
- }
-
- public T get(int index) {
- return listDelegate.get(index);
- }
-
- public int indexOf(Object o) {
- return listDelegate.indexOf(o);
- }
-
- public boolean isEmpty() {
- return listDelegate.isEmpty();
- }
-
- public Iterator<T> iterator() {
- return listDelegate.iterator();
- }
-
- public int lastIndexOf(Object o) {
- return listDelegate.lastIndexOf(o);
- }
-
- /**
- * The ListIterator can modify the list contents, so wrap the delegate's
- * list iterator and use as a delegate itself, checking for null ID on
- * operations which set list properties.
- *
- * @param iteratorDelegate
- * ListIterator to wrap.
- * @return wrapped ListIterator which throws IllegalStateException on calls
- * which modify the list if the ID has been set to a non-null value
- */
- private ListIterator<T> getCheckedListIterator(
- final ListIterator<T> iteratorDelegate) {
- return new ListIterator<T>() {
- public void add(T e) {
- checkUndefinedId();
- iteratorDelegate.add(e);
- }
-
- public boolean hasNext() {
- return iteratorDelegate.hasNext();
- }
-
- public boolean hasPrevious() {
- return iteratorDelegate.hasPrevious();
- }
-
- public T next() {
- return iteratorDelegate.next();
- }
-
- public int nextIndex() {
- return iteratorDelegate.nextIndex();
- }
-
- public T previous() {
- return iteratorDelegate.previous();
- }
-
- public int previousIndex() {
- return iteratorDelegate.previousIndex();
- }
-
- public void remove() {
- checkUndefinedId();
- iteratorDelegate.remove();
- }
-
- public void set(T e) {
- checkUndefinedId();
- iteratorDelegate.set(e);
- }
- };
- }
-
- public ListIterator<T> listIterator() {
- return getCheckedListIterator(listDelegate.listIterator());
- }
-
- public ListIterator<T> listIterator(int index) {
- return getCheckedListIterator(listDelegate.listIterator(index));
- }
-
- public boolean remove(Object o) {
- checkUndefinedId();
- return listDelegate.remove(o);
- }
-
- public T remove(int index) {
- checkUndefinedId();
- return listDelegate.remove(index);
- }
-
- public boolean removeAll(Collection<?> c) {
- checkUndefinedId();
- return listDelegate.removeAll(c);
- }
-
- public boolean retainAll(Collection<?> c) {
- checkUndefinedId();
- return listDelegate.retainAll(c);
- }
-
- public T set(int index, T element) {
- checkUndefinedId();
- return listDelegate.set(index, element);
- }
-
- public int size() {
- return listDelegate.size();
- }
-
- public List<T> subList(int fromIndex, int toIndex) {
- return listDelegate.subList(fromIndex, toIndex);
- }
-
- public Object[] toArray() {
- return listDelegate.toArray();
- }
-
- public <U> U[] toArray(U[] a) {
- return listDelegate.toArray(a);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryErrorDocumentDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryErrorDocumentDao.java
deleted file mode 100644
index 58d7154..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryErrorDocumentDao.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * A trivial in-memory implementation of ErrorDocumentDao for either testing or
- * very lightweight embedded systems. Uses a java Map as the backing store.
- *
- * @author Tom Oinn
- *
- */
-public class InMemoryErrorDocumentDao implements ErrorDocumentDao {
-
- private Map<T2Reference, ErrorDocument> store;
-
- public InMemoryErrorDocumentDao() {
- this.store = new ConcurrentHashMap<T2Reference, ErrorDocument>();
- }
-
- public synchronized ErrorDocument get(T2Reference reference)
- throws DaoException {
- if (store.containsKey(reference)) {
- return store.get(reference);
- } else {
- throw new DaoException("Key " + reference + " not found in store");
- }
- }
-
- public synchronized void store(ErrorDocument theDoc) throws DaoException {
- store.put(theDoc.getId(), theDoc);
- }
-
- public synchronized boolean delete(ErrorDocument theDoc) throws DaoException {
- return store.remove(theDoc.getId())!=null;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryListDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryListDao.java
deleted file mode 100644
index 37dfe38..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryListDao.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * A trivial in-memory implementation of ListDao for either testing or very
- * lightweight embedded systems. Uses a java Map as the backing store.
- *
- * @author Tom Oinn
- *
- */
-public class InMemoryListDao implements ListDao {
-
- private Map<T2Reference, IdentifiedList<T2Reference>> store;
-
- public InMemoryListDao() {
- this.store = new ConcurrentHashMap<T2Reference, IdentifiedList<T2Reference>>();
- }
-
- public synchronized IdentifiedList<T2Reference> get(T2Reference reference)
- throws DaoException {
- if (store.containsKey(reference)) {
- return store.get(reference);
- } else {
- throw new DaoException("Key " + reference + " not found in store");
- }
- }
-
- public synchronized void store(IdentifiedList<T2Reference> theList) throws DaoException {
- store.put(theList.getId(), theList);
- }
-
- public boolean delete(
- IdentifiedList<T2Reference> theList) throws DaoException {
- return (store.remove(theList.getId())!=null);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryReferenceSetDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryReferenceSetDao.java
deleted file mode 100644
index c4713c3..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/InMemoryReferenceSetDao.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * A trivial in-memory implementation of ReferenceSetDao for either testing or
- * very lightweight embedded systems. Uses a java Map as the backing store.
- *
- * @author Tom Oinn
- *
- */
-public class InMemoryReferenceSetDao implements ReferenceSetDao {
-
- private Map<T2Reference, ReferenceSet> store;
-
- public InMemoryReferenceSetDao() {
- this.store = new ConcurrentHashMap<T2Reference, ReferenceSet>();
- }
-
- public synchronized ReferenceSet get(T2Reference reference)
- throws DaoException {
- if (store.containsKey(reference)) {
- return store.get(reference);
- } else {
- throw new DaoException("Key " + reference + " not found in store");
- }
- }
-
- public synchronized void store(ReferenceSet refSet) throws DaoException {
- store.put(refSet.getId(), refSet);
- }
-
- public synchronized void update(ReferenceSet refSet) throws DaoException {
- store.put(refSet.getId(), refSet);
- }
-
- public synchronized boolean delete(ReferenceSet refSet) throws DaoException {
- return store.remove(refSet.getId())!=null;
- }
-
-
-
-
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ListServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ListServiceImpl.java
deleted file mode 100644
index 346c378..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ListServiceImpl.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Implementation of ListService, inject with an appropriate ListDao and
- * T2ReferenceGenerator to enable.
- *
- * @author Tom Oinn
- *
- */
-public class ListServiceImpl extends AbstractListServiceImpl implements
- ListService {
-
- public IdentifiedList<T2Reference> getList(T2Reference id)
- throws ListServiceException {
- checkDao();
- try {
- return listDao.get(id);
- } catch (DaoException de) {
- throw new ListServiceException(de);
- }
- }
-
- public IdentifiedList<T2Reference> registerEmptyList(int depth)
- throws ListServiceException {
- if (depth < 1) {
- throw new ListServiceException("Can't register empty lists of depth " + depth);
- }
- checkDao();
- checkGenerator();
- T2ReferenceImpl newReference = T2ReferenceImpl
- .getAsImpl(t2ReferenceGenerator.nextListReference(false, depth));
- T2ReferenceListImpl newList = new T2ReferenceListImpl();
- newList.setTypedId(newReference);
- try {
- listDao.store(newList);
- return newList;
- } catch (DaoException de) {
- throw new ListServiceException(de);
- }
- }
-
- public IdentifiedList<T2Reference> registerList(List<T2Reference> items)
- throws ListServiceException {
- checkDao();
- checkGenerator();
- if (items.isEmpty()) {
- throw new ListServiceException(
- "Can't register an empty list with this method,"
- + " use the registerEmptyList instead");
- }
- // Track whether there are any items in the collection which are or
- // contain error documents.
- boolean containsErrors = false;
- // Track depth, ensure that all items have the same depth, fail if not.
- int depth = items.get(0).getDepth();
- if (depth < 0) {
- throw new ListServiceException("Can't register list of depth less than 1, but first item " + items.get(0) + " has depth " + depth);
- }
- T2ReferenceListImpl newList = new T2ReferenceListImpl();
- int counter = 0;
- for (T2Reference ref : items) {
- if (ref.getDepth() != depth) {
- throw new ListServiceException(
- "Mismatched depths in list registration; reference at index '"
- + counter + "' has depth " + ref.getDepth()
- + " but all preceeding items have depth "
- + depth);
- }
- if (ref.containsErrors()) {
- // The collection's reference contains errors if any child does
- containsErrors = true;
- }
- newList.add(ref);
- counter++;
- }
- try {
- T2ReferenceImpl newReference = T2ReferenceImpl
- .getAsImpl(t2ReferenceGenerator.nextListReference(
- containsErrors, depth + 1));
- newList.setTypedId(newReference);
- listDao.store(newList);
- return newList;
- } catch (Throwable t) {
- throw new ListServiceException(t);
- }
- }
-
- public boolean delete(T2Reference reference)
- throws ReferenceServiceException {
- checkDao();
- IdentifiedList<T2Reference> list=listDao.get(reference);
- if (list==null) return false;
- return listDao.delete(list);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceServiceImpl.java
deleted file mode 100644
index 4f73e25..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceServiceImpl.java
+++ /dev/null
@@ -1,696 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ContextualizedT2Reference;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.Identified;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetServiceException;
-import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.ValueCarryingExternalReference;
-import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
-import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Implementation of ReferenceService, inject with ReferenceSetService,
- * ErrorDocumentService and ListService to enable.
- *
- * @author Tom Oinn
- * @author Alan R Williams
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- */
-public class ReferenceServiceImpl extends AbstractReferenceServiceImpl
- implements ReferenceService {
-
- private final Log log = LogFactory.getLog(ReferenceServiceImpl.class);
-
- /**
- * The top level registration method is used to register either as yet
- * unregistered ErrorDocuments and ReferenceSets (if these are passed in and
- * already have an identifier this call does nothing) and arbitrarily nested
- * Lists of the same. In addition any ExternalReferenceSPI instances found
- * will be wrapped in a single item ReferenceSet and registered, and any
- * Throwables will be wrapped in an ErrorDocument and registered. Lists will
- * be converted to IdentifiedList<T2Reference> and registered if all
- * children can be (or were already) appropriately named.
- * <p>
- * This method is only valid on parameters of the following type :
- * <ol>
- * <li>{@link ReferenceSet} - registered if not already registered,
- * otherwise returns existing T2Reference</li>
- * <li>{@link ErrorDocument} - same behaviour as ReferenceSet</li>
- * <li>{@link ExternalReferenceSPI} - wrapped in ReferenceSet, registered
- * and ID returned</li>
- * <li>Throwable - wrapped in ErrorDocument with no message, registered and
- * ID returned</li>
- * <li>List - all children are first registered, if this succeeds the list
- * is itself registered as an IdentifiedList of T2Reference and its
- * reference returned.</li>
- * </ol>
- * The exception to this is if the useConvertorSPI parameter is set to true
- * - in this case any objects which do not match the above allowed list will
- * be run through any available ValueToReferenceConvertorSPI instances in
- * turn until one succeeds or all fail, which may result in the creation of
- * ExternalReferenceSPI instances. As these can be registered such objects
- * will not cause an exception to be thrown.
- *
- * @param o
- * the object to register with the reference system, must comply
- * with and will be interpreted as shown in the type list above.
- * @param targetDepth
- * the depth of the top level object supplied. This is needed
- * when registering empty collections and error documents,
- * whether as top level types or as members of a collection
- * within the top level type. If registering a collection this is
- * the collection depth, so a List of ReferenceSchemeSPI would be
- * depth 1. Failing to specify this correctly will result in
- * serious problems downstream so be careful! We can't catch all
- * potential problems in this method (although some errors will
- * be trapped).
- * @param useConverterSPI
- * whether to attempt to use the ValueToReferenceConvertorSPI
- * registry (if defined and available) to map arbitrary objects
- * to ExternalReferenceSPI instances on the fly. The registry of
- * converters is generally injected into the implementation of
- * this service.
- * @param context
- * ReferenceContext to use if required by component services,
- * this is most likely to be used by the object to reference
- * converters if engaged.
- * <p>
- * If the context is null a new empty reference context is
- * inserted.
- * @return a T2Reference to the registered object
- * @throws ReferenceServiceException
- * if the object type (or, for collections, the recursive type
- * of its contents) is not in the allowed list or if a problem
- * occurs during registration. Also thrown if attempting to use
- * the converter SPI without an attached registry.
- */
- public T2Reference register(Object o, int targetDepth,
- boolean useConverterSPI, ReferenceContext context)
- throws ReferenceServiceException {
- checkServices();
- if (context == null) {
- context = new EmptyReferenceContext();
- }
- if (useConverterSPI) {
- checkConverterRegistry();
- }
- return getNameForObject(o, targetDepth, useConverterSPI, context);
- }
-
- private T2Reference getNameForObject(Object o, int currentDepth,
- boolean useConverterSPI, ReferenceContext context)
- throws ReferenceServiceException {
- if (currentDepth < 0) {
- throw new ReferenceServiceException("Cannot register at depth " + currentDepth + ": " + o);
- }
- // First check whether this is an Identified, and if so whether it
- // already has an ID. If this is the case then return it, we assume that
- // anything which has an identifier already allocated must have been
- // registered (this is implicit in the contract for the various
- // sub-services
- if (o instanceof Identified) {
- Identified i = (Identified) o;
- if (i.getId() != null) {
- return i.getId();
- }
- }
- // Then check whether the item *is* a T2Reference, in which case we can
- // just return it (useful for when registering lists of existing
- // references)
- if (o instanceof T2Reference) {
- return (T2Reference) o;
- }
-
- if (o.getClass().isArray()) {
- Class<?> elementType = o.getClass().getComponentType();
- if (elementType.getCanonicalName().equals("char")) {
- char[] cArray = (char[]) o;
- List<Character> cList = new ArrayList<Character>();
- for (char c : cArray) {
- cList.add(new Character(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("short")) {
- short[] cArray = (short[]) o;
- List<Short> cList = new ArrayList<Short>();
- for (short c : cArray) {
- cList.add(new Short(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("int")) {
- int[] cArray = (int[]) o;
- List<Integer> cList = new ArrayList<Integer>();
- for (int c : cArray) {
- cList.add(new Integer(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("long")) {
- long[] cArray = (long[]) o;
- List<Long> cList = new ArrayList<Long>();
- for (long c : cArray) {
- cList.add(new Long(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("float")) {
- float[] cArray = (float[]) o;
- List<Float> cList = new ArrayList<Float>();
- for (float c : cArray) {
- cList.add(new Float(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("double")) {
- double[] cArray = (double[]) o;
- List<Double> cList = new ArrayList<Double>();
- for (double c : cArray) {
- cList.add(new Double(c));
- }
- o = cList;
- } else if (elementType.getCanonicalName().equals("boolean")) {
- boolean[] cArray = (boolean[]) o;
- List<Boolean> cList = new ArrayList<Boolean>();
- for (boolean c : cArray) {
- cList.add(new Boolean(c));
- }
- o = cList;
- } else if (!elementType.getCanonicalName().equals("byte")){
- // Covert arrays of objects
- Object[] cArray = (Object[]) o;
- List<Object> cList = new ArrayList<Object>();
- for (Object c : cArray) {
- cList.add(c);
- }
- o = cList;
- }
- }
-
- // If a Collection but not a List
- if ((o instanceof Collection) && !(o instanceof List)) {
- List<Object> cList = new ArrayList<Object>();
- cList.addAll((Collection)o);
- o = cList;
- }
- // Next check lists.
- if (o instanceof List) {
- if (currentDepth < 1) {
- throw new ReferenceServiceException("Cannot register list at depth " + currentDepth);
- }
- List<?> l = (List<?>) o;
- // If the list is empty then register a new empty list of the
- // appropriate depth and return it
- if (l.isEmpty()) {
- try {
- IdentifiedList<T2Reference> newList = listService
- .registerEmptyList(currentDepth);
- return newList.getId();
- } catch (ListServiceException lse) {
- throw new ReferenceServiceException(lse);
- }
- }
- // Otherwise construct a new list of T2Reference and register it,
- // calling the getNameForObject method on all children of the list
- // to construct the list of references
- else {
- List<T2Reference> references = new ArrayList<T2Reference>();
- for (Object item : l) {
- // Recursively call this method with a depth one lower than
- // the current depth
- references.add(getNameForObject(item, currentDepth - 1,
- useConverterSPI, context));
- }
- try {
- IdentifiedList<T2Reference> newList = listService
- .registerList(references);
- return newList.getId();
- } catch (ListServiceException lse) {
- throw new ReferenceServiceException(lse);
- }
- }
- } else {
- // Neither a list nor an already identified object, first thing is
- // to engage the converters if enabled. Only engage if we don't
- // already have a Throwable or an ExternalReferenceSPI instance
- if (useConverterSPI && (o instanceof Throwable == false)
- && (o instanceof ExternalReferenceSPI == false)) {
- if (currentDepth != 0) {
- throw new ReferenceServiceException(
- "Cannot register object " + o + " at depth "
- + currentDepth);
- }
-
- for (ValueToReferenceConverterSPI converter : converterRegistry) {
- if (converter.canConvert(o, context)) {
- try {
- ExternalReferenceSPI ers = converter.convert(o,
- context);
- o = ers;
- break;
- } catch (ValueToReferenceConversionException vtrce) {
- // Fail, but that doesn't matter at the moment as
- // there may be more converters to try. TODO - log
- // this!
- }
- }
- }
- }
- // If the object is neither a Throwable nor an ExternalReferenceSPI
- // instance at this point we should fail the registration process,
- // this means either that the conversion process wasn't enabled or
- // that it failed to map the object type correctly.
- if ((o instanceof Throwable == false)
- && (o instanceof ExternalReferenceSPI == false)) {
- throw new ReferenceServiceException(
- "Failed to register object " + o + ", found a type '"
- + o.getClass().getCanonicalName()
- + "' which cannot currently be registered with the reference manager");
- }
- // Have either a Throwable or an ExternalReferenceSPI
- else {
- if (o instanceof Throwable) {
- // Wrap in an ErrorDocument and return the ID
- try {
- ErrorDocument doc = errorDocumentService.registerError(
- (Throwable) o, currentDepth);
- return doc.getId();
- } catch (ErrorDocumentServiceException edse) {
- throw new ReferenceServiceException(edse);
- }
- } else if (o instanceof ExternalReferenceSPI) {
- if (currentDepth != 0) {
- throw new ReferenceServiceException("Cannot register external references at depth " + currentDepth);
- }
- try {
- Set<ExternalReferenceSPI> references = new HashSet<ExternalReferenceSPI>();
- references.add((ExternalReferenceSPI) o);
- ReferenceSet rs = referenceSetService
- .registerReferenceSet(references);
- return rs.getId();
- } catch (ReferenceSetServiceException rsse) {
- throw new ReferenceServiceException(rsse);
- }
- }
- }
- }
- throw new ReferenceServiceException(
- "Should never see this, reference registration"
- + " logic has fallen off the end of the"
- + " world, check the code!");
- }
-
- /**
- * Perform recursive identifier resolution, building a collection structure
- * of Identified objects, any collection elements being IdentifiedLists of
- * Identified subclasses. If the id has depth 0 this will just return the
- * Identified to which that id refers.
- *
- * @param id
- * the T2Reference to resolve
- * @param ensureTypes
- * a set of ExternalReferenceSPI classes, this is used to augment
- * any resolved ReferenceSet instances to ensure that each one
- * has at least one of the specified types. If augmentation is
- * not required this can be set to null.
- * @param context
- * the ReferenceContext to use to resolve this and any
- * recursively resolved identifiers
- * <p>
- * If the context is null a new EmptyReferenceContext is inserted
- * in its place.
- * @return fully resolved Identified subclass - this is either a (recursive)
- * IdentifiedList of Identified, a ReferenceSet or an ErrorDocument
- * @throws ReferenceServiceException
- * if any problems occur during resolution
- */
- public Identified resolveIdentifier(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context) throws ReferenceServiceException {
- checkServices();
- if (context == null) {
- context = new EmptyReferenceContext();
- }
- switch (id.getReferenceType()) {
-
- case ReferenceSet:
- try {
- ReferenceSet rs;
- if (ensureTypes == null) {
- rs = referenceSetService.getReferenceSet(id);
- } else {
- rs = referenceSetService.getReferenceSetWithAugmentation(
- id, ensureTypes, context);
- }
- return rs;
- } catch (ReferenceSetServiceException rsse) {
- throw new ReferenceServiceException(rsse);
- }
-
- case ErrorDocument:
- try {
- ErrorDocument ed = errorDocumentService.getError(id);
- return ed;
- } catch (ErrorDocumentServiceException edse) {
- throw new ReferenceServiceException(edse);
- }
-
- case IdentifiedList:
- try {
- IdentifiedList<T2Reference> idList = listService.getList(id);
- // Construct a new list, and populate with the result of
- // resolving each ID in turn
- IdentifiedArrayList<Identified> newList = new IdentifiedArrayList<Identified>();
- for (T2Reference item : idList) {
- newList.add(resolveIdentifier(item, ensureTypes, context));
- }
- newList.setTypedId(T2ReferenceImpl.getAsImpl(id));
- return newList;
- } catch (ListServiceException lse) {
- throw new ReferenceServiceException(lse);
- }
-
- default:
- throw new ReferenceServiceException("Unsupported ID type : "
- + id.getReferenceType());
- }
- }
-
- public Object renderIdentifier(T2Reference id, Class<?> leafClass,
- ReferenceContext context) throws ReferenceServiceException {
- // Check we have the services installed
- checkServices();
-
- // Insert an empty context if context was null
- if (context == null) {
- context = new EmptyReferenceContext();
- }
-
- // Reject if the source reference contains errors
- if (id.containsErrors()) {
- throw new ReferenceServiceException(
- "Can't render an identifier which contains errors to a POJO");
- }
-
- // Attempt to find an appropriate StreamToValueConverterSPI instance to
- // build the specified class
- StreamToValueConverterSPI<?> converter = null;
- if (valueBuilderRegistry != null) {
- for (StreamToValueConverterSPI<?> stvc : valueBuilderRegistry) {
- Class<?> builtClass = stvc.getPojoClass();
- if (leafClass.isAssignableFrom(builtClass)) {
- converter = stvc;
- break;
- }
- }
- }
- if (converter == null) {
- log.warn("No stream->value converters found for type '"
- + leafClass.getCanonicalName() + "'");
- }
-
- // Render the identifier
- return renderIdentifierInner(id, leafClass, context, converter);
- }
-
- private Object renderIdentifierInner(T2Reference id, Class<?> leafClass,
- ReferenceContext context, StreamToValueConverterSPI<?> converter)
- throws ReferenceServiceException {
- checkServices();
-
- switch (id.getReferenceType()) {
-
- case IdentifiedList:
- try {
- IdentifiedList<T2Reference> idList = listService.getList(id);
- List<Object> result = new ArrayList<Object>();
- for (T2Reference child : idList) {
- result.add(renderIdentifierInner(child, leafClass, context,
- converter));
- }
- return result;
- } catch (ListServiceException lse) {
- throw new ReferenceServiceException(lse);
- }
-
- case ReferenceSet:
- try {
- ReferenceSet rs = referenceSetService.getReferenceSet(id);
- // Check that there are references in the set
- if (rs.getExternalReferences().isEmpty()) {
- throw new ReferenceServiceException(
- "Can't render an empty reference set to a POJO");
- }
- // If we can't directly map to an appropriate value keep track
- // of the cheapest reference from which to try to build the pojo
- // from a stream
- ExternalReferenceSPI cheapestReference = null;
- float cheapestReferenceCost = 10.0f;
- for (ExternalReferenceSPI ers : rs.getExternalReferences()) {
- if (ers instanceof ValueCarryingExternalReference<?>) {
- ValueCarryingExternalReference<?> vcer = (ValueCarryingExternalReference<?>) ers;
- if (leafClass.isAssignableFrom(vcer.getValueType())) {
- return vcer.getValue();
- }
- }
- // Got here so this wasn't an appropriate value type
- if (cheapestReference == null
- || ers.getResolutionCost() < cheapestReferenceCost) {
- cheapestReference = ers;
- cheapestReferenceCost = ers.getResolutionCost();
- }
- }
- if (converter != null) {
- return converter.renderFrom(cheapestReference
- .openStream(context));
- }
- } catch (Exception e) {
- throw new ReferenceServiceException(e);
- }
- throw new ReferenceServiceException(
- "No converter found, and reference set didn't contain"
- + " an appropriate value carrying reference, cannot render to POJO");
-
- default:
- throw new ReferenceServiceException("Unsupported ID type : "
- + id.getReferenceType());
- }
- }
-
- /**
- * Initiates a traversal of the specified t2reference, traversing to
- * whatever level of depth is required such that all identifiers returned
- * within the iterator have the specified depth. The context (i.e. the index
- * path from the originally specified reference to each reference within the
- * iteration) is included through use of the ContextualizedT2Reference
- * wrapper class
- *
- * @param source
- * the T2Reference from which to traverse. In general this is the
- * root of a collection structure.
- * @param desiredDepth
- * the desired depth of all returned T2References, must be less
- * than or equal to that of the source reference.
- * @throws ReferenceServiceException
- * if unable to create the iterator for some reason. Note that
- * implementations are free to lazily perform the iteration so
- * this method may succeed but the iterator produced can fail
- * when used. If the iterator fails it will do so by throwing
- * one of the underlying sub-service exceptions.
- */
- public Iterator<ContextualizedT2Reference> traverseFrom(T2Reference source,
- int desiredDepth) throws ReferenceServiceException {
- checkServices();
- if (desiredDepth < 0) {
- throw new ReferenceServiceException(
- "Cannot traverse to a negative depth");
- }
- List<ContextualizedT2Reference> workingSet = new ArrayList<ContextualizedT2Reference>();
- workingSet.add(new ContextualizedT2ReferenceImpl(source, new int[0]));
- int currentDepth = source.getDepth();
- while (currentDepth > desiredDepth) {
- List<ContextualizedT2Reference> newSet = new ArrayList<ContextualizedT2Reference>();
- for (ContextualizedT2Reference ci : workingSet) {
- T2ReferenceImpl ref = (T2ReferenceImpl) ci.getReference();
- switch (ref.getReferenceType()) {
- case IdentifiedList:
- try {
- List<T2Reference> children = getListService().getList(
- ref);
- int position = 0;
- for (T2Reference child : children) {
- newSet.add(new ContextualizedT2ReferenceImpl(child,
- addIndex(ci.getIndex(), position++)));
- }
- } catch (ListServiceException lse) {
- throw new ReferenceServiceException(lse);
- }
- break;
- case ReferenceSet:
- throw new ReferenceServiceException(
- "Should never be trying to drill inside a data document identifier");
- case ErrorDocument:
- newSet.add(new ContextualizedT2ReferenceImpl(ref
- .getDeeperErrorReference(), addIndex(ci.getIndex(),
- 0)));
- break;
- default:
- throw new ReferenceServiceException(
- "Fallen off end of case statement, unknown reference type!");
- }
- }
- currentDepth--;
- workingSet = newSet;
- }
- return workingSet.iterator();
- }
-
- /**
- * Append to an int[]
- *
- * @param current
- * current int[]
- * @param head
- * new int item to append to the current array
- * @return new array of int with the head added
- */
- private static int[] addIndex(int[] current, int head) {
- int[] result = new int[current.length + 1];
- System.arraycopy(current, 0, result, 0, current.length);
- result[current.length] = head;
- return result;
- }
-
- /**
- * Parse the reference contained in the string and return a
- * {@link T2Reference} with the correct properties
- */
- public T2Reference referenceFromString(String reference) {
- T2ReferenceImpl newRef = new T2ReferenceImpl();
- Map<String, String> parseRef = parseRef(reference);
- newRef.setNamespacePart(parseRef.get("namespace"));
- newRef.setLocalPart(parseRef.get("localPart"));
- String type = parseRef.get("type");
- if (type.equals("ref")) {
- newRef.setReferenceType(T2ReferenceType.ReferenceSet);
- } else if (type.equals("list")) {
- newRef.setReferenceType(T2ReferenceType.IdentifiedList);
- newRef.setContainsErrors(Boolean
- .parseBoolean(parseRef.get("error")));
- newRef.setDepth(Integer.parseInt(parseRef.get("depth")));
- } else if (type.equals("error")) {
- newRef.setReferenceType(T2ReferenceType.ErrorDocument);
- newRef.setDepth(Integer.parseInt(parseRef.get("depth")));
- } else {
- return null;
- // should throw an error
- }
-
- return newRef;
- }
-
- /**
- * Parse the reference and return a map with localPart, namespace, depth,
- * contains errors and the type
- *
- * @param ref
- * @return
- */
- private Map<String, String> parseRef(String ref) {
- String[] split = ref.split("\\?");
- // get the bit before and after the final '/' ie. the local part and the
- // depth, there might not be a split1[1] since it might not be a list
- String[] split2 = split[1].split("/");
- // get the t2:abc:// and the namespace
- String[] split3 = split[0].split("//");
- // get the t2 bit and the reference type bit
- String[] split4 = split3[0].split(":");
-
- Map<String, String> refPartsMap = new HashMap<String, String>();
- refPartsMap.put("type", split4[1]);
- refPartsMap.put("namespace", split3[1]);
- refPartsMap.put("localPart", split2[0]);
-
- if (refPartsMap.get("type").equals("list")) {
- refPartsMap.put("error", split2[1]);
- refPartsMap.put("depth", split2[2]);
- }
- if (refPartsMap.get("type").equals("error")) {
- refPartsMap.put("depth", split2[1]);
- }
-
- return refPartsMap;
-
- }
-
-
- public boolean delete(List<T2Reference> references)
- throws ReferenceServiceException {
- boolean result=true;
- for (T2Reference reference : references) {
- delete(reference);
- }
- return result;
- }
-
- public boolean delete(T2Reference reference)
- throws ReferenceServiceException {
- boolean result=false;
- switch (reference.getReferenceType()) {
- case IdentifiedList:
- result=listService.delete(reference);
- break;
- case ReferenceSet:
- result=referenceSetService.delete(reference);
- break;
- case ErrorDocument:
- result=referenceSetService.delete(reference);
- break;
- default:
- throw new ReferenceServiceException(
- "Unknown reference type!");
- }
- return result;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetAugmentorImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetAugmentorImpl.java
deleted file mode 100644
index cbc2685..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetAugmentorImpl.java
+++ /dev/null
@@ -1,700 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.PriorityQueue;
-import java.util.Set;
-
-import net.sf.taverna.raven.spi.InstanceRegistry;
-import net.sf.taverna.raven.spi.InstanceRegistryListener;
-import net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentationException;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentor;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentorCallback;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Implementation of ReferenceSetAugmentor using Dijkstra's shortest path
- * algorithm over a type graph built from SPI instance registries of reference
- * builders and reference translators.
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceSetAugmentorImpl implements ReferenceSetAugmentor {
-
- private final Log log = LogFactory.getLog(ReferenceSetAugmentorImpl.class);
-
- // An instance registry of ExternalReferenceBuilderSPI instances used to
- // construct ExternalReferenceSPI instances from byte streams
- private InstanceRegistry<ExternalReferenceBuilderSPI<?>> builders;
-
- // An instance registry of ExternalReferenceTranslatorSPI instances used to
- // construct ExternalReferenceSPI instances from existing
- // ExternalReferenceSPI instances.
- private InstanceRegistry<ExternalReferenceTranslatorSPI<?, ?>> translators;
-
- private boolean cacheValid = false;
-
- // A private listener used to trigger re-compilation of the shortest paths
- // from each node to each other node in the known types set
- private InstanceRegistryListener registryListener = new InstanceRegistryListener() {
- /**
- * Call the updateAdjacencyList on the enclosing type when any change
- * occurs in the SPIs
- */
- @SuppressWarnings("unchecked")
- public void instanceRegistryUpdated(InstanceRegistry theRegistry) {
- cacheValid = false;
- }
- };
-
- private final Set<Class<ExternalReferenceSPI>> knownReferenceTypes = new HashSet<Class<ExternalReferenceSPI>>();
- @SuppressWarnings("unchecked")
- private final Map<Class<ExternalReferenceSPI>, Set<ExternalReferenceTranslatorSPI>> adjacencySets = new HashMap<Class<ExternalReferenceSPI>, Set<ExternalReferenceTranslatorSPI>>();
-
- private final Map<Class<ExternalReferenceSPI>, ShortestPathSolver> solvers = new HashMap<Class<ExternalReferenceSPI>, ShortestPathSolver>();
-
- /**
- * Default constructor to make life easier when using Spring. To be
- * functional this implementation should be injected with InstanceRegistry
- * implementations containing lists of known implementations of the
- * ExternalReferenceBuilderSPI and ExternalReferenceTranslatorSPI
- * interfaces.
- */
- public ReferenceSetAugmentorImpl() {
- super();
- }
-
- /**
- * Inject an instance registry containing all known implementations of
- * ExternalReferenceBuilderSPI *
- *
- * @throws IllegalStateException
- * if this has already been set, the instance registries should
- * only be set on bean construction.
- */
- public synchronized void setBuilderRegistry(
- InstanceRegistry<ExternalReferenceBuilderSPI<?>> theRegistry) {
- if (this.builders == null) {
- this.builders = theRegistry;
- theRegistry.addRegistryListener(registryListener);
- List<ExternalReferenceBuilderSPI<?>> erb = theRegistry
- .getInstances();
- log.debug("* Builder registry injected :");
- int counter = 0;
- for (ExternalReferenceBuilderSPI<?> builder : erb) {
- log.debug("* " + (++counter) + ") "
- + builder.getClass().getSimpleName() + ", builds "
- + builder.getReferenceType().getSimpleName());
- }
- cacheValid = false;
- } else {
- log.error("Builder registry already injected, invalid operation");
- throw new IllegalStateException(
- "Can't inject the external reference builder registry "
- + "multiple times.");
- }
- }
-
- /**
- * Inject an instance registry containing all known implementations of
- * ExternalReferenceTranslatorSPI
- *
- * @throws IllegalStateException
- * if this has already been set, the instance registries should
- * only be set on bean construction.
- */
- public synchronized void setTranslatorRegistry(
- InstanceRegistry<ExternalReferenceTranslatorSPI<?, ?>> theRegistry) {
- if (this.translators == null) {
- this.translators = theRegistry;
- theRegistry.addRegistryListener(registryListener);
- List<ExternalReferenceTranslatorSPI<?, ?>> ert = theRegistry
- .getInstances();
- log.debug("* Translator registry injected :");
- int counter = 0;
- for (ExternalReferenceTranslatorSPI<?, ?> translator : ert) {
- log.debug("* " + (++counter) + ") "
- + translator.getClass().getSimpleName()
- + ", translates "
- + translator.getSourceReferenceType().getSimpleName()
- + " to "
- + translator.getTargetReferenceType().getSimpleName());
- }
- theRegistry.getInstances();
- cacheValid = false;
- } else {
- log
- .error("Translator registry already injected, invalid operation");
- throw new IllegalStateException(
- "Can't inject the translator registry multiple times.");
- }
- }
-
- @SuppressWarnings("unchecked")
- protected synchronized final void update() {
- if (builders == null || translators == null || cacheValid) {
- return;
- }
- log.debug("# Refreshing shortest path cache");
- knownReferenceTypes.clear();
- solvers.clear();
- adjacencySets.clear();
- for (ExternalReferenceBuilderSPI erb : builders) {
- knownReferenceTypes.add(erb.getReferenceType());
- }
- for (ExternalReferenceTranslatorSPI ert : translators) {
- knownReferenceTypes.add(ert.getSourceReferenceType());
- knownReferenceTypes.add(ert.getTargetReferenceType());
- getNeighbours(ert.getTargetReferenceType()).add(ert);
- }
- for (Class<ExternalReferenceSPI> type : knownReferenceTypes) {
- try {
- solvers.put(type, new ShortestPathSolver(type));
- } catch (Throwable t) {
- log.error(t);
- if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- }
- }
- }
- log.debug("# Path cache refresh done");
- cacheValid = true;
- }
-
- @SuppressWarnings("unchecked")
- Set<ExternalReferenceTranslatorSPI> getNeighbours(
- Class<ExternalReferenceSPI> node) {
- Set<ExternalReferenceTranslatorSPI> adjacentTo = adjacencySets
- .get(node);
- if (adjacentTo != null) {
- return adjacentTo;
- } else {
- HashSet<ExternalReferenceTranslatorSPI> neighbours = new HashSet<ExternalReferenceTranslatorSPI>();
- adjacencySets.put(node, neighbours);
- return neighbours;
- }
-
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public final Set<ExternalReferenceSPI> augmentReferenceSet(
- ReferenceSet references,
- Set<Class<ExternalReferenceSPI>> targetReferenceTypes,
- ReferenceContext context) throws ReferenceSetAugmentationException {
-
- synchronized (this) {
- if (!cacheValid) {
- update();
- }
- }
-
- // Synchronize on the reference set itself
- synchronized (references) {
- // First check whether we actually need to modify the reference set
- // at
- // all - it's perfectly valid to call the augmentor when nothing
- // actually needs to be done (ideally you wouldn't do this, but it's
- // likely to happen)
- for (ExternalReferenceSPI er : references.getExternalReferences()) {
- if (targetReferenceTypes.contains(er.getClass())) {
- return new HashSet<ExternalReferenceSPI>();
- }
- }
-
- // Need to perform augmentation if we reach this point
- List<TranslationPath> candidatePaths = new ArrayList<TranslationPath>();
- for (Class<ExternalReferenceSPI> target : targetReferenceTypes) {
- ShortestPathSolver solver = solvers.get(target);
- if (solver == null) {
- solver = new ShortestPathSolver(target);
- solvers.put(target, solver);
- }
- if (solver != null) {
- for (TranslationPath path : solver.getTranslationPaths()) {
- for (ExternalReferenceSPI er : references
- .getExternalReferences()) {
- if (er.getClass().equals(path.getSourceType())) {
- candidatePaths.add(path);
- }
- }
- for (TranslationPath dereferenceBasedPath : path
- .getDereferenceBasedPaths(references)) {
- candidatePaths.add(dereferenceBasedPath);
- }
- }
- }
- }
- // Now add candidate paths to represent a no-translator 'direct from
- // byte stream source' path for each target type compatible
- // reference builder
- for (ExternalReferenceBuilderSPI builder : builders) {
- if (targetReferenceTypes.contains(builder.getReferenceType())) {
- // The builder can construct one of the target types, add
- // paths for all possible pairs of 'de-reference existing
- // reference' and the builder
- for (ExternalReferenceSPI er : references
- .getExternalReferences()) {
- TranslationPath newPath = new TranslationPath();
- newPath.initialBuilder = builder;
- newPath.sourceReference = er;
- candidatePaths.add(newPath);
- }
- }
- }
-
- // Got a list of candidate paths sorted by estimated overall path
- // cost
- Collections.sort(candidatePaths);
- log
- .debug("Found "
- + candidatePaths.size()
- + " contextual translation path(s) including builder based :");
- int counter = 0;
- for (TranslationPath path : candidatePaths) {
- log.debug(" " + (++counter) + ") " + path.toString());
- }
-
- if (candidatePaths.isEmpty()) {
- log.warn("No candidate paths found for augmentation");
- throw new ReferenceSetAugmentationException(
- "No candidate translation paths were found");
- } else {
- log.debug("Performing augmentation :");
- counter = 0;
- for (TranslationPath path : candidatePaths) {
- try {
- counter++;
- Set<ExternalReferenceSPI> newReferences = path
- .doTranslation(references, context);
- log.debug(" Success ("+counter+"), created "+printRefSet(newReferences));
- return newReferences;
- } catch (Exception ex) {
- log.debug(" Failed ("+counter+")");
- log.trace(ex);
- // Use next path...
- }
- }
- log.warn(" No paths succeeded, augmentation failed");
- throw new ReferenceSetAugmentationException(
- "All paths threw exceptions, can't perform augmentation");
- }
-
- }
- }
-
- private String printRefSet(Set<ExternalReferenceSPI> set) {
- StringBuffer sb = new StringBuffer();
- sb.append("[");
- int counter = 0;
- for (ExternalReferenceSPI ref : set) {
- sb.append(ref.toString());
- counter++;
- if (counter < set.size()) {
- sb.append(",");
- }
- }
- sb.append("]");
- return sb.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- public final void augmentReferenceSetAsynch(final ReferenceSet references,
- final Set<Class<ExternalReferenceSPI>> targetReferenceTypes,
- final ReferenceContext context,
- final ReferenceSetAugmentorCallback callback)
- throws ReferenceSetAugmentationException {
- Runnable r = new Runnable() {
- public void run() {
- try {
- callback.augmentationCompleted(augmentReferenceSet(
- references, targetReferenceTypes, context));
-
- } catch (ReferenceSetAugmentationException rsae) {
- callback.augmentationFailed(rsae);
- }
- }
- };
- executeRunnable(r);
- }
-
- /**
- * Schedule a runnable for execution - current naive implementation uses a
- * new thread and executes immediately, but this is where any thread pool
- * logic would go if we wanted to add that.
- *
- * @param r
- */
- private void executeRunnable(Runnable r) {
- new Thread(r).start();
- }
-
- /**
- * A path from one external reference to another along with a total
- * estimated path cost through one or more reference translators.
- */
- class TranslationPath implements Comparable<TranslationPath>,
- Iterable<ExternalReferenceTranslatorSPI<?, ?>> {
-
- List<ExternalReferenceTranslatorSPI<?, ?>> translators = new ArrayList<ExternalReferenceTranslatorSPI<?, ?>>();
- ExternalReferenceBuilderSPI<?> initialBuilder = null;
- ExternalReferenceSPI sourceReference = null;
-
- /**
- * Return a human readable representation of this translation path, used
- * by the logging methods to print trace information.
- */
- @SuppressWarnings("unchecked")
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(getPathCost() + " ");
- if (sourceReference != null && initialBuilder != null) {
- sb.append(sourceReference.toString() + "->bytes("
- + sourceReference.getResolutionCost() + ")->");
- String builderClassName = initialBuilder.getClass()
- .getSimpleName();
- String builtType = initialBuilder.getReferenceType()
- .getSimpleName();
- sb.append("builder:" + builderClassName + "("
- + initialBuilder.getConstructionCost() + "):<"
- + builtType + ">");
- } else if (translators.isEmpty() == false) {
- sb.append("<"
- + translators.get(0).getSourceReferenceType()
- .getSimpleName() + ">");
- }
- for (ExternalReferenceTranslatorSPI translator : translators) {
- sb.append("-" + translator.getClass().getSimpleName() + "("
- + translator.getTranslationCost() + ")" + "-");
- sb.append("<"
- + translator.getTargetReferenceType().getSimpleName()
- + ">");
- }
- return sb.toString();
- }
-
- @SuppressWarnings("unchecked")
- public Set<ExternalReferenceSPI> doTranslation(ReferenceSet rs,
- ReferenceContext context) {
- Set<ExternalReferenceSPI> results = new HashSet<ExternalReferenceSPI>();
- // Firstly check whether we have an initial reference and builder
- // defined
- ExternalReferenceSPI currentReference = null;
- if (initialBuilder != null && sourceReference != null) {
- ExternalReferenceSPI builtReference = initialBuilder
- .createReference(sourceReference.openStream(context),
- context);
- results.add(builtReference);
- currentReference = builtReference;
- }
- if (translators.isEmpty() == false && currentReference == null) {
- // If there are translators in the path (there may not be if
- // this is a pure 'dereference and build' type path) and the
- // currentReference hasn't been set then search the existing
- // references for an appropriate starting point for the
- // translation.
- for (ExternalReferenceSPI er : rs.getExternalReferences()) {
- if (er.getClass().equals(
- translators.get(0).getSourceReferenceType())) {
- currentReference = er;
- break;
- }
- }
- }
- if (currentReference == null) {
- throw new RuntimeException(
- "Can't locate a starting reference for the"
- + " translation path");
- } else {
- for (ExternalReferenceTranslatorSPI translator : translators) {
- ExternalReferenceSPI translatedReference = translator
- .createReference(currentReference, context);
- results.add(translatedReference);
- currentReference = translatedReference;
- }
- }
- return results;
- }
-
- /**
- * Sum of translation costs of all translators in path
- */
- public float getPathCost() {
- float cost = 0.0f;
- for (ExternalReferenceTranslatorSPI<?, ?> ert : this) {
- cost += ert.getTranslationCost();
- }
- // If the source reference and initial builder are non-null then
- // we're going to start this translation path by downloading a byte
- // stream from the specified (current) reference and using it to
- // construct the starting point for the translation path via the
- // specified builder.
- if (sourceReference != null) {
- cost += sourceReference.getResolutionCost();
- }
- if (initialBuilder != null) {
- cost += initialBuilder.getConstructionCost();
- }
- return cost;
- }
-
- /**
- * Return a list of translation paths based on this one but which start
- * at an existing reference within the supplied reference set. Will only
- * function if there is a reference builder registered that can build
- * the initial reference type used by this translation path, otherwise
- * it returns an empty list.
- *
- * @param rs
- * @return
- */
- @SuppressWarnings("unchecked")
- public List<TranslationPath> getDereferenceBasedPaths(ReferenceSet rs) {
- List<TranslationPath> results = new ArrayList<TranslationPath>();
- for (ExternalReferenceBuilderSPI erb : builders) {
- // Check for each reference builder to see if it can build the
- // source type for this path
- if (erb.getReferenceType().equals(this.getSourceType())) {
- // The builder can construct the type used by the start of
- // this translation path, so we can in general create a path
- // from a fooreference to the target by de-referencing the
- // fooreference and building the start type from it.
- for (ExternalReferenceSPI er : rs.getExternalReferences()) {
- // For each external reference in the existing reference
- // set, check whether that type is already going to be
- // created in the translation path - if so then there's
- // not much point in emiting the modified path, as you'd
- // have something like bytes->a->b->a->result which
- // wouldn't make any sense
- boolean overlapsExistingType = false;
- for (ExternalReferenceTranslatorSPI translationStep : this) {
- if (translationStep.getSourceReferenceType()
- .equals(er.getClass())) {
- overlapsExistingType = true;
- break;
- }
- }
- if (!overlapsExistingType) {
- // The type wasn't found anywhere within the
- // translation path, so we're not generating
- // obviously stupid candidate paths.
- TranslationPath newPath = new TranslationPath();
- newPath.translators = this.translators;
- newPath.initialBuilder = erb;
- newPath.sourceReference = er;
- results.add(newPath);
- }
- }
- }
- }
- return results;
- }
-
- public List<ExternalReferenceTranslatorSPI<?, ?>> pathSteps() {
- return translators;
- }
-
- /**
- * Order by total path cost
- */
- public int compareTo(TranslationPath tp) {
- if (tp.getPathCost() > this.getPathCost()) {
- return -1;
- } else if (tp.getPathCost() < this.getPathCost()) {
- return 1;
- } else {
- return 0;
- }
- }
-
- /**
- * Wrap translator list iterator for convenience
- */
- public Iterator<ExternalReferenceTranslatorSPI<?, ?>> iterator() {
- return translators.iterator();
- }
-
- public Class<? extends ExternalReferenceSPI> getSourceType() {
- if (translators.isEmpty() == false) {
- return translators.get(0).getSourceReferenceType();
- } else if (this.sourceReference != null) {
- return this.sourceReference.getClass();
- } else {
- return null;
- }
- }
-
- public Class<? extends ExternalReferenceSPI> getTargetType() {
- if (translators.isEmpty() == false) {
- return translators.get(translators.size() - 1)
- .getTargetReferenceType();
- } else if (this.initialBuilder != null) {
- return this.initialBuilder.getReferenceType();
- } else {
- return null;
- }
- }
-
- }
-
- class ShortestPathSolver {
-
- private Map<Class<ExternalReferenceSPI>, Class<ExternalReferenceSPI>> predecessors;
- private Map<Class<ExternalReferenceSPI>, ExternalReferenceTranslatorSPI<?, ?>> translators;
- private Map<Class<ExternalReferenceSPI>, Float> shortestDistances;
- private final Comparator<Class<ExternalReferenceSPI>> shortestDistanceComparator = new Comparator<Class<ExternalReferenceSPI>>() {
- public int compare(Class<ExternalReferenceSPI> left,
- Class<ExternalReferenceSPI> right) {
- float shortestDistanceLeft = shortestDistances.get(left);
- float shortestDistanceRight = shortestDistances.get(right);
- if (shortestDistanceLeft > shortestDistanceRight) {
- return +1;
- } else if (shortestDistanceLeft < shortestDistanceRight) {
- return -1;
- } else {
- return left.getCanonicalName().compareTo(
- right.getCanonicalName());
- }
- }
- };
- private final PriorityQueue<Class<ExternalReferenceSPI>> unsettledNodes = new PriorityQueue<Class<ExternalReferenceSPI>>(
- 10, shortestDistanceComparator);
- private final Set<Class<ExternalReferenceSPI>> settledNodes = new HashSet<Class<ExternalReferenceSPI>>();
-
- private final List<TranslationPath> translationPaths = new ArrayList<TranslationPath>();
-
- public List<TranslationPath> getTranslationPaths() {
- return this.translationPaths;
- }
-
- public ShortestPathSolver(Class<ExternalReferenceSPI> targetType) {
- log.debug("# Constructing shortest paths to '"
- + targetType.getSimpleName() + "'");
- predecessors = new HashMap<Class<ExternalReferenceSPI>, Class<ExternalReferenceSPI>>();
- translators = new HashMap<Class<ExternalReferenceSPI>, ExternalReferenceTranslatorSPI<?, ?>>();
- shortestDistances = new HashMap<Class<ExternalReferenceSPI>, Float>();
- setShortestDistance(targetType, 0.0f);
- unsettledNodes.add(targetType);
- while (unsettledNodes.isEmpty() == false) {
- Class<ExternalReferenceSPI> u = extractMin();
- settledNodes.add(u);
- relaxNeighbours(u);
- }
- for (Class<ExternalReferenceSPI> c : settledNodes) {
- if (c.equals(targetType) == false) {
- // Don't calculate a path to itself!
- TranslationPath p = new TranslationPath();
- Class<ExternalReferenceSPI> node = c;
- while (predecessors.get(node) != null) {
- p.pathSteps().add(translators.get(node));
- // Recurse, should terminate at the target type
- node = predecessors.get(node);
- }
- translationPaths.add(p);
- }
- }
- Collections.sort(translationPaths);
- if (translationPaths.isEmpty()) {
- log
- .debug("# no paths discovered, type not reachable through translation");
- } else {
- log.debug("# found " + translationPaths.size()
- + " distinct path(s) :");
- int counter = 0;
- for (TranslationPath path : translationPaths) {
- log.debug("# " + (++counter) + ") " + path.toString());
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- private void relaxNeighbours(Class<ExternalReferenceSPI> u) {
- log.trace("# relaxing node " + u.getSimpleName());
- Set<Class<ExternalReferenceSPI>> alreadySeen = new HashSet<Class<ExternalReferenceSPI>>();
- for (ExternalReferenceTranslatorSPI ert : getNeighbours(u)) {
- // all the translators that translate *to* u
- Class<ExternalReferenceSPI> v = ert.getSourceReferenceType();
- log.trace("# translator found from from '" + v + "' : "
- + ert.getClass().getSimpleName());
- if (alreadySeen.contains(v) == false && isSettled(v) == false) {
- // Avoid duplicate edges, always take the first one where
- // such duplicates exist
- alreadySeen.add(v);
- if (getShortestDistance(v) > getShortestDistance(u)
- + ert.getTranslationCost()) {
- setShortestDistance(v, getShortestDistance(u)
- + ert.getTranslationCost());
- setPredecessor(v, u, ert);
- unsettledNodes.add(v);
- }
- }
- }
- }
-
- private boolean isSettled(Class<ExternalReferenceSPI> node) {
- return settledNodes.contains(node);
- }
-
- private void setShortestDistance(Class<ExternalReferenceSPI> node,
- float distance) {
- shortestDistances.put(node, distance);
- }
-
- private float getShortestDistance(Class<ExternalReferenceSPI> node) {
- Float d = shortestDistances.get(node);
- return (d == null) ? Float.MAX_VALUE : d;
- }
-
- private Class<ExternalReferenceSPI> extractMin() {
- return unsettledNodes.poll();
- }
-
- private void setPredecessor(Class<ExternalReferenceSPI> child,
- Class<ExternalReferenceSPI> parent,
- ExternalReferenceTranslatorSPI<?, ?> translator) {
- predecessors.put(child, parent);
- translators.put(child, translator);
- }
-
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.java
deleted file mode 100644
index e627bc3..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.h3.HibernateMappedEntity;
-
-/**
- * An implementation of ReferenceSet with the additional methods and metadata
- * required by Hibernate3 to allow it to be persisted in a relational store. As
- * with everything else in this package you shouldn't be using this class
- * directly! Instead of this class you should use the registration methods on
- * {@link net.sf.taverna.t2.reference.ReferenceSetService}, implementations of
- * that interface will handle the construction of ReferenceSet implementations
- * (including this one).
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceSetImpl extends AbstractEntityImpl implements
- ReferenceSet, HibernateMappedEntity {
-
- private Set<ExternalReferenceSPI> externalReferences;
-
- /**
- * Construct a new ReferenceSetImpl with the given set of external
- * references and identifier.
- *
- * @param references
- * the set of ExternalReferenceSPI which this reference set
- * should contain initially
- * @param id
- * the T2Reference to use, must be an instance of
- * ReferenceSetT2ReferenceImpl so hibernate can make use of it as
- * a compound primary key component
- */
- public ReferenceSetImpl(Set<ExternalReferenceSPI> references,
- T2ReferenceImpl id) {
- setTypedId(id);
- this.externalReferences = references;
- }
-
- /**
- * Default constructor, used by Hibernate when reconstructing this bean from
- * the database. If you call this directly from your code you must then call
- * both {@link #setExternalReferences(Set)} and
- * {@link #setId(T2ReferenceImpl)} before any use of the reference set. If
- * you're not writing the reference manager implementation you shouldn't be
- * using this class anyway.
- */
- public ReferenceSetImpl() {
- //
- }
-
- /**
- * For debugging purposes, prints a summary of the contents and identifier
- * of this reference set.
- *
- * @return human readable string representation of this object. This is not
- * regarded as 'stable' and should not be parsed for any reason!
- */
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(getId() + " [" + externalReferences.size() + "]\n");
-
- for (ExternalReferenceSPI ref : externalReferences) {
- sb.append(" " + ref.toString() + "\n");
- }
- return sb.toString();
-
- }
-
- /**
- * {@inheritDoc}
- */
- public Set<ExternalReferenceSPI> getExternalReferences() {
- return this.externalReferences;
- }
-
- /**
- * This method is only ever called from within Hibernate, and is used to
- * initialize the set of external references.
- */
- public void setExternalReferences(Set<ExternalReferenceSPI> newReferences) {
- this.externalReferences = newReferences;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceImpl.java
deleted file mode 100644
index 485e9d7..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentationException;
-import net.sf.taverna.t2.reference.ReferenceSetService;
-import net.sf.taverna.t2.reference.ReferenceSetServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Implementation of ReferenceSetService, inject with an appropriate
- * ReferenceSetDao to enable. Implements translation functionality as long as an
- * appropriate ReferenceSetAugmentor implementation is injected.
- *
- * @author Tom Oinn
- *
- */
-public class ReferenceSetServiceImpl extends AbstractReferenceSetServiceImpl
- implements ReferenceSetService {
-
- /**
- * {@inheritDoc}
- */
- public ReferenceSet getReferenceSet(T2Reference id)
- throws ReferenceSetServiceException {
- checkDao();
- try {
- return referenceSetDao.get(id);
- } catch (DaoException de) {
- throw new ReferenceSetServiceException(de);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ReferenceSet getReferenceSetWithAugmentation(T2Reference id,
- Set<Class<ExternalReferenceSPI>> ensureTypes,
- ReferenceContext context) throws ReferenceSetServiceException {
- checkDao();
- checkAugmentor();
- if (context == null) {
- context = new EmptyReferenceContext();
- }
- // Obtain the reference set
-
- try {
- // Synchronize on the reference set, should ensure that we don't
- // have multiple concurrent translations assuming that Hibernate
- // retrieves the same entity each time. To work around this
- // potentially not being the case we can synchronize on the
- // stringified form of the identifier.
- synchronized (id.toString()) {
- ReferenceSet rs = getReferenceSet(id);
- Set<ExternalReferenceSPI> newReferences = referenceSetAugmentor
- .augmentReferenceSet(rs, ensureTypes, context);
- if (newReferences.isEmpty() == false) {
- // Write back changes to the store if we got here, this can
- // potentially throw an unsupported operation exception in
- // which
- // case we have to fail the augmentation.
- try {
- rs.getExternalReferences().addAll(newReferences);
- } catch (RuntimeException re) {
- throw new ReferenceSetAugmentationException(
- "Can't add new references back into existing reference set instance");
- }
- referenceSetDao.update(rs);
- }
- return rs;
- }
-
- } catch (ReferenceSetAugmentationException rsae) {
- throw new ReferenceSetServiceException(rsae);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public ReferenceSet registerReferenceSet(
- Set<ExternalReferenceSPI> references)
- throws ReferenceSetServiceException {
- checkDao();
- checkGenerator();
- ReferenceSetImpl rsi = new ReferenceSetImpl();
- rsi
- .setExternalReferences(new HashSet<ExternalReferenceSPI>(
- references));
- T2Reference id = t2ReferenceGenerator.nextReferenceSetReference();
- rsi.setTypedId(T2ReferenceImpl.getAsImpl(id));
- try {
- referenceSetDao.store(rsi);
- return rsi;
- } catch (DaoException de) {
- throw new ReferenceSetServiceException(de);
- }
- }
-
- public boolean delete(T2Reference reference)
- throws ReferenceServiceException {
- checkDao();
- ReferenceSet set=referenceSetDao.get(reference);
- if (set==null) return false;
- return referenceSetDao.delete(set);
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleCacheProviderImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleCacheProviderImpl.java
deleted file mode 100644
index 1925ba3..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleCacheProviderImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.Identified;
-import net.sf.taverna.t2.reference.ReferenceServiceCacheProvider;
-import net.sf.taverna.t2.reference.T2Reference;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * Completely naive cache provider that just stores everything in a map. This
- * <em>will</em> run out of memory as it makes no attempt to evict old items,
- * it's really just here as a test!
- *
- * @author Tom Oinn
- *
- */
-public class SimpleCacheProviderImpl implements ReferenceServiceCacheProvider {
-
- private final Log log = LogFactory.getLog(SimpleCacheProviderImpl.class);
-
- private Map<T2Reference, Identified> cache = new HashMap<T2Reference, Identified>();
-
- public Identified get(T2Reference id) {
- log.debug("Get " + id.toString() + " (" + cache.containsKey(id) + ")");
- return cache.get(id);
- }
-
- public void put(Identified i) {
- log.debug("Put " + i.getId().toString());
- cache.put(i.getId(), i);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleT2ReferenceGenerator.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleT2ReferenceGenerator.java
deleted file mode 100644
index c7428d8..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/SimpleT2ReferenceGenerator.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Simple implementation of T2ReferenceGenerator intended to be injected into
- * the service layers for integration testing. Exposes a namespace property
- * which can be configured through spring and allocates local parts based on an
- * integer counter - this is only guaranteed to be unique within a single
- * instance of this object so isn't suitable for real production use. For proper
- * usage use an implementation tied to the backing store you're putting t2
- * reference objects into.
- *
- * @author Tom Oinn
- *
- */
-public class SimpleT2ReferenceGenerator extends AbstractT2ReferenceGenerator implements T2ReferenceGenerator {
-
- private String namespace = "testNS";
- private String localPrefix = "test";
- private int counter = 0;
-
- /**
- * Set the namespace for identifiers generated by this class as a string
- *
- * @param newNamespace
- * the namespace to use
- */
- public void setNamespace(String newNamespace) {
- this.namespace = newNamespace;
- }
-
- /**
- * Get the namespace for identifiers generated by this class
- */
- public String getNamespace() {
- return namespace;
- }
-
- @Override
- protected synchronized String getNextLocalPart() {
- return localPrefix + (counter++);
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/StackTraceElementBeanImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/StackTraceElementBeanImpl.java
deleted file mode 100644
index f316b74..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/StackTraceElementBeanImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.StackTraceElementBean;
-import net.sf.taverna.t2.reference.h3.HibernateComponentClass;
-
-/**
- * Simple bean implementation of StackTraceElement for Hibernate
- *
- * @author Tom Oinn
- *
- */
-public class StackTraceElementBeanImpl implements StackTraceElementBean,
- HibernateComponentClass {
-
- private String className;
- private String fileName;
- private String methodName;
- private int lineNumber;
-
- public StackTraceElementBeanImpl() {
- //
- }
-
- public String getClassName() {
- return this.className;
- }
-
- public void setClassName(String className) {
- this.className = className;
- }
-
- public String getFileName() {
- return this.fileName;
- }
-
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public int getLineNumber() {
- return lineNumber;
- }
-
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
-
- public String getMethodName() {
- return this.methodName;
- }
-
- public void setMethodName(String methodName) {
- this.methodName = methodName;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceImpl.java
deleted file mode 100644
index 4a1e203..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceImpl.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.h3.HibernateComponentClass;
-
-import org.apache.log4j.Logger;
-
-/**
- * An implementation of T2Reference specific to the ReferenceSetImpl. This is
- * needed because ReferenceSetImpl uses a component based primary key driven
- * from the namespace and local parts of T2Reference. This in turn means we can
- * query hibernate directly with a T2Reference instance in the data access
- * object. Because this is only used as a component (i.e. a value type) we don't
- * need to define a hibernate mapping file for it.
- *
- * @author Tom Oinn
- *
- */
-public class T2ReferenceImpl implements T2Reference, Serializable,
- HibernateComponentClass {
-
- private static Logger logger = Logger
- .getLogger(T2ReferenceImpl.class);
-
- private static final long serialVersionUID = 8363330461158750319L;
- private URI cachedUri = null;
- private String localPart;
- private String namespacePart;
- private boolean containsErrors = false;
- private T2ReferenceType referenceType = T2ReferenceType.ReferenceSet;
- private int depth = 0;
-
- public T2ReferenceImpl() {
- // Default constructor for Hibernate et al
- }
-
- /**
- * Construct a deep copy of the given T2Reference
- *
- * @param source
- * T2Reference to copy
- */
- private T2ReferenceImpl(T2Reference source) {
- super();
- setNamespacePart(source.getNamespacePart());
- setLocalPart(source.getLocalPart());
- setContainsErrors(source.containsErrors());
- setReferenceType(source.getReferenceType());
- setDepth(source.getDepth());
- }
-
- public static T2ReferenceImpl getAsImpl(T2Reference source) {
- if (source instanceof T2ReferenceImpl) {
- return (T2ReferenceImpl) source;
- } else {
- return new T2ReferenceImpl(source);
- }
- }
-
- /**
- * Return whether the identified entity either is or contains errors
- */
- public boolean containsErrors() {
- return this.containsErrors;
- }
-
- /**
- * Property accessor for Hibernate, complies with java bean spec
- */
- public boolean getContainsErrors() {
- return this.containsErrors;
- }
-
- /**
- * Get the depth of the entity referred to by this reference
- */
- public int getDepth() {
- return this.depth;
- }
-
- /**
- * Get the local part of the URI for this reference
- */
- public String getLocalPart() {
- return this.localPart;
- }
-
- /**
- * Get the namespace part of the URI for this reference
- */
- public String getNamespacePart() {
- return namespacePart;
- }
-
- /**
- * Get the type of the entity to which this reference refers
- */
- public T2ReferenceType getReferenceType() {
- return this.referenceType;
- }
-
- /**
- * This method is only ever called from within Hibernate when
- * re-constructing the identifier component to set the namespace part of the
- * identifier.
- */
- public synchronized void setNamespacePart(String namespacePart) {
- this.namespacePart = namespacePart;
- this.hashCode = -1;
- cachedUri = null;
- }
-
- /**
- * This method is only ever called from within Hibernate when
- * re-constructing the identifier component to set the local part of the
- * identifier.
- */
- public synchronized void setLocalPart(String localPart) {
- this.localPart = localPart;
- this.hashCode = -1;
- cachedUri = null;
- }
-
- /**
- * This method is only ever called from within Hibernate when
- * re-constructing the identifier component to set the depth of the
- * identifier.
- */
- public synchronized void setDepth(int depth) {
- this.depth = depth;
- this.hashCode = -1;
- cachedUri = null;
- }
-
- /**
- * This method is only ever called from within Hibernate when
- * re-constructing the identifier component to set the error property of the
- * identifier.
- */
- public synchronized void setContainsErrors(boolean containsErrors) {
- this.containsErrors = containsErrors;
- cachedUri = null;
- }
-
- /**
- * This method is only ever called from within Hibernate when
- * re-constructing the identifier component to set the reference type
- * property of the identifier.
- */
- public synchronized void setReferenceType(T2ReferenceType type) {
- this.referenceType = type;
- cachedUri = null;
- }
-
- /**
- * By default when printing an identifier we use {@link #toUri()}.{@link java.net.URI#toASCIIString() toASCIIString()}
- */
- @Override
- public String toString() {
- return toUri().toASCIIString();
- }
-
- /**
- * Drill inside an error document reference to get the error one deeper than
- * this as long as it is at least depth 1.
- */
- T2ReferenceImpl getDeeperErrorReference() {
- if (getReferenceType().equals(T2ReferenceType.ErrorDocument)) {
- if (getDepth() == 0) {
- throw new AssertionError(
- "Error identifier already has depth 0, cannot decrease");
- }
- T2ReferenceImpl result = new T2ReferenceImpl();
- result.setContainsErrors(true);
- result.setDepth(getDepth() - 1);
- result.setLocalPart(getLocalPart());
- result.setNamespacePart(getNamespacePart());
- result.setReferenceType(T2ReferenceType.ErrorDocument);
- return result;
- }
- throw new AssertionError(
- "Attempt to get a deeper reference on something that isn't an error ref");
- }
-
- /**
- * Returns the identifier expressed as a {@link java.net.URI URI},
- * constructed based on the reference type. For references to ReferenceSet
- * this is
- * <code>new URI("t2:ref//" + namespacePart + "?" + localPart)</code>
- * leading to URIs of the form <code>t2:ref//namespace?local</code>
- */
- public synchronized URI toUri() {
- if (cachedUri != null) {
- return cachedUri;
- } else if (referenceType.equals(T2ReferenceType.ReferenceSet)) {
- try {
- URI result = new URI("t2:ref//" + namespacePart + "?"
- + localPart);
- cachedUri = result;
- return result;
- } catch (URISyntaxException e) {
- logger.error("Unable to create URI", e);
- return null;
- }
- } else if (referenceType.equals(T2ReferenceType.IdentifiedList)) {
- try {
- URI result = new URI("t2:list//" + namespacePart + "?"
- + localPart + "/" + containsErrors + "/" + depth);
- cachedUri = result;
- return result;
- } catch (URISyntaxException e) {
- logger.error("Unable to create URI", e);
- return null;
- }
- } else if (referenceType.equals(T2ReferenceType.ErrorDocument)) {
- try {
- URI result = new URI("t2:error//" + namespacePart + "?"
- + localPart + "/" + depth);
- cachedUri = result;
- return result;
- } catch (URISyntaxException e) {
- logger.error("Unable to create URI", e);
- return null;
- }
- } else {
- return null;
- }
- }
-
- /**
- * Use the equality operator over the URI representation of this bean.
- */
- @Override
- public boolean equals(Object other) {
- if (other == this) {
- return true;
- }
- if (other instanceof T2ReferenceImpl) {
- T2ReferenceImpl otherRef = (T2ReferenceImpl) other;
- if (localPart.equals(otherRef.localPart)
- && namespacePart.equals(otherRef.namespacePart)
- && depth == otherRef.depth) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- }
-
- private int hashCode = -1;
-
- /**
- * Use hashcode method from the string representation of namespace, local
- * and depth parts
- */
- @Override
- public synchronized int hashCode() {
- if (this.hashCode == -1) {
- this.hashCode = getCompactForm().hashCode();
- }
- return this.hashCode;
- }
-
- private String compactForm = null;
-
- public synchronized String getCompactForm() {
- if (this.compactForm == null) {
- this.compactForm = getNamespacePart() + ":" + getLocalPart() + ":"
- + getDepth();
- }
- return this.compactForm;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.java
deleted file mode 100644
index 5cc5e0d..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.h3.HibernateMappedEntity;
-
-/**
- * Simple extension of
- * <code>{@link IdentifiedArrayList IdentifiedArrayList<T2Reference>}</code>
- * exposing get and set methods for the list contents so we can map it in
- * hibernate.
- *
- * @author Tom Oinn
- *
- */
-public class T2ReferenceListImpl extends IdentifiedArrayList<T2Reference>
- implements HibernateMappedEntity {
-
- public T2ReferenceListImpl() {
- super();
- }
-
- /**
- * This is only called from Hibernate, outside of test code, so is
- * relatively safe to leave unchecked.
- */
- @SuppressWarnings("unchecked")
- public List getListContents() {
- return this.listDelegate;
- }
-
- /**
- * This is only called from Hibernate, outside of test code, so is
- * relatively safe to leave unchecked.
- */
- @SuppressWarnings("unchecked")
- public void setListContents(List newList) {
- this.listDelegate = newList;
- }
-
- /**
- * Print the contents of this list for vaguely human readable debug
- * porpoises.
- */
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(this.getId().toString() + "\n");
- int counter = 0;
- for (T2Reference ref : listDelegate) {
- sb.append(" " + (++counter) + ") " + ref.toString() + "\n");
- }
- return sb.toString();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateErrorDocumentDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateErrorDocumentDao.java
deleted file mode 100644
index ba8f876..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateErrorDocumentDao.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.DeleteIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.hibernate.SessionFactory;
-
-/**
- * An implementation of ErrorDocumentDao based on raw hibernate session factory
- * injection and running within a spring managed context through auto-proxy
- * generation. To use this in spring inject a property 'sessionFactory' with
- * either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- * <p>
- * Methods in this Dao require transactional support
- *
- * @author Tom Oinn
- *
- */
-public class TransactionalHibernateErrorDocumentDao implements ErrorDocumentDao {
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
-
- /**
- * Fetch an ErrorDocument list by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved identified list of T2 references
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public ErrorDocument get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType().equals(T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.ErrorDocument");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (ErrorDocumentImpl) sessionFactory.getCurrentSession()
- .get(ErrorDocumentImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @PutIdentifiedOperation
- public void store(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null) {
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theDocument.getId().getReferenceType().equals(
- T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theDocument instanceof ErrorDocumentImpl) {
- try {
- sessionFactory.getCurrentSession().save(theDocument);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
- }
- }
-
- @DeleteIdentifiedOperation
- public boolean delete(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null) {
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theDocument.getId().getReferenceType().equals(
- T2ReferenceType.ErrorDocument) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theDocument instanceof ErrorDocumentImpl) {
- try {
- sessionFactory.getCurrentSession().delete(theDocument);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
- }
- return true;
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateListDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateListDao.java
deleted file mode 100644
index 126f4c0..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateListDao.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.hibernate.SessionFactory;
-
-/**
- * An implementation of ListDao based on based on raw hibernate session factory
- * injection and running within a spring managed context through auto-proxy
- * generation. To use this in spring inject a property 'sessionFactory' with
- * either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- * <p>
- * Methods in this Dao require transactional support
- *
- * @author Tom Oinn
- *
- */
-public class TransactionalHibernateListDao implements ListDao {
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
-
- /**
- * Fetch a t2reference list by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved identified list of T2 references
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public IdentifiedList<T2Reference> get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType()
- .equals(T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.IdentifiedList");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (T2ReferenceListImpl) sessionFactory.getCurrentSession()
- .get(T2ReferenceListImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @PutIdentifiedOperation
- public void store(IdentifiedList<T2Reference> theList) throws DaoException {
- if (theList.getId() == null) {
- throw new DaoException("Supplied list set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theList.getId().getReferenceType().equals(
- T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.IdentifiedList, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theList instanceof T2ReferenceListImpl) {
- try {
- sessionFactory.getCurrentSession().save(theList);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied identifier list not an instance of T2ReferenceList");
- }
- }
-
- public boolean delete(
- IdentifiedList<T2Reference> theList) throws DaoException {
- if (theList.getId() == null) {
- throw new DaoException("Supplied list set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (theList.getId().getReferenceType().equals(
- T2ReferenceType.IdentifiedList) == false) {
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.IdentifiedList, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (theList instanceof T2ReferenceListImpl) {
- try {
- sessionFactory.getCurrentSession().delete(theList);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied identifier list not an instance of T2ReferenceList");
- }
- return true;
- }
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateReferenceSetDao.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateReferenceSetDao.java
deleted file mode 100644
index d4118c5..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/TransactionalHibernateReferenceSetDao.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-import net.sf.taverna.t2.reference.annotations.DeleteIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.hibernate.SessionFactory;
-
-/**
- * An implementation of ReferenceSetDao based on raw hibernate session factory
- * injection and running within a spring managed context through auto-proxy
- * generation. To use this in spring inject a property 'sessionFactory' with
- * either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean LocalSessionFactoryBean}
- * or the equivalent class from the T2Platform module to add SPI based
- * implementation discovery and mapping. To use outside of Spring ensure you
- * call the setSessionFactory(..) method before using this (but really, use it
- * from Spring, so much easier).
- * <p>
- * Methods in this Dao require transactional support
- *
- * @author Tom Oinn
- *
- */
-public class TransactionalHibernateReferenceSetDao implements ReferenceSetDao {
-
- private SessionFactory sessionFactory;
-
- public void setSessionFactory(SessionFactory sessionFactory) {
- this.sessionFactory = sessionFactory;
- }
-
- /**
- * Store the specified new reference set
- *
- * @param rs
- * a reference set, must not already exist in the database.
- * @throws DaoException
- * if the entry already exists in the database, if the supplied
- * reference set isn't an instance of ReferenceSetImpl or if
- * something else goes wrong connecting to the database
- */
- @PutIdentifiedOperation
- public void store(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- sessionFactory.getCurrentSession().save(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- }
-
- /**
- * Update a pre-existing entry in the database
- *
- * @param rs
- * the reference set to update. This must already exist in the
- * database
- * @throws DaoException
- */
- @PutIdentifiedOperation
- public void update(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- sessionFactory.getCurrentSession().update(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- }
-
- /**
- * Fetch a reference set by id
- *
- * @param ref
- * the ReferenceSetT2ReferenceImpl to fetch
- * @return a retrieved ReferenceSetImpl
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @GetIdentifiedOperation
- public ReferenceSetImpl get(T2Reference ref) throws DaoException {
- if (ref == null) {
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- } else if (ref.getReferenceType().equals(T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.ReferenceSet");
- }
- if (ref instanceof T2ReferenceImpl) {
- try {
- return (ReferenceSetImpl) sessionFactory.getCurrentSession()
- .get(ReferenceSetImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
- }
- }
-
- @DeleteIdentifiedOperation
- public boolean delete(ReferenceSet rs) throws DaoException {
- if (rs.getId() == null) {
- throw new DaoException(
- "Supplied reference set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- } else if (rs.getId().getReferenceType().equals(
- T2ReferenceType.ReferenceSet) == false) {
- throw new DaoException(
- "Strangely the reference set ID doesn't have type "
- + "T2ReferenceType.ReferenceSet, something has probably "
- + "gone badly wrong somewhere earlier!");
- }
- if (rs instanceof ReferenceSetImpl) {
- try {
- sessionFactory.getCurrentSession().delete(rs);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- } else {
- throw new DaoException(
- "Supplied reference set not an instance of ReferenceSetImpl");
- }
- return true;
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/UUIDT2ReferenceGenerator.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/UUIDT2ReferenceGenerator.java
deleted file mode 100644
index 78b302f..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/UUIDT2ReferenceGenerator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.UUID;
-
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * A T2ReferenceGenerator based on UUIDs. Not as fast as
- * {@link SimpleT2ReferenceGenerator}, but IDs will be globally unique.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class UUIDT2ReferenceGenerator extends AbstractT2ReferenceGenerator
- implements T2ReferenceGenerator {
-
- private String namespace = "uuid";
-
- /**
- * Set the namespace for identifiers generated by this class as a string
- *
- * @param newNamespace
- * the namespace to use
- */
- public void setNamespace(String newNamespace) {
- this.namespace = newNamespace;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- @Override
- protected String getNextLocalPart() {
- return UUID.randomUUID().toString();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/WriteQueueAspect.java b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/WriteQueueAspect.java
deleted file mode 100644
index 51fbf08..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/WriteQueueAspect.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.lang.ref.SoftReference;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.Identified;
-import net.sf.taverna.t2.reference.T2Reference;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-
-/**
- * An aspect used to intercept calls to the various data access objects and
- * execute data writes on a thread limited executer with an unbounded blocking queue.
- *
- * @author David Withers
- */
-public class WriteQueueAspect {
-
- private Map<T2Reference, Identified> store = new ConcurrentHashMap<T2Reference, Identified>();
-
- private Map<T2Reference, SoftReference<Identified>> cache = new ConcurrentHashMap<T2Reference, SoftReference<Identified>>();
-
- private ThreadPoolExecutor executer;
-
- public WriteQueueAspect() {
- this(5);
- }
-
- public WriteQueueAspect(int threads) {
- executer = new ThreadPoolExecutor(threads, threads, 60,
- TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), Executors
- .defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
- }
-
-
- /**
- * Handle a 'get by T2Reference' operation on a Dao
- *
- * @param pjp
- * the join point representing the ongoing method call to the dao
- * @return the entity identified by the T2Reference supplied to the method
- * to which this advice applies
- * @throws DaoException
- * if anything goes wrong
- */
- public final Identified getObject(final ProceedingJoinPoint pjp)
- throws DaoException {
-
- Identified result = null;
-
- // Get the T2Reference from the argument to the get method
- T2Reference id = (T2Reference) pjp.getArgs()[0];
- if (id != null) {
- // try the cache
- SoftReference<Identified> ref = cache.get(id);
- if (ref != null) {
- result = ref.get();
- }
- if (result == null) {
- // not in the cache, check if it's still in the write queue
- result = store.get(id);
- }
- }
- // If we miss the cache then call the method as usual
- if (result == null) {
- try {
- result = (Identified) pjp.proceed();
- if (result != null) {
- cache.put(id, new SoftReference<Identified>(result));
- }
- } catch (Throwable e) {
- if (e instanceof DaoException) {
- throw ((DaoException) e);
- } else {
- throw new DaoException(
- "Unexpected exception type during aspect "
- + "based invocation", e);
- }
- }
- }
-
- return result;
- }
-
- /**
- * Called around a write or update operation on the backing store, writes
- * through to the cache after modifying the state of the backing store and
- * before returning from the dao method
- *
- * @param pjp
- * join point representing the ongoing method invocation to cache
- * @throws DaoException
- * if anything goes wrong
- */
- public void putObject(final ProceedingJoinPoint pjp) throws DaoException {
-
- // Get the Identified being stored by the method we're advising
- final Identified storedObject = (Identified) pjp.getArgs()[0];
-
- Runnable task = new Runnable() {
-
- public void run() {
- try {
- // Run the store or update method
- pjp.proceed();
- store.remove(storedObject.getId());
- } catch (Throwable e) {
- if (e instanceof DaoException) {
- throw ((DaoException) e);
- } else {
- throw new DaoException(
- "Unexpected exception type during aspect "
- + "based invocation", e);
- }
- }
- }
-
- };
-
- cache.put(storedObject.getId(), new SoftReference<Identified>(storedObject));
- store.put(storedObject.getId(), storedObject);
- executer.execute(task);
- }
-
- public int cacheSize() {
- return executer.getActiveCount() + executer.getQueue().size();
- }
-
-}
diff --git a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/package.html b/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/package.html
deleted file mode 100644
index 79e0107..0000000
--- a/trunk/reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<body>
-Implementation of the reference manager APIs backed by Hibernate. These
-classes are intended to be used with Spring, so have their dependencies
-injected through set methods rather than constructor arguments.
-</body>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateComponentClass b/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateComponentClass
deleted file mode 100644
index b7b5d58..0000000
--- a/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateComponentClass
+++ /dev/null
@@ -1,2 +0,0 @@
-net.sf.taverna.t2.reference.impl.T2ReferenceImpl
-net.sf.taverna.t2.reference.impl.StackTraceElementBeanImpl
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateMappedEntity b/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateMappedEntity
deleted file mode 100644
index ddf2cc5..0000000
--- a/trunk/reference-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.h3.HibernateMappedEntity
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.reference.impl.ReferenceSetImpl
-net.sf.taverna.t2.reference.impl.T2ReferenceListImpl
-net.sf.taverna.t2.reference.impl.ErrorDocumentImpl
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/META-INF/spring.handlers b/trunk/reference-impl/src/main/resources/META-INF/spring.handlers
deleted file mode 100644
index 462f844..0000000
--- a/trunk/reference-impl/src/main/resources/META-INF/spring.handlers
+++ /dev/null
@@ -1 +0,0 @@
-http\://taverna.sf.net/schema/artifact-support=net.sf.taverna.platform.spring.ArtifactSupportNamespaceHandler
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/META-INF/spring.schemas b/trunk/reference-impl/src/main/resources/META-INF/spring.schemas
deleted file mode 100644
index a4a0513..0000000
--- a/trunk/reference-impl/src/main/resources/META-INF/spring.schemas
+++ /dev/null
@@ -1 +0,0 @@
-http\://taverna.sf.net/schema/artifact-support/artifact-support.xsd=artifact-support.xsd
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/artifact-support.xsd b/trunk/reference-impl/src/main/resources/artifact-support.xsd
deleted file mode 100644
index 9fd6891..0000000
--- a/trunk/reference-impl/src/main/resources/artifact-support.xsd
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<xsd:schema xmlns="http://taverna.sf.net/schema/artifact-support"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:beans="http://www.springframework.org/schema/beans"
- targetNamespace="http://taverna.sf.net/schema/artifact-support"
- elementFormDefault="qualified">
-
- <xsd:import namespace="http://www.springframework.org/schema/beans" />
-
- <xsd:attribute name="artifact" type="xsd:string" />
- <xsd:attribute name="repository" type="xsd:string" />
-
- <xsd:element name="repository">
- <xsd:complexType>
- <xsd:complexContent>
- <xsd:extension base="beans:identifiedType">
- <xsd:all>
- <xsd:element ref="system" />
- <xsd:element ref="repositories" />
- </xsd:all>
- <xsd:attribute name="base" type="xsd:string"
- use="required" />
- </xsd:extension>
- </xsd:complexContent>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="system">
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded" minOccurs="0">
- <xsd:element ref="sys" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="sys">
- <xsd:complexType>
- <xsd:attribute name="artifact" type="xsd:string" use="required"/>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="repositories">
- <xsd:complexType>
- <xsd:sequence maxOccurs="unbounded" minOccurs="0">
- <xsd:element ref="rep" />
- </xsd:sequence>
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="rep">
- <xsd:complexType>
- <xsd:attribute name="url" type="xsd:anyURI" use="required" />
- </xsd:complexType>
- </xsd:element>
-
-
-</xsd:schema>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.hbm.xml b/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.hbm.xml
deleted file mode 100644
index 0bf7bba..0000000
--- a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.hbm.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for ErrorDocumentImpl -->
-<hibernate-mapping>
- <class name="net.sf.taverna.t2.reference.impl.ErrorDocumentImpl"
- abstract="false">
- <id name="internalId" column="id" type="string"/>
- <!-- Composite key constructed from the namespace and local -->
- <!-- parts of the T2Reference implementation type -->
- <component name="typedId"
- class="net.sf.taverna.t2.reference.impl.T2ReferenceImpl">
- <property name="namespacePart" />
- <property name="localPart" />
- <property name="containsErrors"/>
- <property name="depth"/>
- <property name="referenceType"/>
- </component>
- <property name="message" length="10000"/>
- <property name="exceptionMessage" length="10000"/>
- <list name="stackTraceList" cascade="all" lazy="false">
- <key column="id" not-null="true"/>
- <list-index column="i" base="0" />
- <composite-element
- class="net.sf.taverna.t2.reference.impl.StackTraceElementBeanImpl">
- <property name="fileName" />
- <property name="className" />
- <property name="methodName" />
- <property name="lineNumber" />
- </composite-element>
- </list>
- <set name="errorReferenceSet" cascade="all" lazy="false">
- <key column="id" not-null="true"/>
- <composite-element
- class="net.sf.taverna.t2.reference.impl.T2ReferenceImpl">
- <property name="namespacePart" />
- <property name="localPart" />
- <property name="containsErrors"/>
- <property name="depth"/>
- <property name="referenceType"/>
- </composite-element>
- </set>
- </class>
-</hibernate-mapping>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.hbm.xml b/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.hbm.xml
deleted file mode 100644
index 715f002..0000000
--- a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/ReferenceSetImpl.hbm.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for ReferenceSetImpl -->
-<hibernate-mapping>
- <class name="net.sf.taverna.t2.reference.impl.ReferenceSetImpl"
- abstract="false" lazy="false">
- <id name="internalId" column="id" type="string"
- unsaved-value="null" />
-
- <!-- Composite key constructed from the namespace and local -->
- <!-- parts of the T2Reference implementation type, used as -->
- <!-- the foreign key in the one to many relationship with -->
- <!-- extensions of AbstractExternalReference -->
-
- <component name="typedId"
- class="net.sf.taverna.t2.reference.impl.T2ReferenceImpl">
- <property name="namespacePart" />
- <property name="localPart" />
- <property name="containsErrors" />
- <property name="depth" />
- <property name="referenceType" />
- </component>
- <set name="externalReferences" cascade="all" lazy="false">
- <key column="id" />
- <one-to-many
- class="net.sf.taverna.t2.reference.AbstractExternalReference" />
- </set>
-
- </class>
-</hibernate-mapping>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.hbm.xml b/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.hbm.xml
deleted file mode 100644
index 3db2e9f..0000000
--- a/trunk/reference-impl/src/main/resources/net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.hbm.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for T2ReferenceListImpl, used by HibernateListDao -->
-<hibernate-mapping>
- <class name="net.sf.taverna.t2.reference.impl.T2ReferenceListImpl"
- abstract="false">
- <id name="internalId" column="id" type="string"/>
- <!-- Composite key constructed from the namespace and local -->
- <!-- parts of the T2Reference implementation type, used as -->
- <!-- the foreign key in the one to many relationship with -->
- <!-- extensions of AbstractExternalReference -->
- <component name="typedId"
- class="net.sf.taverna.t2.reference.impl.T2ReferenceImpl">
- <property name="namespacePart" />
- <property name="localPart" />
- <property name="containsErrors" />
- <property name="depth" />
- <property name="referenceType" />
- </component>
- <list name="listContents" cascade="all" lazy="false">
- <key column="id"/>
- <list-index column="i" base="0" />
- <composite-element
- class="net.sf.taverna.t2.reference.impl.T2ReferenceImpl">
- <!-- Explicit column mapping otherwise we colide with the implict -->
- <!-- mapping used in the key columns. Oh the joys of composites.. -->
- <property name="namespacePart" column="c_namespace" />
- <property name="localPart" column="c_local" />
- <property name="containsErrors" column="c_errors" />
- <property name="depth" column="c_depth" />
- <property name="referenceType" column="c_type" />
- </composite-element>
- </list>
- </class>
-</hibernate-mapping>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/PropertyInterpolatorTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/PropertyInterpolatorTest.java
deleted file mode 100644
index fd97074..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/PropertyInterpolatorTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring;
-
-import static net.sf.taverna.platform.spring.PropertyInterpolator.interpolate;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Properties;
-
-import org.junit.Test;
-
-/**
- * Test case for the property interpolator, mostly because java regex is evil
- *
- * @author Tom Oinn
- *
- */
-public class PropertyInterpolatorTest {
-
- static Properties exampleProperties() {
- Properties props = new Properties();
- props.put("a", "x");
- props.put("a.b", "xy");
- return props;
- }
-
- @Test
- public void testInterpolation() {
- assertEquals(interpolate("${a}", exampleProperties()), "x");
- assertEquals(interpolate("foo ${a} bar", exampleProperties()),
- "foo x bar");
- assertEquals(interpolate("foo ${a}${a.b} bar", exampleProperties()),
- "foo xxy bar");
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBCTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBCTest.java
deleted file mode 100644
index 449f2b6..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBCTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.platform.spring.jdbc;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-
-import org.junit.Test;
-
-/**
- * Test {@link TemporaryJDBC}
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class TemporaryJDBCTest {
-
- private static final String DB = ".db";
- private static final String T2PLATFORM = "t2platform-";
- private static final String CREATE_TRUE = ";create=true";
- private static final String JDBC_DERBY = "jdbc:derby:";
-
- @Test
- public void getDerby() throws Exception {
- TemporaryJDBC temporaryJDBC = new TemporaryJDBC();
- String jdbcURL = temporaryJDBC.getTemporaryDerbyJDBC();
- assertTrue("Not a Derby URL", jdbcURL.startsWith(JDBC_DERBY));
- String url = jdbcURL.split(JDBC_DERBY)[1];
- assertTrue("Did not end with " + CREATE_TRUE, url.endsWith(CREATE_TRUE));
- String location = url.split(CREATE_TRUE)[0];
- assertFalse("Location was an empty string", location.equals(""));
- File locationFile = new File(location);
- assertFalse("File already exists: " + locationFile, locationFile.exists());
- File parentFile = locationFile.getParentFile();
- assertTrue("Parent directory did not exist", parentFile.isDirectory());
- assertTrue("Did not end with " + T2PLATFORM, parentFile.getName().startsWith(T2PLATFORM));
- assertTrue("Did not start with " + DB , parentFile.getName().endsWith(DB));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/DatabaseSetupTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/DatabaseSetupTest.java
deleted file mode 100644
index cfbf51a..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/DatabaseSetupTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.reference.impl;
-
-import java.util.HashSet;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Tests initialization of the Derby database and Hibernate ORM system
- *
- * @author Tom Oinn
- */
-public class DatabaseSetupTest {
-
- @Test
- public void testListStorage() {
- ApplicationContext context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- ListDao o = (ListDao) context.getBean("testListDao");
- T2ReferenceImpl listReference = new T2ReferenceImpl();
- listReference.setContainsErrors(false);
- listReference.setDepth(1);
- listReference.setLocalPart("list1");
- listReference.setNamespacePart("testNamespace");
- listReference.setReferenceType(T2ReferenceType.IdentifiedList);
-
- T2ReferenceListImpl l = new T2ReferenceListImpl();
-
- T2ReferenceImpl itemId1 = new T2ReferenceImpl();
- itemId1.setNamespacePart("testNamespace");
- itemId1.setLocalPart("item1");
- T2ReferenceImpl itemId2 = new T2ReferenceImpl();
- itemId2.setNamespacePart("testNamespace");
- itemId2.setLocalPart("item2");
-
- l.add(itemId1);
- l.add(itemId2);
-
- l.setTypedId(listReference);
-
- System.out.println(l);
-
- o.store(l);
-
- T2ReferenceImpl listReference2 = new T2ReferenceImpl();
- listReference2.setContainsErrors(false);
- listReference2.setDepth(1);
- listReference2.setLocalPart("list1");
- listReference2.setNamespacePart("testNamespace");
- listReference2.setReferenceType(T2ReferenceType.IdentifiedList);
-
- System.out.println(o.get(listReference2));
-
- }
-
- @SuppressWarnings("serial")
- @Test
- public void testDatabaseReadWriteWithoutPlugins() {
- ApplicationContext context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- ReferenceSetDao o = (ReferenceSetDao) context
- .getBean("testDao");
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
- ReferenceSetImpl rs = new ReferenceSetImpl(
- new HashSet<ExternalReferenceSPI>(), id);
- o.store(rs);
-
-
- // Retrieve with a new instance of an anonymous subclass of
- // ReferenceSetT2ReferenceImpl, just to check that hibernate can cope
- // with this. It can, but this *must* be a subclass of the registered
- // component type, which means we need to modify the component type to
- // be the fully generic T2Reference with all fields accessed via
- // properties.
- T2Reference newReference = new T2ReferenceImpl() {
-
- public boolean containsErrors() {
- return false;
- }
-
- public int getDepth() {
- return 0;
- }
-
- public String getLocalPart() {
- return "testLocal";
- }
-
- public String getNamespacePart() {
- return "testNamespace";
- }
-
- };
-
-
- ReferenceSet returnedset = o.get(newReference);
- Assert.assertNotNull(returnedset.getId());
-
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentDaoTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentDaoTest.java
deleted file mode 100644
index b3a4235..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentDaoTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class ErrorDocumentDaoTest {
-
- private ApplicationContext context;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- }
-
- @Test
- public void store() throws Exception {
- ErrorDocumentDao dao = (ErrorDocumentDao) context.getBean("testErrorDao");
- ErrorDocumentImpl doc = new ErrorDocumentImpl();
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setReferenceType(T2ReferenceType.ErrorDocument);
- id.setDepth(0);
- id.setContainsErrors(true);
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
-
- doc.setExceptionMessage("An exception");
-
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(id);
-
- doc.setTypedId(typedId);
-
- dao.store(doc);
- assertNotNull(dao.get(id));
- }
-
- /**
- * Tests that .get returns null when its missing, rather than throw an exception
- */
- @Test
- public void getMissingItemReturnsNull() {
- ErrorDocumentDao dao = (ErrorDocumentDao) context.getBean("testErrorDao");
- ErrorDocumentImpl doc = new ErrorDocumentImpl();
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setReferenceType(T2ReferenceType.ErrorDocument);
- id.setDepth(0);
- id.setContainsErrors(true);
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
-
- doc.setExceptionMessage("An exception");
-
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(id);
-
- doc.setTypedId(typedId);
- assertNull(dao.get(id));
- }
-
- @Test
- public void delete() throws Exception {
- ErrorDocumentDao dao = (ErrorDocumentDao) context.getBean("testErrorDao");
- ErrorDocumentImpl doc = new ErrorDocumentImpl();
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setReferenceType(T2ReferenceType.ErrorDocument);
- id.setDepth(0);
- id.setContainsErrors(true);
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
-
- doc.setExceptionMessage("An exception");
-
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(id);
-
- doc.setTypedId(typedId);
-
- dao.store(doc);
- assertNotNull(dao.get(id));
-
- assertTrue(dao.delete(doc));
- assertNull(dao.get(id));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceTest.java
deleted file mode 100644
index bce9d14..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class ErrorDocumentServiceTest {
-
- private ApplicationContext context;
- private ErrorDocumentServiceImpl service;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- service = new ErrorDocumentServiceImpl();
- service.setErrorDao((ErrorDocumentDao)context.getBean("testErrorDao"));
- service.setT2ReferenceGenerator(new SimpleT2ReferenceGenerator());
-
- }
-
- @Test
- public void delete() throws Exception {
- ErrorDocument doc = service.registerError("Fred", 0);
- assertNotNull(service.getError(doc.getId()));
- assertTrue(service.delete(doc.getId()));
- assertNull(service.getError(doc.getId()));
- assertFalse(service.delete(doc.getId()));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ListServiceTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ListServiceTest.java
deleted file mode 100644
index c7735df..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ListServiceTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.T2Reference;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class ListServiceTest {
-
- private ApplicationContext context;
- private ListServiceImpl service;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- service = new ListServiceImpl();
- service.setListDao((ListDao)context.getBean("testListDao"));
- service.setT2ReferenceGenerator(new SimpleT2ReferenceGenerator());
- }
-
- @Test
- public void delete() throws Exception {
- IdentifiedList<T2Reference> list =service.registerEmptyList(1);
- assertNotNull(service.getList(list.getId()));
- assertTrue(service.delete(list.getId()));
- assertNull(service.getList(list.getId()));
- assertFalse(service.delete(list.getId()));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetDaoTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetDaoTest.java
deleted file mode 100644
index 88c4949..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetDaoTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class ReferenceSetDaoTest {
-
- private ApplicationContext context;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- }
-
- @Test
- @Ignore
- public void testStore() throws Exception {
- ReferenceSetDao dao = (ReferenceSetDao) context.getBean("testDao");
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
- ReferenceSetImpl rs = new ReferenceSetImpl(
- new HashSet<ExternalReferenceSPI>(), id);
- dao.store(rs);
- assertNotNull(dao.get(id));
- }
-
- @Test
- @Ignore
- public void testDelete() throws Exception {
- ReferenceSetDao dao = (ReferenceSetDao) context.getBean("testDao");
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
- ReferenceSetImpl rs = new ReferenceSetImpl(
- new HashSet<ExternalReferenceSPI>(), id);
- dao.store(rs);
- assertNotNull(dao.get(id));
- assertTrue(dao.delete(rs));
- assertNull(dao.get(id));
- }
-
- /**
- * Tests that .get returns null when its missing, rather than throw an exception
- */
- @Test
- @Ignore
- public void getMissingItemReturnsNull() {
- ReferenceSetDao dao = (ReferenceSetDao) context.getBean("testDao");
- T2ReferenceImpl id = new T2ReferenceImpl();
- id.setNamespacePart("testNamespace");
- id.setLocalPart("testLocal");
- ReferenceSetImpl rs = new ReferenceSetImpl(
- new HashSet<ExternalReferenceSPI>(), id);
- assertNull(dao.get(id));
-
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceTest.java
deleted file mode 100644
index bde4ccd..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/ReferenceSetServiceTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashSet;
-
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class ReferenceSetServiceTest {
-
- private ApplicationContext context;
- private ReferenceSetServiceImpl service;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- service = new ReferenceSetServiceImpl();
- service.setReferenceSetDao((ReferenceSetDao)context.getBean("testDao"));
- service.setT2ReferenceGenerator(new SimpleT2ReferenceGenerator());
- }
-
- @Test
- public void delete() throws Exception {
- ReferenceSet set = service.registerReferenceSet(new HashSet());
- assertNotNull(service.getReferenceSet(set.getId()));
- assertTrue(service.delete(set.getId()));
- assertNull(service.getReferenceSet(set.getId()));
- assertFalse(service.delete(set.getId()));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/RefererenceListDaoTest.java b/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/RefererenceListDaoTest.java
deleted file mode 100644
index e526a88..0000000
--- a/trunk/reference-impl/src/test/java/net/sf/taverna/t2/reference/impl/RefererenceListDaoTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.sf.taverna.t2.reference.impl;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-public class RefererenceListDaoTest {
-
- private ApplicationContext context;
-
- @Before
- public void setup() throws Exception {
- context = new ClassPathXmlApplicationContext(
- "vanillaHibernateAppContext.xml");
- }
-
- @Test
- public void store() throws Exception {
- ListDao dao = (ListDao)context.getBean("testListDao");
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart("testNamespace");
- r.setLocalPart("testLocal");
- r.setReferenceType(T2ReferenceType.IdentifiedList);
- r.setDepth(0);
- r.setContainsErrors(false);
- T2ReferenceListImpl newList = new T2ReferenceListImpl();
- newList.setTypedId(r);
- dao.store(newList);
- assertNotNull(dao.get(r));
- }
-
- /**
- * Tests that .get returns null when its missing, rather than throw an exception
- */
- @Test
- public void getMissingItemReturnsNull() {
- ListDao dao = (ListDao)context.getBean("testListDao");
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart("testNamespace");
- r.setLocalPart("testLocal");
- r.setReferenceType(T2ReferenceType.IdentifiedList);
- r.setDepth(0);
- r.setContainsErrors(false);
- T2ReferenceListImpl newList = new T2ReferenceListImpl();
- newList.setTypedId(r);
- assertNull(dao.get(r));
- }
-
- @Test
- public void delete() throws Exception {
- ListDao dao = (ListDao)context.getBean("testListDao");
- T2ReferenceImpl r = new T2ReferenceImpl();
- r.setNamespacePart("testNamespace");
- r.setLocalPart("testLocal");
- r.setReferenceType(T2ReferenceType.IdentifiedList);
- r.setDepth(0);
- r.setContainsErrors(false);
- T2ReferenceListImpl newList = new T2ReferenceListImpl();
- newList.setTypedId(r);
- dao.store(newList);
- assertNotNull(dao.get(r));
- assertTrue(dao.delete(newList));
- assertNull(dao.get(r));
- }
-
-}
diff --git a/trunk/reference-impl/src/test/resources/commons-logging.properties b/trunk/reference-impl/src/test/resources/commons-logging.properties
deleted file mode 100644
index 9a27a97..0000000
--- a/trunk/reference-impl/src/test/resources/commons-logging.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-# Force use of Log4J based logging
-org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
\ No newline at end of file
diff --git a/trunk/reference-impl/src/test/resources/log4j.xml b/trunk/reference-impl/src/test/resources/log4j.xml
deleted file mode 100644
index f1f4d5e..0000000
--- a/trunk/reference-impl/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-
-<!-- Default Log4J configuration for integration test module -->
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
- <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern"
- value="%p - %C{1}.%M(%L) | %m%n" />
- </layout>
- </appender>
-
- <logger name="net.sf.taverna.platform.spring.orm">
- <level value="TRACE" />
- </logger>
-
- <logger name="net.sf.taverna.platform.spring">
- <level value="INFO" />
- </logger>
-
- <logger name="org.hibernate">
- <level value="ERROR" />
- </logger>
-
- <!--
- <logger name="org.hibernate.SQL">
- <level value="TRACE" />
- </logger>
- <logger name="org.hibernate.type">
- <level value="DEBUG" />
- </logger>
- -->
-
- <logger name="org.springframework">
- <level value="WARN" />
- </logger>
-
- <root>
- <level value="ERROR" />
- <appender-ref ref="CONSOLE" />
- </root>
-
-</log4j:configuration>
\ No newline at end of file
diff --git a/trunk/reference-impl/src/test/resources/vanillaHibernateAppContext.xml b/trunk/reference-impl/src/test/resources/vanillaHibernateAppContext.xml
deleted file mode 100644
index a07897d..0000000
--- a/trunk/reference-impl/src/test/resources/vanillaHibernateAppContext.xml
+++ /dev/null
@@ -1,121 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- A test context with no raven aware components used by the DatabaseSetupTest -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:raven="http://taverna.sf.net/schema/artifact-support"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context
- http://www.springframework.org/schema/context/spring-context-2.5.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
-
- <!-- Transaction manager, commented out to use the regular dao implementations -->
- <!--
- <tx:annotation-driven transaction-manager="txManager" />
- <bean id="txManager"
- class="org.springframework.orm.hibernate3.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactoryBean" />
- </bean>
- -->
-
-
- <!-- Apache Derby rooted at a temporary directory -->
- <bean id="t2reference.jdbc.temporaryjdbc"
- class="net.sf.taverna.platform.spring.jdbc.TemporaryJDBC">
- </bean>
- <bean id="t2reference.jdbc.url" class="java.lang.String"
- factory-bean="t2reference.jdbc.temporaryjdbc"
- factory-method="getTemporaryDerbyJDBC" />
-
- <!-- At least for testing purposes we use Apache Derby -->
- <bean id="exampleDataSource"
- class="net.sf.taverna.platform.spring.jdbc.InterpolatingDriverManagerDataSource">
- <property name="driverClassName">
- <value>org.apache.derby.jdbc.EmbeddedDriver</value>
- </property>
- <property name="url">
- <ref bean="t2reference.jdbc.url" />
- </property>
- </bean>
-
- <!-- Configure hibernate to use dynamic schema update -->
- <bean id="exampleHibernateProperties"
- class="org.springframework.beans.factory.config.PropertiesFactoryBean">
- <property name="properties">
- <props>
- <prop key="hibernate.hbm2ddl.auto">create</prop>
- <prop key="hibernate.dialect">
- org.hibernate.dialect.DerbyDialect
- </prop>
- <prop key="hibernate.query.substitutions">
- true 'T', false 'F'
- </prop>
- <prop key="hibernate.show_sql">false</prop>
- <prop key="hibernate.c3p0.minPoolSize">5</prop>
- <prop key="hibernate.c3p0.maxPoolSize">20</prop>
- <prop key="hibernate.c3p0.timeout">600</prop>
- <prop key="hibernate.c3p0.max_statement">50</prop>
- <prop key="hibernate.c3p0.testConnectionOnCheckout">
- false
- </prop>
- <prop key="show_sql">true</prop>
- <prop key="format_sql">true</prop>
- </props>
- </property>
- </bean>
-
- <!-- A regular hibernate session factory -->
- <bean id="sessionFactoryBean"
- class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
- <property name="dataSource">
- <ref local="exampleDataSource" />
- </property>
- <property name="hibernateProperties">
- <ref bean="exampleHibernateProperties" />
- </property>
- <property name="mappingResources">
- <list>
- <value>
- net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
- </value>
- <value>
- net/sf/taverna/t2/reference/impl/ReferenceSetImpl.hbm.xml
- </value>
- <value>
- net/sf/taverna/t2/reference/impl/T2ReferenceListImpl.hbm.xml
- </value>
- <value>
- net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.hbm.xml
- </value>
- </list>
- </property>
- </bean>
-
- <!-- Test data access object -->
- <bean id="testDao"
- class="net.sf.taverna.t2.reference.impl.HibernateReferenceSetDao">
- <property name="sessionFactory">
- <ref local="sessionFactoryBean" />
- </property>
- </bean>
-
- <!-- Test list data access object -->
- <bean id="testListDao"
- class="net.sf.taverna.t2.reference.impl.HibernateListDao">
- <property name="sessionFactory">
- <ref local="sessionFactoryBean" />
- </property>
- </bean>
-
- <!-- Test list data access object -->
- <bean id="testErrorDao"
- class="net.sf.taverna.t2.reference.impl.HibernateErrorDocumentDao">
- <property name="sessionFactory">
- <ref local="sessionFactoryBean" />
- </property>
- </bean>
-
-</beans>
\ No newline at end of file
diff --git a/trunk/reference-testhelpers/pom.xml b/trunk/reference-testhelpers/pom.xml
deleted file mode 100644
index 136b0f4..0000000
--- a/trunk/reference-testhelpers/pom.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-testhelpers</artifactId>
-
- <name>T2reference dummy implementations for testing</name>
-
- <description>
- In order to properly test the raven-aware functionality within
- the t2reference modules we need a module that is entire external
- to t2reference and to the test cases. If the test
- implementations are included in either the api, core
- implementation or test modules they will be loaded by the root
- classloader of the test runner - by putting them in an
- independent artifact we allow them to be loaded through raven's
- various SPI discovery mechanisms as they would be in a 'real'
- environment.
- </description>
-
- <dependencies>
- <!-- Only depend on the t2reference API package here -->
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/BlueReference.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/BlueReference.java
deleted file mode 100644
index 0622264..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/BlueReference.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import net.sf.taverna.t2.reference.AbstractExternalReference;
-import net.sf.taverna.t2.reference.DereferenceException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferencedDataNature;
-
-/**
- * BlueReferences carry their data as an internal String and have a resolution
- * cost of 1.0f whatever the value of that string.
- *
- * @author Tom Oinn
- *
- */
-public class BlueReference extends AbstractExternalReference implements
- ExternalReferenceSPI {
-
- // Hold the 'value' of this reference, probably the simplest backing store
- // possible for an ExternalReferenceSPI implementation :)
- private String contents;
-
- public BlueReference() {
- //
- }
-
- public BlueReference(String contents) {
- this.contents = contents;
- }
-
- /**
- * Set the 'value' of this reference as a string. It's not really a
- * reference type in any true sense of the word, but it'll do for testing
- * the augmentation system. This method is really here so you can configure
- * test beans from spring.
- */
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- /**
- * Get the 'value' of this reference as a string, really just returns the
- * internal string representation.
- */
- public String getContents() {
- return this.contents;
- }
-
- /**
- * Fakes a de-reference operation, returning a byte stream over the string
- * data.
- */
- public InputStream openStream(ReferenceContext arg0) {
- try {
- return new ByteArrayInputStream(this.contents
- .getBytes(getCharset()));
- } catch (UnsupportedEncodingException e) {
- throw new DereferenceException(e);
- }
- }
-
- /**
- * Default resolution cost of 1.0f whatever the contents
- */
- @Override
- public float getResolutionCost() {
- return 1.0f;
- }
-
- /**
- * Data nature set to 'ReferencedDataNature.TEXT'
- */
- @Override
- public ReferencedDataNature getDataNature() {
- return ReferencedDataNature.TEXT;
- }
-
- /**
- * Character encoding set to 'UTF-8'
- */
- @Override
- public String getCharset() {
- return "UTF-8";
- }
-
- /**
- * String representation for testing, returns <code>blue{CONTENTS}</code>
- */
- @Override
- public String toString() {
- return "blue{" + contents + "}";
- }
-
-}
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenBuilder.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenBuilder.java
deleted file mode 100644
index 14e9d63..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenBuilder.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI;
-import net.sf.taverna.t2.reference.ExternalReferenceConstructionException;
-import net.sf.taverna.t2.reference.ReferenceContext;
-
-import org.apache.log4j.Logger;
-
-/**
- * Trivially build a GreenReference from an InputStream, implementing the
- * ExternalReferenceBuilderSPI interface. Used in the augmentation test cases.
- *
- * @author Tom Oinn
- *
- */
-public class GreenBuilder implements
- ExternalReferenceBuilderSPI<GreenReference> {
-
- private static Logger logger = Logger
- .getLogger(GreenBuilder.class);
-
- /**
- * Construct a new GreenReference from the given input stream, ignoring the
- * otherwise helpful context as we don't need any resources from it. We
- * assume UTF-8 encoding as that's what all the test reference types use,
- * again, with a real example this might have to be a bit smarter!
- *
- * @throws ExternalReferenceConstructionException
- * if there are any issues building the new GreenReference
- * (which there won't be)
- */
- public GreenReference createReference(InputStream is,
- ReferenceContext context)
- throws ExternalReferenceConstructionException {
- GreenReference newReference = new GreenReference();
- // Read input stream into the 'contents' property of the reference
- BufferedReader in = new BufferedReader(new InputStreamReader(is));
- try {
- newReference.setContents(in.readLine());
- } catch (IOException e) {
- throw new ExternalReferenceConstructionException(e);
- } finally {
- try {
- is.close();
- in.close();
- } catch (IOException e) {
- logger.error("Unable to close streams", e);
- }
- }
- return newReference;
- }
-
- /**
- * Construction cost fixed at 1.5f
- *
- * @return <code>1.5f</code>
- */
- public float getConstructionCost() {
- return 1.5f;
- }
-
- /**
- * @return <code>{@link net.sf.taverna.t2referencetest.GreenReference GreenReference}.class</code>
- */
- public Class<GreenReference> getReferenceType() {
- return GreenReference.class;
- }
-
- /**
- * Doesn't use any context resources so is always enabled
- *
- * @return <code>true</code>
- */
- public boolean isEnabled(ReferenceContext arg0) {
- return true;
- }
-
-}
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenReference.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenReference.java
deleted file mode 100644
index f5fa1ad..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenReference.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import net.sf.taverna.t2.reference.AbstractExternalReference;
-import net.sf.taverna.t2.reference.DereferenceException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferencedDataNature;
-
-/**
- * GreenReferences carry their data as an internal String and have a resolution
- * cost of 1.1f whatever the value of that string.
- *
- * @author Tom Oinn
- *
- */
-public class GreenReference extends AbstractExternalReference implements
- ExternalReferenceSPI {
-
- // Hold the 'value' of this reference, probably the simplest backing store
- // possible for an ExternalReferenceSPI implementation :)
- private String contents;
-
- public GreenReference() {
- //
- }
-
- public GreenReference(String contents) {
- this.contents = contents;
- }
-
- /**
- * Set the 'value' of this reference as a string. It's not really a
- * reference type in any true sense of the word, but it'll do for testing
- * the augmentation system. This method is really here so you can configure
- * test beans from spring.
- */
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- /**
- * Get the 'value' of this reference as a string, really just returns the
- * internal string representation.
- */
- public String getContents() {
- return this.contents;
- }
-
- /**
- * Fakes a de-reference operation, returning a byte stream over the string
- * data.
- */
- public InputStream openStream(ReferenceContext arg0) {
- try {
- return new ByteArrayInputStream(this.contents
- .getBytes(getCharset()));
- } catch (UnsupportedEncodingException e) {
- throw new DereferenceException(e);
- }
- }
-
- /**
- * Default resolution cost of 1.0f whatever the contents
- */
- @Override
- public float getResolutionCost() {
- return 1.1f;
- }
-
- /**
- * Data nature set to 'ReferencedDataNature.TEXT'
- */
- @Override
- public ReferencedDataNature getDataNature() {
- return ReferencedDataNature.TEXT;
- }
-
- /**
- * Character encoding set to 'UTF-8'
- */
- @Override
- public String getCharset() {
- return "UTF-8";
- }
-
- /**
- * String representation for testing, returns <code>green{CONTENTS}</code>
- */
- @Override
- public String toString() {
- return "green{" + contents + "}";
- }
-
-
-}
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenToRed.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenToRed.java
deleted file mode 100644
index 52d9eb1..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/GreenToRed.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-
-public class GreenToRed implements
- ExternalReferenceTranslatorSPI<GreenReference, RedReference> {
-
- public RedReference createReference(GreenReference ref,
- ReferenceContext context) {
- RedReference newReference = new RedReference();
- newReference.setContents(ref.getContents());
- // Insert a two second pause to simulate reference translation and to
- // test the behaviour of multiple concurrent translations
- try {
- Thread.sleep(2000);
- } catch (InterruptedException ie) {
- System.out
- .println("Translation thread was interrupted, probably something wrong.");
- }
- return newReference;
- }
-
- public Class<GreenReference> getSourceReferenceType() {
- return GreenReference.class;
- }
-
- public Class<RedReference> getTargetReferenceType() {
- return RedReference.class;
- }
-
- public float getTranslationCost() {
- return 0.4f;
- }
-
- public boolean isEnabled(ReferenceContext arg0) {
- return true;
- }
-
-}
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/RedReference.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/RedReference.java
deleted file mode 100644
index dbe2d5d..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/RedReference.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import net.sf.taverna.t2.reference.AbstractExternalReference;
-import net.sf.taverna.t2.reference.DereferenceException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferencedDataNature;
-
-/**
- * RedReferences carry their data as an internal String and have a resolution
- * cost of 0.9f whatever the value of that string.
- *
- * @author Tom Oinn
- *
- */
-public class RedReference extends AbstractExternalReference implements
- ExternalReferenceSPI {
-
- // Hold the 'value' of this reference, probably the simplest backing store
- // possible for an ExternalReferenceSPI implementation :)
- private String contents;
-
- public RedReference() {
- //
- }
-
- public RedReference(String contents) {
- this.contents = contents;
- }
-
- /**
- * Set the 'value' of this reference as a string. It's not really a
- * reference type in any true sense of the word, but it'll do for testing
- * the augmentation system. This method is really here so you can configure
- * test beans from spring.
- */
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- /**
- * Get the 'value' of this reference as a string, really just returns the
- * internal string representation.
- */
- public String getContents() {
- return this.contents;
- }
-
- /**
- * Fakes a de-reference operation, returning a byte stream over the string
- * data.
- */
- public InputStream openStream(ReferenceContext arg0) {
- try {
- return new ByteArrayInputStream(this.contents
- .getBytes(getCharset()));
- } catch (UnsupportedEncodingException e) {
- throw new DereferenceException(e);
- }
- }
-
- /**
- * Default resolution cost of 1.0f whatever the contents
- */
- @Override
- public float getResolutionCost() {
- return 0.9f;
- }
-
- /**
- * Data nature set to 'ReferencedDataNature.TEXT'
- */
- @Override
- public ReferencedDataNature getDataNature() {
- return ReferencedDataNature.TEXT;
- }
-
- /**
- * Character encoding set to 'UTF-8'
- */
- @Override
- public String getCharset() {
- return "UTF-8";
- }
-
- /**
- * String representation for testing, returns <code>red{CONTENTS}</code>
- */
- @Override
- public String toString() {
- return "red{" + contents + "}";
- }
-
-}
diff --git a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/YellowReference.java b/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/YellowReference.java
deleted file mode 100644
index 285d767..0000000
--- a/trunk/reference-testhelpers/src/main/java/net/sf/taverna/t2referencetest/YellowReference.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2referencetest;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.UnsupportedEncodingException;
-
-import net.sf.taverna.t2.reference.AbstractExternalReference;
-import net.sf.taverna.t2.reference.DereferenceException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferencedDataNature;
-
-
-/**
- * YellowReferences carry their data as an internal String and have a resolution
- * cost of 1.0f whatever the value of that string.
- *
- * @author Tom Oinn
- *
- */
-public class YellowReference extends AbstractExternalReference implements
- ExternalReferenceSPI {
-
- // Hold the 'value' of this reference, probably the simplest backing store
- // possible for an ExternalReferenceSPI implementation :)
- private String contents;
-
- public YellowReference() {
- //
- }
-
- public YellowReference(String contents) {
- this.contents = contents;
- }
-
- /**
- * Set the 'value' of this reference as a string. It's not really a
- * reference type in any true sense of the word, but it'll do for testing
- * the augmentation system. This method is really here so you can configure
- * test beans from spring.
- */
- public void setContents(String contents) {
- this.contents = contents;
- }
-
- /**
- * Get the 'value' of this reference as a string, really just returns the
- * internal string representation.
- */
- public String getContents() {
- return this.contents;
- }
-
- /**
- * Fakes a de-reference operation, returning a byte stream over the string
- * data.
- */
- public InputStream openStream(ReferenceContext arg0) {
- try {
- return new ByteArrayInputStream(this.contents
- .getBytes(getCharset()));
- } catch (UnsupportedEncodingException e) {
- throw new DereferenceException(e);
- }
- }
-
- /**
- * Default resolution cost of 1.0f whatever the contents
- */
- @Override
- public float getResolutionCost() {
- return 1.0f;
- }
-
- /**
- * Data nature set to 'ReferencedDataNature.TEXT'
- */
- @Override
- public ReferencedDataNature getDataNature() {
- return ReferencedDataNature.TEXT;
- }
-
- /**
- * Character encoding set to 'UTF-8'
- */
- @Override
- public String getCharset() {
- return "UTF-8";
- }
-
- /**
- * String representation for testing, returns <code>yellow{CONTENTS}</code>
- */
- @Override
- public String toString() {
- return "yellow{" + contents + "}";
- }
-
-}
diff --git a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI b/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI
deleted file mode 100644
index 3f1a123..0000000
--- a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI
+++ /dev/null
@@ -1,2 +0,0 @@
-# Implementation classes of ExternalReferenceBuilderSPI go here, one per line
-net.sf.taverna.t2referencetest.GreenBuilder
\ No newline at end of file
diff --git a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI b/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI
deleted file mode 100644
index 20a63d6..0000000
--- a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI
+++ /dev/null
@@ -1,5 +0,0 @@
-# Implementation classes of ExternalReferenceSPI go here, one per line
-net.sf.taverna.t2referencetest.GreenReference
-net.sf.taverna.t2referencetest.BlueReference
-net.sf.taverna.t2referencetest.RedReference
-net.sf.taverna.t2referencetest.YellowReference
\ No newline at end of file
diff --git a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI b/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI
deleted file mode 100644
index 7fff1a3..0000000
--- a/trunk/reference-testhelpers/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI
+++ /dev/null
@@ -1,2 +0,0 @@
-# Implementation classes of ExternalReferenceTranslatorSPI go here, one per line
-net.sf.taverna.t2referencetest.GreenToRed
\ No newline at end of file
diff --git a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/BlueReference.hbm.xml b/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/BlueReference.hbm.xml
deleted file mode 100644
index 9483784..0000000
--- a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/BlueReference.hbm.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for blue reference bean -->
-<hibernate-mapping>
- <joined-subclass
- name="net.sf.taverna.t2referencetest.BlueReference"
- extends="net.sf.taverna.t2.reference.AbstractExternalReference">
- <!-- Link to primary key from abstract superclass -->
- <key column="bean_id" />
- <!-- Dummy reference specific props -->
- <property name="contents" type="string" />
- </joined-subclass>
-</hibernate-mapping>
-
diff --git a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/GreenReference.hbm.xml b/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/GreenReference.hbm.xml
deleted file mode 100644
index dc65151..0000000
--- a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/GreenReference.hbm.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for green reference bean -->
-<hibernate-mapping>
- <joined-subclass
- name="net.sf.taverna.t2referencetest.GreenReference"
- extends="net.sf.taverna.t2.reference.AbstractExternalReference">
- <!-- Link to primary key from abstract superclass -->
- <key column="bean_id" />
- <!-- Dummy reference specific props -->
- <property name="contents" type="string" />
- </joined-subclass>
-</hibernate-mapping>
-
diff --git a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/RedReference.hbm.xml b/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/RedReference.hbm.xml
deleted file mode 100644
index 176f60d..0000000
--- a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/RedReference.hbm.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for red reference bean -->
-<hibernate-mapping>
- <joined-subclass
- name="net.sf.taverna.t2referencetest.RedReference"
- extends="net.sf.taverna.t2.reference.AbstractExternalReference">
- <!-- Link to primary key from abstract superclass -->
- <key column="bean_id" />
- <!-- Dummy reference specific props -->
- <property name="contents" type="string" />
- </joined-subclass>
-</hibernate-mapping>
-
diff --git a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/YellowReference.hbm.xml b/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/YellowReference.hbm.xml
deleted file mode 100644
index 6f357f8..0000000
--- a/trunk/reference-testhelpers/src/main/resources/net/sf/taverna/t2referencetest/YellowReference.hbm.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for yellow reference bean -->
-<hibernate-mapping>
- <joined-subclass
- name="net.sf.taverna.t2referencetest.YellowReference"
- extends="net.sf.taverna.t2.reference.AbstractExternalReference">
- <!-- Link to primary key from abstract superclass -->
- <key column="bean_id" />
- <!-- Dummy reference specific props -->
- <property name="contents" type="string" />
- </joined-subclass>
-</hibernate-mapping>
-
diff --git a/trunk/workflowmodel-api/docs/MobyCentralCurationUseCasAggregated.uxf b/trunk/workflowmodel-api/docs/MobyCentralCurationUseCasAggregated.uxf
deleted file mode 100644
index b4411e9..0000000
--- a/trunk/workflowmodel-api/docs/MobyCentralCurationUseCasAggregated.uxf
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><umlet_diagram><help_text>//Uncomment the following line to change the fontsize:
-//fontsize=14
-
-//Welcome to UMLet!
-
-// *Double-click on UML elements to add them to the diagram.
-// *Edit element properties by modifying the text in this panel.
-// *Edit the files in the 'palettes' directory to store your own element palettes.
-// *Press Del or Backspace to remove elements from the diagram.
-// *Hold down Ctrl key to select multiple elements.
-// *Press c to copy the UML diagram to the system clipboard.
-// * This text will be stored with each diagram. Feel free to use the area for notes.
-</help_text><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>470</y><w>170</w><h>80</h></coordinates><panel_attributes>AnnotationAssertion
---
-acceptsInput 'DNASeq'
-authority = "myGrid rep"
-person = "Franck"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>30</x><y>60</y><w>130</w><h>50</h></coordinates><panel_attributes>someMobyService
---
-id = "service1"
-bg=orange</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>320</x><y>470</y><w>160</w><h>80</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-authority = "myGrid rep"
-person = "Franck"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>330</y><w>190</w><h>80</h></coordinates><panel_attributes>AnnotationAssertion
---
-someUntrueFact
-authority = "MobyCentral"
-person = "Service Author X"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>320</x><y>330</y><w>160</w><h>100</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = false
-reason = ....
-authority = "myGrid rep"
-person = "Franck"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>320</x><y>230</y><w>160</w><h>80</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-authority = "myGrid rep"
-person = "Franck"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>230</y><w>190</w><h>80</h></coordinates><panel_attributes>AnnotationAssertion
---
-hasTextualDescription '.....'
-authority = "MobyCentral"
-person = "Service Author X"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>130</y><w>190</w><h>80</h></coordinates><panel_attributes>AnnotationAssertion
---
-performsTask 'Alignment'
-authority = "MobyCentral"
-person = "Service Author X"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>320</x><y>130</y><w>160</w><h>80</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-authority = "myGrid rep"
-person = "Franck"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>20</x><y>30</y><w>470</w><h>530</h></coordinates><panel_attributes>Aggregated Annotations
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>270</x><y>320</y><w>70</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>270</x><y>220</y><w>70</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>270</x><y>120</y><w>70</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>20</x><y>90</y><w>100</w><h>410</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>80;390;20;330;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>30</x><y>90</y><w>90</w><h>270</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>70;250;20;200;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>90</y><w>80</w><h>170</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>60;150;20;120;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>50</x><y>90</y><w>70</w><h>70</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;50;20;50;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>250</x><y>460</y><w>90</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>70;20;20;20</additional_attributes></element></umlet_diagram>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/docs/MobyCentralCurationUseCase.uxf b/trunk/workflowmodel-api/docs/MobyCentralCurationUseCase.uxf
deleted file mode 100644
index d4845a2..0000000
--- a/trunk/workflowmodel-api/docs/MobyCentralCurationUseCase.uxf
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><umlet_diagram><help_text>//Uncomment the following line to change the fontsize:
-//fontsize=14
-
-//Welcome to UMLet!
-
-// *Double-click on UML elements to add them to the diagram.
-// *Edit element properties by modifying the text in this panel.
-// *Edit the files in the 'palettes' directory to store your own element palettes.
-// *Press Del or Backspace to remove elements from the diagram.
-// *Hold down Ctrl key to select multiple elements.
-// *Press c to copy the UML diagram to the system clipboard.
-// * This text will be stored with each diagram. Feel free to use the area for notes.
-</help_text><element><type>com.umlet.element.base.Class</type><coordinates><x>340</x><y>140</y><w>170</w><h>60</h></coordinates><panel_attributes>AnnotationAssertion
---
-acceptsInput 'DNASeq'
-applies to ID "service1"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>340</x><y>300</y><w>130</w><h>70</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-applies to ID "2"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>340</x><y>210</y><w>130</w><h>80</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = false
-reason = ....
-applies to ID "3"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>490</x><y>130</y><w>70</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>540</x><y>140</y><w>130</w><h>50</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>340</x><y>60</y><w>130</w><h>70</h></coordinates><panel_attributes>CurationAssertion
---
-confirmed = true
-applies to ID "1"
-bg=green</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>330</x><y>30</y><w>350</w><h>350</h></coordinates><panel_attributes>myGrid Annotation Store
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>30</x><y>100</y><w>90</w><h>210</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>70;190;20;190;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>280</y><w>190</w><h>70</h></coordinates><panel_attributes>AnnotationAssertion
---
-someUntrueFact
-id = "3"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>200</y><w>190</w><h>70</h></coordinates><panel_attributes>AnnotationAssertion
---
-hasTextualDescription '.....'
-id = "2"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>100</x><y>130</y><w>170</w><h>60</h></coordinates><panel_attributes>AnnotationAssertion
---
-performsTask 'Alignment'
-id = "1"
-bg=red</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>50</x><y>100</y><w>70</w><h>60</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>50;40;20;40;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>40</x><y>100</y><w>80</w><h>130</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>60;110;20;110;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>40</x><y>70</y><w>130</w><h>50</h></coordinates><panel_attributes>someMobyService
---
-id = "service1"
-bg=orange</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Package</type><coordinates><x>20</x><y>30</y><w>280</w><h>330</h></coordinates><panel_attributes>Moby Central Annotation Store
-bg=white</panel_attributes><additional_attributes/></element></umlet_diagram>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/docs/annotationmodel.uxf b/trunk/workflowmodel-api/docs/annotationmodel.uxf
deleted file mode 100644
index 7207eb3..0000000
--- a/trunk/workflowmodel-api/docs/annotationmodel.uxf
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?><umlet_diagram><help_text>//Uncomment the following line to change the fontsize:
-//fontsize=14
-
-//Welcome to UMLet!
-
-// *Double-click on UML elements to add them to the diagram.
-// *Edit element properties by modifying the text in this panel.
-// *Edit the files in the 'palettes' directory to store your own element palettes.
-// *Press Del or Backspace to remove elements from the diagram.
-// *Hold down Ctrl key to select multiple elements.
-// *Press c to copy the UML diagram to the system clipboard.
-// * This text will be stored with each diagram. Feel free to use the area for notes.
-</help_text><element><type>com.umlet.element.base.Class</type><coordinates><x>530</x><y>70</y><w>270</w><h>120</h></coordinates><panel_attributes>/Interface : Curateable/
---
-getCreationDate : Date
-getSources : List<AnnotationSourceSPI>
-getCreators : List<Person>
-getCurations : List<Curateable>
-getAuthority : AnnotationAuthority
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>170</x><y>250</y><w>200</w><h>130</h></coordinates><panel_attributes>Defines the resource which
-holds the annotation or
-curation assertion i.e. a
-registry, the Moby central
-or a local workflow. This is
-also the resource responsible
-for storing the curateable
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>60</x><y>480</y><w>290</w><h>180</h></coordinates><panel_attributes>This is a convenience used in T2,
-for ease of coding against the model
-we allow access to the root annotations
-from a method call but in fact this isn't
-required - the annotations could be
-gathered on the fly given the ID of the
-subject of the annotations.
-
-At a conceptual level though this holds, the
-annotated object has a number of root
-annotations which apply to it.</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>180</x><y>0</y><w>190</w><h>100</h></coordinates><panel_attributes>Defines the resource
-from which this annotation
-or curation was produced,
-i.e. URL, publication or
-other source of information.
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>390</x><y>100</y><w>160</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>20;20;140;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>360</x><y>320</y><w>120</w><h>150</h></coordinates><panel_attributes>lt=<-
-</panel_attributes><additional_attributes>100;20;60;20;50;130;20;130</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>60</x><y>420</y><w>320</w><h>50</h></coordinates><panel_attributes>/Interface : Annotated/
---
-getRootAnnotations : List<AnnotationAssertion>
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>390</x><y>150</y><w>160</w><h>90</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>20;70;60;70;140;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>230</x><y>210</y><w>180</w><h>30</h></coordinates><panel_attributes>/SPI : AnnotationAuthority/
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>230</x><y>110</y><w>180</w><h>30</h></coordinates><panel_attributes>/SPI : AnnotationSourceSPI/
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>390</x><y>120</y><w>160</w><h>60</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>20;40;70;40;90;20;140;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>740</x><y>20</y><w>340</w><h>270</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>20;50;20;20;320;20;320;250;230;250</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>760</x><y>30</y><w>150</w><h>140</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>20;40;20;20;130;20;130;120;40;120</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>870</x><y>880</y><w>110</w><h>30</h></coordinates><panel_attributes>HostInstitution</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>860</x><y>800</y><w>70</w><h>100</h></coordinates><panel_attributes>lt=<<-</panel_attributes><additional_attributes>50;80;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>680</x><y>800</y><w>90</w><h>100</h></coordinates><panel_attributes>lt=<<-</panel_attributes><additional_attributes>20;80;70;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>620</x><y>880</y><w>140</w><h>30</h></coordinates><panel_attributes>FreeTextDescription</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>800</x><y>800</y><w>40</w><h>100</h></coordinates><panel_attributes>lt=<<-</panel_attributes><additional_attributes>20;80;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>770</x><y>880</y><w>90</w><h>30</h></coordinates><panel_attributes>MimeType</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>930</x><y>740</y><w>210</w><h>80</h></coordinates><panel_attributes>/AbstractTripleAssertion/
---
-getObjectLocalName : String
-getOntologyURI : URI
-getPredicateLocalName : String
-bg=red
-</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>510</x><y>500</y><w>220</w><h>100</h></coordinates><panel_attributes>Encapsulates the information
-contained by this annotation,
-i.e. free text description, mapping
-to a specified ontology, tagging,
-MIME type association
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>870</x><y>480</y><w>120</w><h>280</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>100;260;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>710</x><y>770</y><w>210</w><h>50</h></coordinates><panel_attributes>/AbstractTextualValueAssertion/
---
-getText : String
-bg=red
-</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>760</x><y>480</y><w>150</w><h>250</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>20;230;130;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>700</x><y>480</y><w>210</w><h>180</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>20;160;190;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>870</x><y>480</y><w>40</w><h>310</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>20;290;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>390</x><y>640</y><w>350</w><h>60</h></coordinates><panel_attributes>/AbstractNumericRangeAssertion <T extends Number>/
---
-getLowerNumericValue : T
-getUpperNumericValue : T
-bg=red
-</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>1030</x><y>380</y><w>190</w><h>30</h></coordinates><panel_attributes>/SPI : CurationEventBeanSPI/
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>740</x><y>470</y><w>170</w><h>30</h></coordinates><panel_attributes>/SPI : AnnotationBeanSPI/
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>740</x><y>240</y><w>230</w><h>90</h></coordinates><panel_attributes>/Interface : CurationEvent/
---
-getTarget : Curateable
-getType : CurationEventType
-getDetail : CurationEventBeanSPI
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>460</x><y>330</y><w>230</w><h>70</h></coordinates><panel_attributes>/Interface : AnnotationAssertion/
---
-getRole : AnnotationRole
-getDefinition : AnnotationBeanSPI
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>240</x><y>150</y><w>170</w><h>50</h></coordinates><panel_attributes>/Person/
---
-TODO - get from myExp
-bg=white</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Note</type><coordinates><x>1030</x><y>420</y><w>190</w><h>80</h></coordinates><panel_attributes>Any additional information
-associated with the
-curation event, such as a
-free text comment field
-bg=blue</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>950</x><y>270</y><w>100</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>80;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>950</x><y>290</y><w>100</w><h>120</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>80;100;50;100;50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>670</x><y>340</y><w>90</w><h>40</h></coordinates><panel_attributes>lt=<-</panel_attributes><additional_attributes>70;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>670</x><y>360</y><w>90</w><h>140</h></coordinates><panel_attributes>lt=<-
-</panel_attributes><additional_attributes>70;120;50;120;50;20;20;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>740</x><y>350</y><w>160</w><h>80</h></coordinates><panel_attributes>Enum : AnnotationRole
---
-INITIAL_ASSERTION
-REFINEMENT
-REPLACEMENT
-bg=orange</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Class</type><coordinates><x>1030</x><y>280</y><w>190</w><h>80</h></coordinates><panel_attributes>Enum : CurationEventType
---
-NEUTRAL
-REPUDIATION
-VALIDATION
-bg=orange</panel_attributes><additional_attributes/></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>720</x><y>170</y><w>90</w><h>90</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>70;70;20;20</additional_attributes></element><element><type>com.umlet.element.base.Relation</type><coordinates><x>490</x><y>170</y><w>90</w><h>180</h></coordinates><panel_attributes>lt=<<.</panel_attributes><additional_attributes>20;160;70;20</additional_attributes></element><element><type>com.umlet.element.base.Class</type><coordinates><x>500</x><y>710</y><w>350</w><h>50</h></coordinates><panel_attributes>/AbstractNumericValueAssertion <T extends Number>/
---
-getNumericValue : T
-bg=red
-</panel_attributes><additional_attributes/></element></umlet_diagram>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/pom.xml b/trunk/workflowmodel-api/pom.xml
deleted file mode 100644
index 6a9ce33..0000000
--- a/trunk/workflowmodel-api/pom.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-api</artifactId>
- <name>Workflow Model API</name>
- <description>
- Core workflow object model for Taverna 2 workflows. Depends on
- the data layer but nothing else, intended as lightweight
- platform for applications using Taverna APIs as well as the core
- for the new enactor and model.
- </description>
- <dependencies>
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>reference-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.infrastructure</groupId>
- <artifactId>spi-discovery-api</artifactId>
- <version>${t2.infrastructure.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AbstractAnnotatedThing.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AbstractAnnotatedThing.java
deleted file mode 100644
index d4b5328..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AbstractAnnotatedThing.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Convenient abstract superclass for annotated things, manages edits.
- * Subclasses of this must implement the Annotated interface with their own
- * interface type as the parameter, so for example Processor subclasses would
- * implement Annotated<Processor>
- *
- * @author Tom Oinn
- * @author Alan R Williams
- *
- */
-public abstract class AbstractAnnotatedThing<T> implements Annotated<T> {
-
- private Set<AnnotationChain> annotations = new HashSet<AnnotationChain>();
-
- /**
- * Return the set of annotations bound to this annotated object, the set
- * returned is an unmodifiable copy of the internal annotation set, if you
- * need to modify the annotations you should use the get methods for Edit
- * objects to do so.
- *
- * @see net.sf.taverna.t2.annotation.Annotated#getAnnotations()
- */
- public final Set<AnnotationChain> getAnnotations() {
- return Collections.unmodifiableSet(annotations);
- }
-
- /**
- * Set the annotation chains associated with this annotated object. This is
- * only needed for deserialization and could almost certainly be done in a
- * better way.
- *
- * @param annotations
- */
- public final void setAnnotations(Set<AnnotationChain> annotations) {
- this.annotations = annotations;
- }
-
- /**
- * Superclass of edits to remove, add and replace annotations on instances
- * of the enclosing AbstractAnnotatedThing class
- *
- * @author Tom
- *
- * @param <TargetType>
- */
- private static abstract class AbstractAnnotationEdit<TargetType> implements
- Edit<TargetType> {
-
- private AbstractAnnotatedThing<TargetType> subject;
-
- private boolean applied = false;
-
- protected AbstractAnnotationEdit(
- AbstractAnnotatedThing<TargetType> subject) {
- this.subject = subject;
- }
-
- @SuppressWarnings("unchecked")
- public final TargetType doEdit() throws EditException {
- synchronized (subject) {
- if (applied) {
- throw new EditException("Edit already applied!");
- }
- doEditAction(subject);
- this.applied = true;
- return (TargetType) subject;
- }
- }
-
- protected abstract void doEditAction(AbstractAnnotatedThing<?> subject)
- throws EditException;
-
- protected abstract void undoEditAction(AbstractAnnotatedThing<?> subject);
-
- @SuppressWarnings("unchecked")
- public final TargetType getSubject() {
- return (TargetType) subject;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- synchronized (subject) {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- undoEditAction(subject);
- applied = false;
- }
- }
-
- }
-
- /**
- * @see net.sf.taverna.t2.annotation.Annotated#getAddAnnotationEdit(net.sf.taverna.t2.annotation.WorkflowAnnotation)
- */
- public final Edit<T> getAddAnnotationEdit(
- final AnnotationChain newAnnotation) {
- return new AbstractAnnotationEdit<T>(this) {
- @Override
- protected void doEditAction(AbstractAnnotatedThing<?> subject)
- throws EditException {
- annotations.add(newAnnotation);
- }
-
- @Override
- protected void undoEditAction(AbstractAnnotatedThing<?> subject) {
- annotations.remove(newAnnotation);
- }
- };
- }
-
- /**
- * @see net.sf.taverna.t2.annotation.Annotated#getRemoveAnnotationEdit(net.sf.taverna.t2.annotation.WorkflowAnnotation)
- */
- public final Edit<T> getRemoveAnnotationEdit(
- final AnnotationChain annotationToRemove) {
- return new AbstractAnnotationEdit<T>(this) {
- @Override
- protected void doEditAction(AbstractAnnotatedThing<?> subject)
- throws EditException {
- annotations.remove(annotationToRemove);
- }
-
- @Override
- protected void undoEditAction(AbstractAnnotatedThing<?> subject) {
- annotations.add(annotationToRemove);
- }
- };
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Annotated.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Annotated.java
deleted file mode 100644
index ab7ed2c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Annotated.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-
-/**
- * Denotes that the object carries workflow object level annotation. Rather than
- * defining specific annotation types for each workflow entity we work on the
- * basis that multiple annotations of different types may apply, so free text
- * description is one example, semantic annotation of the internal function of a
- * processor might be another.
- * <p>
- * Where annotations are conceptually editable such as free text descriptions
- * the editing framework should internally remove the original annotation and
- * add the replacement rather than modifying the previous annotation in place.
- *
- * @author Tom Oinn
- *
- */
-public interface Annotated<TargetType> {
-
- /**
- * Each annotated object contains a bag of metadata object instances
- *
- * @return set of metadata objects that apply to the annotated object
- */
- Set<? extends AnnotationChain> getAnnotations();
-
- void setAnnotations(Set<AnnotationChain> annotations);
-
- /**
- * Add new workflow object metadata to this annotated entity
- *
- * @param <TargetType>
- * the type of the object being annotated
- * @param newAnnotation
- * metadata object to add to the annotated object
- * @return edit object to perform and undo the metadata assignment
- */
- public Edit<? extends TargetType> getAddAnnotationEdit(
- AnnotationChain newAnnotation);
-
- /**
- * Remove an annotation object from the this annotated entity
- *
- * @param <TargetType>
- * type of the workflow object from which the annotation is
- * removed
- * @param annotationToRemove
- * metadata object to remove
- * @param objectToAnnotate
- * object from which the metadata is removed
- * @return edit object to perform and undo the metadata removal
- */
- public Edit<? extends TargetType> getRemoveAnnotationEdit(
- AnnotationChain annotationToRemove);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertion.java
deleted file mode 100644
index 6f68c35..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertion.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Represents a single assertion of information, providing access to a bean
- * containing the information in the assertion and one specifying the source of
- * the information contained.
- *
- * @author Tom Oinn
- *
- */
-public interface AnnotationAssertion<AnnotationBeanType extends AnnotationBeanSPI>
- extends Curateable {
-
- /**
- * Each annotation assertion contains a bean specifying the actual
- * annotation, varying from a simple string for a free text description to
- * more sophisticated semantic annotations or controlled vocabularies.
- *
- * @return the annotation bean specifying this annotation assertion
- */
- public AnnotationBeanType getDetail();
-
- /**
- * The annotation assertion plays one of several roles within the annotation
- * chain, either an initial assertion, a refinement of a previous assertion
- * or a replacement of a previous assertion.
- *
- * @return the annotation role of this annotation
- */
- public AnnotationRole getRole();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationBeanSPI.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationBeanSPI.java
deleted file mode 100644
index a754148..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationBeanSPI.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Marker interface to denote that a bean class is a container for the
- * information encapsulated by an InformationAssertion object
- *
- * @author Tom Oinn
- *
- */
-public interface AnnotationBeanSPI {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationChain.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationChain.java
deleted file mode 100644
index 6f70faa..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationChain.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.List;
-
-/**
- * A fact about an annotated entity is expressed in terms of an annotation
- * chain. The annotation chain contains one or more information assertions in a
- * list ordered by the creation date of each assertion. Annotation chains are
- * then interpreted by an AnnotationPerspective which is responsible for
- * reasoning over the information in the chain and extracting the set of
- * information assertions that are valid according to the rules in the
- * particular AnnotationPerspective.
- *
- * @author Tom Oinn
- *
- */
-public interface AnnotationChain {
-
- /**
- * Returns the ordered list of AnnotationAssertions. This is the 'raw' set
- * of annotations in creation order - this order is not necessarily the
- * order they were curated, and may include refuted or otherwise wrong
- * annotations. Consumers of this API are recommended to use an
- * AnnotationPerspective to resolve any such conflicts appropriately.
- *
- * @return read only copy of the ordered list of AnnotationAssertion
- * instances
- */
- List<AnnotationAssertion<?>> getAssertions();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationPerspective.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationPerspective.java
deleted file mode 100644
index 656b026..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationPerspective.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.List;
-
-/**
- * Responsible for the interpretation of an AnnotationChain (which may contain
- * conflicting or disputed information) into a set of AnnotationAssertion
- * instances from that chain which are valid given the chain and some
- * interpretation rule.
- *
- * @author Tom Oinn
- *
- */
-public interface AnnotationPerspective {
-
- /**
- * Evaluate the annotations and their curation events in the specified
- * chain, resolve conflicts if possible and return the resultant set of
- * annotations
- *
- * @param chain
- * the annotation chain to evaluate
- * @return the set of annotations which are valid within this chain
- */
- public List<? extends AnnotationAssertion<?>> getAnnotations(
- AnnotationChain chain);
-
- /**
- * Annotation chains may be in a disputed state if there are conflicting
- * mutually exclusive events within them under the interpretation imposed by
- * the annotation perspective and the perspective is unable to sensibly
- * reconcile them. For example, if the perspective is configured to trust
- * two parties equally and they disagree.
- *
- * @param chain
- * the annotation chain to check for conflict
- * @return true if there are conflicts under the interpretation of this
- * annotation perspective
- */
- public boolean isDisputed(AnnotationChain chain);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationRole.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationRole.java
deleted file mode 100644
index 06b37b1..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationRole.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Specifies the role of an AnnotationAssertion within an AnnotationChain
- *
- * @author Tom Oinn
- */
-public enum AnnotationRole {
-
- /**
- * The information assertion is the first in the chain (if this is applied
- * to an annotation that isn't the earliest in its chain it should be
- * treated as a validation failure)
- */
- INITIAL_ASSERTION,
-
- /**
- * The information assertion was added to the chain to refine the existing
- * annotation assertion or assertions, such as cases where a generic
- * description exists which can be specialized in a particular instance but
- * where the original more generic form is still correct
- */
- REFINEMENT,
-
- /**
- * The information assertion was added to the chain in order to override an
- * earlier information assertion which was regarded as incorrect.
- */
- REPLACEMENT;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationSourceSPI.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationSourceSPI.java
deleted file mode 100644
index 1f7a74d..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AnnotationSourceSPI.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * A marker interface that specified that the implementation is a bean
- * containing information about a source of annotations. These might be
- * publications, web URIs, a free text container, a person (etc). We should be
- * able to use existing schemes for identification of sources, publications etc
- * here.
- *
- * @author Tom Oinn
- *
- */
-public interface AnnotationSourceSPI {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AppliesTo.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AppliesTo.java
deleted file mode 100644
index 94293e3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/AppliesTo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.lang.annotation.*;
-
-/**
- * Annotation to be used on metadata objects to denote which workflow objects
- * they apply to
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-public @interface AppliesTo {
-
- /**
- * The class of the metadata object allowed by this annotation
- */
- Class<?>[] targetObjectType();
-
- /**
- * Can you have more than one of these metadata objects in the resolved set?
- */
- boolean many() default true;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Curateable.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Curateable.java
deleted file mode 100644
index 006a59c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Curateable.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.Date;
-import java.util.List;
-
-/**
- * Implemented by objects which can have curation assertions attached to them.
- * In our model this includes the AnnotationAssertion but also includes the
- * CurationEvent itself, in this way we allow curation of curation assertions
- * and thence a conversational model of annotation.
- *
- * @author Tom Oinn
- *
- */
-public interface Curateable {
-
- /**
- * Curateable instances have a list of curation events which are used to
- * determine whether the implementing object is valid given a particular
- * interpretive context. If this list is empty the event is unchallenged.
- *
- * @return
- */
- public List<CurationEvent<?>> getCurationAssertions();
-
- /**
- * All curation events are marked with their creation date, this is the date
- * at which the curation event was associated with its target.
- *
- * @return
- */
- public Date getCreationDate();
-
- /**
- * Each curateable has a list of people associated with it, frequently one
- * person and in some cases none, although this should be avoided if
- * possible.
- *
- * @return
- */
- public List<? extends Person> getCreators();
-
- /**
- * Each annotation or curation has a resource from which the event is
- * inherently derived, for example if the annotation was created manually
- * after reading a paper the source would unambiguously specify the
- * publication.
- *
- * @return
- */
- public AnnotationSourceSPI getSource();
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEvent.java
deleted file mode 100644
index 173cf57..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEvent.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Represents a single act of curation, parameterized on a bean encapsulating
- * the necessary and sufficient information to describe the specifics of the
- * curation event.
- *
- * @author Tom Oinn
- *
- * @param <T>
- */
-public interface CurationEvent<CurationType extends CurationEventBeanSPI> {
-
- public CurationType getDetail();
-
- /**
- * The curation event type specifies whether this curation event is a
- * validation, repudiation or neither of its target.
- *
- * @return
- */
- public CurationEventType getType();
-
- /**
- * The curation event applies to a specific other event, either another
- * curation event or an annotation assertion.
- *
- * @return the event which this event is curating
- */
- public Curateable getTarget();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventBeanSPI.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventBeanSPI.java
deleted file mode 100644
index 2316cde..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventBeanSPI.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Contains the detail for a single curation event. In many cases this will be a
- * plain base curation object with very little information but it allows for us
- * to specify additional parameters to the curation event which can then be used
- * by the AnnotationPerspective instance to determine whether it believes the
- * curator.
- *
- * @author Tom Oinn
- *
- */
-public interface CurationEventBeanSPI {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventType.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventType.java
deleted file mode 100644
index 5b21201..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/CurationEventType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-public enum CurationEventType {
-
- /**
- * The curation event asserts that the event it is attached to was correct,
- * effectively signing off an approval on the attached event.
- */
- VALIDATION,
-
- /**
- * The curation event repudiates the information in the attached event,
- * denying its validity.
- */
- REPUDIATION,
-
- /**
- * The curation event neither validates nor repudiates the information in
- * the attached event.
- */
- NEUTRAL;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyRole.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyRole.java
deleted file mode 100644
index 1c46033..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyRole.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * Possible relationships between entities in a hierarchical context. This is
- * used as a property of the HierarchyTraversal annotation on members which
- * traverse a conceptual object hierarchy such as a parent-child containment
- * relationship. As an example the getProcessors() method in Dataflow is
- * annotated with <code>&HierarchyRole(role=CHILD)</code> to indicate that
- * it accesses child members of the workflow model containment hierarchy.
- *
- * @author Tom Oinn
- *
- */
-public enum HierarchyRole {
-
- CHILD,
-
- PARENT;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyTraversal.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyTraversal.java
deleted file mode 100644
index cbcbbaa..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/HierarchyTraversal.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Applied to getFoo methods to indicate that the returned type is related to
- * the annotated type by some hierarchical relationship, either parent or child.
- * This can then be used by annotation tools to determine the structure of an
- * object under annotation in order to find any child objects without
- * accidentally traversing outside of the bound of the object to be annotated.
- * <p>
- * As annotations are not inherited any annotation tool should traverse up the
- * type structure of an object under annotation to determine the possible
- * child-parent relationships from superclasses and implemented interfaces.
- * <p>
- * There is no guarantee that the return types from annotated members implement
- * Annotated, in these cases traversal should still be followed to cover cases
- * where a grandchild of an object is annotatable even though all children are
- * not.
- * <p>
- * This should only be applied to method with no arguments, if this is not the
- * case an annotation tool is free to not follow such methods (as it has no way
- * to determine what should be applied as arguments)
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.METHOD)
-@Documented
-public @interface HierarchyTraversal {
-
- /**
- * The role the return type of the annotated method plays in the named
- * hierarchy relative to the containing type.
- *
- * @return role in hierarchy at corresponding index in the Hierarchies
- * property, currently either CHILD or PARENT
- */
- HierarchyRole[] role();
-
- /**
- * It is possible for multiple orthogonal containment hierarchies to exist,
- * to allow for this the hierarchies are named using this field.
- *
- * @return name of the hierarchy to which this relationship applies
- */
- String[] hierarchies();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Person.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Person.java
deleted file mode 100644
index 88de1cd..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/Person.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-/**
- * All metadata assertions and curation assertions have a person who is
- * ultimately responsible for the assertion (although this may not necessarily
- * imply that the assertion was created interactively).
- *
- * TODO this needs to have some members! Cross reference with myExperiment user
- * model I suspect.
- *
- * @author Tom Oinn
- *
- */
-public interface Person {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericRangeAssertion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericRangeAssertion.java
deleted file mode 100644
index 76583af..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericRangeAssertion.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AppliesTo;
-
-/**
- * Generic annotation containing a pair of numeric values with precision
- * determined by the type parameter which form a bound.
- *
- * @author Tom Oinn
- *
- */
-@AppliesTo(targetObjectType = { Object.class }, many = true)
-public abstract class AbstractNumericRangeAssertion<NumericType extends Number>
- implements AnnotationBeanSPI {
-
- private NumericType upperNumericValue;
-
- private NumericType lowerNumericValue;
-
- /**
- * Default constructor as mandated by java bean specification
- */
- protected AbstractNumericRangeAssertion() {
- //
- }
-
- public NumericType getUpperNumericValue() {
- return upperNumericValue;
- }
-
- public void setUpperNumericValue(NumericType upperNumericValue) {
- this.upperNumericValue = upperNumericValue;
- }
-
- public NumericType getLowerNumericValue() {
- return lowerNumericValue;
- }
-
- public void setLowerNumericValue(NumericType lowerNumericValue) {
- this.lowerNumericValue = lowerNumericValue;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericValueAssertion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericValueAssertion.java
deleted file mode 100644
index 3688b12..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractNumericValueAssertion.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AppliesTo;
-
-/**
- * Generic annotation containing a single number of precision specified by the
- * type variable
- *
- * @author Tom Oinn
- *
- */
-@AppliesTo(targetObjectType = { Object.class }, many = true)
-public abstract class AbstractNumericValueAssertion<NumericType extends Number>
- implements AnnotationBeanSPI {
-
- private NumericType numericValue;
-
- /**
- * Default constructor as mandated by java bean specification
- */
- protected AbstractNumericValueAssertion() {
- //
- }
-
- public NumericType getNumericValue() {
- return numericValue;
- }
-
- public void setNumericValue(NumericType numericValue) {
- this.numericValue = numericValue;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTextualValueAssertion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTextualValueAssertion.java
deleted file mode 100644
index 5270979..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTextualValueAssertion.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AppliesTo;
-
-/**
- * Generic bit of free text that can be stuck to anything, subclass for more
- * specific uses
- *
- * @author Tom Oinn
- *
- */
-@AppliesTo(targetObjectType = { Object.class }, many = true)
-public abstract class AbstractTextualValueAssertion implements AnnotationBeanSPI {
-
- private String text;
-
- /**
- * Default constructor as mandated by java bean specification
- */
- protected AbstractTextualValueAssertion() {
- //
- }
-
- public String getText() {
- return text;
- }
-
- public void setText(String text) {
- this.text = text;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTripleAssertion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTripleAssertion.java
deleted file mode 100644
index 9b15f04..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/AbstractTripleAssertion.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AppliesTo;
-
-/**
- * A metadata bean containing a predicate and object part of a triple - it is
- * assumed that the entity to which this is bound is the subject part of the
- * triple.
- * <p>
- * This then forms a triple where sense is <em>bound object</em> 'predicate'
- * 'object' for example 'Activity hasRole globalAlignment'.
- * <p>
- * This is a relatively simplistic mapping into an ontology as it only allows
- * for a single predicate and object, but in reality that captures the vast
- * majority of our current usage in myGrid. As this is entirely non-specific in
- * its default form it can be applied to anything, although obviously not all
- * combinations of ontologies and target subjects will make sense! We expect
- * this to be subclassed for specific cases to make annotators etc more user
- * friendly (i.e. have a specific 'hasRole' annotation which delegates to this
- * as its superclass)
- *
- * @author Tom Oinn
- *
- */
-@AppliesTo(targetObjectType = { Object.class }, many = true)
-public abstract class AbstractTripleAssertion implements AnnotationBeanSPI {
-
- private URI ontologyURI;
-
- private String predicateLocalName;
-
- private String objectLocalName;
-
- /**
- * Default public constructor as required by java bean specification
- */
- protected AbstractTripleAssertion() {
- // Default constructor, not much to do here.
- }
-
- /**
- * @return URI of the ontology which contains both object and predicate
- * local names.
- */
- public URI getOntologyURI() {
- return ontologyURI;
- }
-
- /**
- * @param ontologyURI
- * URI of the ontology which contains both object and predicate
- * local names.
- */
- public void setOntologyURI(URI ontologyURI) {
- this.ontologyURI = ontologyURI;
- }
-
- /**
- * @return Local name of the predicate used in this assignment, the fully
- * qualified name is the URI of the ontology plus this local name,
- * i.e. uri:full.ontology.name#localName
- */
- public String getPredicateLocalName() {
- return predicateLocalName;
- }
-
- /**
- * @param predicateLocalName
- * local name of the predicate
- */
- public void setPredicateLocalName(String predicateLocalName) {
- this.predicateLocalName = predicateLocalName;
- }
-
- /**
- * @return Local name of the object used in this assignment, the fully
- * qualified name is the URI of the ontology plus this local name,
- * i.e. uri:full.ontology.name#localName
- */
- public String getObjectLocalName() {
- return objectLocalName;
- }
-
- /**
- * @param objectLocalName
- * local name within the ontology of the object for this triple
- */
- public void setObjectLocalName(String objectLocalName) {
- this.objectLocalName = objectLocalName;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Author.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Author.java
deleted file mode 100644
index b0839da..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Author.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-/**
- * The name of an author of a dataflow held as a String
- *
- * It should allow many but currently only allows one
- *
- * @author Alan R Williams
- *
- */
-@AppliesTo(targetObjectType = { Dataflow.class }, many = false)
-public class Author extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public Author() {
- //
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DescriptiveTitle.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DescriptiveTitle.java
deleted file mode 100644
index f9defd6..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DescriptiveTitle.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-/**
- * The descriptive title of a dataflow held as a String
- *
- * @author Alan R Williams
- *
- */
-@AppliesTo(targetObjectType = { Dataflow.class }, many = false)
-public class DescriptiveTitle extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public DescriptiveTitle() {
- //
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DocumentationUrl.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DocumentationUrl.java
deleted file mode 100644
index 96fe397..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/DocumentationUrl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import java.net.URL;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Port;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * A link to documentation for the target element contained at a particular
- * Uniform Resource Locator (URL)
- *
- * @author Tom Oinn
- * @author Alan Williams
- */
-@AppliesTo(targetObjectType = { Port.class, Activity.class, Processor.class, Dataflow.class }, many = true)
-public class DocumentationUrl implements AnnotationBeanSPI {
-
- private URL documentationURL;
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public DocumentationUrl() {
- //
- }
-
- public URL getDocumentationURL() {
- return documentationURL;
- }
-
- public void setDocumentationURL(URL documentationURL) {
- this.documentationURL = documentationURL;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/ExampleValue.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/ExampleValue.java
deleted file mode 100644
index dd8540c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/ExampleValue.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-
-/**
- * A String containing an example or a description of an example
- *
- * @author Alan R Williams
- *
- */
-@AppliesTo(targetObjectType = { DataflowInputPort.class , DataflowOutputPort.class }, many = false)
-public class ExampleValue extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public ExampleValue() {
- //
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/FreeTextDescription.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/FreeTextDescription.java
deleted file mode 100644
index 04393b8..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/FreeTextDescription.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Port;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * An unconstrained textual description held as a String
- *
- * @author Tom Oinn
- *
- */
-@AppliesTo(targetObjectType = { Dataflow.class, Processor.class,
- Activity.class, Port.class, Datalink.class, Condition.class }, many = false)
-public class FreeTextDescription extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public FreeTextDescription() {
- //
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/HostInstitution.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/HostInstitution.java
deleted file mode 100644
index db35cd3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/HostInstitution.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- *
- */
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * The host institution for an activity implementation
- *
- * @author Tom Oinn
- * @author Alan Williams
- */
-@AppliesTo(targetObjectType = { Activity.class }, many = false)
-public class HostInstitution extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public HostInstitution() {
- super();
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/MimeType.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/MimeType.java
deleted file mode 100644
index b318943..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/MimeType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.workflowmodel.Port;
-
-/**
- * A single MIME type, intended to be used to annotate an input or output port
- * within the workflow to denote the type within that system of data produced or
- * consumed by the port.
- *
- * @author Tom Oinn
- *
- */
-// @AppliesTo(targetObjectType = { Port.class })
-public class MimeType extends AbstractTextualValueAssertion {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public MimeType() {
- super();
- }
-
- /**
- * Return the MIME type as a string, mime types look like 'part/part'. We
- * may want to consider whether it's possible to make this a genuine
- * enumeration driven off a canonical list of MIME types or whether it's
- * best kept as the current (free) string. The advantage of an enumerated
- * type is that we could attach description to the MIME types which would
- * help with the UI construction but maybe this isn't the place to put it
- * (should this link be in the UI layer? probably)
- *
- * @return the MIME type as a string.
- */
- @Override
- public String getText() {
- return super.getText();
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Optional.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Optional.java
deleted file mode 100644
index 3f18282..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/annotationbeans/Optional.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.annotationbeans;
-
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-
-/**
- * A declaration that the bound input port is optional, if this annotation is
- * refuted then the interpretation should be that the input port is required.
- *
- * @author Tom Oinn
- * @author Alan Williams
- */
-@AppliesTo(targetObjectType = { InputPort.class }, many = false)
-public class Optional implements AnnotationBeanSPI {
-
- /**
- * Default constructor as mandated by java bean specification
- */
- public Optional() {
- //
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/package.html
deleted file mode 100644
index 99a5a4f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/package.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<body>
-Entities within the workflow object model may be marked as annotated.
-When marked as such they contract to provide one or more of a variety of
-forms of metadata, whether generic or specific to the type of object
-within the model. This description is deliberately kept vague for now
-because we haven't yet enumerated what classes of annotation exist on
-each entity.
-<p>From this point in we will use the term 'metadata' to distinguish
-between annotations in terms of properties of the workflow and
-annotations in terms of the Java 5 language feature. This is
-particularly important we we use Java Annotations to implement the
-workflow annotations. Yay.
-<p>In keeping with the read-only model of the API package all
-metadata interfaces only specify the get methods for their respective
-contents. Modification of metadata instances is performed through Edit
-objects.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationBeanRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationBeanRegistry.java
deleted file mode 100644
index a2c5af9..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationBeanRegistry.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.spi;
-
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-public class AnnotationBeanRegistry extends SPIRegistry<AnnotationBeanSPI>{
-
- public AnnotationBeanRegistry() {
- super(AnnotationBeanSPI.class);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationSourceRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationSourceRegistry.java
deleted file mode 100644
index 4786a78..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/AnnotationSourceRegistry.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.spi;
-
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-public class AnnotationSourceRegistry extends SPIRegistry<AnnotationSourceSPI>{
-
- public AnnotationSourceRegistry() {
- super(AnnotationSourceSPI.class);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/CurationEventBeanRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/CurationEventBeanRegistry.java
deleted file mode 100644
index dc1f190..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/annotation/spi/CurationEventBeanRegistry.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.spi;
-
-import net.sf.taverna.t2.annotation.CurationEventBeanSPI;
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-public class CurationEventBeanRegistry extends SPIRegistry<CurationEventBeanSPI>{
-
- public CurationEventBeanRegistry() {
- super(CurationEventBeanSPI.class);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/FailureListener.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/FailureListener.java
deleted file mode 100644
index f6fa118..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/FailureListener.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.facade;
-
-/**
- * Used to communicate a failure of the overall workflow to interested parties.
- *
- * @author Tom Oinn
- */
-public interface FailureListener {
-
- /**
- * Called if the workflow fails in a critical and fundamental way. Most
- * internal failures of individual process instances will not trigger this,
- * being handled either by the per processor dispatch stack through retry,
- * failover etc or by being converted into error tokens and injected
- * directly into the data stream. This therefore denotes a catastrophic and
- * unrecoverable problem.
- *
- * @param message
- * @param t
- */
- public void workflowFailed(String message, Throwable t);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/ResultListener.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/ResultListener.java
deleted file mode 100644
index ae33e43..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/ResultListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.facade;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-
-/**
- * Implement and use with the WorkflowInstanceFacade to listen for data
- * production events from the underlying workflow instance
- *
- * @author Tom Oinn
- *
- */
-public interface ResultListener {
-
- /**
- * Called when a new result token is produced by the workflow instance.
- *
- * @param token
- * the WorkflowDataToken containing the result.
- * @param portName
- * The name of the output port on the workflow from which this
- * token is produced, this now folds in the owning process which
- * was part of the signature for this method
- */
- public void resultTokenProduced(WorkflowDataToken token, String portName);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/WorkflowInstanceFacade.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/WorkflowInstanceFacade.java
deleted file mode 100644
index e8a1e21..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/WorkflowInstanceFacade.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.facade;
-
-import java.util.WeakHashMap;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.TokenOrderException;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.monitor.MonitorNode;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.utility.TypedTreeModel;
-import net.sf.taverna.t2.workflowmodel.ControlBoundary;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-/**
- * The interaction point with a workflow instance. Technically there is no such
- * thing as a workflow instance in Taverna2, at least not in any real sense in
- * the code itself. The instance is more literally an identifier used as the
- * root of all data and error objects within this workflow and by which the top
- * level DataFlow or similar object is identified in the state tree. The
- * implementation of this interface should hide this though, automatically
- * prepending the internally stored (and hidden) identifier to all data push
- * messages and providing a subtree of the state model rooted at the internal
- * ID.
- * <p>
- * TODO - we should probably have callbacks for failure states here, but that
- * would need a decent definition (and maybe even ontology of) what failure
- * means. It's less obvious in a data streaming world what a failure is. At the
- * moment the dispatch stack can potentially treat unhandled error messages as
- * failing the processor, how do we get this exception information back up to
- * the workflow level?
- *
- * @author Tom Oinn
- *
- */
-@ControlBoundary
-public interface WorkflowInstanceFacade {
-
- /**
- * A weak hash map of all workflow run IDs mapped against the corresponding WorkflowInstanceFacadeS.
- * This is needed for activities with dependencies (such as beanshell and API consumer) to gain access
- * to the current workflow via the WorkflowInstanceFacade.
- */
- public static final WeakHashMap<String, WorkflowInstanceFacade> workflowRunFacades = new WeakHashMap<String, WorkflowInstanceFacade>();
-
- /**
- * Push a data token into the specified port. If the token is part of a
- * stream the index contains the index of this particular token. If not the
- * index should be the empty integer array.
- *
- * @param token
- * A WorkflowDataToken containing the data to be pushed to the
- * workflow along with its current owning process identifier and
- * index
- * @param portName
- * Port name to use
- * @throws TokenOrderException
- * if ordering constraints on the token stream to each input
- * port are violated
- */
- public void pushData(WorkflowDataToken token, String portName)
- throws TokenOrderException;
-
- /**
- * Where a workflow has no inputs this method will cause it to start
- * processing. Any processors within the workflow with no inputs are fired.
- *
- * @throws IllegalStateException
- * if the workflow has already been fired or has had data pushed
- * to it.
- */
- public void fire() throws IllegalStateException;
-
- /**
- * The result listener is used to handle data tokens produced by the
- * workflow.
- * <p>
- * If the listener is registered after the workflow has already produced
- * results it will be immediately called with any results previously
- * produced. Where the workflow has completed a stream of results it may
- * only message the listener with the highest level one, so for a case where
- * a list of results is emited one at a time the listener may either get the
- * individual items followed by the list token or if registered after the
- * list token has been emited only receive the list token.
- *
- * @param listener
- */
- public void addResultListener(ResultListener listener);
-
- /**
- * Remove a previously registered result listener
- *
- * @param listener
- */
- public void removeResultListener(ResultListener listener);
-
- /**
- * A failure listener reports on overall workflow failure. It is not
- * triggered by the failure of individual processors unless that processor
- * is marked as critical. In fact in T2 all processors are marked as
- * critical by default as there are ways of handling errors within the data
- * stream, if the processor actually fails something really bad has
- * happened.
- * <p>
- * As with the result listener a failure listener registered after the
- * workflow has already failed will be immediately called with the failure
- * data.
- */
- public void addFailureListener(FailureListener listener);
-
- /**
- * Remove a previously registered failure listener
- */
- public void removeFailureListener(FailureListener listener);
-
- /**
- * Workflow state is available through a sub-tree of the monitor tree. For
- * security reasons the full monitor tree is never accessible through this
- * interface but the sub-tree rooted at the node representing this workflow
- * instance is and can be used for both monitoring and steering functions.
- * <p>
- * Uses the standard TreeModel-like mechanisms for registering change events
- * and can be plugged into a JTree for display purposes through the
- * TreeModelAdapter class.
- *
- * @return Typed version of TreeModel representing the state of this
- * workflow. Nodes in the tree are instances of MonitorNode
- */
- public TypedTreeModel<MonitorNode> getStateModel();
-
- /**
- * Return the dataflow this facade facades
- */
- public Dataflow getDataflow();
-
- /**
- * Return the invocation context used by this facade
- */
- public InvocationContext getContext();
-
- /**
- * Return a map of the data pushed on the named port
- */
- public WeakHashMap<String, T2Reference> getPushedDataMap();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/package.html
deleted file mode 100644
index 898ccdf..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/facade/package.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<body>
-Facade interfaces to represent a workflow instance within the enactor.
-<p>Although T2 has no 'real' concept of a workflow instance, using
-identifiers on data instead, it is useful to treat it as if it does. The
-facade classes are the external 'invoke only' interface to the enactment
-system, providing wrappers around the actual single instance model. This
-also hides the shared state tree, exposing only the sub-tree rooted at
-the base ID internal to the facade layer. The state tree acts both as
-monitoring and steering infrastructure, the facade therefore prevents a
-process accessing the state of another workflow either maliciously or
-inadvertently.
-<p>The construction of these facade objects is not defined here, a
-factory method in the implementation package is the most likely
-candidate but there are other options, for example a peer to peer cloud
-may expose services to create new facades and allow access as might a
-web service based interface. The interfaces here are intended to be as
-easy to access remotely as possible.
-<p>For the same reasons there are no methods in the workflow facade
-concerning security or the management of data access - it is assumed
-that the constructor of the facade layer has embedded such concerns
-within it. There is therefore a clear split between initiation of the
-workflow session and manipulation of it with this package only
-addressing the latter of the two.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Completion.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Completion.java
deleted file mode 100644
index c9f84f2..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Completion.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-/**
- * Contains a (possibly partial) completion event. The completion event is a
- * statement that no further events will occur on this channel with an index
- * prefixed by the completion index. As with Job events completion events have
- * an owning process with the same semantics as that of the Job class
- * <p>
- * The conceptual depth of a completion is the sum of the length of index array
- * for any data tokens the completion shares a stream with and the depth of
- * those tokens. This should be constant for any given token stream.
- *
- * @author Tom Oinn
- *
- */
-public class Completion extends IterationInternalEvent<Completion> {
-
- /**
- * Construct a new optionally partial completion event with the specified
- * owner and completion index
- *
- * @param owningProcess
- * @param completionIndex
- */
- public Completion(String owningProcess, int[] completionIndex,
- InvocationContext context) {
- super(owningProcess, completionIndex, context);
- }
-
- /**
- * Construct a new final completion event, equivalent to calling new
- * Completion(owningProcess, new int[0]);
- *
- * @param owningProcess
- */
- public Completion(String owningProcess, InvocationContext context) {
- super(owningProcess, new int[0], context);
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Cmp(" + owner + ")[");
- for (int i = 0; i < index.length; i++) {
- if (i > 0) {
- sb.append(",");
- }
- sb.append(index[i] + "");
- }
- sb.append("]");
- return sb.toString();
- }
-
- /**
- * Push the index array onto the owning process name and return the new Job
- * object. Does not modify this object, the method creates a new Job with
- * the modified index array and owning process
- *
- * @return
- */
- @Override
- public Completion pushIndex() {
- return new Completion(getPushedOwningProcess(), new int[] {}, context);
- }
-
- /**
- * Pull the index array previous pushed to the owning process name and
- * prepend it to the current index array
- */
- @Override
- public Completion popIndex() {
- return new Completion(owner.substring(0, owner.lastIndexOf(':')),
- getPoppedIndex(), context);
- }
-
- @Override
- public Completion popOwningProcess() throws ProcessIdentifierException {
- return new Completion(popOwner(), index, context);
- }
-
- @Override
- public Completion pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new Completion(pushOwner(localProcessName), index, context);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Event.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Event.java
deleted file mode 100644
index f0706a3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/Event.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-/**
- * Abstract superclass of all 'event' types within a workflow invocation. These
- * are the Job and Completion events which are used internally within a
- * Processor, in particular by the dispatch stack and iteration system, and the
- * WorkflowDataToken which is the only event class that can exist outside of a
- * Processor boundary (and is therefore the most significant one for users of
- * the API)
- *
- * @author Tom Oinn
- *
- */
-public abstract class Event<EventType extends Event<?>> {
-
- protected String owner;
-
- protected InvocationContext context;
-
- protected int[] index;
-
- protected Event(String owner, int[] index, InvocationContext context) {
- this.owner = owner;
- this.index = index;
- this.context = context;
- if (index == null) {
- throw new RuntimeException("Job index cannot be null");
- }
- if (owner == null) {
- throw new RuntimeException("Owning process cannot be null");
- }
- if (context == null) {
- throw new RuntimeException("Invocation context cannot be null");
- }
- }
-
- /**
- * An event is final if its index array is zero length
- *
- * @return true if indexarray.length==0
- */
- public final boolean isFinal() {
- return (index.length == 0);
- }
-
- /**
- * The event has an owner, this is represented as a String object but the
- * ownership is hierarchical in nature. The String is a colon separated list
- * of alphanumeric process identifiers, with identifiers being pushed onto
- * this list on entry to a process and popped off on exit.
- *
- * @return String of colon separated process identifiers owning this Job
- */
- public final String getOwningProcess() {
- return this.owner;
- }
-
- public final InvocationContext getContext() {
- return this.context;
- }
-
- /**
- * Return a copy of the event subclass with the last owning process removed
- * from the owning process list. For example, if the event had owner
- * 'foo:bar' this would return a duplicate event with owner 'foo'. If the
- * owning process is the empty string this is invalid and will throw a
- * ProcessIdentifierException
- *
- * @return a copy of the event with the parent process identifier
- */
- public abstract EventType popOwningProcess()
- throws ProcessIdentifierException;
-
- /**
- * Return a copy of the event subclass with the specified local process name
- * appended to the owning process identifier field. If the original owner
- * was 'foo' and this was called with 'bar' you'd end up with a copy of the
- * subclass with owner 'foo:bar'
- *
- * @param localProcessName
- * name to add
- * @return the modified event
- * @throws ProcessIdentifierException
- * if the local process name contains the ':' character
- */
- public abstract EventType pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException;
-
- /**
- * Events have an index placing them in a conceptual tree structure. This
- * index is carried along with the event and used at various points to drive
- * iteration and ensure that separate jobs are kept that way
- */
- public final int[] getIndex() {
- return this.index;
- }
-
- /**
- * Helper method for implementations of popOwningProcess, this constructs
- * the appropriate process identifier after the leaf has been removed and
- * returns it. If there is no leaf to remove, i.e. the current process
- * identifier is the empty string, then ProcessIdentifierException is thrown
- *
- * @return
- * @throws ProcessIdentifierException
- */
- protected final String popOwner() throws ProcessIdentifierException {
- // Empty string already, can't pop from here, throw exception
- if (owner.equals("")) {
- throw new ProcessIdentifierException(
- "Attempt to pop a null owning process (empty string)");
- }
- // A single ID with no colon in, return the empty string
- if (owner.lastIndexOf(':') < 0) {
- return "";
- }
- return owner.substring(0, owner.lastIndexOf(':'));
- }
-
- /**
- * Helper method for implementations of pushOwningProcess, appends the
- * specified local name to the current owning process identifier and returns
- * the new id. This doesn't change the current process identifier. If there
- * is a colon ':' in the specified name this is invalid and will throw
- * ProcessIdentifierException at you.
- *
- * @param newLocalProcess
- * @return
- * @throws ProcessIdentifierException
- */
- protected final String pushOwner(String newLocalProcess)
- throws ProcessIdentifierException {
- if (newLocalProcess.contains(":")) {
- throw new ProcessIdentifierException("Can't push '"
- + newLocalProcess + "' as it contains a ':' character");
- }
- if (owner.equals("")) {
- // If the owner was the empty string we don't need to append the
- // colon
- return newLocalProcess;
- } else {
- return owner + ":" + newLocalProcess;
- }
- }
-
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append(getClass().getSimpleName());
- sb.append(' ');
- sb.append(owner);
- sb.append('[');
- for (int i : index) {
- sb.append(i);
- sb.append(" ");
- }
- sb.append(']');
- return sb.toString();
- };
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/InvocationContext.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/InvocationContext.java
deleted file mode 100644
index 2170eb1..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/InvocationContext.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-import net.sf.taverna.t2.provenance.reporter.ProvenanceReporter;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-/**
- * Carries the context of a workflow invocation, the necessary data manager,
- * security agents and any other resource shared across the invocation such as
- * provenance injectors.
- *
- * @author Tom Oinn
- *
- */
-public interface InvocationContext extends ReferenceContext {
-
- /**
- * Return the reference service to be used within this invocation context
- *
- * @return a configured instance of ReferenceService to be used to resolve
- * and register references to data in the workflow
- */
- public ReferenceService getReferenceService();
-
- public ProvenanceReporter getProvenanceReporter();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/IterationInternalEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/IterationInternalEvent.java
deleted file mode 100644
index 7986260..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/IterationInternalEvent.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-/**
- * Abstract superclass for event types which have to pass through the iteration
- * system. For this they need the ability to push and pull the iteration index
- * to and from the process identifier, this is done through the popIndex and
- * pushIndex methods. Subclasses of this may be used outside the iteration
- * system but anything which is passed into the iteration system must provide
- * this functionality.
- *
- * @author Tom Oinn
- *
- * @param <EventType>
- * reflexive self type
- */
-public abstract class IterationInternalEvent<EventType extends IterationInternalEvent<?>>
- extends Event<EventType> {
-
- /**
- * Protected constructor for the minimum fields required by all Event
- * subclasses
- *
- * @param owner
- * @param index
- * @param context
- */
- protected IterationInternalEvent(String owner, int[] index,
- InvocationContext context) {
- super(owner, index, context);
- }
-
- /**
- * Pop a previously pushed index array off the process name and append the
- * current index array to create the new index array. This is applied to a
- * new instance of an Event subclass and does not modify the target.
- *
- * @return new Event subclass with modified owning process and index
- */
- public abstract IterationInternalEvent<EventType> popIndex();
-
- /**
- * Push the index array onto the owning process name and return the new
- * Event subclass object. Does not modify this object, the method creates a
- * new Event subclass with the modified index array and owning process.
- *
- */
- public abstract IterationInternalEvent<EventType> pushIndex();
-
- /**
- * Helper method for the pushIndex operation
- *
- * @return
- */
- protected final String getPushedOwningProcess() {
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < index.length; i++) {
- if (i != 0) {
- sb.append(",");
- }
- sb.append(index[i]);
- }
- String indexArrayAsString = sb.toString();
- return (owner + ":" + indexArrayAsString);
- }
-
- /**
- * Helper method for the popIndex operation, returns the modified index
- * array. Subclasses must still implement logic to get the modified owning
- * process but that's relatively easy : <code>
- * return new <Event subclass>(owner.substring(0, owner.lastIndexOf(':')),getPoppedIndex(), dataMap);
- * </code>
- *
- * @return
- */
- protected final int[] getPoppedIndex() {
- int lastLocation = owner.lastIndexOf(':');
- String indexArrayAsString = owner.substring(lastLocation + 1);
- String[] parts = indexArrayAsString.split(",");
- int[] newIndexArray = new int[index.length + parts.length];
- int pos = 0;
- for (String part : parts) {
- newIndexArray[pos++] = Integer.parseInt(part);
- }
- for (int i : index) {
- newIndexArray[pos++] = i;
- }
- return newIndexArray;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/ProcessIdentifierException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/ProcessIdentifierException.java
deleted file mode 100644
index 8bf9053..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/ProcessIdentifierException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-/**
- * Thrown when attempting to create an invalid process identifier, either by
- * popping an empty one (this by definition has no parents) or by pushing a
- * local name including a colon ':' character.
- *
- * @author Tom Oinn
- *
- */
-public class ProcessIdentifierException extends RuntimeException {
-
- private static final long serialVersionUID = -221443591753067425L;
-
- public ProcessIdentifierException() {
- super();
- }
-
- public ProcessIdentifierException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ProcessIdentifierException(String message) {
- super(message);
- }
-
- public ProcessIdentifierException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TokenOrderException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TokenOrderException.java
deleted file mode 100644
index 1ecf866..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TokenOrderException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-/**
- * Thrown when tokens are supplied in an invalid order. Examples of this are
- * where duplicate indices are supplied in the same token stream or where list
- * items are emitted at a point where the individual members haven't been fully
- * populated.
- *
- * @author Tom Oinn
- *
- */
-public class TokenOrderException extends Exception {
-
- public TokenOrderException() {
- super();
- }
-
- public TokenOrderException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public TokenOrderException(String arg0) {
- super(arg0);
- }
-
- public TokenOrderException(Throwable arg0) {
- super(arg0);
- }
-
- /**
- *
- */
- private static final long serialVersionUID = -7870614853928171878L;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TreeCache.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TreeCache.java
deleted file mode 100644
index 0491502..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/TreeCache.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Tree cache for jobs waiting to be combined and dispatched down the iteration
- * system
- *
- * @author Tom Oinn
- *
- */
-public class TreeCache {
-
- private NamedNode root = null;
-
- private int indexDepth = -1;
-
- /**
- * Show the tree structure, printing each node recursively
- */
- @Override
- public synchronized String toString() {
- StringBuffer sb = new StringBuffer();
- if (root != null) {
- printNode(root, sb, "");
- }
- else {
- sb.append("No root node defined.");
- }
- return sb.toString();
- }
-
- private synchronized void printNode(NamedNode node, StringBuffer sb, String indent) {
- sb.append(indent+"Node ("+node.contents+")\n");
- String newIndent = indent + " ";
- for (NamedNode child : node.children) {
- if (child == null) {
- sb.append(newIndent+"null\n");
- }
- else {
- printNode(child, sb, newIndent);
- }
- }
- }
-
- public class NamedNode {
-
- public Job contents = null;
-
- public List<NamedNode> children = new ArrayList<NamedNode>();
-
- public void insertJob(Job j) {
- insertJobAt(j, j.getIndex());
- }
-
- private void insertJobAt(Job j, int[] position) {
- if (position.length == 0) {
- this.contents = j;
- return;
- }
- int firstIndex = position[0];
- if (firstIndex >= children.size()) {
- // Pad with blank NamedNode objects
- for (int i = children.size(); i <= firstIndex; i++) {
- children.add(null);
- }
- }
- NamedNode child = children.get(firstIndex);
- if (child == null) {
- child = new NamedNode();
- children.set(firstIndex, child);
- }
-
- int[] newTarget = new int[position.length - 1];
- for (int i = 1; i < position.length; i++) {
- newTarget[i - 1] = position[i];
- }
- child.insertJobAt(j, newTarget);
- }
-
- public NamedNode childAt(int i) {
- if (i >= children.size()) {
- return null;
- } else {
- return children.get(i);
- }
- }
-
- }
-
- /**
- * The length of index arrays of jobs within the TreeCache. This assumes
- * that all jobs have the same index array length, this is true when the
- * cache is used by the iteration strategy but may not be in other
- * scenarios, use with caution!
- * <p>
- * If no jobs have been submitted this method returns -1
- */
- public int getIndexLength() {
- return this.indexDepth;
- }
-
- /**
- * Add a job to the cache, the job is inserted at a position corresponding
- * to its index array property
- *
- * @param j
- */
- public synchronized void insertJob(Job j) {
- if (root == null) {
- root = new NamedNode();
- }
- indexDepth = j.getIndex().length;
- root.insertJob(j);
- }
-
- protected synchronized NamedNode nodeAt(int[] position) {
- if (root == null) {
- return null;
- }
- NamedNode result = root;
- int index = 0;
- while (index < position.length && result != null) {
- result = result.childAt(position[index++]);
- }
- return result;
- }
-
- /**
- * Chop the cache off at the specified index
- *
- * @param indexArray
- */
- public synchronized void cut(int[] indexArray) {
- if (indexArray.length > 0) {
- int[] newIndex = tail(indexArray);
- NamedNode node = nodeAt(newIndex);
- if (node != null) {
- if (node.children.size() >= indexArray[indexArray.length - 1]) {
- node.children.set(indexArray[indexArray.length - 1], null);
- }
- }
- }
- }
-
- /**
- * Recursively fetch contents of all nodes under the specified index array,
- * used by the prefix matching iteration strategy
- */
- public synchronized List<Job> jobsWithPrefix(int[] prefix) {
- List<Job> jobs = new ArrayList<Job>();
- NamedNode prefixNode = nodeAt(prefix);
- if (prefixNode != null) {
- getJobsUnder(prefixNode, jobs);
- }
- return jobs;
- }
-
- private synchronized void getJobsUnder(NamedNode node, List<Job> jobs) {
- if (node.contents != null) {
- jobs.add(node.contents);
- } else {
- for (NamedNode child : node.children) {
- getJobsUnder(child, jobs);
- }
- }
- }
-
- /**
- * Does the location exist?
- *
- * @param location
- * @return whether the contents of the location are non null
- */
- public synchronized boolean containsLocation(int[] location) {
- return (get(location) != null);
- }
-
- /**
- * Get the job object at the specified index array
- *
- * @param location
- * @return Job at the specified location or null if no such job was found
- */
- public synchronized Job get(int[] location) {
- NamedNode n = nodeAt(location);
- if (n == null) {
- return null;
- }
- return n.contents;
- }
-
- /**
- * Chop the last index off an int[]
- *
- * @param arg
- * @return
- */
- private static int[] tail(int[] arg) {
- int result[] = new int[arg.length - 1];
- for (int i = 0; i < arg.length - 1; i++) {
- result[i] = arg[i];
- }
- return result;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/WorkflowDataToken.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/WorkflowDataToken.java
deleted file mode 100644
index 102de29..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/WorkflowDataToken.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation;
-
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * A single data token passed between processors in a workflow. This is distinct
- * from the Job in that it contains a single (unnamed) data reference whereas
- * the Job holds a map of arbitrarily many named data references in a bundle.
- *
- * @author Tom Oinn
- *
- */
-public class WorkflowDataToken extends Event<WorkflowDataToken> {
-
- private T2Reference dataRef;
-
- /**
- * Construct a new data token with the specified owning process, conceptual
- * index array and data reference
- *
- * @param owningProcess
- * @param index
- * @param dataRef
- */
- public WorkflowDataToken(String owningProcess, int[] index, T2Reference dataRef, InvocationContext context) {
- super(owningProcess, index, context);
- this.dataRef = dataRef;
- }
-
- @Override
- public WorkflowDataToken popOwningProcess()
- throws ProcessIdentifierException {
- return new WorkflowDataToken(popOwner(), index, dataRef, context);
- }
-
- @Override
- public WorkflowDataToken pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new WorkflowDataToken(pushOwner(localProcessName), index, dataRef, context);
- }
-
-
- /**
- * Return the ID of the data this event represents
- *
- * @return
- */
- public T2Reference getData() {
- return this.dataRef;
- }
-
- /**
- * Show the owner, index array and data map in textual form for debugging
- * and any other purpose. Jobs appear in the form :
- *
- * <pre>
- * Job(Process1)[2,0]{Input2=dataID4,Input1=dataID3}
- * </pre>
- */
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Token(" + owner + ")[");
- for (int i = 0; i < index.length; i++) {
- if (i > 0) {
- sb.append(",");
- }
- sb.append(index[i] + "");
- }
- sb.append("]{");
- sb.append(dataRef.toString());
- sb.append("}");
- return sb.toString();
- }
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/package.html
deleted file mode 100644
index 8b3c49a..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/invocation/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<body>
-Contains classes supporting workflow invocation. Other packages may have
-dependencies on this one but classes here will only be accessed by
-non-taverna code in an invocation context. Nothing in here should be
-critical to the definition and manipulation of the workflow defintion.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorManager.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorManager.java
deleted file mode 100644
index d24ad6c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorManager.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.observer.MultiCaster;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorManager.MonitorMessage;
-
-/**
- * Manages a list of monitors implementations that get notified to register and
- * deregister nodes (ie. {@link{net.sf.taverna.t2.monitor.MonitorNode}s), in
- * addition to the addition of
- * {@link MonitorableProperty monitorable properties} of such nodes.
- * <p>
- * Nodes are identified by their owning process, which is an array of strings,
- * for instance ["dataflow2", "processor5", "fish"]
- * <p>
- * To notify the (by default 0) monitors, use any of the
- * {@link #addPropertiesToNode(String[], Set)},
- * {@link #registerNode(Object, String[], Set)},
- * {@link #deregisterNode(String)} methods and variants.
- * <p>
- * To register a monitor, use {@link #addObserver(Observer)}.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class MonitorManager implements Observable<MonitorMessage> {
-
- private static MonitorManager instance;
-
- /**
- * Get the MonitorManager singleton instance.
- *
- * @return The MonitorManager singleton
- */
- public synchronized static MonitorManager getInstance() {
- if (instance == null) {
- setInstance(new MonitorManager());
- }
- return instance;
- }
-
- /**
- * Set the MonitorManager singleton instance. Only to be used by overriding
- * super classes at initialisation time.
- *
- * @param instance
- * MonitorManager singleton to be returned by
- * {@link #getInstance()}.
- */
- protected synchronized static void setInstance(MonitorManager instance) {
- MonitorManager.instance = instance;
- }
-
- protected MultiCaster<MonitorMessage> multiCaster = new MultiCaster<MonitorMessage>(
- this);
-
- /**
- * Protected constructor, use singleton access
- * {@link MonitorManager#getInstance()} instead.
- *
- */
- protected MonitorManager() {
- }
-
- /**
- * {@inheritDoc}
- */
- public void addObserver(Observer<MonitorMessage> observer) {
- multiCaster.addObserver(observer);
- }
-
- /**
- * Push new property get / set methods into the specified node. This is used
- * for monitor-able activities where we have to create the node in the state
- * tree before we have the set of monitor-able properties for it.
- *
- * @param owningProcess
- * the node path to add properties, this must already be
- * registered in the state model, if not then this method fails
- * silently and does nothing.
- * @param newProperties
- * the set of properties to add to the specified node in the
- * state model
- */
- public void addPropertiesToNode(String[] owningProcess,
- Set<MonitorableProperty<?>> newProperties) {
- multiCaster.notify(new AddPropertiesMessage(owningProcess,
- newProperties));
- }
-
- /**
- * Remove the specified node from the monitor. This must be called when the
- * final data or completion event leaves a boundary of control. The monitor
- * is free to delay the actual removal of state, in which case the node may
- * choose to throw exceptions when properties are accessed. The monitor
- * should eventually release all references to work-flow objects and process
- * identifiers - typically this is used to allow a UI a few seconds delay on
- * de-registration so that very fast register / de-register cycles are
- * visible to a user.
- * <p>
- * The specified process identifier must exist within the monitor.
- *
- * @param owningProcess
- * the identifier of the node to remove as a :-separated string
- */
- public void deregisterNode(String owningProcessIdentifier) {
- deregisterNode(owningProcessIdentifier.split(":"));
- }
-
- /**
- * Remove the specified node from the monitor. This must be called when the
- * final data or completion event leaves a boundary of control. The monitor
- * is free to delay the actual removal of state, in which case the node may
- * choose to throw exceptions when properties are accessed. The monitor
- * should eventually release all references to work-flow objects and process
- * identifiers - typically this is used to allow a UI a few seconds delay on
- * de-registration so that very fast register / de-register cycles are
- * visible to a user.
- * <p>
- * The specified process identifier must exist within the monitor.
- *
- * @param owningProcess
- * the identifier of the node to remove.
- */
- public void deregisterNode(String[] owningProcess) {
- multiCaster.notify(new DeregisterNodeMessage(owningProcess));
- }
-
- /**
- * {@inheritDoc}
- */
- public List<Observer<MonitorMessage>> getObservers() {
- return multiCaster.getObservers();
- }
-
- /**
- * Register a new node with this monitor. New nodes can only be registered
- * when a new process identifier is allocated to data corresponding to entry
- * to a boundary of control in the data-flow. For cases where extensions
- * such as dispatch layers wish to augment existing state the plug-in point
- * is responsible for the aggregation of appropriate properties.
- * <p>
- * The process identifier must not already exist within the state tree, if
- * it does it will be ignored. Similarly the parent of the process
- * identifier must exist, you cannot specify orphan nodes with no parent.
- *
- * @param workflowObject
- * an object within the work-flow model which has received the
- * data stream and caused this node to be created. This may or
- * may not be a top level work-flow entity such as a processor or
- * data-flow. It may be empty in which case null can be used but
- * this is not recommended (there's almost always something you
- * can put here, in general the code to create a new node is
- * contained within something that's just received a data stream
- * so a default approach would be to use the 'this'
- * meta-variable)
- * @param owningProcess
- * the :-separated process identifier as a string which has been
- * assigned to data moving through the workflow object. The list
- * of IDs must contain the new identifier as the last element.
- */
- public void registerNode(Object workflowObject,
- String owningProcessIdentifier) {
- registerNode(workflowObject, owningProcessIdentifier.split(":"), null);
- }
-
- /**
- * Register a new node with this monitor. New nodes can only be registered
- * when a new process identifier is allocated to data corresponding to entry
- * to a boundary of control in the data-flow. For cases where extensions
- * such as dispatch layers wish to augment existing state the plug-in point
- * is responsible for the aggregation of appropriate properties.
- * <p>
- * The process identifier must not already exist within the state tree, if
- * it does it will be ignored. Similarly the parent of the process
- * identifier must exist, you cannot specify orphan nodes with no parent.
- *
- * @param workflowObject
- * an object within the work-flow model which has received the
- * data stream and caused this node to be created. This may or
- * may not be a top level work-flow entity such as a processor or
- * data-flow. It may be empty in which case null can be used but
- * this is not recommended (there's almost always something you
- * can put here, in general the code to create a new node is
- * contained within something that's just received a data stream
- * so a default approach would be to use the 'this'
- * meta-variable)
- * @param owningProcess
- * the :-separated process identifier as a string which has been
- * assigned to data moving through the workflow object. The list
- * of IDs must contain the new identifier as the last element. *
- * @param properties
- * the set of monitor-able, and potentially steer-able,
- * properties which can be monitored from this node. Properties
- * may cache, may become invalid and may make no guarantee about
- * timely updates.
- */
- public void registerNode(Object workflowObject,
- String owningProcessIdentifier,
- Set<MonitorableProperty<?>> properties) {
- registerNode(workflowObject, owningProcessIdentifier.split(":"),
- properties);
- }
-
- /**
- * Register a new node with this monitor. New nodes can only be registered
- * when a new process identifier is allocated to data corresponding to entry
- * to a boundary of control in the data-flow. For cases where extensions
- * such as dispatch layers wish to augment existing state the plug-in point
- * is responsible for the aggregation of appropriate properties.
- * <p>
- * The process identifier must not already exist within the state tree, if
- * it does it will be ignored. Similarly the parent of the process
- * identifier must exist, you cannot specify orphan nodes with no parent.
- *
- * @param workflowObject
- * an object within the work-flow model which has received the
- * data stream and caused this node to be created. This may or
- * may not be a top level work-flow entity such as a processor or
- * data-flow. It may be empty in which case null can be used but
- * this is not recommended (there's almost always something you
- * can put here, in general the code to create a new node is
- * contained within something that's just received a data stream
- * so a default approach would be to use the 'this'
- * meta-variable)
- * @param owningProcess
- * the process identifier which has been assigned to data moving
- * through the work-flow object. The list of IDs must contain the
- * new identifier as the last element.
- */
- public void registerNode(Object workflowObject, String[] owningProcess) {
- registerNode(workflowObject, owningProcess, null);
- }
-
- /**
- * Register a new node with this monitor. New nodes can only be registered
- * when a new process identifier is allocated to data corresponding to entry
- * to a boundary of control in the data-flow. For cases where extensions
- * such as dispatch layers wish to augment existing state the plug-in point
- * is responsible for the aggregation of appropriate properties.
- * <p>
- * The process identifier must not already exist within the state tree, if
- * it does it will be ignored. Similarly the parent of the process
- * identifier must exist, you cannot specify orphan nodes with no parent.
- *
- * @param workflowObject
- * an object within the work-flow model which has received the
- * data stream and caused this node to be created. This may or
- * may not be a top level work-flow entity such as a processor or
- * data-flow. It may be empty in which case null can be used but
- * this is not recommended (there's almost always something you
- * can put here, in general the code to create a new node is
- * contained within something that's just received a data stream
- * so a default approach would be to use the 'this'
- * meta-variable)
- * @param owningProcess
- * the process identifier which has been assigned to data moving
- * through the work-flow object. The list of IDs must contain the
- * new identifier as the last element.
- * @param properties
- * the set of monitor-able, and potentially steer-able,
- * properties which can be monitored from this node. Properties
- * may cache, may become invalid and may make no guarantee about
- * timely updates.
- */
- public void registerNode(Object workflowObject, String[] owningProcess,
- Set<MonitorableProperty<?>> properties) {
- if (properties == null) {
- properties = new HashSet<MonitorableProperty<?>>();
- }
- multiCaster.notify(new RegisterNodeMessage(workflowObject,
- owningProcess, properties));
- }
-
- /**
- * {@inheritDoc}
- */
- public void removeObserver(Observer<MonitorMessage> observer) {
- multiCaster.removeObserver(observer);
- }
-
- /**
- * Message indicating that {@link #getNewProperties() new properties} have
- * been added to a node identified by given
- * {@link #getOwningProcess() owning process}.
- *
- */
- public class AddPropertiesMessage extends MonitorMessage {
- private final Set<MonitorableProperty<?>> newProperties;
-
- public AddPropertiesMessage(String[] owningProcess,
- Set<MonitorableProperty<?>> newProperties) {
- super(owningProcess);
- this.newProperties = newProperties;
- }
-
- public Set<MonitorableProperty<?>> getNewProperties() {
- return newProperties;
- }
- }
-
- /**
- * Message indicating that the node of the given
- * {@link #getOwningProcess() owning process} is to be deregistered.
- *
- */
- public class DeregisterNodeMessage extends MonitorMessage {
- public DeregisterNodeMessage(String[] owningProcess) {
- super(owningProcess);
- }
- }
-
- /**
- * Common abstract superclass for all monitor messages. Identifies the
- * {@link #getOwningProcess() owning process}.
- *
- */
- public abstract class MonitorMessage {
- private final String[] owningProcess;
-
- public MonitorMessage(String[] owningProcess) {
- this.owningProcess = owningProcess;
- }
-
- public String[] getOwningProcess() {
- return owningProcess;
- }
- }
-
- /**
- * Message indicating that the node of the given
- * {@link #getOwningProcess() owning process} is to be registered. The node
- * might have {@link #getProperties() a set of monitorable properties} and a
- * {@link #getWorkflowObject workflow object}.
- */
- public class RegisterNodeMessage extends MonitorMessage {
- private final Set<MonitorableProperty<?>> properties;
- private final Object workflowObject;
-
- public RegisterNodeMessage(Object workflowObject,
- String[] owningProcess, Set<MonitorableProperty<?>> properties) {
- super(owningProcess);
- this.workflowObject = workflowObject;
- this.properties = properties;
- }
-
- public Set<MonitorableProperty<?>> getProperties() {
- return properties;
- }
-
- public Object getWorkflowObject() {
- return workflowObject;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorNode.java
deleted file mode 100644
index d8abd0a..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorNode.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-import java.util.Date;
-import java.util.Set;
-
-/**
- * A single node in the Monitor tree, containing an optional arbitrary workflow
- * object and a set of properties which may or may not be mutable. For tree
- * traversal operations the top level monitor tree must be used, instances of
- * this class are not aware of the surrounding tree structure.
- *
- * @author Tom Oinn
- *
- */
-public interface MonitorNode {
-
- /**
- * Each monitor node can reference zero or one workflow object. This is the
- * object which is providing any properties the node exposes, so is likely
- * to be a workflow or processor but could be anything.
- *
- * @return the workflow object providing this node's properties, or null if
- * there is no directly corresponding workflow object. Note that
- * this workflow object can be anything, and may not be a top level
- * workflow object at all.
- */
- public Object getWorkflowObject();
-
- /**
- * Each monitor node has an identity corresponding to the identifier stack
- * of the data flowing through the workflow object that created it. This
- * string array also defines its position in the monitor tree.
- */
- public String[] getOwningProcess();
-
- /**
- * Each monitor node exposes a set of properties, which may or may not be
- * mutable
- */
- public Set<? extends MonitorableProperty<?>> getProperties();
-
- /**
- * Each node has a creation date
- */
- public Date getCreationDate();
-
- /**
- * Properties can be added to the monitor node after creation if required,
- * although this should be used only when necessary to avoid race conditions
- */
- public void addMonitorableProperty(MonitorableProperty<?> newProperty);
-
- /**
- * Nodes can persist in the tree after they have expired, in which case this
- * will return true.
- */
- public boolean hasExpired();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorableProperty.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorableProperty.java
deleted file mode 100644
index d6c2e05..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/MonitorableProperty.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-import java.util.Date;
-
-/**
- * A single readable property contained by a Monitorable. This is used to
- * express properties that are dynamic with respect to workflow invocation as
- * opposed to static properties defined by the workflow model. A typical example
- * of this might be dispatch stack queue size or number of jobs completed. All
- * properties are defined relative to a particular owning process identifier,
- * this is the same mechanism as used in the workflow model to isolate different
- * data streams.
- *
- * @author Tom Oinn
- *
- */
-public interface MonitorableProperty<T> {
-
- /**
- * Return the value of this property
- */
- public T getValue() throws NoSuchPropertyException;
-
- /**
- * Return the name of this property, names are heirarchical in nature and
- * are defined as an array of String objects. This is to allow e.g. dispatch
- * layers to expose a set of related properties under the same root name.
- */
- public String[] getName();
-
- /**
- * Get the last update date for this property, if the property is immutable
- * then this should be set to the date at which the implementation is
- * created.
- */
- public Date getLastModified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/NoSuchPropertyException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/NoSuchPropertyException.java
deleted file mode 100644
index 670a81f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/NoSuchPropertyException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-/**
- * Thrown when an attempt is made to access a monitorable property which is no
- * longer current. This is quite a common event as the properties can change
- * extremely quickly whereas the logic accessing them is expected not to.
- * Consumers of state data must cope with this disparity by handling this
- * exception where it is thrown.
- *
- * @author Tom Oinn
- *
- */
-public class NoSuchPropertyException extends Exception {
-
- private static final long serialVersionUID = 6320919057517500603L;
-
- public NoSuchPropertyException() {
- super();
- }
-
- public NoSuchPropertyException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public NoSuchPropertyException(String arg0) {
- super(arg0);
- }
-
- public NoSuchPropertyException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/SteerableProperty.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/SteerableProperty.java
deleted file mode 100644
index 6eb9624..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/SteerableProperty.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-/**
- * Some monitorable properties are mutable and can be written to by steering
- * agents or other clients.
- *
- * @author Tom Oinn
- *
- */
-public interface SteerableProperty<T> extends MonitorableProperty<T> {
-
- /**
- * Set the property value
- *
- * @param newValue
- * @throws NoSuchPropertyException
- */
- public void setProperty(T newValue) throws NoSuchPropertyException;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/package.html
deleted file mode 100644
index 17ee572..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/monitor/package.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<body>
-Defines the API for the monitoring and steering system. As data flows
-through a workflow it passes through a succession of bounds of control.
-Each of these boundaries corresponds to a workflow, a nested process or
-some other contained entity where a new owning process identifier is
-pushed onto the process identifier stack for that data item. This
-modification to the owning process identifier implicitly creates a tree
-structure where the parent of a particular identifier can be obtained by
-popping the last component off its identifier stack (in general this
-means splitting into a list by the ':' character and removing the last
-item).
-<p>Any entity issuing a new identifier to data in this way must
-implement the Monitorable interface and should register itself with the
-Monitor before or at the point of assigning this new identifier. Some
-cases may register child items rather than delegating to the children
-themselves, for example a workflow definition may register all its
-processors as children and deregister on workflow completion rather than
-the process happening for each processor but however it is accomplished
-the result is the creation within the Monitor of a tree where nodes
-contain references to Monitorable objects within the workflow
-definition.
-<p>The Monitorable interface defines a simple contract - once
-registered the implementing class can return a list of
-MonitorableProperty instances defining the exposed dynamic state at this
-node in the context of a given process identifier. Any of these
-properties may be mutable in which case they will extend
-SteerableProperty, a sub-interface of MonitorableProperty which allows
-for the mutation of the property.
-<p>By design the Monitor is rather powerful - it has the ability to
-modify steerable properties in any running workflow. It is obviously
-desirable to restrict this, passing any given monitoring or steering
-agent a restricted subset of the monitor tree rooted at a specific
-process identifier and preventing direct access to the Monitor class.
-The Monitor interface defines methods to expose subsets of the
-monitorable state for this reason.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ActivityProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ActivityProvenanceItem.java
deleted file mode 100644
index c3be16f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ActivityProvenanceItem.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Contains details for an enacted Activity. Parent is a
- * {@link ProcessorProvenanceItem}. Children are {@link IterationProvenanceItem}
- * s. There could be multiple {@link ActivityProvenanceItem}s for each
- * {@link ProcessorProvenanceItem}
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- * @author Paolo Missier
- *
- */
-public class ActivityProvenanceItem implements ProvenanceItem {
-
- private Activity<?> activity;
- private IterationProvenanceItem iterationProvenanceItem;
- private String processId;
- private String identifier;
- private String parentId;
- private SharedVocabulary eventType = SharedVocabulary.ACTIVITY_EVENT_TYPE;
- private String workflowId;
-
- public ActivityProvenanceItem() {
- }
-
- private String getActivityID() {
- return activity.getClass().getSimpleName();
- }
-
- public void setIterationProvenanceItem(
- IterationProvenanceItem iterationProvenanceItem) {
- this.iterationProvenanceItem = iterationProvenanceItem;
- }
-
- public IterationProvenanceItem getIterationProvenanceItem() {
- return iterationProvenanceItem;
- }
-
- public String getAsString() {
- return null;
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public Activity<?> getActivity() {
- return activity;
- }
-
- public void setActivity(Activity<?> activity) {
- this.activity = activity;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
-
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
-
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataProvenanceItem.java
deleted file mode 100644
index 4687726..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataProvenanceItem.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Contains references to data which a workflow has used or created. Parent is
- * an {@link IterationProvenanceItem}
- *
- * @author Ian Dunlop
- * @auhor Stuart Owen
- * @author Paolo Missier
- *
- */
-public abstract class DataProvenanceItem implements ProvenanceItem {
- /** A map of port name to data reference */
- private Map<String, T2Reference> dataMap;
- private ReferenceService referenceService;
- private String workflowId;
-
- /**
- * Is this {@link ProvenanceItem} for input or output data
- *
- * @return
- */
- protected abstract boolean isInput();
-
- public DataProvenanceItem() {
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.provenance.item.DataProvenanceItemInterface#getDataMap()
- */
- public Map<String, T2Reference> getDataMap() {
- return dataMap;
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.provenance.item.DataProvenanceItemInterface#setDataMap(java.util.Map)
- */
- public void setDataMap(Map<String, T2Reference> dataMap) {
- this.dataMap = dataMap;
- }
-
- public abstract String getIdentifier();
-
- public abstract String getParentId();
-
- public abstract String getProcessId();
-
- public void setReferenceService(ReferenceService referenceService) {
- this.referenceService = referenceService;
- }
-
- public ReferenceService getReferenceService() {
- return referenceService;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataflowRunComplete.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataflowRunComplete.java
deleted file mode 100644
index d50384a..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/DataflowRunComplete.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * Informs the {@link ProvenanceConnector} that a workflow has been run to
- * completion. If a {@link ProvenanceConnector} receives this event then it
- * means that there are no further events to come and that the workflow has been
- * enacted to completion
- *
- * @author Ian Dunlop
- *
- */
-public class DataflowRunComplete implements ProvenanceItem {
-
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.END_WORKFLOW_EVENT_TYPE;
- private String workflowId;
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ErrorProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ErrorProvenanceItem.java
deleted file mode 100644
index a025d11..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ErrorProvenanceItem.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * When an error is received in the dispatch stack, one of these is created and
- * sent across to the {@link ProvenanceConnector}. Parent is an
- * {@link IterationProvenanceItem}
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- * @author Paolo Missier
- *
- */
-public class ErrorProvenanceItem implements ProvenanceItem {
-
- private Throwable cause;
- private String message;
- private String errorType;
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.ERROR_EVENT_TYPE;
- private String workflowId;
-
- public ErrorProvenanceItem() {
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public Throwable getCause() {
- return cause;
- }
-
- public void setCause(Throwable cause) {
- this.cause = cause;
- }
-
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public String getErrorType() {
- return errorType;
- }
-
- public void setErrorType(String errorType) {
- this.errorType = errorType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
-
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/InputDataProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/InputDataProvenanceItem.java
deleted file mode 100644
index 06b375e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/InputDataProvenanceItem.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * Contains details of port names and the input data they receive. Parent is an
- * {@link IterationProvenanceItem}
- *
- * @author Paolo Missier
- * @author Stuart Owen
- * @author Ian Dunlop
- *
- */
-public class InputDataProvenanceItem extends DataProvenanceItem {
-
- private String processId;
- private String identifier;
- private String parentId;
- private SharedVocabulary eventType = SharedVocabulary.INPUTDATA_EVENT_TYPE;
-
- /**
- * Used when generating the xml version by the {@link DataProvenanceItem}.
- * Identifies this {@link DataProvenanceItem} as containing input
- */
- protected boolean isInput() {
- return true;
- }
-
- public InputDataProvenanceItem() {
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getParentId() {
- // TODO Auto-generated method stub
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- // TODO Auto-generated method stub
-
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- // TODO Auto-generated method stub
-
- }
-
- public String getProcessId() {
- // TODO Auto-generated method stub
- return processId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/IterationProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/IterationProvenanceItem.java
deleted file mode 100644
index c1475bb..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/IterationProvenanceItem.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * One of these is created for each iteration inside an enacted activity.
- * Contains both the input and output data and port names contained inside
- * {@link DataProvenanceItem}s. The actual iteration number is contained inside
- * an int array eg [1]
- *
- * @author Ian Dunlop
- * @author Paolo Missier
- * @author Stuart Owen
- *
- */
-public class IterationProvenanceItem implements ProvenanceItem {
- private int[] iteration;
- private InputDataProvenanceItem inputDataItem;
- private OutputDataProvenanceItem outputDataItem;
- private ErrorProvenanceItem errorItem;
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.ITERATION_EVENT_TYPE;
- private String workflowId;
-
- public IterationProvenanceItem() {
- }
-
- public void setInputDataItem(InputDataProvenanceItem inputDataItem) {
- this.inputDataItem = inputDataItem;
- }
-
- public void setOutputDataItem(OutputDataProvenanceItem outputDataItem) {
- this.outputDataItem = outputDataItem;
- }
-
- public void setErrorItem(ErrorProvenanceItem errorItem) {
- this.errorItem = errorItem;
- }
-
- public ErrorProvenanceItem getErrorItem() {
- return errorItem;
- }
-
- public int[] getIteration() {
- return iteration;
- }
-
- public void setIteration(int[] iteration) {
- this.iteration = iteration;
- }
-
- public InputDataProvenanceItem getInputDataItem() {
- return inputDataItem;
- }
-
- public OutputDataProvenanceItem getOutputDataItem() {
- return outputDataItem;
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public void setWorklfowId(String workflowId) {
- this.setWorkflowId(workflowId);
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/OutputDataProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/OutputDataProvenanceItem.java
deleted file mode 100644
index 2a2be08..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/OutputDataProvenanceItem.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-/**
- * Contains details of port names and the output data they receive. Parent is an
- * {@link IterationProvenanceItem}
- *
- * @author Paolo Missier
- * @author Stuart Owen
- * @author Ian Dunlop
- *
- */
-public class OutputDataProvenanceItem extends DataProvenanceItem {
-
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.OUTPUTDATA_EVENT_TYPE;
- /**
- * Used when generating the xml version by the {@link DataProvenanceItem}.
- * Identifies this {@link DataProvenanceItem} as containing output
- */
- protected boolean isInput() {
- return false;
- }
-
- public OutputDataProvenanceItem() {
- super();
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessProvenanceItem.java
deleted file mode 100644
index d1d4e45..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessProvenanceItem.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * Each time a job is received by the dispatch stack one of these will be
- * created. It has a {@link ProcessorProvenanceItem} as its child. Its parent is
- * a {@link WorkflowProvenanceItem} which in turn knows the unique id of the
- * workflow the provenance is being stored for. NOTE: May be superfluous since
- * it essentially mimics the behaviour of its child item but may be more hastle
- * than it is worth to remove it
- *
- * @author Stuart owen
- * @author Paolo Missier
- * @author Ian Dunlop
- *
- */
-public class ProcessProvenanceItem implements ProvenanceItem {
- private String owningProcess;
- private ProcessorProvenanceItem processorProvenanceItem;
- private String parentId;
- private String identifier;
- private String facadeID;
- private String processId;
- private String dataflowID;
- private SharedVocabulary eventType = SharedVocabulary.PROCESS_EVENT_TYPE;
- private String workflowId;
-
- public ProcessProvenanceItem() {
-
- }
-
- /**
- * As {@link WorkflowInstanceFacade}s are created for a Processor the
- * details are appended to the owning process identifier. This is in the
- * form facadeX:dataflowY:ProcessorZ etc. This method returns the facadeX part.
- *
- * @return
- */
- public String getFacadeID() {
- return facadeID;
- }
-
- public void setProcessorProvenanceItem(
- ProcessorProvenanceItem processorProvenanceItem) {
- this.processorProvenanceItem = processorProvenanceItem;
- }
-
- public ProcessorProvenanceItem getProcessorProvenanceItem() {
- return processorProvenanceItem;
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getOwningProcess() {
- return owningProcess;
- }
-
- public void setOwningProcess(String owningProcess) {
- this.owningProcess = owningProcess;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public void setFacadeID(String facadeID) {
- this.facadeID = facadeID;
- }
-
- public void setDataflowID(String dataflowID) {
- this.dataflowID = dataflowID;
- }
-
- public String getDataflowID() {
- return dataflowID;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessorProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessorProvenanceItem.java
deleted file mode 100644
index b23017c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProcessorProvenanceItem.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-import org.jdom.Element;
-
-/**
- * Each Processor inside a workflow will have one of these for each provenance
- * run. Its parent is a {@link ProcessProvenanceItem} and child is an
- * {@link ActivityProvenanceItem}. In theory there could be more than one
- * {@link ActivityProvenanceItem} per processor to cope with failover etc
- *
- * @author Ian Dunlop
- * @author Stuart Owen
- * @author Paolo Missier
- *
- */
-public class ProcessorProvenanceItem implements ProvenanceItem {
-
- private ActivityProvenanceItem activityProvenanceItem;
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.PROCESSOR_EVENT_TYPE;
- private String workflowId;
-
- public ProcessorProvenanceItem() {
- }
-
-
- public void setActivityProvenanceItem(
- ActivityProvenanceItem activityProvenanceItem) {
- this.activityProvenanceItem = activityProvenanceItem;
- }
-
- public ActivityProvenanceItem getActivityProvenanceItem() {
- return activityProvenanceItem;
- }
-
- public String getProcessorID() {
- return identifier;
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public void setIdentifier(String identifier) {
- // FIXME this used to be the code below but not really sure why so have
- // changed it
-// String facadeId = processId.split(":")[0];
-// this.identifier = facadeId + "(" + identifier + ")";
- this.identifier = identifier;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProvenanceItem.java
deleted file mode 100644
index 8a852b3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/ProvenanceItem.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-
-/**
- * Used to store some enactment information during a workflow run
- *
- * @author Ian Dunlop
- *
- */
-public interface ProvenanceItem {
-
- /**
- * What type of information does the item contain. The
- * {@link SharedVocabulary} can be used to identify it
- *
- * @return
- */
- public SharedVocabulary getEventType();
-
- /**
- * The unique identifier for this item
- *
- * @return
- */
- public String getIdentifier();
-
- /**
- * A unique id for this event. Any children would use this as their parentId
- *
- * @param identifier
- */
- public void setIdentifier(String identifier);
-
- /**
- * The workflow model id that is supplied during enactment eg
- * facade0:dataflow2:processor1
- *
- * @param processId
- */
- public void setProcessId(String processId);
-
- /**
- * Get the enactor supplie identifier
- *
- * @return
- */
- public String getProcessId();
-
- /**
- * The parent of this provenance Item. The model is
- * WorkflowProvenanceItem>ProcessProvenanceItem
- * >ProcessorProvenanceItem>ActivityProvenanceITem
- * >IterationProvenanceItem>DataProvenanceItem
- *
- * Additionally there is a WorkflowDataProvenanceItem that is sent when the
- * facade receives a completion event and a ErrorProvenanceItem when things
- * go wrong
- *
- * @param parentId
- */
- public void setParentId(String parentId);
-
- /**
- * Who is the parent of this item?
- *
- * @return
- */
- public String getParentId();
-
- /**
- * The uuid that belongs to the actual dataflow
- * @param workflowId
- */
- public void setWorkflowId(String workflowId);
-
- /**
- * The uuid that belongs to the actual dataflow
- * @return a string representation of a uuid
- */
- public String getWorkflowId();
-
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowDataProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowDataProvenanceItem.java
deleted file mode 100644
index ffd0772..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowDataProvenanceItem.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * When the {@link WorkflowInstanceFacade} for a processor receives a data token
- * one of these is created. This is especially important for data which flows
- * straight through a facade without going into the dispatch stack (a rare event
- * but it can happen)
- *
- * @author Ian Dunlop
- *
- */
-public class WorkflowDataProvenanceItem implements ProvenanceItem {
-
- private String identifier;
- private String parentId;
- private String processId;
- private ReferenceService referenceService;
- /** The output port name that the data is for */
- private String portName;
- /** A reference to the data token received in the facade */
- private T2Reference data;
- private SharedVocabulary eventType = SharedVocabulary.WORKFLOW_DATA_EVENT_TYPE;
- private boolean isFinal;
- private int[] index;
- private String workflowId;
-
- public WorkflowDataProvenanceItem() {
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public void setPortName(String portName) {
- this.portName = portName;
- }
-
- public String getPortName() {
- return portName;
- }
-
- public void setData(T2Reference data) {
- this.data = data;
- }
-
- public T2Reference getData() {
- return data;
- }
-
- public void setReferenceService(ReferenceService referenceService) {
- this.referenceService = referenceService;
- }
-
- public ReferenceService getReferenceService() {
- return referenceService;
- }
-
- public void setIndex(int[] index) {
- this.index = index;
-
- }
-
- public int[] getIndex() {
- return index;
- }
-
- public void setFinal(boolean isFinal) {
- this.isFinal = isFinal;
- }
-
- public boolean isFinal() {
- return isFinal;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowProvenanceItem.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowProvenanceItem.java
deleted file mode 100644
index 98b2289..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/item/WorkflowProvenanceItem.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.item;
-
-import net.sf.taverna.t2.facade.WorkflowInstanceFacade;
-import net.sf.taverna.t2.provenance.vocabulary.SharedVocabulary;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-import org.apache.log4j.Logger;
-
-/**
- * The first {@link ProvenanceItem} that the {@link ProvenanceConnector} will
- * receive for a workflow run. Contains the {@link Dataflow} itself as well as
- * the process id for the {@link WorkflowInstanceFacade} (facadeX:dataflowY).
- * Its child is a {@link ProcessProvenanceItem} and parent is the UUID of the
- * {@link Dataflow} itself
- *
- * @author Ian Dunlop
- * @author Paolo Missier
- * @author Stuart Owen
- *
- */
-public class WorkflowProvenanceItem implements ProvenanceItem {
-
- private static Logger logger = Logger
- .getLogger(WorkflowProvenanceItem.class);
-
- private Dataflow dataflow;
- private String processId;
- private String parentId;
- private String identifier;
- private SharedVocabulary eventType = SharedVocabulary.WORKFLOW_EVENT_TYPE;
- private int[] index;
- private boolean isFinal;
-
- private String workflowId;
-
- public WorkflowProvenanceItem() {
-
- }
-
- public Dataflow getDataflow() {
- return dataflow;
- }
-
- public void setDataflow(Dataflow dataflow) {
- this.dataflow = dataflow;
- }
-
- public SharedVocabulary getEventType() {
- return eventType;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public void setProcessId(String processId) {
- this.processId = processId;
- }
-
- public String getParentId() {
- return parentId;
- }
-
- public void setIdentifier(String identifier) {
- this.identifier = identifier;
- }
-
- public void setParentId(String parentId) {
- this.parentId = parentId;
- }
-
- public String getProcessId() {
- return processId;
- }
-
- /**
- * @return the index
- */
- public int[] getIndex() {
- return index;
- }
-
- /**
- * @param index the index to set
- */
- public void setIndex(int[] index) {
- this.index = index;
- }
-
- /**
- * @return the isFinal
- */
- public boolean isFinal() {
- return isFinal;
- }
-
- /**
- * @param isFinal the isFinal to set
- */
- public void setFinal(boolean isFinal) {
- this.isFinal = isFinal;
- }
-
- public String getWorkflowId() {
- return workflowId;
- }
-
- public void setWorkflowId(String workflowId) {
- this.workflowId = workflowId;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/reporter/ProvenanceReporter.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/reporter/ProvenanceReporter.java
deleted file mode 100644
index 5cb3fbd..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/reporter/ProvenanceReporter.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package net.sf.taverna.t2.provenance.reporter;
-
-import java.util.List;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-public interface ProvenanceReporter {
-
- /**
- * Add a {@link ProvenanceItem} to the connector
- *
- * @param provenanceItem
- * @param invocationContext
- */
- public void addProvenanceItem(ProvenanceItem provenanceItem);
-
- // FIXME is this reference service really needed since we have the context?
- /**
- * Tell the connector what {@link ReferenceService} it should use when
- * trying to dereference data items inside {@link ProvenanceItem}s
- *
- * @param referenceService
- */
- public void setReferenceService(ReferenceService referenceService);
-
- /**
- * Get the {@link ReferenceService} in use by this connector
- *
- * @return
- */
- public ReferenceService getReferenceService();
-
- /**
- * Get all the {@link ProvenanceItem}s that the connector currently knows
- * about
- *
- * @return
- */
- public List<ProvenanceItem> getProvenanceCollection();
-
- /**
- * Set the {@link InvocationContext} that this reporter should be using
- *
- * @param invocationContext
- */
- public void setInvocationContext(InvocationContext invocationContext);
-
- /**
- * Get the {@link InvocationContext} that this reporter should be using if
- * it needs to dereference any data
- *
- * @return
- */
- public InvocationContext getInvocationContext();
-
- /**
- * A unique identifier for this run of provenance, should correspond to the
- * initial {@link WorkflowProvenanceItem} idenifier that gets sent through
- *
- * @param identifier
- */
- public void setSessionID(String sessionID);
-
- /**
- * What is the unique identifier used by this connector
- *
- * @return
- */
- public String getSessionID();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/vocabulary/SharedVocabulary.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/vocabulary/SharedVocabulary.java
deleted file mode 100644
index f222736..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/provenance/vocabulary/SharedVocabulary.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.provenance.vocabulary;
-
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-
-/**
- * Static strings which identify all the {@link ProvenanceItem}s and
- * {@link ProvenanceEventType}s
- *
- * @author Paolo Missier
- * @author Ian Dunlop
- *
- */
-public enum SharedVocabulary {
-
- DATAFLOW_EVENT_TYPE, PROCESS_EVENT_TYPE, PROVENANCE_EVENT_TYPE, ACTIVITY_EVENT_TYPE, DATA_EVENT_TYPE, ERROR_EVENT_TYPE, INMEMORY_EVENT_TYPE, INPUTDATA_EVENT_TYPE, ITERATION_EVENT_TYPE, OUTPUTDATA_EVENT_TYPE, PROCESSOR_EVENT_TYPE, WEBSERVICE_EVENT_TYPE, WORKFLOW_DATA_EVENT_TYPE, WORKFLOW_EVENT_TYPE, END_WORKFLOW_EVENT_TYPE;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TreeModelAdapter.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TreeModelAdapter.java
deleted file mode 100644
index 96b14d4..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TreeModelAdapter.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.utility;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.swing.event.TreeModelEvent;
-import javax.swing.event.TreeModelListener;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-/**
- * Wraps a typed tree model up in a standard tree model for use with JTree and
- * friends.
- *
- * @author Tom Oinn
- *
- */
-public final class TreeModelAdapter {
-
- private class TypedListenerPair {
- @SuppressWarnings("unchecked")
- TypedTreeModelListener typedListener;
-
- TreeModelListener untypedListener;
-
- @SuppressWarnings("unchecked")
- TypedListenerPair(TypedTreeModelListener typedListener,
- TreeModelListener untypedListener) {
- this.typedListener = typedListener;
- this.untypedListener = untypedListener;
- }
-
- }
-
- private static Set<TypedListenerPair> mapping = new HashSet<TypedListenerPair>();
-
- private static TreeModelAdapter instance = null;
-
- private TreeModelAdapter() {
- //
- }
-
- private synchronized static TreeModelAdapter getInstance() {
- if (instance == null) {
- instance = new TreeModelAdapter();
- }
- return instance;
- }
-
- /**
- * Return an untyped TreeModel wrapper around the specified TypedTreeModel
- *
- * @param <NodeType>
- * the node type of the typed model being wrapped
- * @param typedModel
- * typed model to wrap
- * @return a TreeModel acting as an untyped view of the typed tree model
- */
- public static <NodeType extends Object> TreeModel untypedView(
- TypedTreeModel<NodeType> typedModel) {
- return getInstance().removeType(typedModel);
- }
-
- private <NodeType extends Object> TreeModel removeType(
- final TypedTreeModel<NodeType> typedModel) {
-
- return new TreeModel() {
-
- @SuppressWarnings("unchecked")
- public void addTreeModelListener(final TreeModelListener arg0) {
- TypedTreeModelListener typedListener = new TypedTreeModelListener<NodeType>() {
-
- public void treeNodesChanged(TypedTreeModelEvent<NodeType> e) {
- arg0.treeNodesChanged(unwrapType(e));
- }
-
- public void treeNodesInserted(
- TypedTreeModelEvent<NodeType> e) {
- arg0.treeNodesInserted(unwrapType(e));
- }
-
- public void treeNodesRemoved(TypedTreeModelEvent<NodeType> e) {
- arg0.treeNodesRemoved(unwrapType(e));
- }
-
- public void treeStructureChanged(
- TypedTreeModelEvent<NodeType> e) {
- arg0.treeStructureChanged(unwrapType(e));
- }
-
- private TreeModelEvent unwrapType(
- final TypedTreeModelEvent<NodeType> e) {
- return new TreeModelEvent(e.getSource(), e
- .getTreePath(), e.getChildIndices(), e
- .getChildren());
- }
-
- };
- synchronized (mapping) {
- typedModel.addTreeModelListener(typedListener);
- mapping.add(new TypedListenerPair(typedListener, arg0));
- }
-
- }
-
- @SuppressWarnings("unchecked")
- public Object getChild(Object arg0, int arg1) {
- return typedModel.getChild((NodeType) arg0, arg1);
- }
-
- @SuppressWarnings("unchecked")
- public int getChildCount(Object arg0) {
- return typedModel.getChildCount((NodeType) arg0);
- }
-
- @SuppressWarnings("unchecked")
- public int getIndexOfChild(Object arg0, Object arg1) {
- return typedModel.getIndexOfChild((NodeType) arg0,
- (NodeType) arg1);
- }
-
- public Object getRoot() {
- return typedModel.getRoot();
- }
-
- @SuppressWarnings("unchecked")
- public boolean isLeaf(Object arg0) {
- return typedModel.isLeaf((NodeType) arg0);
- }
-
- @SuppressWarnings("unchecked")
- public void removeTreeModelListener(TreeModelListener arg0) {
- synchronized (mapping) {
- TypedListenerPair toRemove = null;
- for (TypedListenerPair tpl : mapping) {
- if (tpl.untypedListener == arg0) {
- toRemove = tpl;
- typedModel
- .removeTreeModelListener(tpl.typedListener);
- break;
- }
- }
- if (toRemove == null) {
- return;
- }
- mapping.remove(toRemove);
- }
-
- }
-
- public void valueForPathChanged(TreePath arg0, Object arg1) {
- typedModel.valueForPathChanged(arg0, arg1);
- }
-
- };
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModel.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModel.java
deleted file mode 100644
index 6c74638..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.utility;
-
-import javax.swing.tree.TreePath;
-
-/**
- * A replacement for TreeModel where nodes are typed rather than being generic
- * objects. Because of the way interfaces and generics work this can't be
- * related in any inheritance heirarchy to the actual javax.swing.TreeModel
- * interface but is very similar (okay, identical) in operation. For cases where
- * you want to use a normal TreeModel such as using this as the backing data
- * model for a JTree you can use the TreeModelAdapter class to create an untyped
- * view over the typed version defined here.
- *
- * @author Tom Oinn
- *
- * @see javax.swing.tree.TreeModel
- *
- * @param <NodeType>
- * Each node in the tree is of this type
- */
-public interface TypedTreeModel<NodeType> {
-
- /**
- * Adds a listener for the TreeModelEvent posted after the tree changes.
- */
- void addTreeModelListener(TypedTreeModelListener<NodeType> l);
-
- /**
- * Returns the child of parent at index 'index' in the parent's child array.
- *
- * @param parent
- * parent instance of typed node type
- * @param index
- * index within parent
- * @return child node at the specified index
- */
- NodeType getChild(NodeType parent, int index);
-
- /**
- * Returns the number of children of parent.
- *
- * @param parent
- * node to count children for
- * @return number of children
- */
- int getChildCount(NodeType parent);
-
- /**
- * Returns the index of child in parent.
- *
- * @param parent
- * a node in the tree, obtained from this data source
- * @param child
- * the node we are interested in
- * @return the index of the child in the parent, or -1 if either child or
- * parent are null
- */
- int getIndexOfChild(NodeType parent, NodeType child);
-
- /**
- * Returns the root of the tree. Returns null only if the tree has no nodes.
- *
- * @return the root of the tree
- */
- NodeType getRoot();
-
- /**
- * Returns true if node is a leaf. It is possible for this method to return
- * false even if node has no children. A directory in a filesystem, for
- * example, may contain no files; the node representing the directory is not
- * a leaf, but it also has no children.
- *
- * @param node
- * a node in the tree, obtained from this data source
- * @return true if node is a leaf
- */
- boolean isLeaf(NodeType node);
-
- /**
- * Removes a listener previously added with addTreeModelListener.
- *
- * @param l
- * typed tree model listener to remove
- */
- void removeTreeModelListener(TypedTreeModelListener<NodeType> l);
-
- /**
- * Messaged when the user has altered the value for the item identified by
- * path to newValue. If newValue signifies a truly new value the model
- * should post a treeNodesChanged event.
- *
- * @param path
- * path to the node that the user has altered
- * @param newValue
- * the new value from the TreeCellEditor
- */
- void valueForPathChanged(TreePath path, Object newValue);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelEvent.java
deleted file mode 100644
index c3708c2..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelEvent.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.utility;
-
-import javax.swing.tree.TreePath;
-
-/**
- * Type aware version of TreeModelEvent
- *
- * @author Tom Oinn
- *
- * @see javax.swing.tree.TreeModelEvent
- *
- * @param <NodeType>
- * the node type parameter of the TypedTreeModel to which this event
- * applies
- */
-public class TypedTreeModelEvent<NodeType> {
-
- protected int[] childIndices;
-
- protected NodeType[] children;
-
- protected TreePath path;
-
- protected Object source;
-
- /**
- * Used to create an event when the node structure has changed in some way,
- * identifying the path to the root of a modified subtree as an array of
- * Objects.
- *
- * @param source
- * @param path
- */
- public TypedTreeModelEvent(Object source, NodeType[] path) {
- this.path = new TreePath(path);
- this.source = source;
- this.childIndices = new int[0];
- //this.children = NodeType[].class.cast(java.lang.reflect.Array
- // .newInstance(NodeType[].class, 0));
- }
-
- /**
- * Used to create an event when the node structure has changed in some way,
- * identifying the path to the root of the modified subtree as a TreePath
- * object.
- *
- * @param source
- * @param path
- */
- public TypedTreeModelEvent(Object source, TreePath path) {
- this.path = path;
- this.source = source;
- this.childIndices = new int[0];
- //this.children = NodeType[].class.cast(java.lang.reflect.Array
- // .newInstance(NodeType[].class, 0));
- }
-
- /**
- * Used to create an event when nodes have been changed, inserted, or
- * removed, identifying the path to the parent of the modified items as a
- * TreePath object.
- *
- * @param source
- * @param path
- * @param childIndices
- * @param children
- */
- public TypedTreeModelEvent(Object source, TreePath path,
- int[] childIndices, NodeType[] children) {
- this.source = source;
- this.path = path;
- this.childIndices = childIndices;
- this.children = children;
- }
-
- /**
- * Used to create an event when nodes have been changed, inserted, or
- * removed, identifying the path to the parent of the modified items as an
- * array of Objects.
- *
- * @param source
- * @param path
- * @param childIndices
- * @param children
- */
- public TypedTreeModelEvent(Object source, NodeType[] path,
- int[] childIndices, NodeType[] children) {
- this.path = new TreePath(path);
- this.source = source;
- this.childIndices = childIndices;
- this.children = children;
- }
-
- /**
- * Returns the values of the child indexes.
- *
- * @return
- */
- public int[] getChildIndices() {
- return this.childIndices;
- }
-
- /**
- * Returns the objects that are children of the node identified by getPath
- * at the locations specified by getChildIndices.
- *
- * @return
- */
- public NodeType[] getChildren() {
- return this.children;
- }
-
- /**
- * The object on which the Event initially occurred.
- *
- * @return
- */
- public Object getSource() {
- return this.source;
- }
-
- /**
- * For all events, except treeStructureChanged, returns the parent of the
- * changed nodes.
- *
- * @return
- */
- public TreePath getTreePath() {
- return path;
- }
-
- /**
- * Returns a string that displays and identifies this object's properties.
- */
- @Override
- public String toString() {
- return "Typed TreeModelEvent " + super.toString();
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelListener.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelListener.java
deleted file mode 100644
index 2b75bc4..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/TypedTreeModelListener.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.utility;
-
-/**
- * Equivalent to TreeModelListener for use with the TypedTreeModel
- *
- * @author Tom
- *
- * @see javax.swing.tree.TreeModelListener
- *
- * @param <NodeType>
- * Type of the node within the TypedTreeModel and used to
- * parameterize the typed version of the tree model event.
- */
-public interface TypedTreeModelListener<NodeType> {
-
- /**
- * Invoked after a node (or a set of siblings) has changed in some way. The
- * node(s) have not changed locations in the tree or altered their children
- * arrays, but other attributes have changed and may affect presentation.
- * Example: the name of a file has changed, but it is in the same location
- * in the file system.
- * <p>
- * To indicate the root has changed, childIndices and children will be null.
- * <p>
- * Use e.getPath() to get the parent of the changed node(s).
- * e.getChildIndices() returns the index(es) of the changed node(s).
- */
- void treeNodesChanged(TypedTreeModelEvent<NodeType> e);
-
- /**
- * Invoked after nodes have been inserted into the tree.
- * <p>
- * Use e.getPath() to get the parent of the new node(s). e.getChildIndices()
- * returns the index(es) of the new node(s) in ascending order.
- */
- void treeNodesInserted(TypedTreeModelEvent<NodeType> e);
-
- /**
- * Invoked after nodes have been removed from the tree. Note that if a
- * subtree is removed from the tree, this method may only be invoked once
- * for the root of the removed subtree, not once for each individual set of
- * siblings removed.
- * <p>
- * Use e.getPath() to get the former parent of the deleted node(s).
- * e.getChildIndices() returns, in ascending order, the index(es) the
- * node(s) had before being deleted.
- */
- void treeNodesRemoved(TypedTreeModelEvent<NodeType> e);
-
- /**
- * Invoked after the tree has drastically changed structure from a given
- * node down. If the path returned by e.getPath() is of length one and the
- * first element does not identify the current root node the first element
- * should become the new root of the tree.
- * <p>
- * Use e.getPath() to get the path to the node. e.getChildIndices() returns
- * null.
- */
- void treeStructureChanged(TypedTreeModelEvent<NodeType> e);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/package.html
deleted file mode 100644
index 03fc4c0..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/utility/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<body>
-Utility classes, currently consists of a generic type safe alternative
-to TreeModel along with an adapter class to allow it to be used where a
-TreeModel is required (i.e. JTree)
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractOutputPort.java
deleted file mode 100644
index 131b45c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractOutputPort.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Simple implementation of OutputPort, extends AbstractPort and adds the
- * granular depth bean getter.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractOutputPort extends AbstractPort implements OutputPort {
-
- protected int granularDepth;
-
- protected AbstractOutputPort(String portName, int portDepth,
- int granularDepth) {
- super(portName, portDepth);
- this.granularDepth = granularDepth;
- }
-
- public int getGranularDepth() {
- return granularDepth;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractPort.java
deleted file mode 100644
index f8daaa9..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/AbstractPort.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-
-/**
- * Port definition with depth and name
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractPort extends AbstractAnnotatedThing<Port> implements Port {
-
- protected String name;
- protected int depth;
-
- protected AbstractPort(String name, int depth) {
- this.name = name;
- this.depth = depth;
- }
-
- public int getDepth() {
- return this.depth;
- }
-
- public final String getName() {
- return this.name;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + getName() + " (" + getDepth() + ")";
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/CompoundEdit.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/CompoundEdit.java
deleted file mode 100644
index acc4d9f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/CompoundEdit.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Implementation of Edit which contains an ordered list of child edits. Child
- * edits are applied collectively and in order, any failure in any child edit
- * causes an undo of previously applied children and a propogation of the edit
- * exception.
- *
- * @author Tom Oinn
- *
- */
-public class CompoundEdit implements Edit<Object> {
-
- private final transient List<Edit<?>> childEdits;
-
- private transient boolean applied = false;
-
- /**
- * Create a new compound edit with no existing Edit objects.
- *
- */
- public CompoundEdit() {
- this.childEdits = new ArrayList<Edit<?>>();
- }
-
- /**
- * Create a new compound edit with the specified edits as children.
- */
- public CompoundEdit(List<Edit<?>> edits) {
- this.childEdits = edits;
- }
-
- public List<Edit<?>> getChildEdits() {
- return childEdits;
- }
-
- /**
- * Attempts to call the doEdit method of all child edits. If any of those
- * children throws an EditException any successful edits are rolled back and
- * the exception is rethrown as the cause of a new EditException from the
- * CompoundEdit
- */
- public synchronized Object doEdit() throws EditException {
- if (isApplied()) {
- throw new EditException("Cannot apply an edit more than once!");
- }
- List<Edit<?>> doneEdits = new ArrayList<Edit<?>>();
- try {
- for (Edit<?> edit : childEdits) {
- edit.doEdit();
- // Insert the done edit at position 0 in the list so we can
- // iterate over the list in the normal order if we need to
- // rollback, this ensures that the most recent edit is first.
- doneEdits.add(0, edit);
- }
- applied = true;
- } catch (EditException ee) {
- for (Edit<?> undoMe : doneEdits) {
- undoMe.undo();
- }
- applied = false;
- throw new EditException("Failed child of compound edit", ee);
- }
- return null;
- }
-
- /**
- * There is no explicit subject for a compound edit, so this method always
- * returns null.
- */
- public Object getSubject() {
- return null;
- }
-
- /**
- * Rolls back all child edits in reverse order
- */
- public synchronized void undo() {
- for (int i = (childEdits.size() - 1); i >= 0; i--) {
- // Undo child edits in reverse order
- childEdits.get(i).undo();
- }
- applied = false;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Condition.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Condition.java
deleted file mode 100644
index fd1c842..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Condition.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.annotation.Annotated;
-
-/**
- * Defines the base interface for a condition which must be satisfied before a
- * processor can commence invocation. Conditions are expressed in terms of a
- * relationship between a controlling and a target processor where the target
- * processor may not commence invocation until all conditions for which it is a
- * target are satisfied in the context of a particular owning process
- * identifier.
- *
- * @author Tom Oinn
- *
- */
-public interface Condition extends Annotated<Condition> {
-
- /**
- * @return the Processor constrained by this condition
- */
- public Processor getControl();
-
- /**
- * @return the Processor acting as the controller for this condition
- */
- public Processor getTarget();
-
- /**
- * @param owningProcess
- * the context in which the condition is to be evaluated
- * @return whether the condition is satisfied
- */
- public boolean isSatisfied(String owningProcess);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Configurable.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Configurable.java
deleted file mode 100644
index 255d816..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Configurable.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-
-/**
- * Interface for workflow items that can be configured from a bean.
- *
- * @param <ConfigurationType>
- * the ConfigurationType associated with the workflow item. This is
- * an arbitrary java class that provides details on how the item is
- * configured. To allow successful serialisation it's recommended to
- * keep this configuration as a simple Java bean.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- * @see ActivityConfigurationException
- *
- */
-public interface Configurable<ConfigurationType> {
-
- /**
- * Each item stores configuration within a bean of type ConfigurationType,
- * this method returns the configuration. This is used by the automatic
- * serialisation framework to store the item definition in the workflow XML.
- */
- public abstract ConfigurationType getConfiguration();
-
- /**
- * When the item is built from the workflow definition XML the object is
- * first constructed with a default constructor then this method is called,
- * passing in the configuration bean returned by getConfiguration().
- *
- * @throws ConfigurationException
- * if a problem occurs when configuring the item
- */
- public abstract void configure(ConfigurationType conf)
- throws ConfigurationException;
-
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ConfigurationException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ConfigurationException.java
deleted file mode 100644
index b3310e0..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ConfigurationException.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Thrown when attempting to configure a
- * {@link net.sf.taverna.t2.workflowmodel.Configurable} with an invalid
- * configuration. Causes may include actual configuration errors, unavailable
- * implementations etc.
- *
- * @author Stian Soiland-Reyes
- * @author Tom Oinn
- *
- */
-public class ConfigurationException extends Exception {
-
- private static final long serialVersionUID = -2841928064598107156L;
-
- /**
- * {@inheritDoc}
- */
- public ConfigurationException() {
- super();
- }
-
- /**
- * {@inheritDoc}
- */
- public ConfigurationException(String message, Throwable cause) {
- super(message, cause);
- }
-
- /**
- * {@inheritDoc}
- */
- public ConfigurationException(String message) {
- super(message);
- }
-
- /**
- * {@inheritDoc}
- */
- public ConfigurationException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ControlBoundary.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ControlBoundary.java
deleted file mode 100644
index 2503224..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ControlBoundary.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the associated type creates a boundary of control within the
- * dataflow. Types marked with this annotation are those which can modify the
- * owning process of data tokens they consume and generally correspond to cases
- * where the control flow bifurcates in some fashion.
- * <p>
- * This annotation doesn't currently define this behaviour but serves as an easy
- * way for us to track which objects might potentially do this, something we
- * need to be able to do to guarantee that the monitor works correctly.
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-public @interface ControlBoundary {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Dataflow.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Dataflow.java
deleted file mode 100644
index 15ef129..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Dataflow.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import static net.sf.taverna.t2.annotation.HierarchyRole.CHILD;
-
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.HierarchyTraversal;
-import net.sf.taverna.t2.invocation.InvocationContext;
-
-/**
- * Top level definition object for a dataflow workflow. Currently Taverna only
- * supports dataflow workflows, this is equivalent to the Taverna 1 ScuflModel
- * class in role.
- *
- * @author Tom Oinn
- *
- */
-@ControlBoundary
-public interface Dataflow extends Annotated<Dataflow>, TokenProcessingEntity {
-
- /**
- * A Dataflow consists of a set of named Processor instances. This method
- * returns an unmodifiable list of these processors. Equivalent to calling
- * getEntities(Processor.class).
- *
- * @return list of all processors in the dataflow
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends Processor> getProcessors();
-
- /**
- * Dataflows also contain a set of merge operations, this method returns an
- * unmodifiable copy of the set. Equivalent to calling
- * getEntities(Merge.class)
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends Merge> getMerges();
-
- /**
- * Dataflows have a list of input ports. These are the input ports the world
- * outside the dataflow sees - each one contains an internal output port
- * which is used to forward events on to entities (mostly processors) within
- * the dataflow.
- *
- * @return list of dataflow input port instances
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends DataflowInputPort> getInputPorts();
-
- /**
- * Get all workflow entities with the specified type restriction, this
- * allows retrieval of Processor, Merge, a mix of the two or any other
- * future entity to be added to the workflow model without a significant
- * change in this part of the API.
- *
- * @return an unmodifiable list of entities of the specified type
- * @param entityType
- * a class of the type specified by the type variable T. All
- * entities returned in the list can be cast to this type
- */
- public <T extends NamedWorkflowEntity> List<? extends T> getEntities(
- Class<T> entityType);
-
- /**
- * Dataflows have a list of output ports. The output port in a dataflow is
- * the port visible to the outside world and from which the dataflow emits
- * events. Each dataflow output port also contains an instance of event
- * receiving input port which is used by entities within the dataflow to
- * push events to the corresponding external output port.
- *
- * @return list of dataflow output port instances
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends DataflowOutputPort> getOutputPorts();
-
- /**
- * The dataflow is largely defined by the links between processors and other
- * entities within its scope. This method returns them.
- *
- * @return list of Datalink implementations
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends Datalink> getLinks();
-
- /**
- * Triggers a check for various basic potential problems with the workflow,
- * in particular ones related to type checking. Returns a report object
- * containing the state of the workflow and any problems found.
- *
- * @return validation report
- */
- public DataflowValidationReport checkValidity();
-
- /**
- * A dataflow with no inputs cannot be driven by the supply of data tokens
- * as it has nowhere to receive such tokens. This method allows a dataflow
- * to fire on an empty input set, in this case the owning process identifier
- * must be passed explicitly to the dataflow. This method then calls the
- * fire methods of any Processor instances with no input ports.
- */
- public void fire(String owningProcess, InvocationContext context);
-
- /**
- * The failure transmitter contains event listeners to be notified of
- * workflow level failures - these occur when an error bubbles up to the top
- * of the dispatch stack in a processor and is not handled by conversion to
- * an error token within the data stream.
- * <p>
- * Listeners are messaged after all clean-up has been performed on the
- * dataflow's internal state and that of any child operations within it,
- * guaranteeing that no tokens will be generated with the id of the failed
- * process after the message has been received by the listener
- */
- public FailureTransmitter getFailureTransmitter();
-
- /**
- * An identifier that is unique to this dataflow and its current state.
- * The identifier will change whenever the dataflow is modified.
- *
- * @return a String representing a unique internal identifier.
- */
- public String getInternalIdentier();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowInputPort.java
deleted file mode 100644
index 143b9c3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowInputPort.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * An input port on a Dataflow contains a nested output port within it. This
- * internal output port is used when connecting an edge from the workflow input
- * to a processor or workflow output (which in turn has a nested input port).
- * The workflow ports are therefore effectively pairs of ports with a relay
- * mechanism between the external and internal in the case of the dataflow
- * input.
- *
- * @author Tom Oinn
- *
- */
-public interface DataflowInputPort extends EventHandlingInputPort, DataflowPort {
-
- /**
- * Return the internal output port. Output ports have a granular depth
- * property denoting the finest grained output token they can possibly
- * produce, this is used to configure downstream filtering input ports. In
- * this case the finest depth item is determined by the input to the
- * workflow port and must be explicitly set.
- *
- * @return the internal output port
- */
- public EventForwardingOutputPort getInternalOutputPort();
-
- /**
- * Define the finest grained item that will be sent to this input port. As
- * all data are relayed through to the internal output port this is used to
- * denote output port granularity as well as to configure any downstream
- * connected filtering input ports.
- */
- public int getGranularInputDepth();
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowOutputPort.java
deleted file mode 100644
index e67e19d..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowOutputPort.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.facade.ResultListener;
-
-/**
- * Output port of a DataFlow, exposes an internal EventHandlingInputPort into
- * which the internal workflow logic pushes data to be exposed outside the
- * workflow boundary.
- *
- * @author Tom Oinn
- *
- */
-public interface DataflowOutputPort extends EventForwardingOutputPort, DataflowPort {
-
- /**
- * Get the internal input port for this workflow output
- *
- * @return port into which the workflow can push data for this output
- */
- public EventHandlingInputPort getInternalInputPort();
-
- /**
- * Add a ResultListener, capable of listening to results being received by the output port
- * @param listener the ResultListener
- *
- * @see ResultListener
- */
- public void addResultListener(ResultListener listener);
-
- /**
- * Remove a ResultListener
- * @param listener the ResultListener
- *
- * @see ResultListener
- */
- public void removeResultListener(ResultListener listener);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowPort.java
deleted file mode 100644
index 9fb8d3e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowPort.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Defines that the implementing port belongs to a Dataflow
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public interface DataflowPort extends Port {
-
- /**
- * Get the parent DataFlow to which this port belongs
- */
- public Dataflow getDataflow();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowValidationReport.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowValidationReport.java
deleted file mode 100644
index 8958a9c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/DataflowValidationReport.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Contains a validation report from a dataflow validation check. Processors are
- * classified as failed, unsatisfied or valid depending on whether they directly
- * fail type validation, cannot be checked due to unsatisfied incoming links or
- * pass respectively.
- *
- * @author Tom Oinn
- *
- */
-public interface DataflowValidationReport {
-
- /**
- * Overall validity - if the workflow is valid it can be run, otherwise there
- * are problems somewhere and a facade can't be created from it.
- *
- * @return whether the workflow is valid (true) or not (false)
- */
- public boolean isValid();
-
- /**
- * Whether the workflow is incomplete, i.e. contains no processors and no connected output ports.
- * For example, it is empty or contains only input ports. Even though one can technically run such
- * a workflow it should be prohibited as it does not make any sense. If a workflow
- * is incomplete {@link DataflowValidationReport#isValid()} should return <code>false</code>.
- *
- * @return whether the workflow is incomplete or not
- */
- public boolean isWorkflowIncomplete();
-
- /**
- * The workflow will be marked as invalid if there are entities with
- * unlinked input ports or where there are cycles causing the type checking
- * algorithm to give up. In these cases offending processors or any
- * ancestors that are affected as a knock on effect will be returned in this
- * list.
- *
- * @return list of TokenProcessingEntity instances within the Dataflow for
- * which it is impossible to determine validity due to missing
- * inputs or cyclic dependencies
- */
- public List<? extends TokenProcessingEntity> getUnsatisfiedEntities();
-
- /**
- * The workflow will be marked as invalid if any entity fails to type check.
- *
- * @return list of TokenProcessingEntity instances within the Dataflow which
- * caused explicit type check failures
- */
- public List<? extends TokenProcessingEntity> getFailedEntities();
-
- /**
- * The workflow will be marked as invalid if any of the dataflow output
- * ports can't be typed based on incoming links. This happens if the port
- * isn't linked (a common enough issue for new users in previous releases of
- * Taverna) or if the internal port is linked but the entity it links to
- * isn't validated.
- *
- * @return a list of DataflowOutputPort implementations which are not typed
- * correctly. These will have output depth of -1 indicating an
- * unknown depth, they may or may not have a granular depth set but
- * if the overall depth is -1 this isn't important as the thing
- * won't run anyway.
- */
- public List<? extends DataflowOutputPort> getUnresolvedOutputs();
-
-
- /**
- * An entity will be marked invalid if it depends on a nested dataflow
- * which itself is invalid. If this is the case the entity will be
- * be present both in {@link #getFailedEntities()} and can be used as
- * a key with this method to get the DataflowValidationReport explaining
- * how the nested dataflow failed.
- *
- */
- public Map<TokenProcessingEntity, DataflowValidationReport> getInvalidDataflows();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Datalink.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Datalink.java
deleted file mode 100644
index d8b75d2..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Datalink.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.annotation.Annotated;
-
-/**
- * A single point to point data link from an instance of
- * EventForwardingOutputPort to an instance of EventHandlingInputPort
- *
- * @author Tom Oinn
- *
- */
-public interface Datalink extends Annotated<Datalink> {
-
- /**
- * Get the sink for events flowing through this link
- *
- * @return input port receiving events
- */
- public EventHandlingInputPort getSink();
-
- /**
- * Get the source for events flowing through this link
- *
- * @return output port generating events
- */
- public EventForwardingOutputPort getSource();
-
- /**
- * Each datalink has a resolved depth, this being the constant sum of index
- * array length + item depth for all tokens exchanged along this link. Where
- * no iteration or data streaming is occuring this will evaluate to the
- * output port depth the link is from (as is always the case with the
- * internal output ports in dataflow inputs)
- *
- * @return
- */
- public int getResolvedDepth();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edit.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edit.java
deleted file mode 100644
index f60ebaa..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edit.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * The workflow object model exposed by this API is read only. Properties of the
- * model can only be changed through implementations of this interface, this
- * ensures a consistant approach to grouped edits (transactions) and undo / redo
- * support within the UI. It also potentially allows for capture of editing
- * provenance where a workflow is repurposed or created from an aggregate of
- * several others.
- *
- * @author Tom Oinn
- *
- */
-public interface Edit<TargetType> {
-
- /**
- * Perform the edit
- *
- * @throws EditException
- * if the edit fails. If an edit throws EditException it should
- * try to ensure the subject is unaltered. Where this is
- * impossible consider breaking edits down into a compound edit.
- */
- public TargetType doEdit() throws EditException;
-
- /**
- * Undo the edit, reverting the subject to the state it was in prior to the
- * edit
- */
- public void undo();
-
- /**
- * Return the object to which this edit applies
- *
- * @return
- */
- public Object getSubject();
-
- /**
- * Has the edit been applied yet?
- *
- * @return true if and only if the edit has been successfully applied to the
- * subject
- */
- public boolean isApplied();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditException.java
deleted file mode 100644
index f1dc474..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditException.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Superclass of all exceptions thrown when altering the workflow model through
- * the edit manager.
- *
- * @author Tom Oinn
- *
- */
-public class EditException extends Exception {
-
- public EditException(String string) {
- super(string);
- }
-
- public EditException(String string, Throwable cause) {
- super(string, cause);
- }
-
- public EditException(Throwable t) {
- super(t);
- }
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edits.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edits.java
deleted file mode 100644
index aa2b57e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Edits.java
+++ /dev/null
@@ -1,804 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.annotation.AnnotationRole;
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-import net.sf.taverna.t2.annotation.CurationEvent;
-import net.sf.taverna.t2.annotation.Person;
-import net.sf.taverna.t2.facade.WorkflowInstanceFacade;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-
-/**
- * Defines the set of all available edit actions over a workflow model. This is
- * the only point at which you can modify any of the entities in the workflow
- * object model, the rest of this API is purely read only.
- * <p>
- * In theory this would be some kind of static interface but Java doesn't have
- * this as a concept so the pattern here will be to discover an appropriate
- * implementation of this interface from whatever version of the implementation
- * package you want to use, instantiate it then use the methods defined here to
- * construct and manipulate the workflow model.
- *
- * @author Tom Oinn
- * @author Stuart Owen
- * @author David Withers
- * @author Stian Soiland-Reyes
- *
- */
-public interface Edits {
-
- /**
- * Build a new Dataflow workflow
- *
- * @return
- */
- public Dataflow createDataflow();
-
- /**
- * Builds a new DataflowInputPort.
- *
- * @param name
- * @param depth
- * @param granularDepth
- * @param dataflow
- * @return a new DataflowInputPort
- */
- public DataflowInputPort createDataflowInputPort(String name, int depth,
- int granularDepth, Dataflow dataflow);
-
- /**
- * Builds a new DataflowOutputPort.
- *
- * @param name
- * @param dataflow
- * @return a new DataflowOutputPort
- */
- public DataflowOutputPort createDataflowOutputPort(String name,
- Dataflow dataflow);
-
- /**
- * Builds a new Datalink with the given source and sink ports
- *
- * @param source
- * the source port
- * @param sink
- * the sink port
- * @return a new Datalink instance
- */
- public Datalink createDatalink(EventForwardingOutputPort source,
- EventHandlingInputPort sink);
-
- /**
- * @param dataflow
- * @return an instance of Merge
- *
- * @see Merge
- */
- public Merge createMerge(Dataflow dataflow);
-
- /**
- * Builds a new MergeOutputPort.
- *
- * @param merge
- * the merge that the port eill be added to
- * @param name
- * the name of the port
- * @param depth
- * the depth of the port
- * @return a new MergeOutputPort
- */
- public MergeInputPort createMergeInputPort(Merge merge, String name,
- int depth);
-
- /**
- * Builds a new instance of a Processor with the given name. The processor
- * is setup with a default dispatch stack.
- *
- * @param the
- * local name for the processor.
- */
- public Processor createProcessor(String name);
-
- /**
- * Build a new WorkflowInstanceFacade using the supplied Dataflow
- *
- * @param dataflow
- * @param context
- * @return an instance of a WorkflowInstanceFacade
- * @throws InvalidDataflowException
- * if the workflow was not valid
- *
- * @see WorkflowInstanceFacade
- */
- public WorkflowInstanceFacade createWorkflowInstanceFacade(
- Dataflow dataflow, InvocationContext context, String parentProcess)
- throws InvalidDataflowException;
-
- /**
- * Add an Activity implementation to the set of activities within a
- * Processor
- *
- * @param processor
- * Processor to add the activity to
- * @param activity
- * Activity to add
- */
- public Edit<Processor> getAddActivityEdit(Processor processor,
- Activity<?> activity);
-
- /**
- * Returns an edit to add an ActivityInputPort to an Activity.
- *
- * @param activity
- * activity to add the port to
- * @param activityInputPort
- * the port to add to the activity
- * @return an edit to add an ActivityInputPort to an Activity
- */
- public Edit<Activity<?>> getAddActivityInputPortEdit(Activity<?> activity,
- ActivityInputPort activityInputPort);
-
- /**
- * Returns an edit to add a ProcessorInputPort to ActivityInputPort mapping
- * to an Activity.
- *
- * @param activity
- * activity to add the port mapping to
- * @param processorPortName
- * the name of the processor port
- * @param activityPortName
- * the name of the activity port
- * @return an edit to add a ProcessorInputPort to ActivityInputPort mapping
- * to an Activity
- */
- public Edit<Activity<?>> getAddActivityInputPortMappingEdit(
- Activity<?> activity, String processorPortName,
- String activityPortName);
-
- /**
- * Returns an edit to add an OutputPort to an Activity.
- *
- * @param activity
- * activity to add the port to
- * @param activityOutputPort
- * the port to add to the activity
- * @return an edit to add an OutputPort to an Activity
- */
- public Edit<Activity<?>> getAddActivityOutputPortEdit(Activity<?> activity,
- OutputPort activityOutputPort);
-
- /**
- * Returns an edit to add a ProcessorOutputPort to OutputPort mapping to an
- * Activity.
- *
- * @param activity
- * activity to add the port mapping to
- * @param processorPortName
- * the name of the processor port
- * @param activityPortName
- * the name of the activity port
- * @return an edit to add a ProcessorOutputPort to OutputPort mapping to an
- * Activity
- */
- public Edit<Activity<?>> getAddActivityOutputPortMappingEdit(
- Activity<?> activity, String processorPortName,
- String activityPortName);
-
- /**
- * Add an {@link AnnotationAssertion} to an {@link AnnotationChain}
- *
- * @param annotationChain
- * @param annotationAssertion
- * @return an {@link Edit}able object with undo feature
- */
- @SuppressWarnings("unchecked")
- public Edit<AnnotationChain> getAddAnnotationAssertionEdit(
- AnnotationChain annotationChain,
- AnnotationAssertion annotationAssertion);
-
- /**
- * Add an {@link AnnotationBeanSPI} to an {@link AnnotationAssertion}
- *
- * @param annotationAssertion
- * @param annotationBean
- * @return the edit which has do/undo functionality
- */
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationBean(
- AnnotationAssertion annotationAssertion,
- AnnotationBeanSPI annotationBean);
-
- /**
- * Returnes an edit that creates an AnnotationAssertion, adds the
- * AnnotationAssertion to an AnnotationChain and adds the AnnotationChain to
- * the Annotated.
- *
- * @param annotated
- * the Annotated to add an AnnotationChain to
- * @param annotation
- * the annotation to add to the chain
- * @return an edit that creates and adds an AnnotationChain to an Annotated
- */
- public Edit<?> getAddAnnotationChainEdit(Annotated<?> annotated,
- AnnotationBeanSPI annotation);
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationRole(
- AnnotationAssertion annotationAssertion,
- AnnotationRole annotationRole);
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationSource(
- AnnotationAssertion annotationAssertion,
- AnnotationSourceSPI annotationSource);
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddCreator(
- AnnotationAssertion annotationAssertion, Person person);
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddCurationEvent(
- AnnotationAssertion annotationAssertion, CurationEvent curationEvent);
-
- /**
- * Returns an edit to add a DataflowInputPort to a Dataflow.
- *
- * @param dataflow
- * dataflow to add the port to
- * @param dataflowInputPort
- * the port to add to the dataflow
- * @return an edit to add a DataflowInputPort to a Dataflow
- */
- public Edit<Dataflow> getAddDataflowInputPortEdit(Dataflow dataflow,
- DataflowInputPort dataflowInputPort);
-
- /**
- * Returns an edit to add a DataflowOutputPort to a Dataflow.
- *
- * @param dataflow
- * dataflow to add the port to
- * @param dataflowOutputPort
- * the port to add to the dataflow
- * @return an edit to add a DataflowOutputPort to a Dataflow
- */
- public Edit<Dataflow> getAddDataflowOutputPortEdit(Dataflow dataflow,
- DataflowOutputPort dataflowOutputPort);
-
- /**
- * Returns an edit to change the depth of a DataflowInputPort.
- *
- * @param dataflowInputPort
- * the port to change the depth of
- * @param depth
- * the new depth
- * @return an edit to change the depth of a Dataflow
- */
- public Edit<DataflowInputPort> getChangeDataflowInputPortDepthEdit(
- DataflowInputPort dataflowInputPort, int depth);
-
- /**
- * Returns an edit to change the granular depth of a DataflowInputPort.
- *
- * @param dataflowInputPort
- * the port to change the granular depth of
- * @param granularDepth
- * the new granular depth
- * @return an edit to change the granular depth of a Dataflow
- */
- public Edit<DataflowInputPort> getChangeDataflowInputPortGranularDepthEdit(
- DataflowInputPort dataflowInputPort, int granularDepth);
-
- /**
- * Add a new layer to the specified dispatch stack
- *
- * @param stack
- * Stack to add to
- * @param layer
- * New dispatch layer to add
- * @param position
- * Where to add the new layer? 0 is at the top of the stack.
- */
- public Edit<DispatchStack> getAddDispatchLayerEdit(DispatchStack stack,
- DispatchLayer<?> layer, int position);
-
- public Edit<Dataflow> getAddMergeEdit(Dataflow dataflow, Merge processor);
-
- /**
- * Returns an edit to add a MergeInputPort to a Merge.
- *
- * @param merge
- * merge to add the port to
- * @param mergeInputPort
- * the port to add to the merge
- * @return an edit to add a MergeInputPort to a Merge
- */
- public Edit<Merge> getAddMergeInputPortEdit(Merge merge,
- MergeInputPort mergeInputPort);
-
- /**
- * Returns an edit to reorder the list of MergeInputPortS in a Merge.
- *
- * @param merge
- * merge to reorder the list of input ports to
- * @param reorderedMergeInputPortList
- * a list of reordered input ports
- * @return an edit to reorder the list of MergeInputPortS to a Merge
- */
- public Edit<Merge> getReorderMergeInputPortsEdit(Merge merge,
- List<MergeInputPort> reorderedMergeInputPortList);
-
- /**
- * Provides an edit object responsible for adding a Processor to a Dataflow
- *
- * @param dataflow
- * the dataflow to add this processor to
- * @param processor
- * the processor to be added to the dataflow
- */
- public Edit<Dataflow> getAddProcessorEdit(Dataflow dataflow,
- Processor processor);
-
- /**
- * Provides an Edit to add an input port a processor, creating matching
- * ports in the iteration strategy or strategies as a side effect.
- *
- * @param processor
- * processor to add the port to
- *
- * @param port
- * the input port to be added
- */
- public Edit<Processor> getAddProcessorInputPortEdit(Processor processor,
- ProcessorInputPort port);
-
- /**
- * Provides an Edit to add a new output port on a processor
- *
- * @param processor
- * processor to add the new output port to
- *
- * @param port
- * the port to be added
- */
- public Edit<Processor> getAddProcessorOutputPortEdit(Processor processor,
- ProcessorOutputPort port);
-
- /**
- * Returns an Edit that is responsible for configuring an Activity with a
- * given configuration bean.
- *
- * @see #getConfigureEdit(Configurable, Object)
- * @param activity
- * @param configurationBean
- * @return
- */
- public <ConfigurationBean> Edit<Activity<?>> getConfigureActivityEdit(
- Activity<ConfigurationBean> activity,
- ConfigurationBean configurationBean);
-
- /**
- * Return an Edit that can configure a {@link Configurable} (such as an
- * {@link Activity} or {@link DispatchLayer} with a given configuration
- * bean.
- *
- * @param <ConfigurationType>
- * @param configurable
- * @param configBean
- * @return
- */
- public <ConfigurationType> Edit<? extends Configurable<ConfigurationType>> getConfigureEdit(
- Configurable<ConfigurationType> configurable,
- ConfigurationType configBean);
-
-
- /**
- * Connect a datalink to its source and sink.
- *
- * @param datalink
- * the datalink to connect
- * @return a datalink edit
- */
- public Edit<Datalink> getConnectDatalinkEdit(Datalink datalink);
-
- /**
- * Creates and returns an instance of an Edit<Merge> that is responsible for
- * generating the links to an from the Merge instance to link together the
- * source and sink port via the merge instance.
- *
- * @return a new instance of Edit<Merge> constructed from the provided
- * parameters.
- *
- * @param merge
- * a Merge instance
- * @param sourcePort
- * the source port from which a link is to be created.
- * @param sinkPort
- * the sink port to which the link is to be created.
- *
- * @see Merge
- */
- public Edit<Merge> getConnectMergedDatalinkEdit(Merge merge,
- EventForwardingOutputPort sourcePort,
- EventHandlingInputPort sinkPort);
-
- /**
- * Connect the output port of the specified processor to a target input
- * port. To connect multiple inputs use this method multiple times with
- * different targetPort arguments.
- *
- * @param processor
- * Processor to link from
- * @param outputPortName
- * Name of the output port within the specified processor to link
- * from
- * @param targetPort
- * Input port (specifically an EventHandlingInputPort) to forward
- * data events to.
- */
- public Edit<Processor> getConnectProcessorOutputEdit(Processor processor,
- String outputPortName, EventHandlingInputPort targetPort);
-
- /**
- * Create a condition governing execution of the target processor. The
- * target will not consume jobs from any inputs until all control processors
- * linked through this edit have completed.
- *
- * @param control
- * Processor controlling execution - this must complete before
- * the target can start.
- * @param target
- * Processor controlled by this condition.
- */
- public Edit<OrderedPair<Processor>> getCreateConditionEdit(
- Processor control, Processor target);
-
- /**
- * Add an input port to a dataflow.
- *
- * @param dataflow
- * dataflow to add the port to
- * @param portName
- * name of the port, unique in the dataflow
- * @param portDepth
- * the conceptual depth of collections consumed by this input
- * port
- * @param granularDepth
- * granular depth to copy to the internal output port
- */
- public Edit<Dataflow> getCreateDataflowInputPortEdit(Dataflow dataflow,
- String portName, int portDepth, int granularDepth);
-
- /**
- * Add an output port to a dataflow.
- *
- * @param dataflow
- * dataflow to add the port to
- * @param portName
- * name of the port, unique in the dataflow
- */
- public Edit<Dataflow> getCreateDataflowOutputPortEdit(Dataflow dataflow,
- String portName);
-
- /**
- * Provides an edit that setup the default dispatch stack on a raw
- * processor.
- *
- * @param processor
- * @return
- */
- public Edit<Processor> getDefaultDispatchStackEdit(Processor processor);
-
- /**
- * Remove a dispatch layer from its dispatch stack
- *
- * @param stack
- * The stack from which to remove the layer
- * @param layer
- * The layer to remove
- */
- public Edit<DispatchStack> getDeleteDispatchLayerEdit(DispatchStack stack,
- DispatchLayer<?> layer);
-
- /**
- * Disconnect a datalink from its source and sink.
- *
- * @param datalink
- * the datalink to disconnect
- * @return a datalink edit
- */
- public Edit<Datalink> getDisconnectDatalinkEdit(Datalink datalink);
-
- /**
- * Provides an edit that will configure the processors ports to map to those
- * of its internal Activity. If there is more than 1 activity then only
- * first activity is used. If there are zero then an EditException will be
- * thrown when using the Edit.
- *
- * @param processor
- * @return
- */
- public Edit<Processor> getMapProcessorPortsForActivityEdit(
- Processor processor);
-
- /**
- * Returns an edit to remove an ActivityInputPort from an Activity.
- *
- * @param activity
- * activity to remove the port from
- * @param activityInputPort
- * the port to remove from the activity
- * @return an edit to remove an ActivityInputPort from an Activity
- */
- public Edit<Activity<?>> getRemoveActivityInputPortEdit(
- Activity<?> activity, ActivityInputPort activityInputPort);
-
- /**
- * Returns an edit to remove a ProcessorInputPort to ActivityInputPort
- * mapping from an Activity.
- *
- * @param activity
- * activity to remove the port mapping from
- * @param processorPortName
- * the name of the processor port to remove from the mapping
- * @return an edit to remove a ProcessorInputPort to ActivityInputPort
- * mapping from an Activity
- */
- public Edit<Activity<?>> getRemoveActivityInputPortMappingEdit(
- Activity<?> activity, String processorPortName);
-
- /**
- * Returns an edit to remove an OutputPort from an Activity.
- *
- * @param activity
- * activity to remove the port from
- * @param activityOutputPort
- * the port to remove from the activity
- * @return an edit to remove an OutputPort from an Activity
- */
- public Edit<Activity<?>> getRemoveActivityOutputPortEdit(
- Activity<?> activity, OutputPort activityOutputPort);
-
- /**
- * Returns an edit to remove a ProcessorOutputPort to OutputPort mapping
- * from an Activity.
- *
- * @param activity
- * activity to remove the port mapping from
- * @param processorPortName
- * the name of the processor port to remove from the mapping
- * @return an edit to remove a ProcessorOutputPort to OutputPort mapping
- * from an Activity
- */
- public Edit<Activity<?>> getRemoveActivityOutputPortMappingEdit(
- Activity<?> activity, String processorPortName);
-
- /**
- * Remove a condition previously applied to the specified pair of Processor
- * instances
- *
- * @param control
- * Processor controlling execution - this must complete before
- * the target can start.
- * @param target
- * Processor controlled by this condition.
- * @return
- */
- public Edit<OrderedPair<Processor>> getRemoveConditionEdit(
- Processor control, Processor target);
-
- /**
- * Returns an edit to remove a DataflowInputPort from a Dataflow.
- *
- * @param dataflow
- * the Dataflow to remove this DataflowInputPort from
- * @param dataflowInputPort
- * the DataflowInputPort to be removed from the Dataflow
- */
- public Edit<Dataflow> getRemoveDataflowInputPortEdit(Dataflow dataflow,
- DataflowInputPort dataflowInputPort);
-
- /**
- * Returns an edit to remove a DataflowOutputPort from a Dataflow.
- *
- * @param dataflow
- * the Dataflow to remove this DataflowOutputPort from
- * @param dataflowOutputPort
- * the DataflowOutputPort to be removed from the Dataflow
- */
- public Edit<Dataflow> getRemoveDataflowOutputPortEdit(Dataflow dataflow,
- DataflowOutputPort dataflowOutputPort);
-
- /**
- * Returns an edit to remove a Processor from a Dataflow.
- *
- * @param dataflow
- * the dataflow to remove the processor from
- * @param processor
- * the processor to be removed from the dataflow
- */
- public Edit<Dataflow> getRemoveProcessorEdit(Dataflow dataflow,
- Processor processor);
-
- /**
- * Removes a Processor input port.
- *
- * @param processor
- * @param port
- * @return
- */
- public Edit<Processor> getRemoveProcessorInputPortEdit(Processor processor,
- ProcessorInputPort port);
-
- /**
- * @param processor
- * @param port
- * @return
- */
- public Edit<Processor> getRemoveProcessorOutputPortEdit(
- Processor processor, ProcessorOutputPort port);
-
- /**
- * Removes a merge from the dataflow.
- *
- * @param dataflow
- * @param processor
- * @return
- */
- public Edit<Dataflow> getRemoveMergeEdit(Dataflow dataflow, Merge merge);
-
- /**
- * Rename a dataflow input port
- *
- * @param dataflowInputPort
- * the dataflow input port to rename
- * @param newName
- * the new name, must be unique within the workflow enclosing the
- * dataflow input port instance
- */
- public Edit<DataflowInputPort> getRenameDataflowInputPortEdit(
- DataflowInputPort dataflowInputPort, String newName);
-
- /**
- * Rename a dataflow output port
- *
- * @param dataflowOutputPort
- * the dataflow output port to rename
- * @param newName
- * the new name, must be unique within the workflow enclosing the
- * dataflow output port instance
- */
- public Edit<DataflowOutputPort> getRenameDataflowOutputPortEdit(
- DataflowOutputPort dataflowOutputPort, String newName);
-
- /**
- * Rename a processor
- *
- * @param processor
- * the processor to rename
- * @param newName
- * the new name, must be unique within the workflow enclosing the
- * processor instance
- */
- public Edit<Processor> getRenameProcessorEdit(Processor processor,
- String newName);
-
- /**
- * Rename a merge
- *
- * @param merge
- * the merge to rename
- * @param newName
- * the new name, must be unique within the workflow enclosing the
- * merge instance
- */
- public Edit<Merge> getRenameMergeEdit(Merge merge,
- String newName);
-
- /**
- * Provide an edit that will configure a processors's iteration strategy
- * stack to the one provided.
- *
- * @param processor
- * Processor which iteration stack is to be set
- * @param iterationStrategyStack
- * The new iteration strategy stack
- * @return An Edit that will set the iteration strategy stack of a processor
- */
- public Edit<Processor> getSetIterationStrategyStackEdit(
- Processor processor, IterationStrategyStack iterationStrategyStack);
-
- public Edit<Dataflow> getUpdateDataflowInternalIdentifierEdit(
- Dataflow dataflow, String newId);
-
- public Edit<Dataflow> getUpdateDataflowNameEdit(Dataflow dataflow,
- String newName);
-
- /**
- * Builds an instance of an {@link InputPort} for an Activity.
- *
- * @param portName
- * @param portDepth
- * @param allowsLiteralValues
- * whether the input port can cope with literal values
- * @param handledReferenceSchemes
- * a list of the reference scheme types that can be legitimately
- * pushed into this input port
- * @param translatedElementClass
- * the class desired as result (or elements of collections of
- * results) when interpreted by the data facade
- * @return an instance of InputPort
- */
- ActivityInputPort createActivityInputPort(
- String portName,
- int portDepth,
- boolean allowsLiteralValues,
- List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes,
- Class<?> translatedElementClass);
-
- /**
- * Builds an instance of an {@link OutputPort} for an Activity.
- *
- * @param portName
- * @param portDepth
- * @param portGranularDepth
- * @return an instance of OutputPort
- */
- OutputPort createActivityOutputPort(String portName, int portDepth,
- int portGranularDepth);
-
- /**
- * Creates a new ProcessorInputPort
- *
- * @param processor
- * the processor to with the port will be added
- * @param name
- * @param depth
- * @return
- */
- ProcessorInputPort createProcessorInputPort(Processor processor,
- String name, int depth);
-
- /**
- * Creates a new ProcessorOutputPort
- *
- * @param processor
- * @param name
- * @param depth
- * @param granularDepth
- * @return
- */
- ProcessorOutputPort createProcessorOutputPort(Processor processor,
- String name, int depth, int granularDepth);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditsRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditsRegistry.java
deleted file mode 100644
index f8db6f0..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EditsRegistry.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.List;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-/**
- * Registry for finding the {@link Edits} implementation.
- *
- */
-public class EditsRegistry extends SPIRegistry<Edits> {
-
- private static EditsRegistry instance;
-
- private static Logger logger = Logger.getLogger(EditsRegistry.class);
-
- protected EditsRegistry() {
- super(Edits.class);
- }
-
- public static synchronized EditsRegistry getInstance() {
- if (instance == null) {
- instance = new EditsRegistry();
- }
- return instance;
- }
-
- public static Edits getEdits() {
- List<Edits> instances = getInstance().getInstances();
- Edits result = null;
- if (instances.size() == 0) {
- logger.error("No Edits implementation defined");
- } else {
- if (instances.size() > 1)
- logger.debug("More than 1 Edits implementation defined, using the first");
- result = instances.get(0);
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventForwardingOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventForwardingOutputPort.java
deleted file mode 100644
index ad98a00..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventForwardingOutputPort.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.Set;
-
-/**
- * An extension of OutputPort defining a set of target EventReceivingInputPorts
- * to which internally generated events will be relayed. This is the interface
- * used by output ports on a workflow entity with internal logic generating or
- * relaying events.
- *
- * @author Tom Oinn
- *
- */
-public interface EventForwardingOutputPort extends OutputPort {
-
- /**
- * The set of EventHandlingInputPort objects which act as targets for events
- * produced from this OutputPort
- *
-
- public Set<EventHandlingInputPort> getTargets();
-*/
-
- /**
- * The set of datalinks for which this output port is the source of events
- */
- public Set<? extends Datalink> getOutgoingLinks();
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventHandlingInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventHandlingInputPort.java
deleted file mode 100644
index b756250..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/EventHandlingInputPort.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-
-/**
- * Input port capable of receiving and reacting to workflow events.
- *
- * @author Tom Oinn
- *
- */
-public interface EventHandlingInputPort extends InputPort {
-
- /**
- * Receive an arbitrary workflow event.
- */
- public void receiveEvent(WorkflowDataToken t);
-
- /**
- * If this port is connected to a Datalink return the link, otherwise return
- * null
- */
- public Datalink getIncomingLink();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FailureTransmitter.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FailureTransmitter.java
deleted file mode 100644
index 2277996..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FailureTransmitter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Used to message interested parties when a top level failure occurs within a
- * Dataflow
- * <p>
- * Not implemented in the curent code, this is a placeholder for the failure
- * handling system.
- *
- * @author Tom Oinn
- *
- */
-public interface FailureTransmitter {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FilteringInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FilteringInputPort.java
deleted file mode 100644
index 993b29f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/FilteringInputPort.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * A filtering input port is one capable of filtering events to only pass
- * through data events at a certain depth. Other events are either ignored (in
- * the case of finer granularity) or converted to completion events (for
- * coarser). Where the filter depth and the port depth are distinct this port
- * type will filter on the filter depth then drill into the data to get down to
- * the port depth. Filter depth must always be equal to or greater than port
- * depth.
- * <p>
- * This is used as the interface for Processor input ports.
- * <p>
- * A condition to use this type is that the stream of events for a given process
- * ID must terminate with a top level (i.e. zero length index array) token. This
- * can be accomplished by use of the crystalizer (as found on the output of a
- * Processor instance) or some other mechanism but is required. Similarly it is
- * assumed that all intermediate collections are emited in the correct sequence,
- * if this is not the case the filtering may not function correctly.
- *
- * @author Tom Oinn
- *
- */
-public interface FilteringInputPort extends EventHandlingInputPort {
-
- /**
- * Set the depth at which to filter events. Events at a lower depth than
- * this are ignored completely, those at exactly this depth are passed
- * through intact and those above are converted to completion events.
- *
- * @param filterDepth
- */
- public int getFilterDepth();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InputPort.java
deleted file mode 100644
index f2f3304..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InputPort.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Marker interface denoting that the instance is an input port.
- *
- * @author Tom Oinn
- *
- */
-public interface InputPort extends Port {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InvalidDataflowException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InvalidDataflowException.java
deleted file mode 100644
index 5aa75cb..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/InvalidDataflowException.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-
-/**
- * Thrown if attempting to use a workflow that
- * is not {@link Dataflow#checkValidity() valid}.
- * <p>
- * The {@link DataflowValidationReport} can be retrieved using
- * {@link #getDataflowValidationReport()} and will provide details on how the
- * dataflow is invalid. The {@link #getDataflow()} will provide the invalid
- * dataflow.
- * </p>
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class InvalidDataflowException extends Exception {
- private static final long serialVersionUID = -8470683930687738369L;
- private final DataflowValidationReport report;
- private final Dataflow dataflow;
-
- public InvalidDataflowException(Dataflow dataflow,
- DataflowValidationReport report) {
- this.report = report;
- this.dataflow = dataflow;
- }
-
- /**
- * Get the {@link DataflowValidationReport validation report} for the
- * failing dataflow.
- *
- * @return Dataflow validation report
- */
- public DataflowValidationReport getDataflowValidationReport() {
- return report;
- }
-
- /**
- * Get the {@link Dataflow} that is not valid.
- *
- * @return Invalid Dataflow
- */
- public Dataflow getDataflow() {
- return dataflow;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Merge.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Merge.java
deleted file mode 100644
index 148e14c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Merge.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import java.util.List;
-
-/**
- * Allows multiple outputs to be routed to a single input within the dataflow.
- * The merge operation defines a total order over its input ports, this order is
- * used to modify the index array of all incoming events by adding the port
- * index as a prefix to that array. At a conceptual level this means that any
- * event coming in is 'binned' by port index creating a collection of whatever
- * the port type was. This also places a constraint that all input ports must
- * have the same cardinality (i.e. depth + length of index array must be equal
- * for all events on all ports). If this constraint is violated the merge
- * operation is free to throw a WorkflowStructureException at runtime although
- * it would be preferable if implementing classes were capable of static type
- * analysis to preclude this from happening.
- *
- * @author Tom Oinn
- *
- */
-public interface Merge extends TokenProcessingEntity {
-
- /**
- * The Merge object contains an ordered list of InputPort objects. Data and
- * completion events arriving at an input port have the index of that input
- * within the list prepended to their index array, effectively placing them
- * in a virtual collection the top level of which corresponds to the various
- * input ports defined within the Merge node. When final completion events
- * from all input ports are received the Merge object registers the top
- * level collection with the attached DataManager and emits it and the
- * completion event through the single output port.
- *
- * @return Ordered list of InputPort objects
- */
- List<? extends MergeInputPort> getInputPorts();
-
- /**
- * The Merge object has a single output port through which modified events
- * are emitted as described in the javadoc for getInputPorts
- *
- * @return OutputPort for this Merge object
- */
- EventForwardingOutputPort getOutputPort();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeInputPort.java
deleted file mode 100644
index 4b96d5c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeInputPort.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-
-/**
- * Input port on a Merge object
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public interface MergeInputPort extends EventHandlingInputPort, MergePort {
-
- /**
- * Receive an arbitrary workflow event. The index of this port relative to
- * its parent Merge object is prepended to the event index and the event
- * forwarded through the Merge output port to any targets.
- * <p>
- * If this is a workflow data token and the first such received under a
- * given owning process ID the implementing method also must also store the
- * cardinality, i.e. length of index array + depth of token. Subsequent
- * events are matched to this, if they have unequal cardinality the parent
- * Merge operation will throw a WorkflowStructureException as the merge
- * would result in a collection which violated the constraints defined by
- * the Taverna 2 data model.
- *
- * @param e
- * arbitrary workflow event, will be forwarded unchanged other
- * than an alteration of the index array by prefixing the index
- * of this input port relative to the parent Merge object
- */
- public void receiveEvent(WorkflowDataToken t);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeOutputPort.java
deleted file mode 100644
index 1e4f83d..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergeOutputPort.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * An EventForwardingOutputPort that is associated with Merge instances.
- * In particular it provides access to the Merge instance it is associated with.
- *
- * @see Merge
- * @see MergePort
- * @see EventForwardingOutputPort
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- *
- */
-public interface MergeOutputPort extends EventForwardingOutputPort, MergePort {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergePort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergePort.java
deleted file mode 100644
index 0e081c6..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/MergePort.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * An input or output {@link Port} for a {@link Merge}.
- *
- * @see MergeInputPort
- * @see MergeOutputPort
- * @author Stian Soiland-Reyes
- *
- */
-public interface MergePort extends Port {
-
- /**
- * @return the Merge instance the port is associated with.
- */
- public Merge getMerge();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamedWorkflowEntity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamedWorkflowEntity.java
deleted file mode 100644
index 504fb05..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamedWorkflowEntity.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Entities existing directly within a workflow such as Processors, Merge
- * operators and other potential future extensions exist within a naming scheme.
- * The local name of an entity is unique relative to the enclosing workflow.
- * Global names are not defined outside of the context of a given instance of a
- * workflow as the same workflow may be re-used in multiple other workflows,
- * there is therefore no single parent defined for some entities and the
- * approach of traversing the hierarchy to build a fully qualified name cannot
- * be applied. A given instance can be treated this way but this depends on
- * dataflow rather than inherent workflow structure.
- * <p>
- * All named workflow entities support the sticky note annotation type
- *
- * @author Tom Oinn
- *
- */
-public interface NamedWorkflowEntity {
-
- /**
- * Every workflow level entity has a name which is unique within the
- * workflow in which it exists. This only applies to the immediate parent
- * workflow, names may be duplicated in child workflows etc.
- */
- public String getLocalName();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamingException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamingException.java
deleted file mode 100644
index 2ce2f33..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/NamingException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Potentially thrown when an edit fails due to naming of entities created or
- * modified by the edit. This could be because there are duplicate names in e.g.
- * processor input ports or invalid characters in the name itself
- *
- * @author Tom Oinn
- *
- */
-public class NamingException extends EditException {
-
- private static final long serialVersionUID = -6945542133180017313L;
-
- public NamingException(String message) {
- super(message);
- }
-
- public NamingException(Throwable cause) {
- super(cause);
- }
-
- public NamingException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OrderedPair.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OrderedPair.java
deleted file mode 100644
index 584718c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OrderedPair.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * A simple generic class to hold a pair of same type objects. Used by various
- * Edit implementations that operate on pairs of Processors amongst other
- * things.
- *
- * @author Tom Oinn
- *
- * @param <T>
- * Type of the pair of contained objects
- */
-public class OrderedPair<T> {
-
- private T a, b;
-
- /**
- * Build a new ordered pair with the specified objects.
- *
- * @throws RuntimeException
- * if either a or b are null
- * @param a
- * @param b
- */
- public OrderedPair(T a, T b) {
- if (a == null || b == null) {
- throw new RuntimeException(
- "Cannot construct ordered pair with null arguments");
- }
- this.a = a;
- this.b = b;
- }
-
- /**
- * Return object a
- */
- public T getA() {
- return this.a;
- }
-
- /**
- * Return object b
- */
- public T getB() {
- return this.b;
- }
-
- /**
- * A pair of objects (a,b) is equal to another pair (c,d) if and only if a,
- * b, c and d are all the same type and the condition (a.equals(c) &
- * b.equals(d)) is true.
- */
- @Override
- public boolean equals(Object other) {
- if (other instanceof OrderedPair) {
- OrderedPair<?> op = (OrderedPair<?>) other;
- return (a.equals(op.getA()) && b.equals(op.getB()));
- } else {
- return false;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OutputPort.java
deleted file mode 100644
index 011a489..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/OutputPort.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Port representing the output of an activity, processor or workflow. In addition
- * to the name and port depth defined by the Port interface this includes a
- * granular depth property. The granular depth of an output is the depth of the
- * finest grained entity that can be emitted from that port. For example, if a
- * process conceptually returned a list of strings but was actually capable of
- * streaming strings as they were generated it would set a port depth of 1 and
- * granular depth of zero.
- *
- * @author Tom Oinn
- *
- */
-public interface OutputPort extends Port {
-
- /**
- * The granular depth is the depth of the finest grained item that can be
- * emitted from this output port. A difference in this and the port depth
- * indicates that the entity this port is attached to is capable of
- * streaming data resulting from a single process invocation. The port depth
- * defines the conceptual depth, so a process returning a stream of single
- * items would set port depth to 1 and granular depth to zero.
- *
- * @return granular depth of output port
- */
- public int getGranularDepth();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Port.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Port.java
deleted file mode 100644
index 7b51ced..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Port.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import net.sf.taverna.t2.annotation.Annotated;
-
-/**
- * Named port which receives events from some other entity and handles them
- * appropriately.
- *
- * @author Tom Oinn
- *
- */
-public interface Port extends Annotated<Port> {
-
- public String getName();
-
- public int getDepth();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Processor.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Processor.java
deleted file mode 100644
index b98f24d..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/Processor.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import static net.sf.taverna.t2.annotation.HierarchyRole.CHILD;
-
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.HierarchyTraversal;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-
-/**
- * A single node within the dataflow digraph, the Processor is the basic
- * functional unit within a Taverna workflow. It should also notify interested
- * observers when it has finished execution (including all iterations of the processor).
- *
- * @author Tom Oinn
- * @author Alex Nenadic
- *
- */
-@ControlBoundary
-public interface Processor extends TokenProcessingEntity, Annotated<Processor>, Observable<ProcessorFinishedEvent> {
-
- /**
- * The iteration strategy is responsible for combining input data events
- * into jobs which are then queued for execution through the dispatch stack
- *
- * @return IterationStrategyStack containing one or more IterationStrategy
- * objects. In most cases this will only contain a single
- * IterationStrategy but there are particular scenarios where
- * staging partial iteration strategies together is the only way to
- * get the desired combination of inputs
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public IterationStrategyStack getIterationStrategy();
-
- /**
- * Each processor has a list of zero or more input ports. These are uniquely
- * named within the list. Any input port may have a default value associated
- * with it and may be attached to exactly one upstream output port. Where it
- * is necessary to connect a single input port to multiple output ports a
- * Merge object is used. Ordering within the list is not meaningful but we
- * use List rather than Set to preserve the ordering across serialisation
- * operations.
- * <p>
- * Processor inputs are instances of FilteringInputPort - they must have the
- * filter depth set before any data events arrive at the Processor. In
- * addition they assume that a full collection will be supplied, i.e. that
- * there will be exactly one event at the end of the list of events for a
- * given process ID with an index array of length zero.
- *
- * @return List of named input ports
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends ProcessorInputPort> getInputPorts();
-
- /**
- * Each processor has a list of zero or more output ports. Output ports are
- * uniquely named within the list and may be connected to arbitrarily many
- * downstream input ports or Merge objects. Ordering within the list is not
- * meaningful but we use List rather than Set to preserve the ordering
- * across serialisation operations.
- *
- * @return List of named output ports
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends ProcessorOutputPort> getOutputPorts();
-
- /**
- * The dispatch stack pulls jobs from the queue generated by the iteration
- * system and handles the dispatch of these jobs to appropriate activity
- * workers
- *
- * @return the DispatchStackImpl for this processor
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public DispatchStack getDispatchStack();
-
- /**
- * A processor contains zero or more activities in an ordered list. To be
- * any use in a workflow the processor should contain at least one activity
- * but it's technically valid to have none! Activities may be abstract or
- * concrete where an abstract activity is one with no invocation mechanism,
- * in these cases additional logic must be added to the dispatch stack of
- * the containing processor to convert these to concrete invokable
- * activities during the workflow invocation.
- *
- * @return list of Activity instances
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends Activity<?>> getActivityList();
-
- /**
- * A processor with no inputs cannot be driven by the supply of data tokens
- * as it has nowhere to receive such tokens. This method allows a processor
- * to fire on an empty input set, in this case the owning process identifier
- * must be passed explicitly to the processor. Internally this pushes a
- * single empty job event into the dispatch queue, bypassing the iteration
- * logic (which is entirely predicated on the existence of input ports).
- * Callers must ensure that an appropriate process identifier is specified,
- * the behaviour on missing or duplicate process identifiers is not defined.
- */
- public void fire(String owningProcess, InvocationContext context);
-
- /**
- * A processor has zero or more preconditions explicitly declared. All such
- * preconditions must be satisfied before any jobs are passed into the
- * dispatch stack. These preconditions replace and generalise the
- * coordination constraints from Taverna 1.
- *
- * @return a List of Condition objects defining constraints on this
- * processor's execution
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends Condition> getPreconditionList();
-
- /**
- * A processor may control zero or more other processors within the same
- * level of the workflow through preconditions.
- *
- * @return a List of Condition objects for which this is the controlling
- * processor
- */
- public List<? extends Condition> getControlledPreconditionList();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorFinishedEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorFinishedEvent.java
deleted file mode 100644
index c5de285..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorFinishedEvent.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- *
- * An event saying that a processor with a given owning process has finished with execution
- * (that includes the whole dispatch stack - iterations of the processor and all).
- *
- * @author Alex Nenadic
- *
- */
-public class ProcessorFinishedEvent {
-
- private Processor processor;
- private String owningProcess;
-
- public ProcessorFinishedEvent(Processor processor, String owningProcess) {
- this.setProcessor(processor);
- this.setOwningProcess(owningProcess);
- }
-
- public void setOwningProcess(String owningProcess) {
- this.owningProcess = owningProcess;
- }
-
- public String getOwningProcess() {
- return owningProcess;
- }
-
- public void setProcessor(Processor processor) {
- this.processor = processor;
- }
-
- public Processor getProcessor() {
- return processor;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorInputPort.java
deleted file mode 100644
index 3207f9e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorInputPort.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Input port on a Processor, is both a filtering input port and a processor
- * port
- *
- * @author Tom Oinn
- *
- */
-public interface ProcessorInputPort extends FilteringInputPort, ProcessorPort {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorOutputPort.java
deleted file mode 100644
index 4292426..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorOutputPort.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Input port on a Processor, is both an event forwarding output port and a
- * processor port
- *
- * @author Tom Oinn
- *
- */
-public interface ProcessorOutputPort extends EventForwardingOutputPort,
- ProcessorPort {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorPort.java
deleted file mode 100644
index 85c0e59..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/ProcessorPort.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * An {@link ProcessorInputPort} or {@link ProcessorOutputPort} belonging to a
- * {@link Processor}.
- *
- */
-public interface ProcessorPort extends Port {
-
- /**
- * Get the Processor to which this port belongs
- */
- public Processor getProcessor();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/TokenProcessingEntity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/TokenProcessingEntity.java
deleted file mode 100644
index dbbf1d6..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/TokenProcessingEntity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-import static net.sf.taverna.t2.annotation.HierarchyRole.CHILD;
-
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.HierarchyTraversal;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-
-/**
- * Superinterface for all classes within the workflow model which consume and
- * emit workflow data tokens.
- *
- * @author Tom Oinn
- *
- */
-public interface TokenProcessingEntity extends NamedWorkflowEntity {
-
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends EventHandlingInputPort> getInputPorts();
-
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<? extends EventForwardingOutputPort> getOutputPorts();
-
- /**
- * Run a collection level based type check on the token processing entity
- *
- * @return true if the typecheck was successful or false if the check failed
- * because there were preconditions missing such as unsatisfied
- * input types
- * @throws IterationTypeMismatchException
- * if the typing occurred but didn't match because of an
- * iteration mismatch
- * @throws InvalidDataflowException
- * if the entity depended on a dataflow that was not valid
- */
- public boolean doTypeCheck() throws IterationTypeMismatchException, InvalidDataflowException;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/WorkflowStructureException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/WorkflowStructureException.java
deleted file mode 100644
index 02afdc5..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/WorkflowStructureException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel;
-
-/**
- * Thrown predominantly at runtime under circumstances that suggest an
- * inconsistancy in the workflow model. This might include attempting to feed
- * data into a port that doesn't exist or has an unknown name or similar errors.
- *
- * @author Tom OInn
- */
-public class WorkflowStructureException extends RuntimeException {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- public WorkflowStructureException(String string) {
- super(string);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthChecker.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthChecker.java
deleted file mode 100644
index f46b8db..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthChecker.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-/**
- * An SPI interface whose implementation performs a health check on an arbitrary instance.
- * <br>
- *
- * @author Stuart Owen
- * @author David Withers
- *
- * @param <Type> the type of the item being checked
- */
-public interface HealthChecker<Type extends Object> {
- /**
- * Returns true if the HealthChecker implementation is targeted at the subject being
- * passed to this method.
- * @param subject
- * @return
- */
- public boolean canHandle(Object subject);
-
- /**
- * Carries out a health check on the subject, which should already have been determined as being
- * suitable by a call to canHandle.
- *
- * @param subject
- * @return a HealthReport giving a summary of the result of the health check.
- * @see HealthReport
- */
- public HealthReport checkHealth(Type subject);
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactory.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactory.java
deleted file mode 100644
index 8b18d96..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- * A factory class that performs a discovery of available HealthCheckers that can handle a given Object.
- * <br>
- *
- *
- * @author Stuart Owen
- * @see HealthReport
- * @see HealthChecker
- */
-public class HealthCheckerFactory {
-
- private static HealthCheckerFactory instance = new HealthCheckerFactory();
- private HealthCheckerRegistry registry = new HealthCheckerRegistry();
-
- private HealthCheckerFactory() {
-
- }
-
- /**
- * @return a singleton instance of the HealthCheckerFactory.
- */
- public static HealthCheckerFactory getInstance() {
- return instance;
- }
-
- /**
- *
- * @param subject the Object for which to discover HealthCheckers
- * @return a list of HealthCheckers that can handle the subject.
- */
- public List<HealthChecker<?>> getHealthCheckersForObject(Object subject) {
- List<HealthChecker<?>> result = new ArrayList<HealthChecker<?>>();
- for (HealthChecker<?> checker : registry.getInstances()) {
- if (checker.canHandle(subject)) {
- result.add(checker);
- }
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistry.java
deleted file mode 100644
index 219e965..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistry.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-/**
- * An SPI registry class for the discovery of known HealthCheckers.
- * <br>
- * This class is not normally used directly. To find a HealthChecker for a given Object then {@link HealthCheckerFactory} should be used instead.
- *
- * @author Stuart Owen
- * @see HealthChecker
- * @see HealthReport
- */
-@SuppressWarnings("unchecked")
-public class HealthCheckerRegistry extends SPIRegistry<HealthChecker>{
-
- public HealthCheckerRegistry() {
- super(HealthChecker.class);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthReport.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthReport.java
deleted file mode 100644
index 45392c1..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/HealthReport.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Defines a summary of an individual health check.
- * <br>
- * A number of health checks are performed on a dataflow and its internal elements providing a sanity check before
- * invoking the dataflow itself. It can check such things as whether a service endpoint is accessible or whether a script parses.
- * <br>
- * A HealthReport can contain additional nested HealthReports to an unlimited depth, allowing multiple recursive tests to be performed as
- * part of an overall health check. If a HealthReport contains subreports then its overall status is taken as the most SEVERE of all its sub reports and itself.
- *
- * @author Stuart Owen
- * @author David Withers
- *
- */
-public class HealthReport {
-
- /**
- * Enumeration of the possible status's in increasing severity: OK, WARNING,SEVERE
- */
- public enum Status {OK,WARNING,SEVERE};
-
- private String message;
- private Status status;
- private String subject;
- private List<HealthReport> subReports = new ArrayList<HealthReport>();
-
- /**
- * Constructs the Health Report. The sub reports default to an empty list.
- * @param subject - a String representing the thing being tested.
- * @param message - a summary of the result of the test.
- * @param status - the overall Status.
- */
- public HealthReport(String subject, String message, Status status) {
- this(subject,message,status,new ArrayList<HealthReport>());
- }
-
- /**
- * Constructs the HealthReport
- *
- * @param subject - a String representing the thing being tested.
- * @param message - a summary of the result of the test.
- * @param status - the overall Status.
- * @param subReports - a List of sub reports.
- */
- public HealthReport(String subject, String message,Status status, List<HealthReport> subReports) {
- this.subject=subject;
- this.status=status;
- this.message=message;
- this.subReports=subReports;
- }
-
- /**
- * @return a message summarising the report
- */
- public String getMessage() {
- return message;
- }
-
- /**
- * Sets the message
- * @param message a message summarising the report
- */
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * Determines the overall Status. This is the most severe status of this report and all its sub reports.
- * @return the overall status
- */
- public Status getStatus() {
- Status result = status;
- for (HealthReport report : subReports) {
- if (report.getStatus().compareTo(result)>0) result=report.getStatus();
- }
- return result;
- }
-
- /**
- * Sets the status of this report. Be aware that the overall status of this report may also be affected by its sub reports if they have a more severe Status.
- * @param status
- * @see #getStatus
- */
- public void setStatus(Status status) {
- this.status = status;
- }
-
- /**
- * @return a String representing the subject of this health report
- */
- public String getSubject() {
- return subject;
- }
-
- /**
- * @param subject a String representing the subject of this health report
- */
- public void setSubject(String subject) {
- this.subject = subject;
- }
-
- /**
- * Provides a list of sub reports. This list defaults an empty list, so it is safe to add new reports through this method.
- * @return a list of sub reports associated with this HealthReport
- */
- public List<HealthReport> getSubReports() {
- return subReports;
- }
- /**
- * Replaces the List of sub reports with those provided.
- * @param subReports a list of sub reports
- */
- public void setSubReports(List<HealthReport> subReports) {
- this.subReports = subReports;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/package.html
deleted file mode 100644
index 6cbc3b5..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/health/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<body>
-
-A package that contains a set of classes to be used in testing a Dataflow prior to invocation.<br>
-These can carry our various tests such as a service endpoint being accessible. HealthChecker provides an
-SPI extension point to allow 3rd party developers to implement their own Activity checkers.
-</body>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/package.html
deleted file mode 100644
index abaa693..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Defines classes and interfaces for workflow level entities and events.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractActivity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractActivity.java
deleted file mode 100644
index 0ad8cc1..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractActivity.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.annotation.annotationbeans.MimeType;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean;
-import net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityPortsDefinitionBean;
-
-import org.apache.log4j.Logger;
-
-/**
- * Convenience abstract superclass for generic Activity instances. Parameterised
- * on the configuration type used by the Activity implementation - when this
- * object is serialised the getConfiguration method is used to store specific
- * details of the activity, this is then used immediately after a call to the
- * default constructor when deserialising from XML on a workflow load.
- * <p>
- * This class holds port sets and mappings, and returns references directly to
- * them rather than copies thereof.
- * <p>
- * If you're writing an abstract activity (one that cannot be directly invoked)
- * you should extend this class for convenience. This can be useful when you
- * wish to specify some kind of abstract definition of a process which will be
- * bound at workflow invocation time to a particular concrete activity through
- * the action of a custom dispatch stack layer (which you will also provide)
- *
- * @author Tom Oinn
- * @author Stuart Owen
- *
- * @param <ConfigType>
- * type of configuration object to be used to hold configuration
- * information
- */
-public abstract class AbstractActivity<ConfigType> extends
- AbstractAnnotatedThing<Activity<?>> implements Activity<ConfigType> {
-
- private static Logger logger = Logger
- .getLogger(AbstractActivity.class);
-
- protected Map<String, String> inputPortMapping = new HashMap<String, String>();
-
- protected Map<String, String> outputPortMapping = new HashMap<String, String>();
-
- protected Set<OutputPort> outputPorts = new HashSet<OutputPort>();
-
- protected Set<ActivityInputPort> inputPorts = new HashSet<ActivityInputPort>();
-
- /**
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#configure(java.lang.Object)
- */
- public abstract void configure(ConfigType conf)
- throws ActivityConfigurationException;
-
- /**
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#getConfiguration()
- */
- public abstract ConfigType getConfiguration();
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#getInputPortMapping()
- */
- public final Map<String, String> getInputPortMapping() {
- return this.inputPortMapping;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#getInputPorts()
- */
- public final Set<ActivityInputPort> getInputPorts() {
- return inputPorts;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#getOutputPortMapping()
- */
- public final Map<String, String> getOutputPortMapping() {
- return this.outputPortMapping;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.taverna.t2.workflowmodel.processor.activity.Activity#getOutputPorts()
- */
- public final Set<OutputPort> getOutputPorts() {
- return outputPorts;
- }
-
- /**
- * Creates and adds a new input port with the provided properties.
- *
- * @see #removeInputs()
- * @param portName -
- * the name of the port to be created.
- * @param portDepth -
- * the depth of the port to be created.
- */
- protected void addInput(
- String portName,
- int portDepth,
- boolean allowsLiteralValues,
- List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes,
- Class<?> translatedElementClass) {
- if (handledReferenceSchemes == null) {
- handledReferenceSchemes = Collections.emptyList();
- }
- inputPorts.add(EditsRegistry.getEdits().createActivityInputPort(
- portName, portDepth, allowsLiteralValues,
- handledReferenceSchemes, translatedElementClass));
- }
-
- /**
- * Creates and adds a new output port with the provided properties.
- *
- * @see #removeOutputs()
- * @param portName -
- * the name of the port to be created.
- * @param portDepth -
- * the depth of the port to be created
- * @param granularDepth -
- * the granular depth of the port to be created
- * @param mimeTypes -
- * a List of String representations of the MIME type this port
- * will emit as outputs.
- */
- protected void addOutput(String portName, int portDepth, int granularDepth) {
- outputPorts.add(EditsRegistry.getEdits().createActivityOutputPort(
- portName, portDepth, granularDepth));
- }
-
- /**
- * Convenience method, creates a new output port with depth and granular
- * depth both set to the value for depth, i.e. no streaming behaviour.
- * <p>
- *
- * @see #removeOutputs()
- * @param portName
- * @param portDepth
- */
- protected void addOutput(String portName, int portDepth) {
- addOutput(portName, portDepth, portDepth);
- }
-
- /**
- * <p>
- * Simplifies configuring the Activity input and output ports if its
- * ConfigType is an implementation of {@link ActivityPortsDefinitionBean}
- * </p>
- * <p>
- * For an Activity that has ports that are defined dynamically it is natural
- * that is ConfigType will not implement this interface.
- * </p>
- *
- * @param configBean
- */
- protected void configurePorts(ActivityPortsDefinitionBean configBean) {
- removeInputs();
- for (ActivityInputPortDefinitionBean inputDef : configBean
- .getInputPortDefinitions()) {
- addInput(inputDef.getName(), inputDef.getDepth(), inputDef
- .getAllowsLiteralValues(), inputDef
- .getHandledReferenceSchemes(), inputDef
- .getTranslatedElementType());
- // TODO - use the mime types from the config bean if required,
- // probably best handled elsewhere though
- }
- removeOutputs();
-
- for (ActivityOutputPortDefinitionBean outputDef : configBean
- .getOutputPortDefinitions()) {
- OutputPort createActivityOutputPort = EditsRegistry.getEdits().createActivityOutputPort(
- outputDef.getName(), outputDef.getDepth(), outputDef
- .getGranularDepth());
-// addOutput(outputDef.getName(), outputDef.getDepth(), outputDef
-// .getGranularDepth());
- this.outputPorts.add(createActivityOutputPort);
- //add the mime types as annotations
- for (String mimeType:outputDef.getMimeTypes()) {
- MimeType mimeTypeAnnotation = new MimeType();
- mimeTypeAnnotation.setText(mimeType);
- try {
- EditsRegistry.getEdits().getAddAnnotationChainEdit(createActivityOutputPort, mimeTypeAnnotation).doEdit();
- } catch (EditException e) {
- logger.error(e);
- }
- }
- }
- }
-
- /**
- * Remove existing output ports.
- *
- */
- protected void removeOutputs() {
- outputPorts.clear();
- }
-
- /**
- * Remove existing input ports
- *
- */
- protected void removeInputs() {
- inputPorts.clear();
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractAsynchronousActivity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractAsynchronousActivity.java
deleted file mode 100644
index a290312..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AbstractAsynchronousActivity.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Abstract superclass for asynchronous activities. Activity providers should only
- * have to implement the configuration and invocation methods to have a fully
- * functional activity - serialisation and deserialisation are handled
- * automatically.
- *
- * @author Tom Oinn
- *
- * @param <ConfigType>
- * the configuration type used for this activity
- */
-public abstract class AbstractAsynchronousActivity<ConfigType> extends
- AbstractActivity<ConfigType> implements AsynchronousActivity<ConfigType> {
-
- /**
- * Called immediately after object construction by the deserialisation
- * framework with a configuration bean built from the auto-generated XML.
- * <p>
- * This method is responsible for the creation of input and output ports,
- * something that is currently done in the constructor of the Taverna 1
- * Processor class.
- */
- @Override
- public abstract void configure(ConfigType conf)
- throws ActivityConfigurationException;
-
- /**
- * Get a configuration bean representing the definition of the activity. This
- * bean should contain enough information to rebuild the input and output
- * port sets, mappings are explicitly handled by the serialisation framework
- * but the ports are assumed to be generated during the configuration stage
- * rather than explicitly stored.
- */
- @Override
- public abstract ConfigType getConfiguration();
-
- /**
- * Request an asynchronous invocation of the activity on the specified data.
- * The data items are named relative to the input port names of the activity
- * (as opposed to the parent processor), the invocation layer is responsible
- * for translating these appropriately before this method is called. The
- * callback object provides access to a DataManager instance that can be
- * used to resolve the entity identifiers in the data map, push results up
- * and signal failure conditions.
- * <p>
- * This method must not block! However it happens this method must return
- * immediately after creating the new activity invocation. Do not do any
- * heavy lifting in the body of this method without creating a new thread
- * specifically for it.
- */
- public abstract void executeAsynch(Map<String, T2Reference> data,
- AsynchronousActivityCallback callback);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Activity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Activity.java
deleted file mode 100644
index 544b8de..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Activity.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import static net.sf.taverna.t2.annotation.HierarchyRole.CHILD;
-
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.HierarchyTraversal;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Configurable;
-
-/**
- * Defines a single abstract or concrete invokable activity. Each Processor
- * contains at least one of these and may contain many, similarly the dispatch
- * stack may create new Activity instances from e.g. dynamic lookup or resolution
- * of an abstract activity to a concrete activity or set of activities.
- *
- * @param <ConfigurationType> the ConfigurationType associated with the Activity. This is an arbitrary java class that provides details on how the Activity is configured..
- * @author Tom Oinn
- *
- */
-public interface Activity<ConfigurationType> extends Annotated<Activity<?>>, Configurable<ConfigurationType> {
-
-
-
- /**
- * An Activity contains a set of named input ports. Names must be unique
- * within this set.
- *
- * @return the set of input ports for this activity
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public Set<ActivityInputPort> getInputPorts();
-
- /**
- * A processor may have different input port names to the activity or
- * activities it contains. This map is keyed on the processor input port names
- * with the corresponding value being the activity port name.
- *
- * @return mapping from processor input port names to activity input port
- * names
- */
- public Map<String, String> getInputPortMapping();
-
- /**
- * An Activity contains a set of named output ports. As with input ports names
- * must be unique within the set.
- *
- * @return
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public Set<OutputPort> getOutputPorts();
-
- /**
- * Outputs of the activity may be named differently to those of the
- * processor. This map is keyed on an activity output port name with each
- * corresponding value being the processor output port name to which the
- * activity output is bound.
- *
- * @return mapping from activity output port name to processor output port
- * name
- */
- public Map<String, String> getOutputPortMapping();
-
- /**
- * {@inheritDoc}
- */
- public abstract void configure(ConfigurationType conf) throws ActivityConfigurationException;
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityAndBeanWrapper.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityAndBeanWrapper.java
deleted file mode 100644
index 0cedc45..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityAndBeanWrapper.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.awt.datatransfer.Transferable;
-
-/**
- * Used when dragging activities from the palette onto "something". Place it
- * inside a {@link Transferable} when doing a drag operation. Contains an
- * {@link Activity} and its configuration bean.
- *
- * @author Ian Dunlop
- *
- */
-public class ActivityAndBeanWrapper {
- /** The Activity being dragged */
- private Activity<?> activity;
- /** The bean used to configure the activity */
- private Object bean;
- private String name;
-
- public Activity<?> getActivity() {
- return activity;
- }
-
- public void setActivity(Activity<?> activity) {
- this.activity = activity;
- }
-
- public Object getBean() {
- return bean;
- }
-
- public void setBean(Object bean) {
- this.bean = bean;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityConfigurationException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityConfigurationException.java
deleted file mode 100644
index 96284b0..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityConfigurationException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-
-/**
- * Thrown when attempting to configure an Activity instance with an invalid
- * configuration. Causes may include actual configuration errors, unavailable
- * activities etc.
- *
- * @author Tom Oinn
- *
- */
-public class ActivityConfigurationException extends ConfigurationException {
-
- private static final long serialVersionUID = 6940385954331153900L;
-
- /**
- * @param msg a message describing the reason for the exception.
- */
- public ActivityConfigurationException(String msg) {
- super(msg);
- }
-
- /**
- * @param cause a previous exception that caused this ActivityConfigurationException to be thrown.
- */
- public ActivityConfigurationException(Throwable cause) {
- super(cause);
- }
-
- /**
- * @param msg a message describing the reason for the exception.
- * @param cause a previous exception that caused this ActivityConfigurationException to be thrown.
- */
- public ActivityConfigurationException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityInputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityInputPort.java
deleted file mode 100644
index 66e4de5..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityInputPort.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-
-/**
- * Specialisation of InputPort to capture the extra information required by
- * Activity instances.
- *
- * @author Tom Oinn
- *
- */
-public interface ActivityInputPort extends InputPort, ActivityPort {
-
- /**
- * Declares that the DataDocument instances fed as input data (either
- * directly or as elements of a collection) to this input port must contain
- * at least one of the specified ReferenceScheme types. This is used to
- * specify that e.g. an activity can only accept URLs, values or similar.
- *
- * @return Class objects representing the reference scheme types which this
- * input can handle
- */
- public List<Class<? extends ExternalReferenceSPI>> getHandledReferenceSchemes();
-
- /**
- * Literal values are a special case as they are not represented by
- * reference schemes - in rare cases activities may choose to deny literal
- * values, forcing *all* their inputs to be in a particular reference
- * scheme. If this is the case then this method should return false, if the
- * activity is capable of handling literal types without any upconversion to
- * references (please do implement this!) then it returns false
- *
- * @return true if the activity can cope with literal values, false if it
- * requires them to be converted to an instance of a reference
- * scheme class (as defined by getHandledReferenceSchemes)
- */
- public boolean allowsLiteralValues();
-
- /**
- * The Java object type desired when the input data reference is converted
- * to an object. This is only used by the parent Activity when invoking the
- * data facade. Where the input data is a list this returns the type of leaf
- * nodes within the collection structure - the instances of this type will
- * always be wrapped up in a Java collection rather than an array type
- * <p>
- * Note that this is not intended to allow activities to consume arbitrary
- * java classes, activities such as the API consumer should handle this
- * through the reference scheme mechanism backed by an appropriate store
- * (most likely an in-memory hash of active objects)
- *
- * @return the desired class of the object returned by the data facade when
- * converting the input data reference into a java object. This will
- * almost always be String.class or byte[].class but other cases may
- * exist.
- */
- public Class<?> getTranslatedElementClass();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityOutputPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityOutputPort.java
deleted file mode 100644
index 3e10763..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityOutputPort.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-
-/**
- * The output port of an {@link Activity}.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public interface ActivityOutputPort extends OutputPort, ActivityPort {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityPort.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityPort.java
deleted file mode 100644
index 62f074f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/ActivityPort.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import net.sf.taverna.t2.workflowmodel.Port;
-
-/**
- * The input or output port of an {@link Activity}.
- *
- * @see ActivityInputPort
- * @see ActivityOutputPort
- * @author Stian Soiland-Reyes
- *
- */
-public interface ActivityPort extends Port {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivity.java
deleted file mode 100644
index d7c318a..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivity.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * A concrete invokable activity with an asynchronous invocation API and no
- * knowledge of invocation context. This is the most common concrete activity
- * type in Taverna 2, it has no knowledge of any enclosing iteration or other
- * handling process. The activity may stream results in the sense that it can use
- * the AsynchronousActivityCallback object to push multiple results followed by a
- * completion event. If a completion event is received by the callback before
- * any data events the callback will insert a data event containing empty
- * collections of the appropriate depth.
- *
- * @param <ConfigurationType> the ConfigurationType associated with the Activity.
- * @author Tom Oinn
- *
- */
-public interface AsynchronousActivity<ConfigurationType> extends Activity<ConfigurationType> {
-
- /**
- * Invoke the activity in an asynchronous manner. The activity uses the
- * specified ActivityCallback object to push results, errors and completion
- * events back to the dispatch stack.
- */
- public void executeAsynch(Map<String, T2Reference> data,
- AsynchronousActivityCallback callback);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivityCallback.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivityCallback.java
deleted file mode 100644
index 6dfc231..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/AsynchronousActivityCallback.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-
-/**
- * The callback interface used by instances of AsynchronousActivity to push
- * results and failure messages back to the invocation layer.
- *
- * @author Tom Oinn
- *
- */
-public interface AsynchronousActivityCallback {
-
- /**
- * The invocation context contains resources such as data managers, security
- * agents and provenance consumers to be used by the Activity as it runs.
- * This replaces the getLocalDataManager and getLocalSecurityManager calls.
- */
- public InvocationContext getContext();
-
- /**
- * If an activity proxy wants to create a new thread of activity it should
- * use this method unless there is a very good reason not to. This allows
- * the workflow framework to control its own thread usage, possibly
- * implementing per user, per workflow or per processor thread limit
- * policies. Exceptions to this principle might include cases where the
- * activity proxy is capable of managing thread usage across all instances
- * of that activity type and therefore more efficiently (fewer threads) than
- * if it let the workflow manager perform this function.
- *
- * @param runMe
- * a Runnable to implement the activity proxy logic.
- */
- public void requestRun(Runnable runMe);
-
- /**
- * Push a map of named identifiers out to the invocation layer which is then
- * responsible for wrapping them up into an appropriate Job object and
- * sending it up the dispatch stack. The keys of the map are names local to
- * the activity, the callback object is responsible for rewriting them
- * according to the activity mapping rules (i.e. Activity.getXXXPortMapping)
- *
- * @param data
- * a single result data packet
- * @param index
- * the index of the result in the context of this single process
- * invocation. If there's no streaming involved this should be a
- * zero length int[].
- */
- public void receiveResult(Map<String, T2Reference> data, int[] index);
-
- /**
- * If (and only if) the activity is streaming data then this method can be
- * called to signal a (possibly partial) completion of the stream. If this
- * is a total completion event, i.e. one with a zero length index array and
- * there have been no result data sent the callback object will create a
- * single job containing empty lists and send that instead otherwise it will
- * be passed straight through. The index array is relative to this
- * particular activity invocation as the invocation has no contextual
- * awareness.
- *
- * @param completionIndex
- */
- public void receiveCompletion(int[] completionIndex);
-
- /**
- * If the job fails (as opposed to succeeding and sending an error for which
- * the receiveResult method is used) this method will cause an error to be
- * sent up the dispatch stack, triggering any appropriate handling methods
- * such as retry, failover etc. This particular method accepts both a free
- * text message and an instance of Throwable for additional information, in
- * addition to which it sends an error type which allows upstream layers to
- * determine whether they can handle the error or whether it should be
- * passed directly upwards.
- *
- * @param message
- * @param t
- */
- public void fail(String message, Throwable t, DispatchErrorType errorType);
-
- /**
- * If the job fails (as opposed to succeeding and sending an error for which
- * the receiveResult method is used) this method will cause an error to be
- * sent up the dispatch stack, triggering any appropriate handling methods
- * such as retry, failover etc. This particular method accepts both a free
- * text message and an instance of Throwable for additional information.
- *
- * @param message
- * @param t
- */
- public void fail(String message, Throwable t);
-
- /**
- * If the job fails (as opposed to succeeding and sending an error for which
- * the receiveResult method is used) this method will cause an error to be
- * sent up the dispatch stack, triggering any appropriate handling methods
- * such as retry, failover etc. This method just takes a free text message
- * for cases where a failure is properly described by an instance of
- * Throwable
- *
- * @param message
- */
- public void fail(String message);
-
- /**
- * For activities which are going to establish state below the invoke node
- * in the monitor tree this method returns the owning process identifier
- * allocated to the invoke node. This is particularly necessary for nested
- * workflow activities.
- * <p>
- * Any calls to Monitor.register... must establish a state tree rooted at
- * this node, they may assume that this node already exists.
- */
- public String getParentProcessIdentifier();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Job.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Job.java
deleted file mode 100644
index 02f6184..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/Job.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Contains a (possibly partial) job description. A job is the smallest entity
- * that can be enacted by the invocation layer of the dispatch stack within a
- * processor. Jobs are partial jobs if the set of keys in the data map is not
- * identical to the set of named input ports on the processor within which the
- * job is used. These objects are used internally within the processor to stage
- * data during iteration and within the dispatch stack, they do not appear
- * within the workflow itself.
- *
- * @author Tom Oinn
- *
- */
-public class Job extends IterationInternalEvent<Job> {
-
- private Map<String, T2Reference> dataMap;
-
- /**
- * Push the index array onto the owning process name and return the new Job
- * object. Does not modify this object, the method creates a new Job with
- * the modified index array and owning process
- *
- * @return
- */
- @Override
- public Job pushIndex() {
- return new Job(getPushedOwningProcess(), new int[] {}, dataMap, context);
- }
-
- /**
- * Pull the index array previous pushed to the owning process name and
- * prepend it to the current index array
- */
- @Override
- public Job popIndex() {
- return new Job(owner.substring(0, owner.lastIndexOf(':')),
- getPoppedIndex(), dataMap, context);
- }
-
- /**
- * The actual data carried by this (partial) Job object is in the form of a
- * map, where the keys of the map are Strings identifying the named input
- * and the values are Strings containing valid data identifiers within the
- * context of a visible DataManager object (see CloudOne specification for
- * further information on the DataManager system)
- *
- * @return Map of name to data reference for this Job
- */
- public Map<String, T2Reference> getData() {
- return this.dataMap;
- }
-
- /**
- * Create a new Job object with the specified owning process (colon
- * separated 'list' of process identifiers), index array and data map
- *
- * @param owner
- * @param index
- * @param data
- */
- public Job(String owner, int[] index, Map<String, T2Reference> data,
- InvocationContext context) {
- super(owner, index, context);
- this.dataMap = data;
-
- }
-
- /**
- * Show the owner, index array and data map in textual form for debugging
- * and any other purpose. Jobs appear in the form :
- *
- * <pre>
- * Job(Process1)[2,0]{Input2=dataID4,Input1=dataID3}
- * </pre>
- */
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append("Job(" + owner + ")[");
- for (int i = 0; i < index.length; i++) {
- if (i > 0) {
- sb.append(",");
- }
- sb.append(index[i] + "");
- }
- sb.append("]{");
- boolean first = true;
- for (String key : dataMap.keySet()) {
- if (!first) {
- sb.append(",");
- }
- sb.append(key + "=" + dataMap.get(key));
- first = false;
- }
- sb.append("}");
- return sb.toString();
- }
-
- @Override
- public Job popOwningProcess() throws ProcessIdentifierException {
- return new Job(popOwner(), index, dataMap, context);
- }
-
- @Override
- public Job pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new Job(pushOwner(localProcessName), index, dataMap, context);
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/MonitorableAsynchronousActivity.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/MonitorableAsynchronousActivity.java
deleted file mode 100644
index 3f1afec..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/MonitorableAsynchronousActivity.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * An extension of AsynchronousActivity with the additional stipulation that
- * implementing classes must return a set of monitorable properties for the
- * activity invocation instance when invoked. This allows for deep state
- * management, where the monitor state extends out from the workflow engine into
- * the remote resources themselves and is dependant on the resource proxied by
- * the activity implementation providing this information.
- *
- * @author Tom Oinn
- *
- */
-public interface MonitorableAsynchronousActivity<ConfigType> extends
- AsynchronousActivity<ConfigType> {
-
- /**
- * This has the same invocation semantics as
- * AsynchronousActivity.executeAsynch and all implementations should also
- * implement that method, with the difference that this one returns
- * immediately with a set of monitorable properties which represent
- * monitorable or steerable state within the invocation itself.
- *
- * @param data
- * @param callback
- * @return a set of monitorable properties representing internal state of
- * the invoked resource
- */
- public Set<MonitorableProperty<?>> executeAsynchWithMonitoring(
- Map<String, T2Reference> data,
- AsynchronousActivityCallback callback);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/NestedDataflow.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/NestedDataflow.java
deleted file mode 100644
index 1c0016b..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/NestedDataflow.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-/**
- * Nested workflows/dataflows can come in many shapes and sizes - in-line, url
- * etc. However, they are all {@link Dataflow}s. Implement this in any
- * implementation of a Nested dataflow
- *
- * @author Ian Dunlop
- *
- */
-public interface NestedDataflow {
-
- public Dataflow getNestedDataflow();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityInputPortDefinitionBean.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityInputPortDefinitionBean.java
deleted file mode 100644
index 7d6c17c..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityInputPortDefinitionBean.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.config;
-
-import java.util.Collections;
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-
-/**
- * A bean that describes properties of an Input port.
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- *
- */
-public class ActivityInputPortDefinitionBean extends ActivityPortDefinitionBean {
-
- private List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes;
-
- private Class<?> translatedElementType;
-
- private boolean allowsLiteralValues;
-
- public List<Class<? extends ExternalReferenceSPI>> getHandledReferenceSchemes() {
- if (handledReferenceSchemes == null) {
- return Collections
- .<Class<? extends ExternalReferenceSPI>> emptyList();
- }
- return handledReferenceSchemes;
- }
-
- public void setHandledReferenceSchemes(
- List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes) {
- this.handledReferenceSchemes = handledReferenceSchemes;
- }
-
- public Class<?> getTranslatedElementType() {
- return translatedElementType;
- }
-
- public void setTranslatedElementType(Class<?> translatedElementType) {
- this.translatedElementType = translatedElementType;
- }
-
- public boolean getAllowsLiteralValues() {
- return allowsLiteralValues;
- }
-
- public void setAllowsLiteralValues(boolean allowsLiteralValues) {
- this.allowsLiteralValues = allowsLiteralValues;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityOutputPortDefinitionBean.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityOutputPortDefinitionBean.java
deleted file mode 100644
index d1c0e24..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityOutputPortDefinitionBean.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.config;
-
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-
-/**
- * A bean that describes properties of an Output port.
- *
- * @author Stuart Owen
- *
- */
-public class ActivityOutputPortDefinitionBean extends ActivityPortDefinitionBean {
- private int granularDepth;
-
- /**
- * @return the granular depth of the port
- * @see OutputPort#getGranularDepth()
- */
- public int getGranularDepth() {
- return granularDepth;
- }
-
- /**
- * @param granularDepth the granular depth of the port
- */
- public void setGranularDepth(int granularDepth) {
- this.granularDepth = granularDepth;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortDefinitionBean.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortDefinitionBean.java
deleted file mode 100644
index 3fd3c7e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortDefinitionBean.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.config;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A generic bean that describes the shared properties of input and output ports.
- *
- * @author Stuart Owen
- *
- */
-public abstract class ActivityPortDefinitionBean {
- private String name;
- private int depth;
- private List<String> mimeTypes;
-
- /**
- * @return the port name
- */
- public String getName() {
- return name;
- }
-
- /**
- * @param name the port name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * @return the depth of the port
- */
- public int getDepth() {
- return depth;
- }
-
- /**
- * @param depth the depth of the port
- */
- public void setDepth(int depth) {
- this.depth = depth;
- }
-
- /**
- * @return a list a MIME types that describe the port
- */
- public List<String> getMimeTypes() {
- if (mimeTypes == null) {
- return Collections.emptyList();
- }
- return mimeTypes;
- }
-
- /**
- * @param mimeTypes the list of MIME-types that describe the port
- */
- public void setMimeTypes(List<String> mimeTypes) {
- this.mimeTypes = mimeTypes;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortsDefinitionBean.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortsDefinitionBean.java
deleted file mode 100644
index 704db5f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/ActivityPortsDefinitionBean.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.config;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * <p>
- * Defines a configuration type that relates directly to an {@link Activity} and in particular defines details its
- * input and output ports.<br>
- * An Activity that has its ports implicitly defined may define a ConfigType that extends this class, but this is not enforced.
- * </p>
- *
- * @author Stuart Owen
- *
- */
-public class ActivityPortsDefinitionBean {
-
- private List<ActivityInputPortDefinitionBean> inputs = new ArrayList<ActivityInputPortDefinitionBean>();
- private List<ActivityOutputPortDefinitionBean> outputs = new ArrayList<ActivityOutputPortDefinitionBean>();
-
-
- /**
- * @return a list of {@link ActivityInputPortDefinitionBean} that describes each input port
- */
- public List<ActivityInputPortDefinitionBean> getInputPortDefinitions() {
- return inputs;
- }
-
- /**
- * @return a list of {@link ActivityOutputPortDefinitionBean} that describes each output port.
- */
- public List<ActivityOutputPortDefinitionBean> getOutputPortDefinitions() {
- return outputs;
- }
-
- /**
- * @param portDefinitions a list of {@link ActivityInputPortDefinitionBean} that describes each input port
- */
- public void setInputPortDefinitions(
- List<ActivityInputPortDefinitionBean> portDefinitions) {
- inputs=portDefinitions;
- }
-
- /**
- * @param portDefinitions a list of {@link ActivityOutputPortDefinitionBean} that describes each output port
- */
- public void setOutputPortDefinitions(
- List<ActivityOutputPortDefinitionBean> portDefinitions) {
- outputs=portDefinitions;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/package.html
deleted file mode 100644
index fa104d7..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/config/package.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<body>
-A set of helper classes to aid in defining how Activities are configured.
-An Activity class is associated with a ConfigurationType, which is an arbitrary Java object defining
-how the Activity should be configured.<br>
-This package provides classes and interfaces that help in creating these ConfigurationTypes with details that are common
-across different Activities, but there use is in no way enforced.
-</body>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/package.html
deleted file mode 100644
index 72a9076..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<body>
-Provides definitions for a single Activity to be contained within a
-Processor. Activity was previously called 'Service' but this was
-somewhat misleading as there wasn't always a service backing it. The
-Activity may be abstract, it may be synchronous or asynchronous in which
-case it uses a callback mechanism. It doesn't carry around annotation
-itself instead using an activity annotation container to handle this
-(this avoids third parties having to manage annotation containment
-themselves).
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractDispatchLayer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractDispatchLayer.java
deleted file mode 100644
index 0d66d67..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractDispatchLayer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-import java.util.Timer;
-
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Convenience abstract implementation of DispatchLayer
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractDispatchLayer<ConfigurationType> implements
- DispatchLayer<ConfigurationType> {
-
- protected static Timer cleanupTimer = new Timer("Dispatch stack state cleanup", true);
-
- protected static final int CLEANUP_DELAY_MS = 1000;
-
- public void setDispatchStack(DispatchStack parentStack) {
- this.dispatchStack = parentStack;
- }
-
- protected DispatchStack dispatchStack;
-
- protected final DispatchLayer<?> getAbove() {
- return this.dispatchStack.layerAbove(this);
- }
-
- protected final DispatchLayer<?> getBelow() {
- return this.dispatchStack.layerBelow(this);
- }
-
- public void receiveError(DispatchErrorEvent errorEvent) {
- DispatchLayer<?> above = dispatchStack.layerAbove(this);
- if (above != null) {
- above.receiveError(errorEvent);
- }
- }
-
- public void receiveJob(DispatchJobEvent jobEvent) {
- DispatchLayer<?> below = dispatchStack.layerBelow(this);
- if (below != null) {
- below.receiveJob(jobEvent);
- }
- }
-
- @SuppressWarnings("unchecked")
- public void receiveJobQueue(DispatchJobQueueEvent jobQueueEvent) {
- DispatchLayer below = dispatchStack.layerBelow(this);
- if (below != null) {
- below.receiveJobQueue(jobQueueEvent);
- }
-
- }
-
- public void receiveResult(DispatchResultEvent resultEvent) {
- DispatchLayer<?> above = dispatchStack.layerAbove(this);
- if (above != null) {
- above.receiveResult(resultEvent);
- }
- }
-
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent) {
- DispatchLayer<?> above = dispatchStack.layerAbove(this);
- if (above != null) {
- above.receiveResultCompletion(completionEvent);
- }
-
- }
-
- public void finishedWith(String owningProcess) {
- // Do nothing by default
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractErrorHandlerLayer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractErrorHandlerLayer.java
deleted file mode 100644
index 17043fc..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/AbstractErrorHandlerLayer.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Superclass of error handling dispatch layers (for example retry and
- * failover). Provides generic functionality required by this class of layers.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public abstract class AbstractErrorHandlerLayer<ConfigurationType> extends
- AbstractDispatchLayer<ConfigurationType> {
-
- private static Logger logger = Logger
- .getLogger(AbstractErrorHandlerLayer.class);
-
- /**
- * Compare two arrays of ints, return true if they are the same length and
- * if at every index the two integer values are equal
- *
- * @param a
- * @param b
- * @return
- */
- private static boolean identicalIndex(int[] a, int[] b) {
- if (a.length != b.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * Map of process name -> list of state models. Note that all access to this
- * map must be synchronized on the stateMap, and access to the lists inside
- * it must be synchronized on the list.
- *
- * @see #addJobToStateList(DispatchJobEvent)
- * @see #removeJob(String, JobState)
- * @see #getJobsDefault(String)
- * @see #getJobsCopy(String)
- */
- private Map<String, List<JobState>> stateMap = new HashMap<String, List<JobState>>();
-
- protected AbstractErrorHandlerLayer() {
- super();
- }
-
- /**
- * Clear cached state for the specified process when notified by the
- * dispatch stack
- */
- @Override
- public void finishedWith(String owningProcess) {
- synchronized (stateMap) {
- stateMap.remove(owningProcess);
- }
- }
-
- /**
- * If an error occurs we can either handle the error or send it to the layer
- * above for further processing.
- */
- @Override
- public void receiveError(DispatchErrorEvent errorEvent) {
- String owningProcess = errorEvent.getOwningProcess();
- List<JobState> activeJobs = getJobsCopy(owningProcess);
-
- for (JobState rs : activeJobs) {
- if (identicalIndex(rs.jobEvent.getIndex(), errorEvent.getIndex())) {
- boolean handled = rs.handleError();
- if (!handled) {
- removeJob(owningProcess, rs);
- getAbove().receiveError(errorEvent);
- return;
- }
- }
- }
- }
-
- /**
- * Receive a job from the layer above, store it for later retries and pass
- * it down to the next layer
- */
- @Override
- public void receiveJob(DispatchJobEvent jobEvent) {
- addJobToStateList(jobEvent);
- getBelow().receiveJob(jobEvent);
- }
-
- /**
- * If we see a result with an index matching one of those in the current
- * retry state we can safely forget that state object
- */
- @Override
- public void receiveResult(DispatchResultEvent j) {
- forget(j.getOwningProcess(), j.getIndex());
- getAbove().receiveResult(j);
- }
-
- /**
- * If we see a completion event with an index matching one of those in the
- * current retry state we can safely forget that state object
- */
- @Override
- public void receiveResultCompletion(DispatchCompletionEvent c) {
- forget(c.getOwningProcess(), c.getIndex());
- getAbove().receiveResultCompletion(c);
- }
-
- /**
- * Remove the specified pending retry job from the cache
- *
- * @param owningProcess
- * Owning process identifier as returned by
- * {@link DispatchJobEvent#getOwningProcess()}
- * @param index
- * Index of the job as returned by
- * {@link DispatchJobEvent#getIndex()}
- */
- protected void forget(String owningProcess, int[] index) {
- for (JobState jobState : getJobsCopy(owningProcess)) {
- if (identicalIndex(jobState.jobEvent.getIndex(), index)) {
- removeJob(owningProcess, jobState);
- return;
- }
- }
- // It could be due to pipelining activities like BioMart
- logger.debug("Could not forget " + owningProcess + " " + Arrays.toString(index));
- }
-
- protected void addJobToStateList(DispatchJobEvent jobEvent) {
- List<JobState> stateList = null;
- stateList = getJobsDefault(jobEvent.getOwningProcess());
- synchronized (stateList) {
- stateList.add(getStateObject(jobEvent));
- }
- }
-
- /**
- * Get a copy of the list of {@link JobState}s for the owning process, or an
- * empty list if the owning process is unknown or have been
- * {@link #forget(String, int[]) forgotten}.
- * <p>
- * This list can safely be iterated over without synchronizing. If you need
- * to modify the list, either synchronize over the returned list from
- * {@link #getJobsDefault(String)} or use
- * {@link #removeJob(String, JobState)}.
- *
- * @param owningProcess
- * Owning process identifier as returned by
- * {@link DispatchJobEvent#getOwningProcess()}
- * @return A copy of the list of known JobState {@link JobState}s for the
- * owning process,
- */
- protected List<JobState> getJobsCopy(String owningProcess) {
- List<JobState> activeJobs;
- synchronized (stateMap) {
- activeJobs = stateMap.get(owningProcess);
- }
- if (activeJobs == null) {
- logger.error("Could not find any active jobs for " + owningProcess);
- return Collections.emptyList();
- }
- // Take a copy of the list so we don't modify it while iterating over it
- List<JobState> activeJobsCopy;
- synchronized (activeJobs) {
- activeJobsCopy = new ArrayList<JobState>(activeJobs);
- }
- return activeJobsCopy;
- }
-
- /**
- * Get the list of {@link JobState}s for the owning process, creating and
- * adding it to the state map if necessary.
- * <p>
- * Note that all access to the returned list must be synchronized on the
- * list to avoid threading issues.
- * <p>
- * If you are going to iterate over the list, use
- * {@link #getJobsCopy(String)} instead.
- *
- * @see #getJobsCopy(String)
- * @param owningProcess
- * Owning process identifier as returned by
- * {@link DispatchJobEvent#getOwningProcess()}
- *
- * @return List of {@link JobState}s for the owning process
- */
- protected List<JobState> getJobsDefault(String owningProcess) {
- List<JobState> stateList;
- synchronized (stateMap) {
- stateList = stateMap.get(owningProcess);
- if (stateList == null) {
- stateList = new ArrayList<JobState>();
- stateMap.put(owningProcess, stateList);
- }
- }
- return stateList;
- }
-
- /**
- * Generate an appropriate state object from the specified job event. The
- * state object is a concrete subclass of JobState.
- *
- * @return
- */
- protected abstract JobState getStateObject(DispatchJobEvent jobEvent);
-
- protected void removeJob(String owningProcess, JobState jobState) {
- List<JobState> activeJobs;
- synchronized (stateMap) {
- activeJobs = stateMap.get(owningProcess);
- }
- if (activeJobs == null) {
- logger.error("Could not find active jobs for " + owningProcess);
- return;
- }
- synchronized (activeJobs) {
- activeJobs.remove(jobState);
- }
- }
-
- /**
- * Abstract superclass of all state models for pending failure handlers.
- * This object is responsible for handling failure messages if they occur
- * and represents the current state of the failure handling algorithm on a
- * per job basis.
- *
- * @author Tom Oinn
- *
- */
- protected abstract class JobState {
- protected DispatchJobEvent jobEvent;
-
- protected JobState(DispatchJobEvent jobEvent) {
- this.jobEvent = jobEvent;
- }
-
- /**
- * Called when the layer below pushes an error up and where the error
- * index and owning process matches that of this state object. The
- * implementation must deal with the error, either by handling it and
- * pushing a new job down the stack or by rejecting it. If this method
- * returns false the error has not been dealt with and MUST be pushed up
- * the stack by the active dispatch layer. In this case the layer will
- * be a subclass of AbstractErrorHandlerLayer and the logic to do this
- * is already included in the receive methods for results, errors and
- * completion events.
- *
- * @return true if the error was handled.
- */
- public abstract boolean handleError();
-
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchLayer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchLayer.java
deleted file mode 100644
index 292ca93..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchLayer.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-import net.sf.taverna.t2.workflowmodel.Configurable;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Layers within the dispatch stack define a control flow to handle dispatch of
- * jobs from a queue (generated by the iteration system) to appropriate
- * activities.
- * <p>
- * A dispatch layer can receive a reference to the Queue and a set of
- * Activities, or a single Job and a set of Activities from the layer above it
- * (or from the DispatchStackImpl object itself if this is the top layer). It
- * can receive errors, results and partial or total completion events from the
- * layer immediately below it.
- * <p>
- * To assist in graphical representation of the dispatch configuration each
- * layer declares for each class of message whether it intercepts and alters,
- * intercepts and observes or ignores (forwards) the message onto the next layer
- * (either up or down depending on the message) and whether the layer is capable
- * of instigating the creation of each class of message.
- *
- * @author Tom Oinn
- *
- */
-public interface DispatchLayer<ConfigurationType> extends Configurable<ConfigurationType> {
-
- /**
- * Receive a pointer to the job queue along with a set of activities, this
- * is received from the layer above in the dispatch stack or from the
- * DispatchStackImpl object itself if this is the top layer
- */
- public void receiveJobQueue(DispatchJobQueueEvent queueEvent);
-
- /**
- * Receive a single job and associated set of activities from the layer
- * above
- */
- public void receiveJob(DispatchJobEvent jobEvent);
-
- /**
- * Receive a single error reference from the layer below
- */
- public void receiveError(DispatchErrorEvent errorEvent);
-
- /**
- * Receive a result from the layer below
- */
- public void receiveResult(DispatchResultEvent resultEvent);
-
- /**
- * Receive a (possibly partial) completion event from the layer below. This
- * is only going to be used when the activities invocation is capable of
- * streaming partial data back up through the dispatch stack before the
- * activities has completed. Not all dispatch stack layers are compatible
- * with this mode of operation, for example retry and recursion do not play
- * well here!
- *
- */
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent);
-
- /**
- * Called when there will be no more events with the specified process
- * identifier, can be used to purge cached state from layers within the
- * stack
- */
- public void finishedWith(String owningProcess);
-
- /**
- * Set the parent dispatch stack of this layer, this is called when a layer
- * is added to the dispatch stack and can be safely ignored by end users of
- * this API
- */
- public void setDispatchStack(DispatchStack stack);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchStack.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchStack.java
deleted file mode 100644
index a764907..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DispatchStack.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-import static net.sf.taverna.t2.annotation.HierarchyRole.CHILD;
-import static net.sf.taverna.t2.annotation.HierarchyRole.PARENT;
-
-
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.HierarchyTraversal;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * The dispatch stack is responsible for consuming a queue of jobs from the
- * iteration strategy and dispatching those jobs through a stack based control
- * flow to an appropriate invocation target. Conceptually the queue and
- * description of activities enter the stack at the top, travel down to an
- * invocation layer at the bottom from which results, errors and completion
- * events rise back up to the top layer. Dispatch stack layers are stored as an
- * ordered list with index 0 being the top of the stack.
- *
- * @author Tom Oinn
- *
- */
-public interface DispatchStack extends Annotated<DispatchStack> {
-
- /**
- * The DispatchStack consists of an ordered list of DispatchLayer instances
- * where the DispatchLayer at index zero is at the bottom of the stack and
- * is almost always an invocation layer of some kind (in any working
- * dispatch stack configuration)
- *
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { CHILD })
- public List<DispatchLayer<?>> getLayers();
-
- /**
- * The dispatch stack is contained within a processor, this can be null if
- * the stack is being used out of this context but layers may be relying on
- * this link to get information about the processor input ports and their
- * annotations for various reasons.
- */
- @HierarchyTraversal(hierarchies = { "workflowStructure" }, role = { PARENT })
- public Processor getProcessor();
-
- /**
- * Return the layer above (lower index!) the specified layer, or a reference
- * to the internal top layer dispatch layer if there is no layer above the
- * specified one. Remember - input data and activities go down, results,
- * errors and completion events bubble back up the dispatch stack.
- * <p>
- * The top layer within the dispatch stack is always invisible and is held
- * within the DispatchStackImpl object itself, being used to route data out
- * of the entire stack
- *
- * @param layer
- * @return
- */
- public DispatchLayer<?> layerAbove(DispatchLayer<?> layer);
-
- /**
- * Return the layer below (higher index) the specified layer, or null if
- * there is no layer below this one.
- *
- * @param layer
- * @return
- */
- public DispatchLayer<?> layerBelow(DispatchLayer<?> layer);
-
- /**
- * The dispatch stack acts as an aggregator for monitorable properties
- * exposed by the dispatch layers. This is distinct from layers which are
- * capable of rewriting the process idenfitier of tokens - these require
- * their own nodes in the monitor in addition to any contributed properties.
- *
- * @param prop
- * @param processID
- */
- public void receiveMonitorableProperty(MonitorableProperty<?> prop,
- String processID);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/NotifiableLayer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/NotifiableLayer.java
deleted file mode 100644
index 65423dc..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/NotifiableLayer.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-/**
- * If a layer requires notification of the arrival of new items to the event
- * queues within the dispatcher it should implement this interface.
- *
- * @author Tom Oinn
- *
- */
-public interface NotifiableLayer {
-
- /**
- * Called when a new Job or Completion is added to a queue within the
- * dispatch stack
- *
- * @param owningProcess
- */
- public void eventAdded(String owningProcess);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/PropertyContributingDispatchLayer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/PropertyContributingDispatchLayer.java
deleted file mode 100644
index 06e73a9..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/PropertyContributingDispatchLayer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-/**
- * Used by dispatch layers which can contribute property information to their
- * parent processor instance. This is distinct from dispatch layers which modify
- * the process identifier and therefore create their own nodes in the monitor
- * tree, although there's no reason a layer can't perform both functions. For
- * example, the fault tolerance layers create their own state subtrees for each
- * failure recovery but could also contribute aggregate fault information to the
- * parent processor's property set.
- *
- * @author Tom Oinn
- *
- * @param <ConfigType>
- * configuration type for the dispatch layer
- */
-public interface PropertyContributingDispatchLayer<ConfigType> extends
- DispatchLayer<ConfigType> {
-
- /**
- * Inject properties for the specified owning process into the parent
- * dispatch stack. At some point prior to this call being made the
- * setDispatchStack will have been called, implementations of this method
- * need to use this DispatchStack reference to push properties in with the
- * specified key.
- * <p>
- * Threading - this thread must not fork, do all the work in this method in
- * the thread you're given by the caller. This is because implementations
- * may assume that they can collect properties from the dispatch stack
- * implementation (which will expose them through a private access method to
- * prevent arbitrary access to layer properties) once this call has
- * returned.
- * <p>
- * There is no guarantee that the layer will have seen an event with the
- * specified process, and in fact it's unlikely to in the general case as
- * any layers above it are free to modify the process identifier of tokens
- * as they go. Remember that this method is for aggregating properties into
- * the top level (processor) view so you may need to implement the property
- * getters such that they check prefixes of identifiers rather than
- * equality.
- *
- * @param owningProcess
- */
- void injectPropertiesFor(String owningProcess);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerErrorReaction.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerErrorReaction.java
deleted file mode 100644
index d6774a2..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerErrorReaction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes how a dispatch layer reacts to an error message
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-@ReactionTo(messageType = DispatchMessageType.ERROR)
-public @interface DispatchLayerErrorReaction {
-
- public DispatchLayerStateEffect[] stateEffects();
-
- public DispatchMessageType[] emits();
-
- public boolean relaysUnmodified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobQueueReaction.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobQueueReaction.java
deleted file mode 100644
index b4b4fab..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobQueueReaction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes how a dispatch layer reacts to a Job Queue message
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-@ReactionTo(messageType = DispatchMessageType.JOB_QUEUE)
-public @interface DispatchLayerJobQueueReaction {
-
- public DispatchLayerStateEffect[] stateEffects();
-
- public DispatchMessageType[] emits();
-
- public boolean relaysUnmodified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobReaction.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobReaction.java
deleted file mode 100644
index 5023aef..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerJobReaction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes how a dispatch layer reacts to a Job message
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-@ReactionTo(messageType = DispatchMessageType.JOB)
-public @interface DispatchLayerJobReaction {
-
- public DispatchLayerStateEffect[] stateEffects();
-
- public DispatchMessageType[] emits();
-
- public boolean relaysUnmodified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultCompletionReaction.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultCompletionReaction.java
deleted file mode 100644
index f000d3a..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultCompletionReaction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes how a dispatch layer reacts to a result completion message
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-@ReactionTo(messageType = DispatchMessageType.RESULT_COMPLETION)
-public @interface DispatchLayerResultCompletionReaction {
-
- public DispatchLayerStateEffect[] stateEffects();
-
- public DispatchMessageType[] emits();
-
- public boolean relaysUnmodified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultReaction.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultReaction.java
deleted file mode 100644
index d713a42..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerResultReaction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes how a dispatch layer responds to a result message
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-@ReactionTo(messageType = DispatchMessageType.RESULT)
-public @interface DispatchLayerResultReaction {
-
- public DispatchLayerStateEffect[] stateEffects();
-
- public DispatchMessageType[] emits();
-
- public boolean relaysUnmodified();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerStateEffect.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerStateEffect.java
deleted file mode 100644
index 59e8670..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchLayerStateEffect.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-/**
- * Describes the effect of a message on the state of a dispatch layer, used by
- * DispatchLayerReaction. If no message causes any of these actions the layer
- * can be described as state free.
- *
- * @author Tom Oinn
- *
- */
-public enum DispatchLayerStateEffect {
-
- /**
- * The message causes a state object within the dispatch layer to be created
- * keyed on the process identifier and index
- */
- CREATE_LOCAL_STATE,
-
- /**
- * The message causes the removal of a state object within the dispatch
- * layer, the layer to be removed is keyed on process identifier and index
- * of the message
- */
- REMOVE_LOCAL_STATE,
-
- /**
- * The message causes the modification of a previously stored state object
- * within the dispatch layer, the state object modified is keyed on process
- * identifier and index of the message.
- */
- UPDATE_LOCAL_STATE,
-
- /**
- * The message causes a state object within the dispatch layer to be created
- * keyed only on the process identifier and not on the index of the message.
- */
- CREATE_PROCESS_STATE,
-
- /**
- * The message causes a state object to be removed from the dispatch layer,
- * the state object is identified only by the process identifier
- */
- REMOVE_PROCESS_STATE,
-
- /**
- * The message causes a state object to be modified, the state object is
- * identified by process identifier only
- */
- UPDATE_PROCESS_STATE,
-
- /**
- * The message causes global level state to be modified within the dispatch
- * layer
- */
- UPDATE_GLOBAL_STATE,
-
- /**
- * The message has no effect on state. This value is used when specifying
- * that a message might cause effect or it might not, the interpretation of
- * the various reaction annotations is that exactly one of the state effects
- * will take place, so if the state side effect array isn't empty you have
- * to insert this one to specify that it's possible that no state change
- * will occur
- */
- NO_EFFECT;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchMessageType.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchMessageType.java
deleted file mode 100644
index 866a83b..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/DispatchMessageType.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-/**
- * Enumeration of the possible message types passed between layers of the
- * dispatch stack.
- *
- * @author Tom Oinn
- *
- */
-public enum DispatchMessageType {
-
- /**
- * A reference to a queue of Job objects waiting to be used as input along
- * with a list of activities to process them.
- */
- JOB_QUEUE,
-
- /**
- * A Job object and list of activities to be used to process the data in the
- * Job. The Job will have been previously extracted from the JobQueue
- */
- JOB,
-
- /**
- * A Job object containing the result of a single activity invocation.
- */
- RESULT,
-
- /**
- * A (possibly partial) completion event from the layer below. This is only
- * going to be used when the activity invocation is capable of streaming
- * partial data back up through the dispatch stack before the activity has
- * completed. Not all dispatch stack layers are compatible with this mode of
- * operation, for example retry and recursion do not play well here!
- */
- RESULT_COMPLETION,
-
- /**
- * A failure message sent by the layer below to denote some kind of failure
- * (surprisingly)
- */
- ERROR;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/ReactionTo.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/ReactionTo.java
deleted file mode 100644
index 73f10d3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/ReactionTo.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Describes the type of message to which the various DispatchLayerFooReaction
- * classes are referring
- *
- * @author Tom Oinn
- *
- */
-@Documented
-@Target(ElementType.ANNOTATION_TYPE)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface ReactionTo {
-
- public DispatchMessageType messageType();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/SupportsStreamedResult.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/SupportsStreamedResult.java
deleted file mode 100644
index aae32e6..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/SupportsStreamedResult.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.description;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Declares that a dispatch layer can handle streamed result data correctly, if
- * this annotation is attached to a DispatchLayer implementation that
- * implementation must be able to correctly handle the result completion message
- * type. By default dispatch layers are assumed to not handle this message type.
- *
- * @author Tom Oinn
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(ElementType.TYPE)
-@Documented
-public @interface SupportsStreamedResult {
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/package.html
deleted file mode 100644
index f0629bb..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/description/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Annotations and enumerations used to describe dispatch layers, specifically the types of messages they can consume and their reactions to those messages.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/AbstractDispatchEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/AbstractDispatchEvent.java
deleted file mode 100644
index 39327c5..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/AbstractDispatchEvent.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import net.sf.taverna.t2.invocation.Event;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * Superclass of events within the dispatch stack
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractDispatchEvent<EventType extends AbstractDispatchEvent<EventType>>
- extends Event<EventType> {
-
- protected AbstractDispatchEvent(String owner, int[] index,
- InvocationContext context) {
- super(owner, index, context);
- }
-
- /**
- * Return the DispatchMessageType for this event object
- *
- * @return instance of DispatchMessageType represented by this event
- */
- public abstract DispatchMessageType getMessageType();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchCompletionEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchCompletionEvent.java
deleted file mode 100644
index 40cafda..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchCompletionEvent.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * Dispatch event containing detailing a (potentially partial) completion of a
- * stream of streaming result events. Layers which do not support streaming by
- * definition can't cope with this event and the dispatch stack checker should
- * prevent them from ever seeing it.
- *
- * @author Tom Oinn
- *
- */
-public class DispatchCompletionEvent extends
- AbstractDispatchEvent<DispatchCompletionEvent> {
-
- /**
- * Construct a new dispatch result completion event
- *
- * @param owner
- * @param index
- * @param context
- */
- public DispatchCompletionEvent(String owner, int[] index,
- InvocationContext context) {
- super(owner, index, context);
- }
-
- @Override
- public DispatchCompletionEvent popOwningProcess()
- throws ProcessIdentifierException {
- return new DispatchCompletionEvent(popOwner(), index, context);
- }
-
- @Override
- public DispatchCompletionEvent pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new DispatchCompletionEvent(pushOwner(localProcessName), index,
- context);
- }
-
- /**
- * DispatchMessageType.RESULT_COMPLETION
- */
- @Override
- public DispatchMessageType getMessageType() {
- return DispatchMessageType.RESULT_COMPLETION;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorEvent.java
deleted file mode 100644
index 76f967f..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorEvent.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * Message within the dispatch stack representing a single error report. This
- * may then be handled by upstream layers to retry jobs etc. If it reaches the
- * top of the dispatch stack the behaviour is configurable but by default it
- * will abort that workflow instance, being treated as a catastrophic
- * unhandleable problem.
- *
- * @author Tom Oinn
- *
- */
-public class DispatchErrorEvent extends
- AbstractDispatchEvent<DispatchErrorEvent> {
-
- private Throwable cause;
- private String message;
- private DispatchErrorType failureType;
- private Activity<?> failedActivity;
-
- /**
- * Create a new error event
- *
- * @param owningProcess
- * @param index
- * @param context
- * @param errorMessage
- * @param t
- */
- public DispatchErrorEvent(String owningProcess, int[] index,
- InvocationContext context, String errorMessage, Throwable t,
- DispatchErrorType failureType, Activity<?> failedActivity) {
- super(owningProcess, index, context);
- this.message = errorMessage;
- this.cause = t;
- this.failureType = failureType;
- this.failedActivity = failedActivity;
- }
-
- /**
- * Return the type of failure, this is used by upstream dispatch layers to
- * determine whether they can reasonably handle the error message
- */
- public DispatchErrorType getFailureType() {
- return this.failureType;
- }
-
- /**
- * Return the Activity instance which failed to produce this error message
- */
- public Activity<?> getFailedActivity() {
- return this.failedActivity;
- }
-
- /**
- * Return the throwable behind this error, or null if there was no exception
- * raised to create it.
- *
- * @return
- */
- public Throwable getCause() {
- return this.cause;
- }
-
- /**
- * Return the textual message representing this error
- *
- * @return
- */
- public String getMessage() {
- return this.message;
- }
-
- @Override
- public DispatchErrorEvent popOwningProcess()
- throws ProcessIdentifierException {
- return new DispatchErrorEvent(popOwner(), index, context, message,
- cause, failureType, failedActivity);
- }
-
- @Override
- public DispatchErrorEvent pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new DispatchErrorEvent(pushOwner(localProcessName), index,
- context, message, cause, failureType, failedActivity);
- }
-
- /**
- * DispatchMessageType.ERROR
- */
- @Override
- public DispatchMessageType getMessageType() {
- return DispatchMessageType.ERROR;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorType.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorType.java
deleted file mode 100644
index 009ce43..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchErrorType.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-/**
- * A simple enumeration of possible failure classes, used to determine whether
- * fault handling dispatch layers should attempt to handle a given failure
- * message.
- *
- * @author Tom Oinn
- *
- */
-public enum DispatchErrorType {
-
- /**
- * Indicates that the failure to invoke the activity was due to invalid
- * input data, in this case there is no point in trying to invoke the
- * activity again with the same data as it will always fail. Fault handling
- * layers such as retry should pass this error type through directly; layers
- * such as failover handlers should handle it as the input data may be
- * applicable to other activities within the processor.
- */
- DATA,
-
- /**
- * Indicates that the failure was related to the invocation of the resource
- * rather than the input data, and that an identical invocation at a later
- * time may succeed.
- */
- INVOCATION,
-
- /**
- * Indicates that the failure was due to missing or incorrect authentication
- * credentials and that retrying the activity invocation without modifying
- * the credential set is pointless.
- */
- AUTHENTICATION;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobEvent.java
deleted file mode 100644
index 7b0203e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobEvent.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * An event within the dispatch stack containing a single job's worth of data
- * along with an ordered list of Activity instances.
- *
- * @author Tom Oinn
- *
- */
-public class DispatchJobEvent extends AbstractDispatchEvent<DispatchJobEvent> {
-
- private Map<String, T2Reference> dataMap;
-
- private List<? extends Activity<?>> activities;
-
- /**
- * Create a new job event, specifying a complete set of input data and a
- * list of activities which could potentially consume this data
- *
- * @param owningProcess
- * @param index
- * @param context
- * @param data
- * @param activities
- */
- public DispatchJobEvent(String owningProcess, int[] index,
- InvocationContext context, Map<String, T2Reference> data,
- List<? extends Activity<?>> activities) {
- super(owningProcess, index, context);
- this.dataMap = data;
- this.activities = activities;
- }
-
- /**
- * The actual data carried by this dispatch job event object is in the form
- * of a map, where the keys of the map are Strings identifying the named
- * input and the values are Strings containing valid data identifiers within
- * the context of a visible DataManager object (see CloudOne specification
- * for further information on the DataManager system)
- *
- * @return Map of name to data reference for this Job
- */
- public Map<String, T2Reference> getData() {
- return this.dataMap;
- }
-
- /**
- * Returns a list of activity instances which can be applied to the data
- * contained by this job event.
- *
- * @return ordered list of Activity instances
- */
- public List<? extends Activity<?>> getActivities() {
- return this.activities;
- }
-
- @Override
- public DispatchJobEvent popOwningProcess()
- throws ProcessIdentifierException {
- return new DispatchJobEvent(popOwner(), index, context, dataMap, activities);
- }
-
- @Override
- public DispatchJobEvent pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new DispatchJobEvent(pushOwner(localProcessName), index, context, dataMap, activities);
- }
-
- /**
- * DispatchMessageType.JOB
- */
- @Override
- public DispatchMessageType getMessageType() {
- return DispatchMessageType.JOB;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobQueueEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobQueueEvent.java
deleted file mode 100644
index 5caec06..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchJobQueueEvent.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * A message within the dispatch stack containing a single reference to the job
- * queue from the iteration system along with an ordered list of Activity
- * instances.
- *
- * @author Tom Oinn
- *
- */
-public class DispatchJobQueueEvent extends
- AbstractDispatchEvent<DispatchJobQueueEvent> {
-
- private BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>> queue;
- private List<? extends Activity<?>> activities;
-
- /**
- * Create a new job queue event, specifying the queue of Completion and Job
- * objects and the list of activities which will be used to process the
- * corresponding dispatch events
- *
- * @param owner
- * @param context
- * @param queue
- * @param activities
- */
- public DispatchJobQueueEvent(String owner, InvocationContext context,
- BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>> queue,
- List<? extends Activity<?>> activities) {
- super(owner, new int[] {}, context);
- this.queue = queue;
- this.activities = activities;
- }
-
- public BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>> getQueue() {
- return this.queue;
- }
-
- public List<? extends Activity<?>> getActivities() {
- return this.activities;
- }
-
- @Override
- public DispatchJobQueueEvent popOwningProcess()
- throws ProcessIdentifierException {
- return new DispatchJobQueueEvent(popOwner(), context, queue, activities);
- }
-
- @Override
- public DispatchJobQueueEvent pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new DispatchJobQueueEvent(pushOwner(localProcessName), context,
- queue, activities);
- }
-
- /**
- * DispatchMessageType.JOB_QUEUE
- */
- @Override
- public DispatchMessageType getMessageType() {
- return DispatchMessageType.JOB_QUEUE;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchResultEvent.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchResultEvent.java
deleted file mode 100644
index a289318..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/events/DispatchResultEvent.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.events;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.ProcessIdentifierException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType;
-
-/**
- * Dispatch event containing the results from an invocation. If the event is
- * part of a stream of such events from a single job invocation the streaming
- * flag will be set to true - when set layers that do not support streaming
- * should either disable any related functionality or complain bitterly. They
- * should never see such an event as the type checker will in the future catch
- * such cases before they occur but for now it's something to watch for.
- *
- * @author Tom Oinn
- *
- */
-public class DispatchResultEvent extends
- AbstractDispatchEvent<DispatchResultEvent> {
-
- private Map<String, T2Reference> dataMap;
- private boolean streaming;
-
- /**
- * Construct a new dispatch result event, specifying the data and whether
- * the result is part of a stream of multiple results events from a single
- * invocation
- *
- * @param owner
- * @param index
- * @param context
- * @param data
- * @param streaming
- */
- public DispatchResultEvent(String owner, int[] index,
- InvocationContext context, Map<String, T2Reference> data,
- boolean streaming) {
- super(owner, index, context);
- this.dataMap = data;
- this.streaming = streaming;
- }
-
- /**
- * If this result is part of a stream, that is to say multiple result events
- * from a single job event, then return true otherwise return false.
- *
- * @return whether this is part of a streamed result set
- */
- public boolean isStreamingEvent() {
- return this.streaming;
- }
-
- /**
- * The result contains a map of named EntityIdentifier instances
- * corresponding to the result data.
- *
- * @return the result data for this event
- */
- public Map<String, T2Reference> getData() {
- return this.dataMap;
- }
-
- @Override
- public DispatchResultEvent popOwningProcess()
- throws ProcessIdentifierException {
- return new DispatchResultEvent(popOwner(), index, context, dataMap,
- streaming);
- }
-
- @Override
- public DispatchResultEvent pushOwningProcess(String localProcessName)
- throws ProcessIdentifierException {
- return new DispatchResultEvent(pushOwner(localProcessName), index,
- context, dataMap, streaming);
- }
-
- /**
- * DispatchMessageType.RESULT
- */
- @Override
- public DispatchMessageType getMessageType() {
- return DispatchMessageType.RESULT;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/package.html
deleted file mode 100644
index d4dc0d4..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/package.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<body>
-Definition and support classes for the Dispatch Stack. Each processor in
-a workflow contains a stack of dispatch layers with each layer being
-responsible for a particular aspect of the invocation. At a high level
-the stack consumes a queue of events from the iteration system along
-with an initial set of service proxy objects and is repsonsible for
-taking jobs from the queue and matching them to appropriate invocation
-targets.
-<p>Taverna 1 has in effect a single hardcoded dispatch stack for
-each processor with little control over it aside from a few basic
-properties. To replicate the same behaviour within Taverna 2 there are
-dispatch layers for parallelism, retry, failover and invocation. As the
-dispatch layer is an extension point we or others can provide other
-aspects such as recursive invocation and dynamic (runtime) binding from
-abstract service proxies to concrete instances. The last is possible
-because the service list is passed through the stack along with the
-queue or individual job events and can be rewritten or filtered by
-dispatch layer implementations.
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/AbstractIterationStrategyNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/AbstractIterationStrategyNode.java
deleted file mode 100644
index bd93be5..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/AbstractIterationStrategyNode.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
-
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreeNode;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Abstract superclass for implementations of IterationStrategyNode, adds logic
- * to connect nodes together and convenience methods to push jobs and completion
- * events up to the parent node.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public abstract class AbstractIterationStrategyNode implements
- IterationStrategyNode {
-
- private List<IterationStrategyNode> children = new ArrayList<IterationStrategyNode>();
-
- private IterationStrategyNode parent = null;
-
- /**
- * Implement TreeNode
- */
- public final synchronized Enumeration<IterationStrategyNode> children() {
- return new Vector<IterationStrategyNode>(children).elements();
- }
-
- /**
- * Clear the child list and parent of this node
- */
- public final synchronized void clear() {
- for (IterationStrategyNode child : children) {
- child.setParent(null);
- }
- children.clear();
- this.parent = null;
- }
-
- /**
- * Implement TreeNode
- */
- public boolean getAllowsChildren() {
- return true;
- }
-
- /**
- * Implement TreeNode
- */
- public final synchronized IterationStrategyNode getChildAt(int position) {
- return children.get(position);
- }
-
- /**
- * Implement TreeNode
- */
- public final int getChildCount() {
- return children.size();
- }
-
- /**
- * Implements IterationStrategyNode
- */
- public final synchronized List<IterationStrategyNode> getChildren() {
- return new ArrayList<IterationStrategyNode>(this.children);
- }
-
- /**
- * Implement TreeNode
- */
- public final synchronized int getIndex(TreeNode node) {
- return children.indexOf(node);
- }
-
- /**
- * Implement TreeNode
- */
- public final IterationStrategyNode getParent() {
- return parent;
- }
-
- public synchronized void insert(MutableTreeNode child) {
- insert(child, getChildCount());
- }
-
- public synchronized void insert(MutableTreeNode child, int index) {
- if (!getAllowsChildren()) {
- throw new IllegalStateException("Node does not allow children");
- }
- if (!(child instanceof IterationStrategyNode)) {
- throw new IllegalArgumentException(
- "Child not an instance of IterationStrategyNode: " + child);
- }
- if (child == this) {
- throw new IllegalArgumentException("Can't be it's own parent");
- }
- // Check if it is already there (in case we'll just move it)
- int alreadyExistsIndex = children.indexOf(child);
-
- children.add(index, (IterationStrategyNode) child);
-
- if (alreadyExistsIndex > -1) {
- // Remove it from the old position
- if (index < alreadyExistsIndex
- && alreadyExistsIndex + 1 < children.size()) {
- alreadyExistsIndex++;
- }
- children.remove(alreadyExistsIndex);
- }
- if (child.getParent() != this) {
- child.setParent(this);
- }
- }
-
- /**
- * Implement TreeNode
- */
- public boolean isLeaf() {
- return children.isEmpty();
- }
-
- public void remove(int index) {
- if (!getAllowsChildren()) {
- throw new IllegalStateException("Node does not allow children");
- }
- children.remove(index);
-
- }
-
- public synchronized void remove(MutableTreeNode node) {
- if (!getAllowsChildren()) {
- throw new IllegalStateException("Node does not allow children");
- }
- children.remove(node);
- if (node.getParent() == this) {
- node.setParent(null);
- }
- }
-
- public void removeFromParent() {
- if (parent != null) {
- IterationStrategyNode oldParent = parent;
- parent = null;
- oldParent.remove(this);
- }
- }
-
- /**
- * Implements IterationStrategyNode
- */
- public final synchronized void setParent(MutableTreeNode newParent) {
- if (newParent != null && !(newParent instanceof IterationStrategyNode)) {
- throw new IllegalArgumentException(
- "Parent not a IterationStrategyNode instance: " + newParent);
- }
- if (newParent != null && !newParent.getAllowsChildren()) {
- throw new IllegalStateException(
- "New parent does not allow children");
- }
- if (newParent == this) {
- throw new IllegalArgumentException("Can't be it's own parent");
- }
- removeFromParent();
- parent = (IterationStrategyNode) newParent;
- if (parent != null) {
- if (!parent.getChildren().contains(this)) {
- parent.insert(this);
- }
- }
- }
-
- public void setUserObject(Object object) {
- throw new UnsupportedOperationException("Can't set user object");
- }
-
- /**
- * Push the specified completion event to the parent node
- */
- protected final void pushCompletion(Completion completion) {
- if (parent != null) {
- parent.receiveCompletion(parent.getIndex(this), completion);
- }
- }
-
- /**
- * Push the specified job up to the parent node in the iteration strategy.
- */
- protected final void pushJob(Job job) {
- if (parent != null) {
- int index = parent.getIndex(this);
- if (index < 0) {
- throw new WorkflowStructureException(
- "Parent doesn't have this node in its child list!");
- }
- parent.receiveJob(parent.getIndex(this), job);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CompletionHandlingAbstractIterationStrategyNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CompletionHandlingAbstractIterationStrategyNode.java
deleted file mode 100644
index 7978e47..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CompletionHandlingAbstractIterationStrategyNode.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * A superclass for all iteration strategy nodes which are required to propagate
- * final completion events formed from multiple inputs. This is all the 'real'
- * iteration strategy nodes (but not the internal ones within the iteration
- * strategy object itself or the named input port nodes). All events are passed
- * to delegates in subclasses after which the completion state is checked, the
- * logic is as follows :
- * <p>
- * If the event received is final, that is to say it has an index of zero, and
- * final events have been received on all other inputs and at least one final
- * completion has been received then emit a final completion, otherwise do
- * nothing.
- * <p>
- * This means that subclasses should not emit final completion events themselves
- * - these will be handled by this superclass and emiting them in the subclass
- * will lead to duplicatation.
- *
- * @author Tom Oinn
- *
- */
-public abstract class CompletionHandlingAbstractIterationStrategyNode extends
- AbstractIterationStrategyNode {
-
- /**
- * Container class for the state of completion for a given process
- * identifier
- *
- * @author Tom Oinn
- *
- */
- private final class CompletionState {
- protected CompletionState(int indexLength) {
- inputComplete = new boolean[indexLength];
- for (int i = 0; i < indexLength; i++) {
- inputComplete[i] = false;
- }
- }
-
- protected boolean[] inputComplete;
- protected boolean receivedCompletion = false;
-
- /**
- * Return true iff all inputs have completed
- */
- protected boolean isComplete() {
- for (boolean inputCompletion : inputComplete) {
- if (!inputCompletion) {
- return false;
- }
- }
- return true;
- }
- }
-
- private Map<String, CompletionState> ownerToCompletion = new HashMap<String, CompletionState>();
-
- public final void receiveCompletion(int inputIndex, Completion completion) {
- innerReceiveCompletion(inputIndex, completion);
- if (completion.getIndex().length == 0) {
- pingCompletionState(inputIndex, completion.getOwningProcess(),
- true, completion.getContext());
- }
- }
-
- public final void receiveJob(int inputIndex, Job newJob) {
- innerReceiveJob(inputIndex, newJob);
- if (newJob.getIndex().length == 0) {
- pingCompletionState(inputIndex, newJob.getOwningProcess(), false,
- newJob.getContext());
- }
- }
-
- /**
- * Called after a final completion event has been emited for a given owning
- * process, should be used by subclasses to do any tidying required,
- * removing state etc.
- *
- * @param owningProcess
- */
- protected abstract void cleanUp(String owningProcess);
-
- private void pingCompletionState(int inputIndex, String owningProcess,
- boolean isCompletion, InvocationContext context) {
- synchronized (ownerToCompletion) {
- CompletionState cs = getCompletionState(owningProcess);
- cs.inputComplete[inputIndex] = true;
- if (isCompletion) {
- cs.receivedCompletion = true;
- }
- if (cs.isComplete() && cs.receivedCompletion) {
- ownerToCompletion.remove(owningProcess);
- cleanUp(owningProcess);
- pushCompletion(new Completion(owningProcess, new int[0],
- context));
- }
- }
- }
-
- private CompletionState getCompletionState(String owningProcess) {
- synchronized (ownerToCompletion) {
- if (ownerToCompletion.containsKey(owningProcess)) {
- return ownerToCompletion.get(owningProcess);
- } else {
- CompletionState cs = new CompletionState(getChildCount());
- ownerToCompletion.put(owningProcess, cs);
- return cs;
- }
- }
- }
-
- protected abstract void innerReceiveCompletion(int inputIndex,
- Completion completion);
-
- protected abstract void innerReceiveJob(int inputIndex, Job newJob);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CrossProduct.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CrossProduct.java
deleted file mode 100644
index fe4da95..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/CrossProduct.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * A cross product node combines its inputs in an 'all against all' manner. When
- * a new job is received on index 'n' a set of jobs is emited corresponding to
- * the combination of the new job with all other jobs on input indices other
- * than 'n'.
- *
- * @author Tom Oinn
- *
- */
-public class CrossProduct extends
- CompletionHandlingAbstractIterationStrategyNode {
-
- private Map<String, List<Set<Job>>> ownerToCache = new HashMap<String, List<Set<Job>>>();
-
- /**
- * Receive a job, emit jobs corresponding to the orthogonal join of the new
- * job with all jobs in all other input lists.
- */
- @Override
- public synchronized void innerReceiveJob(int inputIndex, Job newJob) {
- if (!ownerToCache.containsKey(newJob.getOwningProcess())) {
- List<Set<Job>> perInputCache = new ArrayList<Set<Job>>();
- for (int i = 0; i < getChildCount(); i++) {
- perInputCache.add(new HashSet<Job>());
- }
- ownerToCache.put(newJob.getOwningProcess(), perInputCache);
- }
- // Store the new job
- List<Set<Job>> perInputCache = ownerToCache.get(newJob
- .getOwningProcess());
- perInputCache.get(inputIndex).add(newJob);
- // Find all combinations of the new job with all permutations of jobs in
- // the other caches. We could make this a lot easier by restricting it
- // to a single pair of inputs, this might be a more sane way to go in
- // the future...
- Set<Job> workingSet = perInputCache.get(0);
- if (inputIndex == 0) {
- workingSet = new HashSet<Job>();
- workingSet.add(newJob);
- }
- for (int i = 1; i < getChildCount(); i++) {
- Set<Job> thisSet = perInputCache.get(i);
- if (i == inputIndex) {
- // This is the cache for the new job, so we rewrite the set to a
- // single element one containing only the newly submitted job
- thisSet = new HashSet<Job>();
- thisSet.add(newJob);
- }
- workingSet = merge(workingSet, thisSet);
- }
- for (Job outputJob : workingSet) {
- pushJob(outputJob);
- }
-
- }
-
- private Set<Job> merge(Set<Job> set1, Set<Job> set2) {
- Set<Job> newSet = new HashSet<Job>();
- for (Job job1 : set1) {
- for (Job job2 : set2) {
- int[] newIndex = new int[job1.getIndex().length
- + job2.getIndex().length];
- int j = 0;
- for (int i = 0; i < job1.getIndex().length; i++) {
- newIndex[j++] = job1.getIndex()[i];
- }
- for (int i = 0; i < job2.getIndex().length; i++) {
- newIndex[j++] = job2.getIndex()[i];
- }
- Map<String, T2Reference> newDataMap = new HashMap<String, T2Reference>();
- newDataMap.putAll(job1.getData());
- newDataMap.putAll(job2.getData());
- newSet.add(new Job(job1.getOwningProcess(), newIndex,
- newDataMap, job1.getContext()));
- }
- }
- return newSet;
- }
-
- @Override
- public synchronized void innerReceiveCompletion(int inputIndex,
- Completion completion) {
- // Do nothing, let the superclass handle final completion events
- }
-
- @Override
- protected final synchronized void cleanUp(String owningProcess) {
- ownerToCache.remove(owningProcess);
- }
-
- public synchronized int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException {
- int temp = 0;
- for (IterationStrategyNode child : getChildren()) {
- temp += child.getIterationDepth(inputDepths);
- }
- return temp;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DotProduct.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DotProduct.java
deleted file mode 100644
index 9aebb37..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DotProduct.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.TreeCache;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * The dot product matches jobs by index array, when a job is received a job is
- * emited if and only if the index array of the new job is matched exactly by
- * index arrays of one job in each other input index.
- *
- * @author Tom Oinn
- *
- */
-public class DotProduct extends CompletionHandlingAbstractIterationStrategyNode {
-
- Map<String, TreeCache[]> ownerToCache = new HashMap<String, TreeCache[]>();
-
- @Override
- public synchronized void innerReceiveJob(int inputIndex, Job newJob) {
- String owningProcess = newJob.getOwningProcess();
- if (!ownerToCache.containsKey(owningProcess)) {
- TreeCache[] caches = new TreeCache[getChildCount()];
- for (int i = 0; i < getChildCount(); i++) {
- caches[i] = new TreeCache();
- }
- ownerToCache.put(owningProcess, caches);
- }
- // Firstly store the new job in the cache, this isn't optimal but is
- // safe for now - we can make this more efficient by doing the
- // comparison first and only storing the job if required
- TreeCache[] caches = ownerToCache.get(owningProcess);
- caches[inputIndex].insertJob(newJob);
- int[] indexArray = newJob.getIndex();
- boolean foundMatch = true;
- Map<String, T2Reference> newDataMap = new HashMap<String, T2Reference>();
- for (TreeCache cache : caches) {
-
- if (cache.containsLocation(indexArray)) {
- newDataMap.putAll(cache.get(indexArray).getData());
- } else {
- foundMatch = false;
- }
- }
- if (foundMatch) {
- Job j = new Job(owningProcess, indexArray, newDataMap, newJob
- .getContext());
- // Remove all copies of the job with this index from the cache,
- // we'll never use it
- // again and it pays to be tidy
- for (TreeCache cache : caches) {
- cache.cut(indexArray);
- }
- pushJob(j);
- }
- }
-
- /**
- * Delegate to the superclass to propogate completion events if and only if
- * the completion event is a final one. We can potentially implement finer
- * grained logic here in the future.
- */
- @Override
- public synchronized void innerReceiveCompletion(int inputIndex,
- Completion completion) {
- // Do nothing, let the superclass handle final completion events, ignore
- // others for now (although in theory we should be able to do better
- // than this really)
- }
-
- @Override
- protected synchronized void cleanUp(String owningProcess) {
- ownerToCache.remove(owningProcess);
- }
-
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException {
- // Check that all input depths are the same
- int depth = getChildAt(0).getIterationDepth(inputDepths);
- for (IterationStrategyNode childNode : getChildren()) {
- if (childNode.getIterationDepth(inputDepths) != depth) {
- throw new IterationTypeMismatchException(
- "Mismatched input types for dot product node");
- }
- }
- return depth;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategy.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategy.java
deleted file mode 100644
index 84a6031..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.Map;
-
-public interface IterationStrategy {
-
- /**
- * The iteration strategy results in a set of job objects with a particular
- * job index. This method returns the length of that index array when the
- * specified input types are used. Input types are defined in terms of name
- * and integer pairs where the name is the name of a NamedInputPortNode in
- * the iteration strategy and the integer is the depth of the input data
- * collection (i.e. item depth + index array length for that item which
- * should be a constant).
- *
- * @param inputDepths
- * map of port names to input collection depth
- * @return the length of the index array which will be generated for each
- * resultant job object.
- */
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException;
-
- /**
- * Return a map of port name -> desired cardinality for this iteration
- * strategy
- */
- public Map<String, Integer> getDesiredCardinalities();
-
- public TerminalNode getTerminalNode();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyNode.java
deleted file mode 100644
index 86f1df3..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyNode.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Map;
-
-import javax.swing.tree.MutableTreeNode;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Interface for nodes within an iteration strategy layer
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public interface IterationStrategyNode extends MutableTreeNode {
-
- /**
- * Specialised return type of {@link TreeNode#children()}
- */
-
- public Enumeration<IterationStrategyNode> children();
-
- /**
- * Remove all children nodes and set the parent to <code>null</code>.
- */
- public void clear();
-
- /**
- * Specialised return type of {@link TreeNode#getChildAt(int)}
- */
- public IterationStrategyNode getChildAt(int childIndex);
-
- /**
- * Return a copy of the list of children nodes, or an empty list if
- * {@link #getAllowsChildren()} is <code>false</code>.
- *
- * @return List of children nodes.
- */
- public List<IterationStrategyNode> getChildren();
-
- /**
- * In the context of an enclosing iteration strategy each node should be
- * able to return the iteration depth, i.e. the length of the index array,
- * for items it will emit. In all cases other than leaf nodes this is
- * defined in terms of the depth of child nodes. The input cardinalities for
- * named ports are pushed through each node so that the terminal nodes
- * corresponding to input port collators can evaluate this expression -
- * pushing it through the entire evaluation means we don't have to keep
- * state anywhere in the leaf nodes (standard dependency injection)
- * <p>
- * Nodes can choose to throw the IterationTypeMismatchException if their
- * inputs aren't compatible with the operational semantics of the node such
- * as in the case of a dot product node with inputs with different depths.
- *
- * @param inputDepths
- * @return
- * @throws IterationTypeMismatchException
- */
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException;
-
- /**
- * Specialised return type of {@link TreeNode#getParent()}
- */
- public IterationStrategyNode getParent();
-
- /**
- * Insert a new child node. The new child will be added in the end of the
- * list, so this would be equivalent to insert(child, getChildCount()).
- *
- * @param child
- * Child node to add
- */
- public void insert(MutableTreeNode child);
-
- /**
- * Nodes can also receive completion events, the simplest being one
- * declaring that no further input is expected on the given input, or
- * partial completion events which are interpreted as 'no event with an
- * index array prefixed by the specified completion index array will be
- * received on the specified index'
- */
- public void receiveCompletion(int inputIndex, Completion completion);
-
- /**
- * The nodes within the iteration strategy, a tree structure, are event
- * based. When a new fragment of a job from upstream in the tree (towards
- * leaves) arrives it is handled by this method. Implementations will
- * probably have to handle state management, i.e. what jobs have we already
- * seen, and emit appropriate jobs to downstream nodes.
- *
- * @param inputIndex
- * @param newJob
- */
- public void receiveJob(int inputIndex, Job newJob);
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyStack.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyStack.java
deleted file mode 100644
index 1423e8e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationStrategyStack.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Stack of iteration strategy containers. The stacking behaviour allows for
- * staged implicit iteration where intermediate strategies are used to drill
- * into the collection structure to a certain depth with a final one used to
- * render job objects containing data at the correct depth for the process. This
- * was achieved in Taverna 1 through the combination of nested workflows and
- * 'forcing' processors which could echo and therefore force input types of the
- * workflow to a particular cardinality.
- *
- * @author Tom Oinn
- *
- */
-public interface IterationStrategyStack {
-
- /**
- * The iteration strategy stack consists of an ordered list of iteration
- * strategies.
- *
- * @return An unmodifiable copy of the list containing the iteration
- * strategy objects in order, with the strategy at position 0 in the
- * list being the one to which data is fed first.
- */
- public List<? extends IterationStrategy> getStrategies();
-
- /**
- * Calculate the depth of the iteration strategy stack as a whole given a
- * set of named inputs and their cardinalities. This depth is the length of
- * the index array which will be added to any output data, so the resultant
- * output of each port in the owning processor is the depth of that port as
- * defined by the activity plus this value.
- *
- * @param inputDepths
- * @return
- * @throws IterationTypeMismatchException
- * @throws MissingIterationInputException
- */
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException,
- MissingIterationInputException;
-
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationTypeMismatchException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationTypeMismatchException.java
deleted file mode 100644
index 9db4a34..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/IterationTypeMismatchException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-/**
- * Thrown during the typecheck phase when an iteration strategy is configured
- * such that at runtime it would fail. This is generally because a dot product
- * node has been specified where the children of that node will have different
- * cardinalities (in this case the dot product isn't defined)
- *
- * @author Tom Oinn
- *
- */
-public class IterationTypeMismatchException extends Exception {
-
- private static final long serialVersionUID = -3034020607723767223L;
-
- public IterationTypeMismatchException() {
- // TODO Auto-generated constructor stub
- }
-
- public IterationTypeMismatchException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public IterationTypeMismatchException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public IterationTypeMismatchException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/MissingIterationInputException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/MissingIterationInputException.java
deleted file mode 100644
index 6e09470..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/MissingIterationInputException.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-/**
- * Thrown when an attempt is made to evaluate the type of the iteration strategy
- * but one or more input ports aren't defined in the input array of types.
- * Shouldn't normally happen as this will be handled by the type checker
- * detecting that there aren't enough inputs to check but we indicate it for
- * extra robustness.
- *
- * @author Tom Oinn
- *
- */
-public class MissingIterationInputException extends Exception {
-
- /**
- *
- */
- private static final long serialVersionUID = -1615949178096496592L;
-
- public MissingIterationInputException() {
- // TODO Auto-generated constructor stub
- }
-
- public MissingIterationInputException(String arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public MissingIterationInputException(Throwable arg0) {
- super(arg0);
- // TODO Auto-generated constructor stub
- }
-
- public MissingIterationInputException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- // TODO Auto-generated constructor stub
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/NamedInputPortNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/NamedInputPortNode.java
deleted file mode 100644
index 7859bdc..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/NamedInputPortNode.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Acts as the input to a stage within the iteration strategy, passes all jobs
- * straight through. NamedInputPortNode objects are, as the name suggests,
- * named. These names correspond to the names of abstract input ports on the
- * Processor object to which the iteration strategy belongs.
- *
- * @author Tom Oinn
- *
- */
-public class NamedInputPortNode extends AbstractIterationStrategyNode {
-
- private String portName;
-
- private int desiredCardinality;
-
- public NamedInputPortNode(String name, int cardinality) {
- super();
- this.portName = name;
- this.desiredCardinality = cardinality;
- }
-
- /**
- * If this node receives a job it will always be pushed without modification
- * up to the parent
- */
- public void receiveJob(int inputIndex, Job newJob) {
- pushJob(newJob);
- }
-
- /**
- * Completion events are passed straight through the same as jobs
- */
- public void receiveCompletion(int inputIndex, Completion completion) {
- pushCompletion(completion);
- }
-
- /**
- * Each node maps to a single named input port within the processor
- */
- public String getPortName() {
- return this.portName;
- }
-
- /**
- * Each node defines the level of collection depth for that input port
- */
- public int getCardinality() {
- return this.desiredCardinality;
- }
-
- /**
- * These nodes correspond to inputs to the iteration strategy and are always
- * leaf nodes as a result.
- *
- * @override
- */
- @Override
- public boolean isLeaf() {
- return true;
- }
-
- /**
- * These nodes can never have children
- *
- * @override
- */
- @Override
- public boolean getAllowsChildren() {
- return false;
- }
-
- /**
- * Iteration depth is the difference between the supplied input depth and
- * the desired one. If the desired depth is greater then wrapping will
- * happen and the iteration depth will be zero (rather than a negative!)
- */
- public int getIterationDepth(Map<String, Integer> inputDepths) {
- int myInputDepth = inputDepths.get(portName);
- int depthMismatch = myInputDepth - desiredCardinality;
- return (depthMismatch > 0 ? depthMismatch : 0);
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + " " + getPortName() + "("
- + getCardinality() + ")";
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/PrefixDotProduct.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/PrefixDotProduct.java
deleted file mode 100644
index 0767a3e..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/PrefixDotProduct.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.TreeCache;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Matches jobs where the index array of the job on index 0 is the prefix of the
- * index array of the job on index 1. This node can only ever have exactly two
- * child nodes!
- *
- * @author Tom Oinn
- *
- */
-public class PrefixDotProduct extends DotProduct {
-
- @Override
- protected synchronized final void cleanUp(String owningProcess) {
- ownerToCache.remove(owningProcess);
- }
-
- @Override
- public void innerReceiveJob(int inputIndex, Job newJob) {
- String owningProcess = newJob.getOwningProcess();
- TreeCache[] caches;
- synchronized (ownerToCache) {
- caches = ownerToCache.get(owningProcess);
- // Create the caches if not already initialized
- if (caches == null) {
- caches = new TreeCache[getChildCount()];
- for (int i = 0; i < getChildCount(); i++) {
- caches[i] = new TreeCache();
- }
- ownerToCache.put(owningProcess, caches);
- }
- }
-
- // Store the job
- caches[inputIndex].insertJob(newJob);
-
- // If this job came in on index 0 we have to find all jobs in the cache
- // for index 1 which have the index array as a prefix. Fortunately this
- // is quite easy due to the tree structure of the cache, we can just ask
- // for all nodes in the cache with that index.
- if (inputIndex == 0) {
- int[] prefixIndexArray = newJob.getIndex();
- List<Job> matchingJobs;
- synchronized (caches[1]) {
- // Match all jobs and remove them so other calls can't produce
- // duplicates
- matchingJobs = caches[1].jobsWithPrefix(prefixIndexArray);
- caches[1].cut(prefixIndexArray);
- }
- for (Job job : matchingJobs) {
- Map<String, T2Reference> newDataMap = new HashMap<String, T2Reference>();
- newDataMap.putAll(newJob.getData());
- newDataMap.putAll(job.getData());
- Job mergedJob = new Job(owningProcess, job.getIndex(),
- newDataMap, newJob.getContext());
- pushJob(mergedJob);
- }
- }
-
- // If the job came in on index 1 we have to find the job on index 0 that
- // matches the first 'n' indices, where 'n' is determined by the depth
- // of jobs on the cache for index 0.
- else if (inputIndex == 1) {
- // Only act if we've received jobs on the cache at index 0
- if (caches[0].getIndexLength() > 0) {
- int[] prefix = new int[caches[0].getIndexLength()];
- for (int i = 0; i < prefix.length; i++) {
- prefix[i] = newJob.getIndex()[i];
- }
- Job j = caches[0].get(prefix);
- if (j != null) {
- Map<String, T2Reference> newDataMap = new HashMap<String, T2Reference>();
- newDataMap.putAll(j.getData());
- newDataMap.putAll(newJob.getData());
- Job mergedJob = new Job(owningProcess, newJob.getIndex(),
- newDataMap, newJob.getContext());
- pushJob(mergedJob);
- }
- }
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TerminalNode.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TerminalNode.java
deleted file mode 100644
index 15836bb..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TerminalNode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import javax.swing.tree.MutableTreeNode;
-
-/**
- * The terminal node is the root of the iteration strategy tree, it is
- * responsible for forwarding all events up to the iteration strategy itself
- * which can then propogate them to the strategy stack.
- */
-public abstract class TerminalNode extends AbstractIterationStrategyNode {
- @Override
- public synchronized void insert(MutableTreeNode child, int index) {
- if (getChildCount() > 0 && getChildAt(0) != child) {
- throw new IllegalStateException(
- "The terminal node can have maximum one child");
- }
- super.insert(child, index);
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/package.html
deleted file mode 100644
index 65f2a61..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/package.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-Object model and enactment logic for the iteration strategy component of
-a Processor
-</body>
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/DeserializationException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/DeserializationException.java
deleted file mode 100644
index 904299b..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/DeserializationException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization;
-
-
-public class DeserializationException extends Exception {
-
- public DeserializationException(String msg) {
- super(msg);
- }
-
- public DeserializationException(String msg, Exception cause) {
- super(msg,cause);
- }
-
- private static final long serialVersionUID = -5905705659863088259L;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/SerializationException.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/SerializationException.java
deleted file mode 100644
index 03709b2..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/SerializationException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization;
-
-
-public class SerializationException extends Exception {
-
- public SerializationException(String msg, Exception cause) {
- super(msg,cause);
- }
-
- public SerializationException(String msg) {
- super(msg);
- }
-
- private static final long serialVersionUID = -218787623524401819L;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializer.java
deleted file mode 100644
index db8ef8b..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.jdom.Element;
-
-/**
- * The API that defines the entry point for deserialising a complete dataflow XML document into a dataflow instance.
- *
- * @author Stuart Owen
- *
- */
-public interface XMLDeserializer {
-
- /**
- * Deserialises a complete dataflow document into a Dataflow instance.
- *
- * @param element a jdom element holding the XML document that represents the dataflow
- * @return an instance of the Dataflow
- * @throws DeserializationException
- * @throws EditException - should an error occur whilst constructing the dataflow via Edits
- *
- * @see Edits
- */
- public Dataflow deserializeDataflow(Element element) throws DeserializationException,EditException;
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerRegistry.java
deleted file mode 100644
index 918d162..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerRegistry.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-import org.apache.log4j.Logger;
-
-public class XMLDeserializerRegistry extends SPIRegistry<XMLDeserializer> {
-
- private static Logger logger = Logger.getLogger(XMLDeserializerRegistry.class);
-
- private static XMLDeserializerRegistry instance;
-
- protected XMLDeserializerRegistry() {
- super(XMLDeserializer.class);
- }
-
- public static synchronized XMLDeserializerRegistry getInstance() {
- if (instance == null) {
- instance = new XMLDeserializerRegistry();
- }
- return instance;
- }
-
- public XMLDeserializer getDeserializer() {
- List<XMLDeserializer> instances = getInstance().getInstances();
- XMLDeserializer result = null;
- if (instances.size() == 0) {
- logger.error("No Deserializer implementation defined");
- } else {
- if (instances.size() > 1)
- logger.error("More that 1 XML Deserializer implementation defined, using the first");
- result=instances.get(0);
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializer.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializer.java
deleted file mode 100644
index a50a9e9..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.serialization.SerializationException;
-
-import org.jdom.Element;
-
-
-/**
- * The main interface that defines the entry point for serialising a Dataflow instance into a JDOM Element
- * <br>
- * If the dataflow internally contains DataflowActivities (i.e. nested dataflows) then the resulting XML will also include
- * a definition of these.
- *
- * @author Stuart Owen
- * @author Alan R Williams
- *
- */
-public interface XMLSerializer {
-
- /**
- * Serialises the dataflow into a JDOM element
- * @param dataflow
- * @return
- * @throws SerializationException if there is a problem serializing the dataflow
- */
- Element serializeDataflow(Dataflow dataflow) throws SerializationException;
-
- /**
- * Specify what program produced the serialization
- *
- * @param producedBy
- */
- void setProducedBy(String producedBy);
-
- String getProducedBy();
-
-}
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerRegistry.java b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerRegistry.java
deleted file mode 100644
index bef47e8..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerRegistry.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-
-import net.sf.taverna.t2.spi.SPIRegistry;
-
-import org.apache.log4j.Logger;
-
-public class XMLSerializerRegistry extends SPIRegistry<XMLSerializer> {
-
- private static Logger logger = Logger.getLogger(XMLSerializerRegistry.class);
-
- private static XMLSerializerRegistry instance;
-
- protected XMLSerializerRegistry() {
- super(XMLSerializer.class);
- }
-
- public static synchronized XMLSerializerRegistry getInstance() {
- if (instance == null) {
- instance = new XMLSerializerRegistry();
- }
- return instance;
- }
-
- public XMLSerializer getSerializer() {
- List<XMLSerializer> instances = getInstance().getInstances();
- XMLSerializer result = null;
- if (instances.size() == 0) {
- logger.error("No Serializer implementation defined");
- } else {
- if (instances.size() > 1)
- logger.error("More that 1 XML Serializer implementation defined, using the first");
- result=instances.get(0);
- }
- return result;
- }
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html b/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html
deleted file mode 100644
index d1800c8..0000000
--- a/trunk/workflowmodel-api/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-The API definition for serialization/deserialization of a dataflow to and from XML.
-</body>
\ No newline at end of file
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/monitor/TestMonitorManager.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/monitor/TestMonitorManager.java
deleted file mode 100644
index 29285fd..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/monitor/TestMonitorManager.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorManager.AddPropertiesMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.DeregisterNodeMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.MonitorMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.RegisterNodeMessage;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test {@link MonitorManager}.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class TestMonitorManager {
-
- private MonitorManager monitorManager;
-
- @Test
- public void addMonitor() {
- TestMonitor testMonitor = new TestMonitor();
- monitorManager.addObserver(testMonitor);
- assertEquals(0, testMonitor.getCounts());
- // Make a fake registration
- Object workflowObject = "The workflow object as a string";
- String[] owningProcess = { "dataflow0", "process4", "42424" };
- Set<MonitorableProperty<?>> properties = new HashSet<MonitorableProperty<?>>();
- properties.add(new ExampleProperty());
- monitorManager.registerNode(workflowObject, owningProcess, properties);
-
- assertEquals(1, testMonitor.getCounts());
- assertEquals(monitorManager, testMonitor.lastSender);
- MonitorMessage lastMessage = testMonitor.lastMessage;
- assertTrue("Owning process did not match", Arrays.equals(owningProcess,
- lastMessage.getOwningProcess()));
-
- assertTrue("Message was not a RegisterNodeMessage",
- lastMessage instanceof RegisterNodeMessage);
- RegisterNodeMessage registerNodeMessage = (RegisterNodeMessage) lastMessage;
- assertSame("Workflow object was not same", workflowObject,
- registerNodeMessage.getWorkflowObject());
- assertEquals(properties, registerNodeMessage.getProperties());
-
- assertEquals("Another event was received", 1, testMonitor.getCounts());
- }
-
- @Test
- public void addProperties() {
- TestMonitor testMonitor = new TestMonitor();
- monitorManager.addObserver(testMonitor);
- assertEquals(0, testMonitor.getCounts());
- // Make a fake add properties
- String[] owningProcess = { "dataflow0", "process4", "42424" };
- Set<MonitorableProperty<?>> newProperties = new HashSet<MonitorableProperty<?>>();
- newProperties.add(new ExampleProperty());
- monitorManager.addPropertiesToNode(owningProcess, newProperties);
-
- assertEquals(1, testMonitor.getCounts());
- assertEquals(monitorManager, testMonitor.lastSender);
- MonitorMessage lastMessage = testMonitor.lastMessage;
- assertTrue("Owning process did not match", Arrays.equals(owningProcess,
- lastMessage.getOwningProcess()));
-
- assertTrue("Message was not a AddPropertiesMessage",
- lastMessage instanceof AddPropertiesMessage);
- AddPropertiesMessage registerNodeMessage = (AddPropertiesMessage) lastMessage;
- assertEquals(newProperties, registerNodeMessage.getNewProperties());
-
- assertEquals("Another event was received", 1, testMonitor.getCounts());
- }
-
- @Before
- public void findMonitorManager() {
- monitorManager = MonitorManager.getInstance();
- }
-
- @Test
- public void removeMonitor() {
- TestMonitor testMonitor = new TestMonitor();
- monitorManager.addObserver(testMonitor);
- assertEquals(0, testMonitor.getCounts());
-
- // Make a fake deregistration
- String[] owningProcess = { "dataflow0", "process4", "1337" };
- monitorManager.deregisterNode(owningProcess);
-
- assertEquals(1, testMonitor.getCounts());
- assertEquals(monitorManager, testMonitor.lastSender);
- MonitorMessage lastMessage = testMonitor.lastMessage;
- assertTrue("Owning process did not match", Arrays.equals(owningProcess,
- lastMessage.getOwningProcess()));
- assertTrue("Message was not a DeregisterNodeMessage",
- lastMessage instanceof DeregisterNodeMessage);
- assertEquals("Another event was received", 1, testMonitor.getCounts());
- }
-
- public class TestMonitor implements Observer<MonitorManager.MonitorMessage> {
-
- private int counts = 0;
- private MonitorMessage lastMessage;
- private Observable<MonitorMessage> lastSender;
-
- public int getCounts() {
- return counts;
- }
-
- public MonitorMessage getMessage() {
- return lastMessage;
- }
-
- public Observable<MonitorMessage> getSender() {
- return lastSender;
- }
-
- public synchronized void notify(Observable<MonitorMessage> sender,
- MonitorMessage message) throws Exception {
- this.lastSender = sender;
- this.lastMessage = message;
- this.counts++;
- }
- }
-
- private final class ExampleProperty implements MonitorableProperty<String> {
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "monitor", "test", "example" };
- }
-
- public String getValue() throws NoSuchPropertyException {
- return "Example property value";
- }
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker.java
deleted file mode 100644
index 4c25e5f..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-
-public class FloatHealthChecker implements HealthChecker<Float> {
-
- public boolean canHandle(Object subject) {
- return subject!=null && subject instanceof Float;
- }
-
- public HealthReport checkHealth(Float subject) {
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker2.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker2.java
deleted file mode 100644
index 0dd9f01..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/FloatHealthChecker2.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-
-public class FloatHealthChecker2 implements HealthChecker<Float> {
-
- public boolean canHandle(Object subject) {
- return subject!=null && subject instanceof Float;
- }
-
- public HealthReport checkHealth(Float subject) {
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactoryTest.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactoryTest.java
deleted file mode 100644
index 696e65e..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerFactoryTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthCheckerFactory;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class HealthCheckerFactoryTest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testGetHealthCheckerForObject() {
- String str = "A String";
- List<HealthChecker<?>> checkers = HealthCheckerFactory.getInstance().getHealthCheckersForObject(str);
- assertEquals("There should be 1 checker for String",1,checkers.size());
-
- Long l = new Long(123);
- checkers = HealthCheckerFactory.getInstance().getHealthCheckersForObject(l);
- assertEquals("There should be 0 checkers for Long",0,checkers.size());
-
- Float f = new Float(2.5f);
- checkers = HealthCheckerFactory.getInstance().getHealthCheckersForObject(f);
- assertEquals("There should be 2 checkers for Float",2,checkers.size());
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistryTest.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistryTest.java
deleted file mode 100644
index 8a13e59..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthCheckerRegistryTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import static org.junit.Assert.fail;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthCheckerRegistry;
-
-import org.junit.Test;
-
-public class HealthCheckerRegistryTest {
-
-
- @SuppressWarnings("unchecked")
- @Test
- public void testGetInstances() {
- HealthCheckerRegistry registry = new HealthCheckerRegistry();
- List<HealthChecker> checkers = registry.getInstances();
- for (HealthChecker<?> checker : checkers) {
- if (checker.canHandle("a string")) return;
- }
- fail("A checker should have been found that can handle String");
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthReportTest.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthReportTest.java
deleted file mode 100644
index dded8be..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/HealthReportTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport.Status;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class HealthReportTest {
-
- HealthReport report;
-
- @Before
- public void setUp() throws Exception {
- List<HealthReport> subreports = new ArrayList<HealthReport>();
- subreports.add(new HealthReport("sub subject","this is a subreport",Status.OK));
- report = new HealthReport("a subject","a message",Status.WARNING,subreports);
- }
-
- @Test
- public void testActivityHealthReportStringStatus() {
- report = new HealthReport("the subject","a string",Status.SEVERE);
- assertEquals("a string",report.getMessage());
- assertEquals(Status.SEVERE,report.getStatus());
- assertEquals("the subject",report.getSubject());
- assertEquals("the subreports should be an empty list",0,report.getSubReports().size());
- }
-
- @Test
- public void testGetMessage() {
- assertEquals("a message",report.getMessage());
- }
-
- @Test
- public void testGetStatus() {
- assertEquals(Status.WARNING,report.getStatus());
- }
-
- @Test
- public void testGetSubject() {
- assertEquals("a subject",report.getSubject());
- }
-
- @Test
- public void testGetSubreports() {
- List<HealthReport> subreports = report.getSubReports();
- assertEquals("There should be 1 report",1,subreports.size());
- assertEquals("Wrong subject","sub subject",subreports.get(0).getSubject());
- }
-
- @Test
- public void testStatusHighestIncludingSubReports() {
- report = new HealthReport("parent","set to ok",Status.OK);
- assertEquals("should be OK",Status.OK,report.getStatus());
- report.getSubReports().add(new HealthReport("child1","set to warning",Status.WARNING));
- assertEquals("should be WARNING",Status.WARNING,report.getStatus());
- report.getSubReports().add(new HealthReport("child1","set to severe",Status.SEVERE));
- assertEquals("should be SEVERE",Status.SEVERE,report.getStatus());
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/StringHealthChecker.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/StringHealthChecker.java
deleted file mode 100644
index 1ef8132..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/health/StringHealthChecker.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.health;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-
-public class StringHealthChecker implements HealthChecker<String> {
-
- public boolean canHandle(Object subject) {
- return subject!=null && subject instanceof String;
- }
-
- public HealthReport checkHealth(String subject) {
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TestIterationStrategyNodes.java b/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TestIterationStrategyNodes.java
deleted file mode 100644
index 90f0cfd..0000000
--- a/trunk/workflowmodel-api/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/TestIterationStrategyNodes.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import static org.junit.Assert.*;
-
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Map;
-
-import javax.swing.tree.TreeNode;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test {@link AbstractIterationStrategyNode} implementations for
- * {@link TreeNode} behaviour.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class TestIterationStrategyNodes {
-
- TerminalNode root;
- private NamedInputPortNode input1;
- private NamedInputPortNode input2;
- private CrossProduct crossProduct1;
- private CrossProduct crossProduct2;
- private DotProduct dotProduct1;
- private DotProduct dotProduct2;
-
- @Test
- public void addSingleChildToTerminal() throws Exception {
- assertNull(input1.getParent());
- assertEquals(0, root.getChildCount());
- root.insert(input1);
- assertEquals(root, input1.getParent());
- assertEquals(1, root.getChildCount());
- assertEquals(input1, root.getChildAt(0));
- assertEquals(Arrays.asList(input1), root.getChildren());
-
- root.insert(input1);
- assertEquals(1, root.getChildCount());
-
- root.insert(input1, 0);
- assertEquals(1, root.getChildCount());
- }
-
- @Test(expected = IllegalStateException.class)
- public void cantAddSeveralChildrenToTerminal() throws Exception {
- root.insert(input1);
- root.insert(input2);
- }
-
- @Test
- public void addCrossProduct() throws Exception {
- assertNull(crossProduct1.getParent());
- crossProduct1.setParent(root);
- assertEquals(root, crossProduct1.getParent());
- assertEquals(1, root.getChildCount());
- assertEquals(crossProduct1, root.getChildAt(0));
- assertEquals(Arrays.asList(crossProduct1), root.getChildren());
- assertEquals(0, crossProduct1.getChildCount());
-
- crossProduct1.insert(input1);
- assertEquals(input1, crossProduct1.getChildAt(0));
- crossProduct1.insert(input2, 0);
- assertEquals(input2, crossProduct1.getChildAt(0));
- assertEquals(input1, crossProduct1.getChildAt(1));
- assertEquals(2, crossProduct1.getChildCount());
- assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
-
- // A re-insert should move it
- crossProduct1.insert(input2, 2);
- assertEquals(2, crossProduct1.getChildCount());
- assertEquals(Arrays.asList(input1, input2), crossProduct1.getChildren());
-
- crossProduct1.insert(input2, 0);
- assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
-
- crossProduct1.insert(input1, 1);
- assertEquals(Arrays.asList(input2, input1), crossProduct1.getChildren());
- }
-
- @Test
- public void addCrossProductMany() {
- crossProduct1.insert(dotProduct1);
- crossProduct1.insert(dotProduct2);
- crossProduct1.insert(input1);
- crossProduct1.insert(input2);
- crossProduct1.insert(crossProduct2);
- assertEquals(5, crossProduct1.getChildCount());
- assertEquals(Arrays.asList(dotProduct1, dotProduct2, input1, input2,
- crossProduct2), crossProduct1.getChildren());
- Enumeration<IterationStrategyNode> enumeration = crossProduct1
- .children();
- assertTrue(enumeration.hasMoreElements());
- assertEquals(dotProduct1, enumeration.nextElement());
- assertEquals(dotProduct2, enumeration.nextElement());
- assertEquals(input1, enumeration.nextElement());
- assertEquals(input2, enumeration.nextElement());
- assertEquals(crossProduct2, enumeration.nextElement());
- assertFalse(enumeration.hasMoreElements());
- }
-
- @Test
- public void moveNodeToDifferentParent() {
- crossProduct1.setParent(root);
- crossProduct1.insert(input1);
- crossProduct1.insert(dotProduct1);
- dotProduct1.insert(input2);
- dotProduct1.insert(crossProduct2);
-
- // Check tree
- assertEquals(crossProduct2, root.getChildAt(0).getChildAt(1)
- .getChildAt(1));
- assertEquals(Arrays.asList(input2, crossProduct2), dotProduct1
- .getChildren());
-
- crossProduct1.insert(crossProduct2, 1);
- assertEquals(Arrays.asList(input1, crossProduct2, dotProduct1),
- crossProduct1.getChildren());
- assertEquals(crossProduct1, crossProduct2.getParent());
- // Should no longer be in dotProduct1
- assertEquals(Arrays.asList(input2), dotProduct1.getChildren());
- }
-
- @Test(expected = IllegalStateException.class)
- public void cantAddToNamedInput() throws Exception {
- input1.insert(dotProduct1);
- }
-
- @Test
- public void cantAddSelf() throws Exception {
- dotProduct1.setParent(crossProduct1);
- try {
- dotProduct1.insert(dotProduct1);
- fail("Didn't throw IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // Make sure we didn't loose our old parent and
- // ended up in a funny state
- assertEquals(crossProduct1, dotProduct1.getParent());
- assertEquals(dotProduct1, crossProduct1.getChildAt(0));
- }
- }
-
- @Test
- public void cantSetSelfParent() throws Exception {
- crossProduct1.insert(dotProduct1);
- try {
- dotProduct1.setParent(dotProduct1);
- fail("Didn't throw IllegalArgumentException");
- } catch (IllegalArgumentException ex) {
- // Make sure we didn't loose our old parent and
- // ended up in a funny state
- assertEquals(crossProduct1, dotProduct1.getParent());
- assertEquals(dotProduct1, crossProduct1.getChildAt(0));
- }
- }
-
- @Before
- public void makeNodes() throws Exception {
- root = new DummyTerminalNode();
- input1 = new NamedInputPortNode("input1", 1);
- input2 = new NamedInputPortNode("input2", 2);
- crossProduct1 = new CrossProduct();
- crossProduct2 = new CrossProduct();
- dotProduct1 = new DotProduct();
- dotProduct2 = new DotProduct();
- }
-
- protected final class DummyTerminalNode extends TerminalNode {
-
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException {
- return 0;
- }
-
- public void receiveCompletion(int inputIndex, Completion completion) {
- }
-
- public void receiveJob(int inputIndex, Job newJob) {
- }
- }
-
-}
diff --git a/trunk/workflowmodel-api/src/test/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/trunk/workflowmodel-api/src/test/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
deleted file mode 100644
index 63bb2e4..0000000
--- a/trunk/workflowmodel-api/src/test/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.workflowmodel.health.StringHealthChecker
-net.sf.taverna.t2.workflowmodel.health.FloatHealthChecker
-net.sf.taverna.t2.workflowmodel.health.FloatHealthChecker2
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/pom.xml b/trunk/workflowmodel-impl/pom.xml
deleted file mode 100644
index c8a8036..0000000
--- a/trunk/workflowmodel-impl/pom.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>net.sf.taverna.t2</groupId>
- <artifactId>core</artifactId>
- <version>0.9</version>
- </parent>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-impl</artifactId>
- <name>Workflow Model implementation</name>
- <description> Implementation of the core workflow object model for
- Taverna 2 workflows including concrete instances of the workflow
- definition objects and enactment behaviours.</description>
- <dependencies>
- <dependency>
- <groupId>jdom</groupId>
- <artifactId>jdom</artifactId>
- </dependency>
- <dependency>
- <groupId>net.sf.taverna.t2.core</groupId>
- <artifactId>workflowmodel-api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.thoughtworks.xstream</groupId>
- <artifactId>xstream</artifactId>
- <version>1.2.1</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AddAnnotationAssertionEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AddAnnotationAssertionEdit.java
deleted file mode 100644
index 542a864..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AddAnnotationAssertionEdit.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-public class AddAnnotationAssertionEdit implements Edit<AnnotationChain> {
-
- private boolean applied;
-
- @SuppressWarnings("unchecked")
- private AnnotationAssertion annotationAssertion;
- private AnnotationChain annotationChain;
-
- @SuppressWarnings("unchecked")
- public AddAnnotationAssertionEdit(AnnotationChain annotationChain,
- AnnotationAssertion annotationAssertion) {
- this.annotationChain = annotationChain;
- this.annotationAssertion = annotationAssertion;
- }
-
- public AnnotationChain doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationChain instanceof AnnotationChainImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationChainImpl");
- }
-
- try {
- synchronized (annotationChain) {
- ((AnnotationChainImpl) annotationChain)
- .addAnnotationAssertion(annotationAssertion);
- applied = true;
- return this.annotationChain;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
-
- }
-
- public Object getSubject() {
- return annotationChain;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationChainImpl)annotationChain).removeAnnotationAssertion(annotationAssertion);
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertionImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertionImpl.java
deleted file mode 100644
index 30a7626..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationAssertionImpl.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-public class AnnotationAssertionImpl implements AnnotationAssertion<AnnotationBeanSPI> {
-
- private AnnotationBeanSPI annotationBean;
- private AnnotationRole annotationRole;
- private Date date;
- private List<Person> creators;
- private AnnotationSourceSPI annotationSource;
- private List<CurationEvent<?>> curationEventList;
-
- public AnnotationAssertionImpl(){
- date = new Date();
- curationEventList = new ArrayList<CurationEvent<?>>();
- creators = new ArrayList<Person>();
-
- }
-
- public AnnotationAssertionImpl(AnnotationBeanSPI freeTextDescription, AnnotationRole annotationRole, List<Person> creators, AnnotationSourceSPI annotationSource) {
- this.annotationBean = freeTextDescription;
- this.annotationRole = annotationRole;
- this.creators = creators;
- this.annotationSource = annotationSource;
- }
-
- public AnnotationBeanSPI getDetail() {
- return annotationBean;
- }
-
- public AnnotationRole getRole() {
- return annotationRole;
- }
-
- public Date getCreationDate() {
- return date;
- }
-
- public List<? extends Person> getCreators() {
- return creators;
- }
-
- public void addCreator(Person person) {
- creators.add(person);
- }
-
- public void removeCreator(Person person) {
- creators.remove(person);
- }
-
- public List<CurationEvent<?>> getCurationAssertions() {
- return curationEventList;
- }
-
- public AnnotationSourceSPI getSource() {
- return annotationSource;
- }
-
- public void setAnnotationBean(AnnotationBeanSPI annotationBean) {
- this.annotationBean = annotationBean;
- }
-
- public void setAnnotationRole(AnnotationRole annotationRole) {
- this.annotationRole = annotationRole;
- }
-
- public void removeAnnotationRole() {
- this.annotationRole = null;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public void setCreators(List<Person> creators) {
- this.creators = creators;
- }
-
- public void setAnnotationSource(AnnotationSourceSPI annotationSource) {
- this.annotationSource = annotationSource;
- }
-
- public void removeAnnotationSource() {
- this.annotationSource = null;
- }
-
- public void removeAnnotationBean() {
- annotationBean = null;
- }
-
- @SuppressWarnings("unchecked")
- public void addCurationEvent(CurationEvent curationEvent) {
- curationEventList.add(curationEvent);
- }
-
- @SuppressWarnings("unchecked")
- public void removeCurationEvent(CurationEvent curationEvent) {
- curationEventList.remove(curationEvent);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationChainImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationChainImpl.java
deleted file mode 100644
index 30b8500..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationChainImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AnnotationChainImpl implements AnnotationChain{
-
- private List<AnnotationAssertion<?>> annotationAssertions = new ArrayList<AnnotationAssertion<?>>();
-
- public List<AnnotationAssertion<?>> getAssertions() {
- return new ArrayList<AnnotationAssertion<?>>(annotationAssertions);
- }
-
- /**
- * Add an annotation to the chain Added because without the edits stuff how
- * else can we do it?
- *
- * @param annotationAssertion
- */
- @SuppressWarnings("unchecked")
- public void addAnnotationAssertion(AnnotationAssertion annotationAssertion) {
- annotationAssertions.add(annotationAssertion);
- }
-
- @SuppressWarnings("unchecked")
- public void removeAnnotationAssertion(AnnotationAssertion annotationAssertion) {
- annotationAssertions.remove(annotationAssertion);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationEditsImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationEditsImpl.java
deleted file mode 100644
index ae36325..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/AnnotationEditsImpl.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-public class AnnotationEditsImpl {
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEvent.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEvent.java
deleted file mode 100644
index 20eb547..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEvent.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-public class DisputeEvent implements CurationEvent<DisputeEventDetails>{
-
- private DisputeEventDetails disputeEventDetails;
- private CurationEventType curationEventType;
- private Curateable targetEvent;
-
- public DisputeEvent() {
-
- }
-
-
- public DisputeEvent(DisputeEventDetails disputeEventDetails, CurationEventType curationEventType, Curateable targetEvent) {
- this.disputeEventDetails = disputeEventDetails;
- this.curationEventType = curationEventType;
- this.targetEvent = targetEvent;
- }
-
- public DisputeEventDetails getDetail() {
- return disputeEventDetails;
- }
-
- public Curateable getTarget() {
- return targetEvent;
- }
-
- public CurationEventType getType() {
- return curationEventType;
- }
-
-
- public void setDisputeEventDetails(DisputeEventDetails disputeEventDetails) {
-// if (disputeEventDetails != null) {
-// throw new RuntimeException("Dispute event details have already been set");
-// }
- this.disputeEventDetails = disputeEventDetails;
- }
-
-
- public void setCurationEventType(CurationEventType curationEventType) {
-// if (curationEventType != null) {
-// throw new RuntimeException("Curation event details have already been set");
-// }
- this.curationEventType = curationEventType;
- }
-
-
- public void setTargetEvent(Curateable targetEvent) {
-// if (targetEvent!= null) {
-// throw new RuntimeException("Target event details have already been set");
-// }
- this.targetEvent = targetEvent;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEventDetails.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEventDetails.java
deleted file mode 100644
index d6a51d6..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/DisputeEventDetails.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-public class DisputeEventDetails implements CurationEventBeanSPI {
-
- public DisputeEventDetails() {
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/PersonImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/PersonImpl.java
deleted file mode 100644
index a29ee6f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/PersonImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-public class PersonImpl implements Person {
-
- @SuppressWarnings("unused")
- private String name;
-
- public PersonImpl(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/URISource.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/URISource.java
deleted file mode 100644
index 407b230..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/URISource.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import java.net.URI;
-
-public class URISource implements AnnotationSourceSPI{
-
- private URI uri;
-
- public URISource() {
-
- }
-
- public URISource(URI uri) {
- this.uri = uri;
- }
-
- public void setUri(URI uri) {
-// if (uri != null) {
-// throw new RuntimeException("URI has already been set");
-// }
- this.uri = uri;
- }
-
- public URI getUri() {
- return uri;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java
deleted file mode 100644
index 5535e09..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.facade.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.UUID;
-import java.util.WeakHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import net.sf.taverna.t2.facade.FailureListener;
-import net.sf.taverna.t2.facade.ResultListener;
-import net.sf.taverna.t2.facade.WorkflowInstanceFacade;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.TokenOrderException;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorManager;
-import net.sf.taverna.t2.monitor.MonitorNode;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.provenance.item.DataflowRunComplete;
-import net.sf.taverna.t2.provenance.item.WorkflowDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.utility.TypedTreeModel;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-import net.sf.taverna.t2.workflowmodel.InvalidDataflowException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorFinishedEvent;
-import net.sf.taverna.t2.workflowmodel.impl.ProcessorImpl;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.IntermediateProvenance;
-
-import org.apache.log4j.Logger;
-
-/**
- * Implementation of {@link WorkflowInstanceFacade}
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- * @author Ian Dunlop
- * @author Alex Nenadic
- *
- */
-public class WorkflowInstanceFacadeImpl implements WorkflowInstanceFacade {
-
- private static Logger logger = Logger
- .getLogger(WorkflowInstanceFacadeImpl.class);
-
- protected static AtomicLong owningProcessId = new AtomicLong(0);
-
- private InvocationContext context;
-
- public InvocationContext getContext() {
- return context;
- }
-
- private Dataflow dataflow;
- private ResultListener facadeResultListener;
- // In case workflow has no output ports we have to listen to individual processors to know when the workflow has finished
- private List<ProcessorFinishedObserver> processorFinishedObservers;
- // How many processors have finished so far
- private int numberOfProcessorsFinished;
- private String instanceOwningProcessId;
- private String localName;
- private MonitorManager monitorManager = MonitorManager.getInstance();
- private boolean pushDataCalled = false;
- protected List<FailureListener> failureListeners = new ArrayList<FailureListener>();
- protected List<ResultListener> resultListeners = new ArrayList<ResultListener>();
-
- private boolean provEnabled = false;
-
- private WeakHashMap<String, T2Reference> pushedDataMap = new WeakHashMap<String, T2Reference> ();
-
- public WorkflowInstanceFacadeImpl(final Dataflow dataflow,
- InvocationContext context, String parentProcess)
- throws InvalidDataflowException {
- DataflowValidationReport report = dataflow.checkValidity();
- if (!report.isValid()) {
- throw new InvalidDataflowException(dataflow, report);
- }
-
- this.dataflow = dataflow;
- this.context = context;
- this.localName = "facade" + owningProcessId.getAndIncrement();
- if (parentProcess.equals("")) {
- this.instanceOwningProcessId = localName;
- // Add this WorkflowInstanceFacade to the map of all workflow run IDs
- // against the corresponding WorkflowInstanceFacadeS/
- WorkflowInstanceFacade.workflowRunFacades.put(localName, this);
- // Note that we do not put the IDs for nested workflows, just for the main ones!
- } else {
- this.instanceOwningProcessId = parentProcess + ":" + localName;
- }
-
- WorkflowProvenanceItem workflowItem = null;
-
- if (context.getProvenanceReporter() != null) {
-
- provEnabled = true;
- workflowItem = new WorkflowProvenanceItem();
- workflowItem.setDataflow(dataflow);
- workflowItem.setProcessId(instanceOwningProcessId);
- workflowItem.setIdentifier(UUID.randomUUID().toString());
- workflowItem.setParentId(dataflow.getInternalIdentier());
-
- addProvenanceLayerToProcessors(dataflow, workflowItem);
- context.getProvenanceReporter().setSessionID(workflowItem.getIdentifier());
- context.getProvenanceReporter().addProvenanceItem(workflowItem);
- }
- facadeResultListener = new FacadeResultListener(dataflow, workflowItem);
-
- // If workflow has no output ports then we have to monitor all its processors to know when
- // the workflow has finished running
- if (dataflow.getOutputPorts().size() == 0){
- processorFinishedObservers = new ArrayList<ProcessorFinishedObserver>();
- // Register an observer with each of the processors
- for (Processor processor: dataflow.getProcessors()){
- ProcessorFinishedObserver observer = new ProcessorFinishedObserver(workflowItem);
- ((ProcessorImpl) processor).addObserver(observer);
- processorFinishedObservers.add(observer);
- }
- numberOfProcessorsFinished = 0;
- }
- }
-
- private void addProvenanceLayerToProcessors(Dataflow dataflow2, WorkflowProvenanceItem workflowItem) {
- for (Processor processor : dataflow.getProcessors()) {
- DispatchStack dispatchStack = processor.getDispatchStack();
- List<DispatchLayer<?>> layers = dispatchStack.getLayers();
- boolean provAlreadyAdded = false;
- for (DispatchLayer<?> layer : layers) {
- if (layer instanceof IntermediateProvenance) {
- provAlreadyAdded = true;
- }
- }
- if (provAlreadyAdded) {
- continue;
- }
- for (int j = 0; j < layers.size(); j++) {
- if (! (layers.get(j) instanceof ErrorBounce)) {
- continue;
- }
- DispatchLayer<?> provenance = new IntermediateProvenance();
- IntermediateProvenance intermediateProvenance = (IntermediateProvenance) provenance;
- intermediateProvenance.setWorkflow(workflowItem);
- intermediateProvenance.setReporter(context
- .getProvenanceReporter());
-
- Edits edits = EditsRegistry.getEdits();
- try {
- edits.getAddDispatchLayerEdit(dispatchStack, provenance,
- j).doEdit();
- break;
- } catch (EditException e) {
- logger.warn("adding provenance layer to dispatch stack failed "
- + e.toString());
- }
-
- }
- }
- }
-
- public void addFailureListener(FailureListener listener) {
- failureListeners.add(listener);
- }
-
- public synchronized void addResultListener(ResultListener listener) {
- if (resultListeners.isEmpty()) {
- for (DataflowOutputPort port : dataflow.getOutputPorts()) {
- port.addResultListener(facadeResultListener);
- }
- }
- resultListeners.add(listener);
- }
-
- public void fire() throws IllegalStateException {
- if (pushDataCalled)
- throw new IllegalStateException(
- "Data has already been pushed, fire must be called first!");
- monitorManager.registerNode(this, instanceOwningProcessId.split(":"),
- new HashSet<MonitorableProperty<?>>());
- dataflow.fire(instanceOwningProcessId, context);
- }
-
- public Dataflow getDataflow() {
- return dataflow;
- }
-
- public TypedTreeModel<MonitorNode> getStateModel() {
- // TODO WorkflowInstanceFacade.getStateModel not yet implemented
- return null;
- }
-
- public void pushData(WorkflowDataToken token, String portName)
- throws TokenOrderException {
- // TODO: throw TokenOrderException when token stream is violates order
- // constraints.
- for (DataflowInputPort port : dataflow.getInputPorts()) {
- if (portName.equals(port.getName())) {
- pushedDataMap.put(portName, token.getData());
- port.receiveEvent(token.pushOwningProcess(localName));
- }
- }
- pushDataCalled = true;
- }
-
- public void removeFailureListener(FailureListener listener) {
- failureListeners.remove(listener);
- }
-
- public synchronized void removeResultListener(ResultListener listener) {
- resultListeners.remove(listener);
- if (resultListeners.isEmpty()) {
- for (DataflowOutputPort port : dataflow.getOutputPorts()) {
- port.removeResultListener(facadeResultListener);
- }
- }
- }
-
- protected class FacadeResultListener implements ResultListener {
- private int portsToComplete;
- private final WorkflowProvenanceItem workflowItem;
-
- public FacadeResultListener(Dataflow dataflow,
- WorkflowProvenanceItem workflowItem) {
- this.workflowItem = workflowItem;
- portsToComplete = dataflow.getOutputPorts().size();
- }
-
- public void resultTokenProduced(WorkflowDataToken token, String portName) {
- if (!instanceOwningProcessId.equals(token.getOwningProcess())) {
- return;
- }
- if (provEnabled) {
- WorkflowDataProvenanceItem workflowDataProvenanceItem = new WorkflowDataProvenanceItem();
- workflowDataProvenanceItem.setPortName(portName);
- workflowDataProvenanceItem.setData(token.getData());
- workflowDataProvenanceItem.setReferenceService(context.getReferenceService());
- workflowDataProvenanceItem.setParentId(workflowItem.getIdentifier());
- workflowDataProvenanceItem.setWorkflowId(workflowItem.getParentId());
- workflowDataProvenanceItem.setIdentifier(UUID.randomUUID().toString());
- workflowDataProvenanceItem.setParentId(instanceOwningProcessId);
- workflowDataProvenanceItem.setProcessId(instanceOwningProcessId);
- workflowDataProvenanceItem.setIndex(token.getIndex());
- workflowDataProvenanceItem.setFinal(token.isFinal());
- context.getProvenanceReporter().addProvenanceItem(
- workflowDataProvenanceItem);
- }
- synchronized (this) {
- if (token.getIndex().length == 0) {
- portsToComplete--;
- }
- if (portsToComplete == 0) {
- // Received complete events on all ports, can
- // un-register this node from the monitor
- monitorManager.deregisterNode(
- instanceOwningProcessId.split(":"));
- if (provEnabled) {
- try {
- DataflowRunComplete dataflowRunComplete = new DataflowRunComplete();
- dataflowRunComplete.setParentId(workflowItem.getParentId());
- dataflowRunComplete.setWorkflowId(workflowItem.getIdentifier());
- dataflowRunComplete
- .setProcessId(instanceOwningProcessId);
- dataflowRunComplete.setIdentifier(UUID.randomUUID().toString());
- context.getProvenanceReporter().addProvenanceItem(
- dataflowRunComplete);
- } catch (Exception ex) {
- logger.error("Could not store provenance for " + instanceOwningProcessId, ex);
- }
- }
- }
- }
- ArrayList<ResultListener> copyOfListeners = new ArrayList<ResultListener>(
- resultListeners);
- for (ResultListener resultListener : copyOfListeners) {
- try {
- resultListener.resultTokenProduced(
- token.popOwningProcess(), portName);
- } catch (RuntimeException ex) {
- logger.warn("Could not notify result listener "
- + resultListener, ex);
- }
- }
-
- }
- }
-
-
- /**
- * An observer of events that occur when a processor finishes with execution.
- *
- */
- private class ProcessorFinishedObserver implements Observer<ProcessorFinishedEvent>{
-
- private WorkflowProvenanceItem workflowItem;
-
- public ProcessorFinishedObserver(WorkflowProvenanceItem workflowItem) {
- this.workflowItem = workflowItem;
- }
-
- public void notify(Observable<ProcessorFinishedEvent> sender,
- ProcessorFinishedEvent message) throws Exception {
-
- numberOfProcessorsFinished++;
-
- // De-register the processor node from the monitor as it has finished
- monitorManager.deregisterNode(message.getOwningProcess());
-
- // De-register this observer from the processor
- message.getProcessor().removeObserver(this);
-
- // All processors have finished => the workflow run has finished
- if (numberOfProcessorsFinished == dataflow.getProcessors().size()){
-
- // De-register the workflow node from the monitor (if this is the top level
- // workflow object) as for some reason it does not get de-registered when
- // there are no output ports
- if (dataflow.getLocalName().split(":").length==1){ // this is a top level workflow
- monitorManager.deregisterNode(instanceOwningProcessId + ":" + dataflow.getLocalName());
- }
-
- // De-register this facade node from the monitor - this will effectively
- // tell the monitor that the workflow run has finished
- monitorManager.deregisterNode(instanceOwningProcessId);
-
- synchronized (this) {
- if (provEnabled) {
- DataflowRunComplete dataflowRunComplete = new DataflowRunComplete();
- dataflowRunComplete.setParentId(workflowItem
- .getIdentifier());
- dataflowRunComplete
- .setProcessId(instanceOwningProcessId);
- dataflowRunComplete.setIdentifier(UUID.randomUUID()
- .toString());
- context.getProvenanceReporter().addProvenanceItem(
- dataflowRunComplete);
- }
- }
-
- // Also remove this observer from the list of processor observers maintained by the facade
- processorFinishedObservers.remove(this);
- }
- }
- }
-
- public WeakHashMap<String, T2Reference> getPushedDataMap() {
- return pushedDataMap;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java
deleted file mode 100644
index 212f738..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor.impl;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Set;
-
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorNode;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.monitor.NoSuchPropertyException;
-import net.sf.taverna.t2.monitor.MonitorManager.AddPropertiesMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.DeregisterNodeMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.MonitorMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.RegisterNodeMessage;
-
-import org.apache.log4j.Logger;
-
-/**
- * A relatively naive Monitor interface which holds all
- * state in a tree model. Use getMonitor() to get the monitor singleton, all
- * workflows under a given JVM use the same instance in this implementation with
- * the root node of the monitor tree corresponding to the monitor itself.
- * <p>
- * Internally we use a default tree model with default mutable tree nodes where
- * the user object is set to instances of MonitorNode, with the exception of the
- * 'true' root of the tree in which it is set to the MonitorImpl itself
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public class MonitorTreeModel implements Observer<MonitorMessage> {
-
- private static MonitorTreeModel instance = null;
-
- private static Logger logger = Logger.getLogger(MonitorTreeModel.class);
-
- /**
- * Get the MonitorImpl singleton
- *
- * @return The MonitorImpl singleton
- */
- public synchronized static MonitorTreeModel getInstance() {
- if (instance == null) {
- instance = new MonitorTreeModel();
- }
- return instance;
- }
-
- private long nodeRemovalDelay = 1000;
-
- private DefaultTreeModel monitorTree;
-
- private java.util.Timer nodeRemovalTimer;
-
- /**
- * Protected constructor, use singleton access {@link #getInstance()}
- * instead.
- *
- */
- protected MonitorTreeModel() {
- monitorTree = new DefaultTreeModel(new DefaultMutableTreeNode(this));
- // Create the node removal timer as a daemon thread
- nodeRemovalTimer = new java.util.Timer(true);
- }
-
- /**
- * Returns a tree view over the monitor.
- *
- * @return a tree view over the monitor
- */
- public JTree getJTree() {
- return new AlwaysOpenJTree(monitorTree);
- }
-
- /**
- * {@inheritDoc}
- */
- public void notify(Observable<MonitorMessage> sender, MonitorMessage message)
- throws Exception {
- if (message instanceof RegisterNodeMessage) {
- RegisterNodeMessage regMessage = (RegisterNodeMessage) message;
- registerNode(regMessage.getWorkflowObject(), regMessage
- .getOwningProcess(), regMessage.getProperties());
- } else if (message instanceof DeregisterNodeMessage) {
- deregisterNode(message.getOwningProcess());
- } else if (message instanceof AddPropertiesMessage) {
- AddPropertiesMessage addMessage = (AddPropertiesMessage) message;
- addPropertiesToNode(addMessage.getOwningProcess(), addMessage
- .getNewProperties());
- } else {
- logger.warn("Unknown message " + message + " from " + sender);
- }
- }
-
- /**
- * Nodes will be removed at least delayTime milliseconds after their initial
- * deregistration request, this allows UI components to show nodes which
- * would otherwise vanish almost instantaneously.
- *
- * @param delayTime
- * time in milliseconds between the deregistration request and
- * attempt to actually remove the node in question
- */
- public void setNodeRemovalDelay(long delayTime) {
- nodeRemovalDelay = delayTime;
- }
-
- /**
- * Very simple UI!
- */
- public void showMonitorFrame() {
- final JTree tree = new AlwaysOpenJTree(monitorTree);
- final JScrollPane jsp = new JScrollPane(tree);
- JFrame frame = new JFrame();
- frame.getContentPane().setLayout(new BorderLayout());
- frame.getContentPane().add(jsp);
- frame.pack();
- frame.setVisible(true);
- new javax.swing.Timer(500, new ActionListener() {
- public void actionPerformed(ActionEvent ae) {
- jsp.repaint();
- }
- }).start();
- }
-
- /**
- * Return the node pointed to by the first 'limit' number of elements in the
- * owning process string array. If limit is -1 then use owningProcess.length
- *
- * @param owningProcess
- * @param limit
- * @return
- */
- protected DefaultMutableTreeNode nodeAtProcessPath(String[] owningProcess,
- int limit) throws IndexOutOfBoundsException {
- if (limit == -1) {
- limit = owningProcess.length;
- }
- DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) monitorTree
- .getRoot();
- for (int index = 0; index < limit && index < owningProcess.length; index++) {
- boolean found = false;
- for (int childIndex = 0; childIndex < monitorTree
- .getChildCount(currentNode)
- && !found; childIndex++) {
- DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) monitorTree
- .getChild(currentNode, childIndex);
- MonitorNode childMonitorNode = (MonitorNode) childNode
- .getUserObject();
- if (childMonitorNode.getOwningProcess()[index]
- .equals(owningProcess[index])) {
- currentNode = childNode;
- found = true;
- // break;
- }
- }
- if (!found) {
- throw new IndexOutOfBoundsException(
- "Cannot locate node with process ID "
- + printProcess(owningProcess));
- }
- }
- return currentNode;
- }
-
- protected String printProcess(String[] process) {
- StringBuffer sb = new StringBuffer();
- for (String part : process) {
- sb.append("{" + part + "}");
- }
- return sb.toString();
- }
-
- /**
- * Inject properties into an existing node
- */
- protected void addPropertiesToNode(String[] owningProcess,
- Set<MonitorableProperty<?>> newProperties) {
- try {
- DefaultMutableTreeNode node = nodeAtProcessPath(owningProcess, -1);
- MonitorNode mn = (MonitorNode) node.getUserObject();
- for (MonitorableProperty<?> prop : newProperties) {
- mn.addMonitorableProperty(prop);
- }
- } catch (IndexOutOfBoundsException ioobe) {
- // Fail silently here, the node wasn't found in the state tree
- logger.warn("Could not add properties to unknown node "
- + printProcess(owningProcess));
- }
- }
-
- /**
- * Request the removal of the specified node from the monitor tree. In this
- * particular case the removal task will be added to a timer and executed at
- * some (slightly) later time as determined by the removalDelay property.
- */
- protected void deregisterNode(String[] owningProcess) {
- // logger.debug("Remove node @" +
- // printProcess(owningProcess));
- final DefaultMutableTreeNode nodeToRemove = nodeAtProcessPath(
- owningProcess, -1);
- ((MonitorNodeImpl) nodeToRemove.getUserObject()).expire();
- nodeRemovalTimer.schedule(new java.util.TimerTask() {
- @Override
- public void run() {
- synchronized (monitorTree) {
- monitorTree.removeNodeFromParent(nodeToRemove);
- }
- }
- }, getNodeRemovalDelay());
- }
-
- /**
- * Create a new node in the monitor
- */
- protected void registerNode(final Object workflowObject,
- final String[] owningProcess,
- final Set<MonitorableProperty<?>> properties) {
- // logger.debug("Registering node " + printProcess(owningProcess));
-
- // Create a new MonitorNode
- final DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(
- new MonitorNodeImpl(workflowObject, owningProcess, properties));
- synchronized (monitorTree) {
- final MutableTreeNode parentNode = nodeAtProcessPath(owningProcess,
- owningProcess.length - 1);
- monitorTree.insertNodeInto(newNode, parentNode, monitorTree
- .getChildCount(parentNode));
- }
- }
-
- class AlwaysOpenJTree extends JTree {
- private static final long serialVersionUID = -3769998854485605447L;
-
- public AlwaysOpenJTree(TreeModel newModel) {
- super(newModel);
- setRowHeight(18);
- setLargeModel(true);
- setEditable(false);
- setExpandsSelectedPaths(false);
- setDragEnabled(false);
- setScrollsOnExpand(false);
- setSelectionModel(EmptySelectionModel.sharedInstance());
- setCellRenderer(new CellRenderer());
- }
-
- @Override
- public void setModel(TreeModel model) {
- if (treeModel == model)
- return;
- if (treeModelListener == null)
- treeModelListener = new TreeModelListener();
- if (model != null) {
- model.addTreeModelListener(treeModelListener);
- }
- TreeModel oldValue = treeModel;
- treeModel = model;
- firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
- }
-
- protected class CellRenderer extends DefaultTreeCellRenderer {
- private static final long serialVersionUID = 7106767124654545039L;
-
- @Override
- public Component getTreeCellRendererComponent(JTree tree,
- Object value, boolean sel, boolean expanded,
- boolean leaf, int row, boolean hasFocus) {
- super.getTreeCellRendererComponent(tree, value, sel,
- expanded, leaf, row, hasFocus);
- if (value instanceof DefaultMutableTreeNode) {
- Object o = ((DefaultMutableTreeNode) value)
- .getUserObject();
- if (o instanceof MonitorNode) {
- MonitorNode mn = (MonitorNode) o;
- if (mn.hasExpired()) {
- setEnabled(false);
- }
- }
- }
- return this;
- }
- }
-
- protected class TreeModelListener extends TreeModelHandler {
- @Override
- public void treeNodesInserted(final TreeModelEvent ev) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- TreePath path = ev.getTreePath();
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
- });
- }
- @Override
- public void treeStructureChanged(final TreeModelEvent ev) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- TreePath path = ev.getTreePath();
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
- });
- }
- }
- }
-
- class MonitorNodeImpl implements MonitorNode {
-
- private boolean expired = false;
- private String[] owningProcess;
- private Set<MonitorableProperty<?>> properties;
- private Object workflowObject;
-
- Date creationDate = new Date();
-
- MonitorNodeImpl(Object workflowObject, String[] owningProcess,
- Set<MonitorableProperty<?>> properties) {
- this.properties = properties;
- this.workflowObject = workflowObject;
- this.owningProcess = owningProcess;
- }
-
- public void addMonitorableProperty(MonitorableProperty<?> newProperty) {
- properties.add(newProperty);
- }
-
- public void expire() {
- expired = true;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public String[] getOwningProcess() {
- return owningProcess;
- }
-
- /**
- * Return an unmodifiable copy of the property set
- */
- public Set<? extends MonitorableProperty<?>> getProperties() {
- return Collections.unmodifiableSet(properties);
- }
-
- public Object getWorkflowObject() {
- return workflowObject;
- }
-
- public boolean hasExpired() {
- return this.expired;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(getWorkflowObject().getClass().getSimpleName());
- sb.append(", ");
- sb.append(owningProcess[owningProcess.length - 1]);
- sb.append(" : ");
- for (MonitorableProperty<?> prop : getProperties()) {
- int i = 0;
- for (String nameElement : prop.getName()) {
- sb.append(nameElement);
- i++;
- if (i < prop.getName().length) {
- sb.append(".");
- }
- }
- sb.append("=");
- try {
- sb.append(prop.getValue().toString());
- } catch (NoSuchPropertyException nspe) {
- sb.append("EXPIRED");
- }
- sb.append(" ");
- }
- return sb.toString();
- }
- }
-
-
- public long getNodeRemovalDelay() {
- return nodeRemovalDelay;
- }
-
- protected DefaultTreeModel getMonitorTree() {
- return monitorTree;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java
deleted file mode 100644
index 834c671..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Abstraction of an edit acting on a Activity instance. Handles the check to
- * see that the Activity supplied is really a AbstractActivity.
- *
- * @author David Withers
- * @author Stian Soiland-Reyes
- *
- */
-public abstract class AbstractActivityEdit extends AbstractEdit<Activity<?>, AbstractActivity<?>> {
-
- protected AbstractActivityEdit(Activity<?> activity) {
- super(AbstractActivity.class, activity);
- }
-
- public void setActivity(Activity<?> activity) {
- this.subject = activity;
- }
-
- public Activity<?> getActivity() {
- return getSubject();
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java
deleted file mode 100644
index 3484c5f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OrderedPair;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Generalization over all operations acting on an ordered pair of ProcessorImpl
- * objects. These include most operations where a relationship is created,
- * modified or destroyed between two processors.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractBinaryProcessorEdit implements
- Edit<OrderedPair<Processor>> {
-
- private OrderedPair<Processor> processors;
-
- private boolean applied = false;
-
- public AbstractBinaryProcessorEdit(Processor a, Processor b) {
- this.processors = new OrderedPair<Processor>(a, b);
- }
-
- public final OrderedPair<Processor> doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (processors.getA() instanceof ProcessorImpl == false
- || processors.getB() instanceof ProcessorImpl == false) {
- throw new EditException(
- "Edit cannot be applied to a Processor which isn't an instance of ProcessorImpl");
- }
- ProcessorImpl pia = (ProcessorImpl) processors.getA();
- ProcessorImpl pib = (ProcessorImpl) processors.getB();
-
- try {
- synchronized (processors) {
- doEditAction(pia, pib);
- applied = true;
- return this.processors;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- public final OrderedPair<Processor> getSubject() {
- return this.processors;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ProcessorImpl pia = (ProcessorImpl) processors.getA();
- ProcessorImpl pib = (ProcessorImpl) processors.getB();
- synchronized (processors) {
- undoEditAction(pia, pib);
- applied = false;
- }
-
- }
-
- /**
- * Do the actual edit here
- *
- * @param processorA
- * The ProcessorImpl which is in some sense the source of the
- * relation between the two being asserted or operated on by this
- * edit
- * @param processorB
- * The ProcessorImpl at the other end of the relation. *
- * @throws EditException
- */
- protected abstract void doEditAction(ProcessorImpl processorA,
- ProcessorImpl processorB) throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(ProcessorImpl processorA,
- ProcessorImpl processorB);
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java
deleted file mode 100644
index 8c85998..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.invocation.TreeCache;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Receives Job and Completion events and emits Jobs unaltered. Completion
- * events additionally cause registration of lists for each key in the datamap
- * of the jobs at immediate child locations in the index structure. These list
- * identifiers are sent in place of the Completion events.
- * <p>
- * State for a given process ID is purged when a final completion event is
- * received so there is no need for an explicit cache purge operation in the
- * public API (although for termination of partially complete workflows it may
- * be sensible for subclasses to provide one)
- * <p>
- *
- * @author Tom Oinn
- */
-public abstract class AbstractCrystalizer implements Crystalizer {
-
- private Map<String, CompletionAwareTreeCache> cacheMap = new HashMap<String, CompletionAwareTreeCache>();
-
- public abstract Job getEmptyJob(String owningProcess, int[] index,
- InvocationContext context);
-
- /**
- * Receive a Job or Completion, Jobs are emitted unaltered and cached,
- * Completion events trigger registration of a corresponding list - this may
- * be recursive in nature if the completion event's index implies nested
- * lists which have not been registered.
- * <p>
- * If the baseListDepth property is defined then completion events on nodes
- * which don't already exist create empty jobs instead and emit those, if
- * undefined the completion event is emited intact.
- *
- * @param e
- */
- @SuppressWarnings("unchecked")
- // suppressed to avoid jdk1.5 compilation errors caused by the declaration
- // IterationInternalEvent<? extends IterationInternalEvent<?>> e
- public void receiveEvent(IterationInternalEvent e) {
- String owningProcess = e.getOwningProcess();
- CompletionAwareTreeCache cache = null;
- synchronized (cacheMap) {
- if (!cacheMap.containsKey(owningProcess)) {
- cache = new CompletionAwareTreeCache(owningProcess, e
- .getContext());
- cacheMap.put(owningProcess, cache);
- } else {
- cache = cacheMap.get(owningProcess);
- }
- }
- synchronized (cache) {
- if (e instanceof Job) {
- // Pass through Job after storing it in the cache
- Job j = (Job) e;
- cache.insertJob(j);
- jobCreated(j);
- if (j.getIndex().length == 0) {
- cacheMap.remove(j.getOwningProcess());
- }
- return;
- } else if (e instanceof Completion) {
- Completion c = (Completion) e;
- int[] completionIndex = c.getIndex();
- cache.resolveAt(owningProcess, completionIndex);
- if (c.getIndex().length == 0) {
- cacheMap.remove(c.getOwningProcess());
- }
- }
- }
- }
-
- protected class CompletionAwareTreeCache extends TreeCache {
-
- private String owningProcess;
- private InvocationContext context;
-
- public CompletionAwareTreeCache(String owningProcess,
- InvocationContext context) {
- super();
- this.context = context;
- this.owningProcess = owningProcess;
- }
-
- public void resolveAt(String owningProcess, int[] completionIndex) {
- NamedNode n = nodeAt(completionIndex);
- if (n != null) {
- assignNamesTo(n, completionIndex);
- } else {
-
- // We know what the list depth should be, so we can
- // construct appropriate depth empty lists to fill in the
- // gaps.
- Job j = getEmptyJob(owningProcess, completionIndex, context);
- insertJob(j);
- jobCreated(j);
-
- }
- }
-
- private void assignNamesTo(NamedNode n, int[] index) {
- // Only act if contents of this node undefined
- // StringBuffer iString = new StringBuffer();
- // for (int foo : index) {
- // iString.append(foo+" ");
- // }
- if (n.contents == null) {
- Map<String, List<T2Reference>> listItems = new HashMap<String, List<T2Reference>>();
- int pos = 0;
- for (NamedNode child : n.children) {
-
- // If child doesn't have a defined name map yet then define
- // it
- Job j;
- if (child == null) {
- // happens if we're completing a partially empty
- // collection structure
- int[] newIndex = new int[index.length + 1];
- for (int i = 0; i < index.length; i++) {
- newIndex[i] = index[i];
- }
- newIndex[index.length] = pos++;
- j = getEmptyJob(owningProcess, newIndex, context);
- AbstractCrystalizer.this.jobCreated(j);
- } else {
-
- if (child.contents == null) {
- int[] newIndex = new int[index.length + 1];
- for (int i = 0; i < index.length; i++) {
- newIndex[i] = index[i];
- }
- newIndex[index.length] = pos++;
- assignNamesTo(child, newIndex);
- } else {
- pos++;
- }
- j = child.contents;
- }
- // Now pull the names out of the child job map and push them
- // into lists to be registered
-
- for (String outputName : j.getData().keySet()) {
- List<T2Reference> items = listItems.get(outputName);
- if (items == null) {
- items = new ArrayList<T2Reference>();
- listItems.put(outputName, items);
- }
- items.add(j.getData().get(outputName));
- }
- }
- Map<String, T2Reference> newDataMap = new HashMap<String, T2Reference>();
- for (String outputName : listItems.keySet()) {
- List<T2Reference> idlist = listItems.get(outputName);
- newDataMap.put(outputName, context.getReferenceService()
- .getListService().registerList(idlist).getId());
-
- }
- Job newJob = new Job(owningProcess, index, newDataMap, context);
- n.contents = newJob;
- // Get rid of the children as we've now named this node
- n.children.clear();
- AbstractCrystalizer.this.jobCreated(n.contents);
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java
deleted file mode 100644
index cc07d61..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-
-/**
- * Abstraction of an edit acting on a Dataflow instance. Handles the check to
- * see that the Dataflow supplied is really a DataflowImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDataflowEdit extends
- AbstractEdit<Dataflow, DataflowImpl> implements Edit<Dataflow> {
-
- protected AbstractDataflowEdit(Dataflow dataflow) {
- super(DataflowImpl.class, dataflow);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java
deleted file mode 100644
index f16c9cd..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a DataflowInputPort instance. Handles the check to
- * see that the DataflowInputPort supplied is really a DataflowInputPortImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDataflowInputPortEdit implements Edit<DataflowInputPort> {
-
- private boolean applied = false;
-
- private DataflowInputPort dataflowInputPort;
-
- protected AbstractDataflowInputPortEdit(DataflowInputPort dataflowInputPort) {
- if (dataflowInputPort == null) {
- throw new RuntimeException(
- "Cannot construct a DataflowInputPort edit with null DataflowInputPort");
- }
- this.dataflowInputPort = dataflowInputPort;
- }
-
- public final DataflowInputPort doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (dataflowInputPort instanceof DataflowInputPortImpl == false) {
- throw new EditException(
- "Edit cannot be applied to a DataflowInputPort which isn't an instance of DataflowInputPortImpl");
- }
- DataflowInputPortImpl dataflowInputPortImpl = (DataflowInputPortImpl) dataflowInputPort;
- try {
- synchronized (dataflowInputPortImpl) {
- doEditAction(dataflowInputPortImpl);
- applied = true;
- return this.dataflowInputPort;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param dataflowInputPort
- * The DataflowInputPortImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DataflowInputPortImpl dataflowInputPort)
- throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(DataflowInputPortImpl dataflowInputPort);
-
- public final DataflowInputPort getSubject() {
- return dataflowInputPort;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- DataflowInputPortImpl dataflowInputPortImpl = (DataflowInputPortImpl) dataflowInputPort;
- synchronized (dataflowInputPortImpl) {
- undoEditAction(dataflowInputPortImpl);
- applied = false;
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java
deleted file mode 100644
index 333145b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a DataflowOutputPort instance. Handles the check to
- * see that the DataflowOutputPort supplied is really a DataflowOutputPortImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDataflowOutputPortEdit implements Edit<DataflowOutputPort> {
-
- private boolean applied = false;
-
- private DataflowOutputPort dataflowOutputPort;
-
- protected AbstractDataflowOutputPortEdit(DataflowOutputPort dataflowOutputPort) {
- if (dataflowOutputPort == null) {
- throw new RuntimeException(
- "Cannot construct a DataflowOutputPort edit with null DataflowOutputPort");
- }
- this.dataflowOutputPort = dataflowOutputPort;
- }
-
- public final DataflowOutputPort doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (dataflowOutputPort instanceof DataflowOutputPortImpl == false) {
- throw new EditException(
- "Edit cannot be applied to a DataflowOutputPort which isn't an instance of DataflowOutputPortImpl");
- }
- DataflowOutputPortImpl dataflowOutputPortImpl = (DataflowOutputPortImpl) dataflowOutputPort;
- try {
- synchronized (dataflowOutputPortImpl) {
- doEditAction(dataflowOutputPortImpl);
- applied = true;
- return this.dataflowOutputPort;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param dataflowOutputPort
- * The DataflowOutputPortImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DataflowOutputPortImpl dataflowOutputPort)
- throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(DataflowOutputPortImpl dataflowOutputPort);
-
- public final DataflowOutputPort getSubject() {
- return dataflowOutputPort;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- DataflowOutputPortImpl dataflowOutputPortImpl = (DataflowOutputPortImpl) dataflowOutputPort;
- synchronized (dataflowOutputPortImpl) {
- undoEditAction(dataflowOutputPortImpl);
- applied = false;
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java
deleted file mode 100644
index cf46b3f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a Datalink instance. Handles the check to
- * see that the Datalink supplied is really a DatalinkImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDatalinkEdit implements Edit<Datalink> {
-
- private boolean applied = false;
-
- private Datalink datalink;
-
- protected AbstractDatalinkEdit(Datalink datalink) {
- if (datalink == null) {
- throw new RuntimeException(
- "Cannot construct a datalink edit with null datalink");
- }
- this.datalink = datalink;
- }
-
- public final Datalink doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (datalink instanceof DatalinkImpl == false) {
- throw new EditException(
- "Edit cannot be applied to a Datalink which isn't an instance of DatalinkImpl");
- }
- DatalinkImpl datalinkImpl = (DatalinkImpl) datalink;
- try {
- synchronized (datalinkImpl) {
- doEditAction(datalinkImpl);
- applied = true;
- return this.datalink;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param datalink
- * The DatalinkImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DatalinkImpl datalink)
- throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(DatalinkImpl datalink);
-
- public final Datalink getSubject() {
- return datalink;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- DatalinkImpl datalinkImpl = (DatalinkImpl) datalink;
- synchronized (datalinkImpl) {
- undoEditAction(datalinkImpl);
- applied = false;
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEdit.java
deleted file mode 100644
index f59098b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEdit.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * An abstract {@link Edit} implementation that checks if an edit has been
- * applied or not, and that can also check if the subject implements the given
- * implementation subclass.
- *
- * @author Stian Soiland-Reyes
- *
- * @param <SubjectInterface>
- * Official interface of the Subject of this edit
- * @param <SubjectType>
- * Expected implementation type of the Subject of this edit
- */
-public abstract class AbstractEdit<SubjectInterface, SubjectType extends SubjectInterface>
- implements Edit<SubjectInterface> {
-
- private boolean applied = false;
- protected SubjectInterface subject;
- private final Class<? extends SubjectInterface> subjectType;
-
- /**
- * Construct an AbstractEdit.
- *
- * @param subjectType
- * The expected implementation type of the subject. The edit will
- * not go through unless the subject is an instance of this type.
- * If the edit don't care about the implementation type, provide
- * the official SubjectInterface instead.
- * @param subject
- * The subject of this edit
- */
- @SuppressWarnings("unchecked")
- public AbstractEdit(Class<?> subjectType, SubjectInterface subject) {
- if (subject == null && !isNullSubjectAllowed()) {
- throw new RuntimeException(
- "Cannot construct an edit with null subject");
- }
- this.subjectType = (Class<? extends SubjectInterface>) subjectType;
- this.subject = subject;
- }
-
- protected boolean isNullSubjectAllowed() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public final SubjectInterface doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (!subjectType.isInstance(subject)) {
- throw new EditException(
- "Edit cannot be applied to a object which isn't an instance of "
- + subjectType);
- }
- SubjectType subjectImpl = (SubjectType) subject;
- try {
- synchronized (subjectImpl) {
- doEditAction(subjectImpl);
- applied = true;
- return this.subject;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param subjectImpl
- * The implementation instance to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(SubjectType subjectImpl)
- throws EditException;
-
- /**
- * Undo any edit effects here
- *
- * @param subjectImpl
- * The implementation instance to which the edit applies
- */
- protected abstract void undoEditAction(SubjectType subjectImpl);
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public final SubjectType getSubject() {
- return (SubjectType) subject;
- }
-
- /**
- * {@inheritDoc}
- */
- public final boolean isApplied() {
- return applied;
- }
-
- /**
- * {@inheritDoc}
- */
- @SuppressWarnings("unchecked")
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- SubjectType subjectImpl = (SubjectType) subject;
- synchronized (subjectImpl) {
- undoEditAction(subjectImpl);
- applied = false;
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEventHandlingInputPort.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEventHandlingInputPort.java
deleted file mode 100644
index 1351500..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractEventHandlingInputPort.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.AbstractPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-/**
- * Extends AbstractPort with the getIncomingLink method and an additional
- * implementation method to set the incoming data link
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractEventHandlingInputPort extends AbstractPort
- implements EventHandlingInputPort {
-
- private Datalink incomingLink = null;
-
- protected AbstractEventHandlingInputPort(String name, int depth) {
- super(name, depth);
- }
-
- public Datalink getIncomingLink() {
- return this.incomingLink;
- }
-
- protected void setIncomingLink(Datalink newLink) {
- this.incomingLink = newLink;
- }
-
- protected void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractFilteringInputPort.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractFilteringInputPort.java
deleted file mode 100644
index b73ba6f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractFilteringInputPort.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.reference.ContextualizedT2Reference;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.FilteringInputPort;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-
-/**
- * Abstract superclass for filtering input ports, extend and implement the
- * pushXXX methods to configure behaviour
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractFilteringInputPort extends
- AbstractEventHandlingInputPort implements FilteringInputPort {
-
- protected AbstractFilteringInputPort(String name, int depth) {
- super(name, depth);
- this.filterDepth = depth;
- }
-
- public int getFilterDepth() {
- return this.filterDepth;
- }
-
- private int filterDepth;
-
- public void receiveEvent(WorkflowDataToken token) {
- receiveToken(token);
- }
-
- public void pushToken(WorkflowDataToken dt, String owningProcess,
- int desiredDepth) {
- if (dt.getData().getDepth() == desiredDepth) {
- pushData(getName(), owningProcess, dt.getIndex(), dt.getData(), dt
- .getContext());
- } else {
-
- ReferenceService rs = dt.getContext().getReferenceService();
-
- Iterator<ContextualizedT2Reference> children = rs.traverseFrom(dt
- .getData(), dt.getData().getDepth() - 1);
-
- while (children.hasNext()) {
- ContextualizedT2Reference ci = children.next();
- int[] newIndex = new int[dt.getIndex().length
- + ci.getIndex().length];
- int i = 0;
- for (int indx : dt.getIndex()) {
- newIndex[i++] = indx;
- }
- for (int indx : ci.getIndex()) {
- newIndex[i++] = indx;
- }
- pushToken(new WorkflowDataToken(owningProcess, newIndex, ci
- .getReference(), dt.getContext()), owningProcess,
- desiredDepth);
- }
- pushCompletion(getName(), owningProcess, dt.getIndex(), dt
- .getContext());
- }
- }
-
- public void receiveToken(WorkflowDataToken token) {
- String newOwner = transformOwningProcess(token.getOwningProcess());
- if (filterDepth == -1) {
- throw new WorkflowStructureException(
- "Input depth filter not configured on input port, failing");
- } else {
- int tokenDepth = token.getData().getDepth();
- if (tokenDepth == filterDepth) {
- if (filterDepth == getDepth()) {
- // Pass event straight through, the filter depth is the same
- // as the desired input port depth
- pushData(getName(), newOwner, token.getIndex(), token
- .getData(), token.getContext());
- } else {
- pushToken(token, newOwner, getDepth());
- /**
- * // Shred the input identifier into the appropriate port //
- * depth and send the events through, pushing a //
- * completion event at the end. DataManager dManager =
- * ContextManager .getDataManager(newOwner); Iterator<ContextualizedIdentifier>
- * children = dManager .traverse(token.getData(),
- * getDepth()); while (children.hasNext()) {
- * ContextualizedIdentifier ci = children.next(); int[]
- * newIndex = new int[token.getIndex().length +
- * ci.getIndex().length]; int i = 0; for (int indx :
- * token.getIndex()) { newIndex[i++] = indx; } for (int indx :
- * ci.getIndex()) { newIndex[i++] = indx; }
- * pushData(getName(), newOwner, newIndex, ci.getDataRef()); }
- * pushCompletion(getName(), newOwner, token.getIndex());
- */
-
- }
- } else if (tokenDepth > filterDepth) {
- // Convert to a completion event and push into the iteration
- // strategy
- pushCompletion(getName(), newOwner, token.getIndex(), token
- .getContext());
- } else if (tokenDepth < filterDepth) {
- // Normally we can ignore these, but there is a special case
- // where token depth is less than filter depth and there is no
- // index array. In this case we can't throw the token away as
- // there will never be an enclosing one so we have to use the
- // data manager to register a new single element collection and
- // recurse.
- if (token.getIndex().length == 0) {
- T2Reference ref = token.getData();
- ReferenceService rs = token.getContext()
- .getReferenceService();
- int currentDepth = tokenDepth;
- while (currentDepth < filterDepth) {
- // Wrap in a single item list
- List<T2Reference> newList = new ArrayList<T2Reference>();
- newList.add(ref);
- ref = rs.getListService().registerList(newList).getId();
- currentDepth++;
- }
- pushData(getName(), newOwner, new int[0], ref, token
- .getContext());
- }
- }
- }
- }
-
- public void setFilterDepth(int filterDepth) {
- this.filterDepth = filterDepth;
- if (filterDepth < getDepth()) {
- this.filterDepth = getDepth();
- }
- }
-
- /**
- * Action to take when the filter pushes a completion event out
- *
- * @param portName
- * @param owningProcess
- * @param index
- */
- protected abstract void pushCompletion(String portName,
- String owningProcess, int[] index, InvocationContext context);
-
- /**
- * Action to take when a data event is created by the filter
- *
- * @param portName
- * @param owningProcess
- * @param index
- * @param data
- */
- protected abstract void pushData(String portName, String owningProcess,
- int[] index, T2Reference data, InvocationContext context);
-
- /**
- * Override this to transform owning process identifiers as they pass
- * through the filter, by default this is the identity transformation
- *
- * @param oldOwner
- * @return
- */
- protected String transformOwningProcess(String oldOwner) {
- return oldOwner;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractMergeEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractMergeEdit.java
deleted file mode 100644
index 70739e0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractMergeEdit.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-
-public abstract class AbstractMergeEdit implements Edit<Merge>{
-
- Merge merge;
- boolean applied=false;
-
- public AbstractMergeEdit(Merge merge) {
- if (merge==null) throw new RuntimeException("Cannot construct a merge edit with a null merge");
- this.merge=merge;
- }
-
- public Merge doEdit() throws EditException {
- if (applied) throw new EditException("Edit has already been applied!");
- if (!(merge instanceof MergeImpl)) throw new EditException("Merge must be an instanceof MergeImpl");
- MergeImpl mergeImpl = (MergeImpl)merge;
- try {
- synchronized (mergeImpl) {
- doEditAction(mergeImpl);
- applied = true;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
-
- return this.merge;
- }
-
- protected abstract void doEditAction(MergeImpl mergeImpl) throws EditException;
- protected abstract void undoEditAction(MergeImpl mergeImpl);
-
- public Object getSubject() {
- return merge;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- MergeImpl mergeImpl = (MergeImpl) merge;
- synchronized (mergeImpl) {
- undoEditAction(mergeImpl);
- applied = false;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractProcessorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractProcessorEdit.java
deleted file mode 100644
index cefc24d..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractProcessorEdit.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Abstraction of an edit acting on a Processor instance. Handles the check to
- * see that the Processor supplied is really a ProcessorImpl.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractProcessorEdit implements Edit<Processor> {
-
- private boolean applied = false;
-
- private Processor processor;
-
- protected AbstractProcessorEdit(Processor p) {
- if (p == null) {
- throw new RuntimeException(
- "Cannot construct a processor edit with null processor");
- }
- this.processor = p;
- }
-
- public final Processor doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (!(processor instanceof ProcessorImpl)) {
- throw new EditException(
- "Edit cannot be applied to a Processor which isn't an instance of ProcessorImpl");
- }
- ProcessorImpl pi = (ProcessorImpl) processor;
- try {
- synchronized (pi) {
- doEditAction(pi);
- applied = true;
- return this.processor;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param processor
- * The ProcessorImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(ProcessorImpl processor)
- throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(ProcessorImpl processor);
-
- public final Processor getSubject() {
- return processor;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ProcessorImpl pi = (ProcessorImpl) processor;
- synchronized (pi) {
- undoEditAction(pi);
- applied = false;
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityEdit.java
deleted file mode 100644
index 972b462..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityEdit.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Add a new Activity to a Processor, adding the new Activity at the end of the
- * current activity list for that processor.
- *
- * @author Tom Oinn
- *
- */
-public class AddActivityEdit extends AbstractProcessorEdit {
-
- private Activity<?> activityToAdd;
-
- public AddActivityEdit(Processor processor, Activity<?> activity) {
- super(processor);
- this.activityToAdd = activity;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- List<Activity<?>> activities = processor.activityList;
- if (activities.contains(activityToAdd) == false) {
- synchronized (processor) {
- activities.add(activityToAdd);
- }
- } else {
- throw new EditException(
- "Cannot add a duplicate activity to processor");
- }
-
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- synchronized (processor) {
- processor.activityList.remove(activityToAdd);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortEdit.java
deleted file mode 100644
index fb9c6c6..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-
-/**
- * Adds an activity input port to an activity.
- *
- * @author David Withers
- */
-public class AddActivityInputPortEdit extends AbstractActivityEdit {
-
- private ActivityInputPort activityInputPort;
-
- public AddActivityInputPortEdit(Activity<?> activity, ActivityInputPort activityInputPort) {
- super(activity);
- this.activityInputPort = activityInputPort;
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity) throws EditException {
- activity.getInputPorts().add(activityInputPort);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getInputPorts().remove(activityInputPort);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortMappingEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortMappingEdit.java
deleted file mode 100644
index ce5e3d0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class AddActivityInputPortMappingEdit extends AbstractActivityEdit {
-
- private final String processorPortName;
- private final String activityPortName;
-
- public AddActivityInputPortMappingEdit(Activity<?> activity, String processorPortName, String activityPortName) {
- super(activity);
- this.processorPortName = processorPortName;
- this.activityPortName = activityPortName;
- }
- @Override
- protected void doEditAction(AbstractActivity<?> activity)
- throws EditException {
- if (activity.getInputPortMapping().containsKey(processorPortName)) throw new EditException("The output mapping for processor name:"+processorPortName+" already exists");
- // Note javadoc of getOutputPortMapping - the mapping is processorPort -> activityPort
- // -- opposite of the outputPortMapping
- activity.getInputPortMapping().put(processorPortName, activityPortName);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getInputPortMapping().remove(processorPortName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortEdit.java
deleted file mode 100644
index 481387a..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Adds an output port to an activity.
- *
- * @author David Withers
- */
-public class AddActivityOutputPortEdit extends AbstractActivityEdit {
-
- private OutputPort activityOutputPort;
-
- public AddActivityOutputPortEdit(Activity<?> activity, OutputPort activityInputPort) {
- super(activity);
- this.activityOutputPort = activityInputPort;
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity) throws EditException {
- activity.getOutputPorts().add(activityOutputPort);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getOutputPorts().remove(activityOutputPort);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortMappingEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortMappingEdit.java
deleted file mode 100644
index 19caeab..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class AddActivityOutputPortMappingEdit extends AbstractActivityEdit {
-
- private final String processorPortName;
- private final String activityPortName;
-
- public AddActivityOutputPortMappingEdit(Activity<?> activity, String processorPortName, String activityPortName) {
- super(activity);
- this.processorPortName = processorPortName;
- this.activityPortName = activityPortName;
- }
- @Override
- protected void doEditAction(AbstractActivity<?> activity)
- throws EditException {
- if (activity.getOutputPortMapping().containsKey(activityPortName)) throw new EditException("The mapping starting with:"+activityPortName+" already exists");
- // Note javadoc of getOutputPortMapping - the mapping is activityPort -> processorPort
- // -- opposite of the outputPortMapping
- activity.getOutputPortMapping().put(activityPortName, processorPortName);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getOutputPortMapping().remove(activityPortName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationBeanEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationBeanEdit.java
deleted file mode 100644
index 027a4b4..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationBeanEdit.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-@SuppressWarnings("unchecked")
-public class AddAnnotationBeanEdit implements Edit<AnnotationAssertion> {
-
- private AnnotationAssertion annotationAssertion;
- private AnnotationBeanSPI annotationBean;
- private boolean applied;
-
- public AddAnnotationBeanEdit(AnnotationAssertion annotationAssertion,
- AnnotationBeanSPI annotationBean) {
- this.annotationAssertion = annotationAssertion;
- this.annotationBean = annotationBean;
- }
-
- public AnnotationAssertion doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationAssertion instanceof AnnotationAssertionImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationAssertionImpl");
- }
-
- try {
- synchronized (annotationAssertion) {
- ((AnnotationAssertionImpl) annotationAssertion).setAnnotationBean(annotationBean);
- applied = true;
- return this.annotationAssertion;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
- }
-
- public Object getSubject() {
- return annotationAssertion;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationAssertionImpl) annotationAssertion).removeAnnotationBean();
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationRoleEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationRoleEdit.java
deleted file mode 100644
index 94d1069..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationRoleEdit.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.AnnotationRole;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-@SuppressWarnings("unchecked")
-public class AddAnnotationRoleEdit implements Edit<AnnotationAssertion> {
-
- private AnnotationAssertion annotationAssertion;
- private AnnotationRole annotationRole;
- private boolean applied;
-
- @SuppressWarnings("unchecked")
- public AddAnnotationRoleEdit(AnnotationAssertion annotationAssertion,
- AnnotationRole annotationRole) {
- this.annotationAssertion = annotationAssertion;
- this.annotationRole = annotationRole;
- }
-
- public AnnotationAssertion doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationAssertion instanceof AnnotationAssertionImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationAssertionImpl");
- }
-
- try {
- synchronized (annotationAssertion) {
- ((AnnotationAssertionImpl) annotationAssertion)
- .setAnnotationRole(annotationRole);
- applied = true;
- return this.annotationAssertion;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
- }
-
- public Object getSubject() {
- return annotationAssertion;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationAssertionImpl) annotationAssertion).removeAnnotationRole();
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationSourceEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationSourceEdit.java
deleted file mode 100644
index 34814dc..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddAnnotationSourceEdit.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-@SuppressWarnings("unchecked")
-public class AddAnnotationSourceEdit implements Edit<AnnotationAssertion> {
-
- private AnnotationAssertion annotationAssertion;
- private AnnotationSourceSPI annotationSource;
- private boolean applied;
-
- @SuppressWarnings("unchecked")
- public AddAnnotationSourceEdit(AnnotationAssertion annotationAssertion,
- AnnotationSourceSPI annotationSource) {
- this.annotationAssertion = annotationAssertion;
- this.annotationSource = annotationSource;
- }
-
- public AnnotationAssertion doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationAssertion instanceof AnnotationAssertionImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationAssertionImpl");
- }
-
- try {
- synchronized (annotationAssertion) {
- ((AnnotationAssertionImpl) annotationAssertion)
- .setAnnotationSource(annotationSource);
- applied = true;
- return this.annotationAssertion;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
- }
-
- public Object getSubject() {
- return annotationAssertion;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationAssertionImpl) annotationAssertion)
- .removeAnnotationSource();
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCreatorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCreatorEdit.java
deleted file mode 100644
index 5b716eb..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCreatorEdit.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.Person;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-@SuppressWarnings("unchecked")
-public class AddCreatorEdit implements Edit<AnnotationAssertion> {
-
- private AnnotationAssertion annotationAssertion;
- private Person person;
- private boolean applied;
-
- @SuppressWarnings("unchecked")
- public AddCreatorEdit(AnnotationAssertion annotationAssertion, Person person) {
- this.annotationAssertion = annotationAssertion;
- this.person = person;
- }
-
- public AnnotationAssertion doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationAssertion instanceof AnnotationAssertionImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationAssertionImpl");
- }
-
- try {
- synchronized (annotationAssertion) {
- ((AnnotationAssertionImpl) annotationAssertion).addCreator(person);
- applied = true;
- return this.annotationAssertion;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
- }
-
- public Object getSubject() {
- return annotationAssertion;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationAssertionImpl) annotationAssertion).removeCreator(person);
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCurationEventEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCurationEventEdit.java
deleted file mode 100644
index a256930..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddCurationEventEdit.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.CurationEvent;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-@SuppressWarnings("unchecked")
-public class AddCurationEventEdit implements Edit<AnnotationAssertion> {
-
- private AnnotationAssertion annotationAssertion;
- private CurationEvent curationEvent;
- private boolean applied;
-
- @SuppressWarnings("unchecked")
- public AddCurationEventEdit(AnnotationAssertion annotationAssertion,
- CurationEvent curationEvent) {
- this.annotationAssertion = annotationAssertion;
- this.curationEvent = curationEvent;
- }
-
- public AnnotationAssertion doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied");
- }
- if (!(annotationAssertion instanceof AnnotationAssertionImpl)) {
- throw new EditException(
- "Object being edited must be instance of AnnotationAssertionImpl");
- }
-
- try {
- synchronized (annotationAssertion) {
- ((AnnotationAssertionImpl) annotationAssertion)
- .addCurationEvent(curationEvent);
- applied = true;
- return this.annotationAssertion;
- }
- } catch (Exception e) {
- applied = false;
- throw new EditException("There was a problem with the edit", e);
- }
- }
-
- public Object getSubject() {
- return annotationAssertion;
- }
-
- public boolean isApplied() {
- return applied;
- }
-
- public void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- ((AnnotationAssertionImpl)annotationAssertion).removeCurationEvent(curationEvent);
- applied = false;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowInputPortEdit.java
deleted file mode 100644
index a3065d0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowInputPortEdit.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Adds a dataflow input port to a dataflow.
- *
- * @author David Withers
- */
-public class AddDataflowInputPortEdit extends AbstractDataflowEdit {
-
- private DataflowInputPort dataflowInputPort;
-
- public AddDataflowInputPortEdit(Dataflow dataflow, DataflowInputPort dataflowInputPort) {
- super(dataflow);
- this.dataflowInputPort = dataflowInputPort;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- if (dataflowInputPort instanceof DataflowInputPortImpl) {
- dataflow.addInputPort((DataflowInputPortImpl) dataflowInputPort);
- }
- else {
- throw new EditException("The DataflowInputPort is of the wrong implmentation, it should be of type DataflowInputPortImpl");
- }
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- try {
- dataflow.removeDataflowInputPort(dataflowInputPort);
- } catch (EditException e1) {
- //this port has already been added
- }
- }
-
- public DataflowInputPort getDataflowInputPort() {
- return dataflowInputPort;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowOutputPortEdit.java
deleted file mode 100644
index 5cc5409..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Adds a dataflow output port to a dataflow.
- *
- * @author David Withers
- */
-public class AddDataflowOutputPortEdit extends AbstractDataflowEdit {
-
- private DataflowOutputPort dataflowOutputPort;
-
- public AddDataflowOutputPortEdit(Dataflow dataflow, DataflowOutputPort dataflowOutputPort) {
- super(dataflow);
- this.dataflowOutputPort = dataflowOutputPort;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- if (dataflowOutputPort instanceof DataflowOutputPortImpl) {
- dataflow.addOutputPort((DataflowOutputPortImpl) dataflowOutputPort);
- }
- else {
- throw new EditException("The DataflowOutputPort is of the wrong implmentation, it should be of type DataflowOutputPortImpl");
- }
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- try {
- dataflow.removeDataflowOutputPort(dataflowOutputPort);
- } catch (EditException e1) {
- //this port has already been added
- }
- }
-
- public DataflowOutputPort getDataflowOutputPort() {
- return dataflowOutputPort;
- }
-
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeEdit.java
deleted file mode 100644
index a84ca24..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeEdit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-
-/**
- * An Edit class responsible for adding a Merge to the dataflow.
- *
- * @author Tom Oinn
- *
- */
-public class AddMergeEdit extends AbstractDataflowEdit{
-
- private Merge merge;
-
- protected AddMergeEdit(Dataflow dataflow, Merge merge) {
- super(dataflow);
- this.merge=merge;
- }
-
- /**
- * Adds the Merge instance to the Dataflow
- *
- * @throws EditException if the edit has already taken place (without an intermediate undo) or a processor with that name already exists.
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- if (merge instanceof MergeImpl) {
- dataflow.addMerge((MergeImpl)merge);
- }
- else {
- throw new EditException("The Merge is of the wrong implmentation, it should be of type MergeImpl");
- }
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- dataflow.removeMerge(merge);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeInputPortEdit.java
deleted file mode 100644
index 4c20738..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddMergeInputPortEdit.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-
-/**
- * Adds a merge input port to a merge.
- *
- * @author David Withers
- */
-public class AddMergeInputPortEdit extends AbstractMergeEdit {
-
- private MergeInputPort mergeInputPort;
-
- public AddMergeInputPortEdit(Merge merge, MergeInputPort mergeInputPort) {
- super(merge);
- this.mergeInputPort = mergeInputPort;
- }
-
- @Override
- protected void doEditAction(MergeImpl mergeImpl) throws EditException {
- if (mergeInputPort instanceof MergeInputPortImpl) {
- mergeImpl.addInputPort((MergeInputPortImpl) mergeInputPort);
- }
- else {
- throw new EditException("The MergeInputPort is of the wrong implmentation, it should be of type MergeInputPortImpl");
- }
- }
-
- @Override
- protected void undoEditAction(MergeImpl mergeImpl) {
- if (mergeInputPort instanceof MergeInputPortImpl) {
- mergeImpl.removeInputPort((MergeInputPortImpl) mergeInputPort);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEdit.java
deleted file mode 100644
index 1cec30e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEdit.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * An Edit class responsible for add a Processor to the dataflow.
- *
- * @author Stuart Owen
- *
- */
-public class AddProcessorEdit extends AbstractDataflowEdit{
-
- private Processor processor;
-
- public Processor getProcessor() {
- return processor;
- }
-
- protected AddProcessorEdit(Dataflow dataflow, Processor processor) {
- super(dataflow);
- this.processor=processor;
- }
-
- /**
- * Adds the Processor instance to the Dataflow
- *
- * @throws EditException if the edit has already taken place (without an intermediate undo) or a processor with that name already exists.
- */
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- if (processor instanceof ProcessorImpl) {
- dataflow.addProcessor((ProcessorImpl)processor);
- }
- else {
- throw new EditException("The Processor is of the wrong implmentation, it should be of type ProcessorImpl");
- }
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- dataflow.removeProcessor(processor);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorInputPortEdit.java
deleted file mode 100644
index 59fb30a..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorInputPortEdit.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.NamedInputPortNode;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-
-import org.jdom.Element;
-
-/**
- * Build a new input port on a processor, also modifies the processor's
- * iteration strategy or strategies to ensure the new port is bound into them.
- *
- * @author Tom Oinn
- *
- */
-public class AddProcessorInputPortEdit extends AbstractProcessorEdit {
-
- Element previousIterationStrategyState = null;
-
- private final ProcessorInputPortImpl port;
-
- public AddProcessorInputPortEdit(Processor p, ProcessorInputPort port) {
- super(p);
- this.port = (ProcessorInputPortImpl)port;
-
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- // Add a new InputPort object to the processor and also create an
- // appropriate NamedInputPortNode in any iteration strategies. By
- // default set the desired drill depth on each iteration strategy node
- // to the same as the input port, so this won't automatically trigger
- // iteration staging unless the depth is altered on the iteration
- // strategy itself.)
- if (processor.getInputPortWithName(port.getName()) != null) {
- throw new EditException(
- "Attempt to create duplicate input port with name '"
- + port.getName() + "'");
- }
- previousIterationStrategyState = processor.iterationStack.asXML();
- processor.inputPorts.add(port);
- for (IterationStrategyImpl is : processor.iterationStack.getStrategies()) {
- NamedInputPortNode nipn = new NamedInputPortNode(port.getName(),
- port.getDepth());
- is.addInput(nipn);
- is.connectDefault(nipn);
- }
-
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- processor.iterationStack
- .configureFromElement(previousIterationStrategyState);
- processor.inputPorts
- .remove(processor.getInputPortWithName(port.getName()));
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorOutputPortEdit.java
deleted file mode 100644
index 7a67268..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Add a new output port to the specified ProcessorImpl
- *
- * @author Tom Oinn
- *
- */
-public class AddProcessorOutputPortEdit extends AbstractProcessorEdit {
-
- private final ProcessorOutputPortImpl port;
-
- public AddProcessorOutputPortEdit(Processor processor, OutputPort port) {
- super(processor);
- this.port = (ProcessorOutputPortImpl)port;
-
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- if (processor.getOutputPortWithName(port.getName()) != null) {
- throw new EditException("Duplicate output port name");
- }
-
- processor.outputPorts.add(port);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- BasicEventForwardingOutputPort pop = processor.getOutputPortWithName(port.getName());
- if (pop != null) {
- processor.outputPorts.remove(pop);
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/BasicEventForwardingOutputPort.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/BasicEventForwardingOutputPort.java
deleted file mode 100644
index c8587f8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/BasicEventForwardingOutputPort.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.AbstractOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-
-/**
- * Extension of AbstractOutputPort implementing EventForwardingOutputPort
- *
- * @author Tom Oinn
- *
- */
-public class BasicEventForwardingOutputPort extends AbstractOutputPort
- implements EventForwardingOutputPort {
-
- protected Set<DatalinkImpl> outgoingLinks;
-
- /**
- * Construct a new abstract output port with event forwarding capability
- *
- * @param portName
- * @param portDepth
- * @param granularDepth
- */
- public BasicEventForwardingOutputPort(String portName, int portDepth,
- int granularDepth) {
- super(portName, portDepth, granularDepth);
- this.outgoingLinks = new HashSet<DatalinkImpl>();
- }
-
- /**
- * Implements EventForwardingOutputPort
- */
- public final Set<? extends Datalink> getOutgoingLinks() {
- return Collections.unmodifiableSet(this.outgoingLinks);
- }
-
- /**
- * Forward the specified event to all targets
- *
- * @param e
- */
- public void sendEvent(WorkflowDataToken e) {
- for (Datalink link : outgoingLinks) {
- link.getSink().receiveEvent(e);
- }
- }
-
- protected void addOutgoingLink(DatalinkImpl link) {
- if (outgoingLinks.contains(link) == false) {
- outgoingLinks.add(link);
- }
- }
-
- protected void removeOutgoingLink(Datalink link) {
- outgoingLinks.remove(link);
- }
-
- protected void setDepth(int depth) {
- this.depth = depth;
- }
-
- protected void setGranularDepth(int granularDepth) {
- this.granularDepth = granularDepth;
- }
-
- protected void setName(String name) {
- this.name = name;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEdit.java
deleted file mode 100644
index 60007fa..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Change the depth of the specified DataflowInputPort.
- *
- * @author David Withers
- *
- */
-public class ChangeDataflowInputPortDepthEdit extends AbstractDataflowInputPortEdit {
-
- private int newDepth;
-
- private int oldDepth;
-
- public ChangeDataflowInputPortDepthEdit(DataflowInputPort dataflowInputPort, int newDepth) {
- super(dataflowInputPort);
- this.newDepth = newDepth;
- }
-
- @Override
- protected void doEditAction(DataflowInputPortImpl dataflowInputPort) throws EditException {
- oldDepth = dataflowInputPort.getDepth();
- dataflowInputPort.setDepth(newDepth);
- }
-
- @Override
- protected void undoEditAction(DataflowInputPortImpl dataflowInputPort) {
- dataflowInputPort.setDepth(oldDepth);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEdit.java
deleted file mode 100644
index 751057b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Change the granular depth of the specified DataflowInputPort.
- *
- * @author David Withers
- *
- */
-public class ChangeDataflowInputPortGranularDepthEdit extends AbstractDataflowInputPortEdit {
-
- private int newGranularDepth;
-
- private int oldGranularDepth;
-
- public ChangeDataflowInputPortGranularDepthEdit(DataflowInputPort dataflowInputPort, int newGranularDepth) {
- super(dataflowInputPort);
- this.newGranularDepth = newGranularDepth;
- }
-
- @Override
- protected void doEditAction(DataflowInputPortImpl dataflowInputPort) throws EditException {
- oldGranularDepth = dataflowInputPort.getGranularInputDepth();
- dataflowInputPort.setGranularDepth(newGranularDepth);
- }
-
- @Override
- protected void undoEditAction(DataflowInputPortImpl dataflowInputPort) {
- dataflowInputPort.setGranularDepth(oldGranularDepth);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConditionImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConditionImpl.java
deleted file mode 100644
index 58334a5..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConditionImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.workflowmodel.Condition;
-
-public class ConditionImpl extends AbstractAnnotatedThing<Condition> implements Condition {
-
- private ProcessorImpl control, target;
-
- private Map<String, Boolean> stateMap = new HashMap<String, Boolean>();
-
- protected ConditionImpl(ProcessorImpl control, ProcessorImpl target) {
- this.control = control;
- this.target = target;
- }
-
- public ProcessorImpl getControl() {
- return this.control;
- }
-
- public ProcessorImpl getTarget() {
- return this.target;
- }
-
- public boolean isSatisfied(String owningProcess) {
- if (stateMap.containsKey(owningProcess)) {
- return stateMap.get(owningProcess);
- } else {
- return false;
- }
- }
-
- protected void satisfy(String owningProcess) {
- stateMap.put(owningProcess, Boolean.TRUE);
- // TODO - poke target processor here
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEdit.java
deleted file mode 100644
index 63a44aa..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEdit.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-import org.apache.log4j.Logger;
-
-/**
- * An Edit that is responsible for configuring an Activity with a given
- * configuration bean.
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- *
- */
-@SuppressWarnings("unchecked")
-public class ConfigureActivityEdit extends ConfigureEdit {
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger
- .getLogger(ConfigureActivityEdit.class);
-
- public ConfigureActivityEdit(Activity<?> activity, Object configurationBean) {
- super(Activity.class, activity, configurationBean);
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureEdit.java
deleted file mode 100644
index f339215..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureEdit.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.workflowmodel.Configurable;
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.AbstractXMLDeserializer;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.AbstractXMLSerializer;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-/**
- * An Edit that is responsible for configuring a {@link Configurable} with a
- * given configuration bean.
- *
- * @author Stuart Owen
- * @author Stian Soiland-Reyes
- */
-@SuppressWarnings("unchecked")
-public class ConfigureEdit<SubjectInterface extends Configurable, SubjectType extends SubjectInterface>
- extends AbstractEdit<SubjectInterface, SubjectType> {
-
- private static Logger logger = Logger
- .getLogger(ConfigureEdit.class);
-
- private BeanDeSerialiser beanDeSerialiser = new BeanDeSerialiser();
-
- private BeanSerialiser beanSerialiser = new BeanSerialiser();
-
- private final Object configurationBean;
-
- private Element previousBean;
-
- public ConfigureEdit(Class<?> subjectType,
- SubjectInterface configurable, Object configurationBean) {
- super(subjectType, configurable);
- this.configurationBean = configurationBean;
- }
-
- @Override
- protected void doEditAction(SubjectType subject) throws EditException {
- if (subject.getConfiguration() == null) {
- previousBean = null;
- } else {
- try {
- previousBean = beanSerialiser.beanAsElement(subject
- .getConfiguration());
- } catch (Exception e) {
- logger.error("Error serializing configuration bean for: "
- + subject);
- throw new EditException(
- "Error serializing configuration bean for: " + subject,
- e);
- }
- }
-
- try {
- // FIXME: Should clone bean on configuration to prevent caller from
- // modifying bean afterwards
- subject.configure(configurationBean);
- } catch (ConfigurationException e) {
- logger.error("Error configuring :"
- + subject.getClass().getSimpleName(), e);
- throw new EditException(e);
- }
- }
-
- protected Object cloneBean(Object object) throws JDOMException, IOException {
- Element element = beanSerialiser.beanAsElement(object);
- return beanDeSerialiser.createBean(element);
- }
-
- @Override
- protected void undoEditAction(SubjectType subject) {
- try {
- if (previousBean == null) {
- logger.warn("Ignoring attempt to reconfiguring " + subject + " with a null-bean");
- // which would breaks most activities if undoing a recent
- // dragging of activity to dataflow
- // subject.configure(null);
- } else {
- Object bean = beanDeSerialiser.createBean(previousBean);
- subject.configure(bean);
- }
- } catch (ConfigurationException e) {
- logger.error("There was an error reconfiguring " + subject
- + " during an undo");
- }
- }
-
- /**
- * Deserialise the bean using its classloader if it has one, otherwise use
- * the bean deserialisers
- *
- */
- protected class BeanDeSerialiser extends AbstractXMLDeserializer {
- public Object createBean(Element configElement) {
- ClassLoader beanClassLoader = getClass().getClassLoader();
- ClassLoader configurableClassLoader = getSubject()
- .getConfiguration().getClass().getClassLoader();
- if (configurableClassLoader != null) {
- return super.createBean(configElement, configurableClassLoader);
- } else {
- return super.createBean(configElement, beanClassLoader);
- }
- }
- }
-
- protected class BeanSerialiser extends AbstractXMLSerializer {
- public Element beanAsElement(Object obj) throws JDOMException,
- IOException {
- return super.beanAsElement(obj);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEdit.java
deleted file mode 100644
index cc16ff0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEdit.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-/**
- * Connect a datalink to its source and sink.
- *
- * @author David Withers
- *
- */
-public class ConnectDatalinkEdit extends AbstractDatalinkEdit {
-
- public ConnectDatalinkEdit(Datalink datalink) {
- super(datalink);
- }
-
- @Override
- protected void doEditAction(DatalinkImpl datalink) throws EditException {
- EventForwardingOutputPort source = datalink.getSource();
- EventHandlingInputPort sink = datalink.getSink();
- if (source instanceof BasicEventForwardingOutputPort) {
- ((BasicEventForwardingOutputPort) source).addOutgoingLink(datalink);
- }
- if (sink instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort) sink).setIncomingLink(datalink);
- }
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- EventForwardingOutputPort source = datalink.getSource();
- EventHandlingInputPort sink = datalink.getSink();
- if (source instanceof BasicEventForwardingOutputPort) {
- ((BasicEventForwardingOutputPort) source).removeOutgoingLink(datalink);
- }
- if (sink instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort) sink).setIncomingLink(null);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEdit.java
deleted file mode 100644
index 06fa753..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEdit.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.utils.Tools;
-
-/**
- * <p>
- * An edit that connects an EventForwardingOutputPort sourcePort and EventHandlingInputPort sinkPort together
- * via an intermediary {@link Merge} instance, which is provided to the constructor.
- * The connections are made using {@link Datalink}. Using a Merge facilitates multiple incoming Datalinks connect to a single
- * input port.
- * </p>
- * <p>
- * If an connection already exists between a sinkPort and a sourcePort, then then an new datalink is provided
- * for the incoming link but the outgoing link remains as is (since there can only be 1). In this case, if the
- * sink port differs from the existing one then an EditException is thrown.
- * </p>
- *
- * @author Stuart Owen
- *
- */
-public class ConnectMergedDatalinkEdit extends AbstractMergeEdit {
-
- private EventHandlingInputPort sinkPort;
- private EventForwardingOutputPort sourcePort;
- private Datalink inLink;
- private Datalink outLink;
- private Edit<Datalink> connectInLinkEdit;
- private Edit<Datalink> connectOutLinkEdit;
- private MergeInputPortImpl mergeInputPort;
-
- /**
- * Constructs the ConnectMergedDatalinkEdit with an existing Merge instance, and the source and sink ports that are to
- * be connected.
- *
- * @param merge
- * @param sourcePort
- * @param sinkPort
- */
- public ConnectMergedDatalinkEdit(Merge merge, EventForwardingOutputPort sourcePort, EventHandlingInputPort sinkPort) {
- super(merge);
- if (sinkPort==null) throw new RuntimeException("The sinkport cannot be null");
- this.sinkPort=sinkPort;
- if (sourcePort==null) throw new RuntimeException("The sourceport cannot be null");
- this.sourcePort=sourcePort;
- }
-
- @Override
- protected void doEditAction(MergeImpl mergeImpl) throws EditException {
- Edits edits = new EditsImpl();
- String name = Tools.getUniqueMergeInputPortName(mergeImpl, sourcePort.getName()+"To" + merge.getLocalName() + "_input", 0);
- mergeInputPort = new MergeInputPortImpl(mergeImpl,name,sinkPort.getDepth());
- inLink = edits.createDatalink(sourcePort, mergeInputPort);
- connectInLinkEdit=edits.getConnectDatalinkEdit(inLink);
- if (mergeImpl.getOutputPort().getOutgoingLinks().size()==0) {
- outLink = edits.createDatalink(mergeImpl.getOutputPort(), sinkPort);
- connectOutLinkEdit=edits.getConnectDatalinkEdit(outLink);
- }
- else if (mergeImpl.getOutputPort().getOutgoingLinks().size()==1){
- if (mergeImpl.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() != sinkPort) {
- throw new EditException("Cannot add a different sinkPort to a Merge that already has one defined");
- }
- }
- else {
- throw new EditException("The merge instance cannot have more that 1 outgoing Datalink");
- }
-
- mergeImpl.addInputPort(mergeInputPort);
- connectInLinkEdit.doEdit();
- if (connectOutLinkEdit!=null) connectOutLinkEdit.doEdit();
- }
-
- @Override
- protected void undoEditAction(MergeImpl mergeImpl) {
- if (connectOutLinkEdit!=null) connectOutLinkEdit.undo();
- connectInLinkEdit.undo();
- mergeImpl.removeInputPort(mergeInputPort);
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectProcesorOutputEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectProcesorOutputEdit.java
deleted file mode 100644
index bb4f2b9..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ConnectProcesorOutputEdit.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Connect the named output port on a given processor to the specified
- * EventHandlingInputPort, updating the connected port list on the output port
- * of the processor such that events will be forwarded as appropriate. If the
- * target port is a FilteringInputPort then also set the filter level
- * appropriately.
- *
- * @author Tom Oinn
- *
- */
-public class ConnectProcesorOutputEdit extends AbstractProcessorEdit {
-
- private EventHandlingInputPort target;
-
- private String outputName;
-
- private BasicEventForwardingOutputPort outputPort;
-
- private DatalinkImpl newLink = null;
-
- public ConnectProcesorOutputEdit(Processor p, String outputName,
- EventHandlingInputPort targetPort) {
- super(p);
- this.target = targetPort;
- this.outputName = outputName;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- for (BasicEventForwardingOutputPort popi : processor.outputPorts) {
- if (popi.getName().equals(outputName)) {
- newLink = new DatalinkImpl(popi, target);
- popi.addOutgoingLink(newLink);
- if (target instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort)target).setIncomingLink(newLink);
- }
- outputPort = popi;
- return;
- }
- }
- throw new EditException("Cannot locate output port with name '"
- + outputName + "'");
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- outputPort.removeOutgoingLink(newLink);
- if (target instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort)target).setIncomingLink(null);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateConditionEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateConditionEdit.java
deleted file mode 100644
index 3735f17..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateConditionEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-public class CreateConditionEdit extends AbstractBinaryProcessorEdit {
-
- private ConditionImpl condition;
-
- CreateConditionEdit(Processor control, Processor target) {
- super(control, target);
- }
-
- @Override
- protected void doEditAction(ProcessorImpl control, ProcessorImpl target) throws EditException {
- condition = new ConditionImpl(control, target);
- // Check for duplicates
- for (Condition c : control.controlledConditions) {
- if (c.getTarget() == target) {
- throw new EditException("Attempt to create duplicate control link");
- }
- }
- control.controlledConditions.add(condition);
- target.conditions.add(condition);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl control, ProcessorImpl target) {
- control.controlledConditions.remove(condition);
- target.conditions.remove(condition);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEdit.java
deleted file mode 100644
index d12d095..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEdit.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Adds a new input port to a dataflow
- *
- * @author David Withers
- *
- */
-public class CreateDataflowInputPortEdit extends AbstractDataflowEdit {
-
- private String newPortName;
-
- private int newPortDepth;
-
- private int newPortGranularDepth;
-
- public CreateDataflowInputPortEdit(Dataflow dataflow, String portName,
- int portDepth, int portGranularDepth) {
- super(dataflow);
- this.newPortName = portName;
- this.newPortDepth = portDepth;
- this.newPortGranularDepth = portGranularDepth;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.createInputPort(newPortName, newPortDepth, newPortGranularDepth);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- try {
- dataflow.removeDataflowInputPort(newPortName);
- } catch (EditException e) {
- //shouldn't happen as port should exist
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEdit.java
deleted file mode 100644
index 63e3dde..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Adds a new output port to a dataflow
- *
- * @author David Withers
- *
- */
-public class CreateDataflowOutputPortEdit extends AbstractDataflowEdit {
-
- private String newPortName;
-
- public CreateDataflowOutputPortEdit(Dataflow dataflow, String portName) {
- super(dataflow);
- this.newPortName = portName;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.createOutputPort(newPortName);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- try {
- dataflow.removeDataflowOutputPort(newPortName);
- } catch (EditException e) {
- // shouldn't happen as port should exist
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Crystalizer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Crystalizer.java
deleted file mode 100644
index 60ccd66..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Crystalizer.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Recieves Job and Completion events and emits Jobs unaltered. Completion
- * events additionally cause registration of lists for each key in the datamap
- * of the jobs at immediate child locations in the index structure. These list
- * identifiers are sent in place of the Completion events.
- * <p>
- * State for a given process ID is purged when a final completion event is
- * received so there is no need for an explicit cache purge operation in the
- * public API (although for termination of partially complete workflows it may
- * be sensible for subclasses to provide one)
- * <p>
- *
- * @author Tom Oinn
- */
-public interface Crystalizer {
-
- /**
- * Receive a Job or Completion, Jobs are emitted unaltered and cached,
- * Completion events trigger registration of a corresponding list - this may
- * be recursive in nature if the completion event's index implies nested
- * lists which have not been registered.
- */
- public void receiveEvent(IterationInternalEvent<? extends IterationInternalEvent<?>> event);
-
- /**
- * This method is called when a new Job has been handled by the
- * AbstractCrystalizer, either by direct passthrough or by list
- * registration.
- *
- */
- public void jobCreated(Job outputJob);
-
- /**
- * Called whenever a completion not corresponding to a node in the cache is
- * generated. In many cases this is an indication of an error state, the
- * processor implementation should ensure that completion events are only
- * sent to the crystalizer if there has been at least one data event with a
- * lower depth on the same path.
- */
- public void completionCreated(Completion completion);
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImpl.java
deleted file mode 100644
index 1b76f0e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImpl.java
+++ /dev/null
@@ -1,782 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.monitor.MonitorManager;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.FailureTransmitter;
-import net.sf.taverna.t2.workflowmodel.InvalidDataflowException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.NamedWorkflowEntity;
-import net.sf.taverna.t2.workflowmodel.NamingException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.TokenProcessingEntity;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-
-/**
- * Implementation of Dataflow including implementation of the dataflow level
- * type checker. Other than this the implementation is fairly simple as it's
- * effectively just a container for other things especially the dataflow input
- * and output port implementations.
- *
- * @author Tom Oinn
- *
- */
-public class DataflowImpl extends AbstractAnnotatedThing<Dataflow> implements
- Dataflow {
-
- List<ProcessorImpl> processors;
- List<MergeImpl> merges;
- private String name;
- private static int nameIndex = 1;
- private List<DataflowInputPortImpl> inputs;
- private List<DataflowOutputPortImpl> outputs;
- protected String internalIdentifier;
-
- /**
- * Protected constructor, assigns a default name. To build an instance of
- * DataflowImpl you should use the appropriate Edit object from the Edits
- * interface
- */
- protected DataflowImpl() {
- this.name = "Workflow" + (nameIndex++);
- this.processors = new ArrayList<ProcessorImpl>();
- this.merges = new ArrayList<MergeImpl>();
- this.inputs = new ArrayList<DataflowInputPortImpl>();
- this.outputs = new ArrayList<DataflowOutputPortImpl>();
- refreshInternalIdentifier();
- }
-
- /**
- * Adds a processor on the DataFlow.
- *
- * @param processor
- * the ProcessorImpl to be added to the Dataflow
- * @return
- * @throws NamingException
- * if a processor already exists with the same local name
- */
- protected synchronized void addProcessor(ProcessorImpl processor)
- throws NamingException {
- for (Processor existingProcessor : processors
- .toArray(new Processor[] {})) {
- if (existingProcessor.getLocalName().equals(
- processor.getLocalName()))
- throw new NamingException("There already is a processor named:"
- + processor.getLocalName());
- }
- processors.add(processor);
- }
-
- protected synchronized void removeProcessor(Processor processor) {
- processors.remove(processor);
- }
-
- /**
- * Adds a processor on the DataFlow.
- *
- * @param processor
- * the ProcessorImpl to be added to the Dataflow
- * @return
- * @throws NamingException
- * if a processor already exists with the same local name
- */
- protected synchronized void addMerge(MergeImpl merge)
- throws NamingException {
- for (Merge existingMerge : merges.toArray(new Merge[] {})) {
- if (existingMerge.getLocalName().equals(merge.getLocalName()))
- throw new NamingException(
- "There already is a merge operation named:"
- + merge.getLocalName());
- }
- merges.add(merge);
- }
-
- protected synchronized void removeMerge(Merge merge) {
- merges.remove(merge);
- }
-
- /**
- * Build a new dataflow input port, the granular depth is set for the input
- * port so it can be copied onto the internal output port
- *
- * @param name
- * name of the dataflow input port to build
- * @param depth
- * input depth
- * @param granularDepth
- * granular depth to copy to the internal output port
- * @throws NamingException
- * in the event of a duplicate or invalid name
- * @return the newly created input port
- */
- protected synchronized DataflowInputPort createInputPort(String name,
- int depth, int granularDepth) throws NamingException {
- for (DataflowInputPort dip : inputs) {
- if (dip.getName().equals(name)) {
- throw new NamingException("Duplicate workflow input port name '" + name
- + "' in workflow already.");
- }
- }
- DataflowInputPortImpl dipi = new DataflowInputPortImpl(name, depth,
- granularDepth, this);
- inputs.add(dipi);
- return dipi;
- }
-
- /**
- * Adds an input port to the DataFlow.
- *
- * @param inputPort
- * the DataflowInputPortImpl to be added to the Dataflow
- * @throws EditException
- */
- protected synchronized void addInputPort(DataflowInputPortImpl inputPort)
- throws EditException {
- for (DataflowInputPort existingInputPort : inputs
- .toArray(new DataflowInputPort[] {})) {
- if (existingInputPort.getName().equals(inputPort.getName()))
- throw new NamingException("There already is a workflow input port named:"
- + inputPort.getName());
- }
- if (inputPort.getDataflow() != this) {
- throw new EditException("Port specifies a different workflow");
- }
- inputs.add(inputPort);
- }
-
- /**
- * Remove the named dataflow input port
- *
- * @param name
- * name of the dataflow input port to remove
- * @throws EditException
- * if the specified port doesn't exist within this dataflow
- */
- protected synchronized void removeDataflowInputPort(String name)
- throws EditException {
- DataflowInputPort found = null;
- for (DataflowInputPort dip : inputs) {
- if (dip.getName().equals(name)) {
- found = dip;
- break;
- }
- }
- if (found != null) {
- removeDataflowInputPort(found);
- } else {
- throw new EditException("No such input port '" + name
- + "' in workflow.");
- }
- }
-
- /**
- * Remove the specified input port from this dataflow
- *
- * @param dip
- * dataflow input port to remove
- * @throws EditException
- * if the input port isn't in the list of inputs - should never
- * happen but you never know.
- */
- protected synchronized void removeDataflowInputPort(DataflowInputPort dip)
- throws EditException {
- if (inputs.contains(dip)) {
- inputs.remove(dip);
- } else {
- throw new EditException(
- "Can't locate the specified input port in workflow. Input port has name '"
- + dip.getName() + "'.");
- }
- }
-
- /**
- * Create and return a new DataflowOutputPort in this dataflow
- *
- * @param name
- * name of the port to create, must be unique within the set of
- * output ports for this dataflow
- * @return the newly created DataflowOutputPort
- * @throws NamingException
- * if the name is invalid or already exists as a name for a
- * dataflow output
- */
- protected synchronized DataflowOutputPort createOutputPort(String name)
- throws NamingException {
- for (DataflowOutputPort dop : outputs) {
- if (dop.getName().equals(name)) {
- throw new NamingException("Duplicate workflow output port name '" + name
- + "' in workflow already.");
- }
- }
- DataflowOutputPortImpl dopi = new DataflowOutputPortImpl(name, this);
- outputs.add(dopi);
- return dopi;
- }
-
- /**
- * Adds an output port to the DataFlow.
- *
- * @param outputPort
- * the DataflowOutputPortImpl to be added to the Dataflow
- * @throws EditException
- */
- protected synchronized void addOutputPort(DataflowOutputPortImpl outputPort)
- throws EditException {
- for (DataflowOutputPort existingOutputPort : outputs
- .toArray(new DataflowOutputPort[] {})) {
- if (existingOutputPort.getName().equals(outputPort.getName()))
- throw new NamingException("There already is a workflow output port named:"
- + outputPort.getName());
- }
- if (outputPort.getDataflow() != this) {
- throw new EditException("Port specifies a different workflow");
- }
- outputs.add(outputPort);
- }
-
- /**
- * Remove the named dataflow output port
- *
- * @param name
- * name of the dataflow output port to remove
- * @throws EditException
- * if the specified port doesn't exist within this dataflow
- */
- protected synchronized void removeDataflowOutputPort(String name)
- throws EditException {
- DataflowOutputPort found = null;
- for (DataflowOutputPort dop : outputs) {
- if (dop.getName().equals(name)) {
- found = dop;
- break;
- }
- }
- if (found != null) {
- removeDataflowOutputPort(found);
- } else {
- throw new EditException("No such output port '" + name
- + "' in workflow.");
- }
- }
-
- /**
- * Remove the specified output port from this dataflow
- *
- * @param dop
- * dataflow output port to remove
- * @throws EditException
- * if the output port isn't in the list of outputs for this
- * dataflow
- */
- protected synchronized void removeDataflowOutputPort(DataflowOutputPort dop)
- throws EditException {
- if (outputs.contains(dop)) {
- outputs.remove(dop);
- } else {
- throw new EditException(
- "Can't locate the specified output port in workflow, output port has name '"
- + dop.getName() + "'.");
- }
- }
-
- /**
- * Create a new datalink between two entities within the workflow
- *
- * @param sourceName
- * interpreted either as the literal name of a dataflow input
- * port or the colon seperated name of a
- * [processorName|mergeName]:[outputPort]
- * @param sinkName
- * as with sourceName but for processor or merge input ports and
- * dataflow output ports
- * @return the created Datalink
- * @throws EditException
- * if either source or sink isn't found within this dataflow or
- * if the link would violate workflow structural constraints in
- * an immediate way. This won't catch cycles (see the validation
- * methods for that) but will prevent you from having more than
- * one link going to an input port.
- */
- protected synchronized Datalink link(String sourceName, String sinkName)
- throws EditException {
- BasicEventForwardingOutputPort source = null;
- AbstractEventHandlingInputPort sink = null;
-
- // Find source port
- String[] split = sourceName.split(":");
- if (split.length == 2) {
- // source is a processor
- // TODO - update to include Merge when it's added
- for (ProcessorImpl pi : processors) {
- if (pi.getLocalName().equals(split[0])) {
- source = pi.getOutputPortWithName(split[1]);
- break;
- }
- }
- } else if (split.length == 1) {
- // source is a workflow input port, or at least the internal output
- // port within it
- for (DataflowInputPortImpl dipi : inputs) {
- if (dipi.getName().equals(split[0])) {
- source = dipi.internalOutput;
- break;
- }
- }
- } else {
- throw new EditException("Invalid source link name '" + sourceName
- + "'.");
- }
- if (source == null) {
- throw new EditException("Unable to find source port named '"
- + sourceName + "' in link creation.");
- }
-
- // Find sink
- split = sinkName.split(":");
- if (split.length == 2) {
- // sink is a processor
- // TODO - update to include Merge when it's added
- for (ProcessorImpl pi : processors) {
- if (pi.getLocalName().equals(split[0])) {
- sink = pi.getInputPortWithName(split[1]);
- break;
- }
- }
- } else if (split.length == 1) {
- // source is a workflow input port, or at least the internal output
- // port within it
- for (DataflowOutputPortImpl dopi : outputs) {
- if (dopi.getName().equals(split[0])) {
- sink = dopi.internalInput;
- break;
- }
- }
- } else {
- throw new EditException("Invalid link sink name '" + sinkName
- + "'.");
- }
- if (sink == null) {
- throw new EditException("Unable to find sink port named '"
- + sinkName + "' in link creation");
- }
-
- // Check whether the sink is already linked
- if (sink.getIncomingLink() != null) {
- throw new EditException("Cannot link to sink port '" + sinkName
- + "' as it is already linked");
- }
-
- // Got here so we have both source and sink and the sink isn't already
- // linked from somewhere. If the sink isn't linked we can't have a
- // duplicate link here which would have been the other condition to
- // check for.
- DatalinkImpl link = new DatalinkImpl(source, sink);
- source.addOutgoingLink(link);
- sink.setIncomingLink(link);
-
- return link;
-
- }
-
- /**
- * Return a copy of the list of dataflow input ports for this dataflow
- */
- public synchronized List<? extends DataflowInputPort> getInputPorts() {
- return Collections.unmodifiableList(inputs);
- }
-
- /**
- * For each processor input, merge input and workflow output get the
- * incoming link and, if non null, add to a list and return the entire list.
- */
- public synchronized List<? extends Datalink> getLinks() {
- List<Datalink> result = new ArrayList<Datalink>();
- // All processors have a set of input ports each of which has at most
- // one incoming data link
- for (TokenProcessingEntity p : getEntities(TokenProcessingEntity.class)) {
- for (EventHandlingInputPort pip : p.getInputPorts()) {
- Datalink dl = pip.getIncomingLink();
- if (dl != null) {
- result.add(dl);
- }
- }
- }
- // Workflow outputs have zero or one incoming data link to their
- // internal input port
- for (DataflowOutputPort dop : getOutputPorts()) {
- Datalink dl = dop.getInternalInputPort().getIncomingLink();
- if (dl != null) {
- result.add(dl);
- }
- }
-
- return result;
- }
-
- /**
- * Return the list of all processors within the dataflow
- */
- public synchronized List<? extends Processor> getProcessors() {
- return getEntities(Processor.class);
- }
-
- /**
- * Return the list of all merge operations within the dataflow
- */
- public synchronized List<? extends Merge> getMerges() {
- return getEntities(Merge.class);
- }
-
- /**
- * Return all dataflow output ports
- */
- public synchronized List<? extends DataflowOutputPort> getOutputPorts() {
- return Collections.unmodifiableList(this.outputs);
- }
-
- /**
- * Return the local name of this workflow
- */
- public String getLocalName() {
- return this.name;
- }
-
- /**
- * Run the type check algorithm and return a report on any problems found.
- * This method must be called prior to actually pushing data through the
- * dataflow as it sets various properties as a side effect.
- */
- public synchronized DataflowValidationReport checkValidity() {
- // First things first - nullify the resolved depths in all datalinks
- for (Datalink dl : getLinks()) {
- if (dl instanceof DatalinkImpl) {
- DatalinkImpl dli = (DatalinkImpl) dl;
- dli.setResolvedDepth(-1);
- }
- }
- // Now copy type information from workflow inputs
- for (DataflowInputPort dip : getInputPorts()) {
- for (Datalink dl : dip.getInternalOutputPort().getOutgoingLinks()) {
- if (dl instanceof DatalinkImpl) {
- DatalinkImpl dli = (DatalinkImpl) dl;
- dli.setResolvedDepth(dip.getDepth());
- }
- }
- }
- // Now iteratively attempt to resolve everything else.
-
- // Firstly take a copy of the processor list, we'll processors from this
- // list as they become either failed or resolved
- List<TokenProcessingEntity> unresolved = new ArrayList<TokenProcessingEntity>(
- getEntities(TokenProcessingEntity.class));
-
- // Keep a list of processors that have failed, initially empty
- List<TokenProcessingEntity> failed = new ArrayList<TokenProcessingEntity>();
-
- /**
- * Is the dataflow valid? The flow is valid if and only if both
- * unresolved and failed lists are empty at the end. This doesn't
- * guarantee that the workflow will run, in particular it doesn't
- * actually check for issues such as unresolved output edges.
- */
-
- // Flag to indicate whether we've finished yet, set to true if no
- // changes are made in an iteration
- boolean finished = false;
-
- Map<TokenProcessingEntity, DataflowValidationReport> invalidDataflows = new HashMap<TokenProcessingEntity, DataflowValidationReport>();
- while (!finished) {
- // We're finished unless something happens later
- finished = true;
- // Keep a list of processors to remove from the unresolved list
- // because they've been resolved properly
- List<TokenProcessingEntity> removeValidated = new ArrayList<TokenProcessingEntity>();
- // Keep another list of those that have failed
- List<TokenProcessingEntity> removeFailed = new ArrayList<TokenProcessingEntity>();
-
-
- for (TokenProcessingEntity p : unresolved) {
- try {
- // true = checked and valid, false = can't check, the
- // exception means the processor was checked but was invalid
- // for some reason
- boolean entityValid = p.doTypeCheck();
- if (entityValid) {
- removeValidated.add(p);
- }
- } catch (IterationTypeMismatchException e) {
- removeFailed.add(p);
- } catch (InvalidDataflowException e) {
- invalidDataflows.put(p, e.getDataflowValidationReport());
- removeFailed.add(p);
- }
- }
-
- /**
- * Remove validated and failed items from the pending lists. If
- * anything was removed because it validated okay then we're not
- * finished yet and should reset the boolean finished flag
- */
- for (TokenProcessingEntity p : removeValidated) {
- unresolved.remove(p);
- finished = false;
- }
- for (TokenProcessingEntity p : removeFailed) {
- unresolved.remove(p);
- failed.add(p);
- }
-
- }
-
- // At this point we know whether the processors within the workflow
- // validated. If all the processors validated then we're probably okay,
- // but there are a few other problems to check for. Firstly we need to
- // check whether all the dataflow outputs are connected; any unconnected
- // output is by definition a validation failure.
- List<DataflowOutputPort> unresolvedOutputs = new ArrayList<DataflowOutputPort>();
- for (DataflowOutputPortImpl dopi : outputs) {
- Datalink dl = dopi.getInternalInputPort().getIncomingLink();
- // Unset any type information on the output port, we'll set it again
- // later if there's a suitably populated link going into it
- dopi.setDepths(-1, -1);
- if (dl == null) {
- // not linked, this is by definition an unsatisfied link!
- unresolvedOutputs.add(dopi);
- } else if (dl.getResolvedDepth() == -1) {
- // linked but the edge hasn't had its depth resolved, i.e. it
- // links from an unresolved entity
- unresolvedOutputs.add(dopi);
- } else {
- // linked and edge depth is defined, we can therefore populate
- // the granular and real depth of the dataflow output port. Note
- // that this is the only way these values can be populated, you
- // don't define them when creating the ports as they are
- // entirely based on the type check stage.
- int granularDepth = dl.getSource().getGranularDepth();
- int resolvedDepth = dl.getResolvedDepth();
- dopi.setDepths(resolvedDepth, granularDepth);
- }
- }
-
- // Check if workflow is 'incomplete' - i.e. if it contains no processors and no output ports.
- // This is to prevent empty workflows or ones that contain input ports from being run.
- boolean dataflowIsIncomplete = getProcessors().isEmpty() && getOutputPorts().isEmpty();
- // For a workflow to be valid - workflow must not be 'empty' and lists of problems must all be empty
- boolean dataflowValid = (!dataflowIsIncomplete) && unresolvedOutputs.isEmpty() && failed.isEmpty()
- && unresolved.isEmpty();
-
- // Build and return a new validation report containing the overall state
- // along with lists of failed and unsatisfied processors and unsatisfied
- // output ports
- return new DataflowValidationReportImpl(dataflowValid, dataflowIsIncomplete, failed,
- unresolved, unresolvedOutputs, invalidDataflows);
- }
-
- /**
- * Gets all workflow entities of the specified type and returns as an
- * unmodifiable list of that type
- */
- public <T extends NamedWorkflowEntity> List<? extends T> getEntities(
- Class<T> entityType) {
- List<T> result = new ArrayList<T>();
- filterAndAdd(processors, result, entityType);
- filterAndAdd(merges, result, entityType);
- return Collections.unmodifiableList(result);
- }
-
- private <T extends NamedWorkflowEntity> void filterAndAdd(
- Iterable<?> source, List<T> target, Class<T> type) {
- for (Object o : source) {
- if (type.isAssignableFrom(o.getClass())) {
- T targetObject = type.cast(o);
- target.add(targetObject);
- }
- }
- }
-
- /**
- * The active process identifiers correspond to current strands of data
- * running through this dataflow. The keys are process identifiers, the
- * values are sets of output port names for which final events have been
- * received.
- */
- private Map<String, Set<String>> activeProcessIdentifiers = new HashMap<String, Set<String>>();
-
- /**
- * Called when a token is received or the dataflow is fired, checks to see
- * whether the process identifier is already known (in which case we assume
- * it's been registered and can ignore it) or registers it with the monitor
- * along with all child entities. The method is called with the ID of the
- * new process, that is to say the ID of the token with ':'getLocalName()
- * appended.
- *
- * @param owningProcess
- *
- * @return true if the owning process specified was already in the active
- * process identifier set, false otherwise
- */
- protected boolean tokenReceived(String owningProcess,
- InvocationContext context) {
- synchronized (activeProcessIdentifiers) {
- if (! activeProcessIdentifiers.keySet().contains(owningProcess)) {
- MonitorManager.getInstance().registerNode(this, owningProcess);
- // Message each processor within the dataflow and instruct it to
- // register any properties with the monitor including any
- // processor level properties it can aggregate from its dispatch
- // stack.
- for (ProcessorImpl p : getEntities(ProcessorImpl.class)) {
- p.registerWithMonitor(owningProcess);
- if (p.getInputPorts().isEmpty()) {
- p.fire(owningProcess, context);
- }
- }
- activeProcessIdentifiers.put(owningProcess,
- new HashSet<String>());
- return false;
- }
- return true;
- }
- }
-
- /**
- * Sets the local name for the dataflow
- * @param localName
- */
- public void setLocalName(String localName) {
- name=localName;
- }
-
- @Override
- public String toString() {
- return "Dataflow " + getLocalName() + "[" + getInternalIdentier() + "]";
- }
-
- public void fire(String owningProcess, InvocationContext context) {
- String newOwningProcess = owningProcess + ":" + getLocalName();
- if (tokenReceived(newOwningProcess, context)) {
- // This is not good - should ideally handle it as it means the
- // workflow has been fired when in a state where this wasn't
- // sensible, i.e. already having been fired on this process
- // identifier. For now we'll ignore it (ho hum, release deadline
- // etc!)
- }
- // The code below now happens in the tokenReceived method, we need to
- // fire any processors which don't have dependencies when a new token
- // arrives and we weren't doing that anywhere.
- /**
- * for (Processor p : getEntities(Processor.class)) { if
- * (p.getInputPorts().isEmpty()) { p.fire(newOwningProcess, context); } }
- */
- }
-
- /**
- * Called when a token with index array length zero is sent from a dataflow
- * output port.
- *
- * @param portName
- */
- public void sentFinalToken(String portName, String owningProcess) {
- synchronized (activeProcessIdentifiers) {
- Set<String> alreadyReceivedPortNames = activeProcessIdentifiers
- .get(owningProcess);
- if (alreadyReceivedPortNames == null) {
- throw new RuntimeException(
- "Workflow's broken in some way, received an output token for process '"
- + owningProcess + "' that shouldn't exist!");
- }
- if (alreadyReceivedPortNames.contains(portName)) {
- throw new RuntimeException(
- "Received duplicate final events on port name '"
- + portName + "' for process '" + owningProcess
- + "', this is not a good thing");
- }
-
- // No duplicates and the set wasn't null, add this port name to the
- // set of ports which have sent final events.
- alreadyReceivedPortNames.add(portName);
-
- // Check - if we have no duplicates and the set of output ports
- // which have sent final events in this data thread is the same size
- // as the number of output ports then we've finished and can
- // deregister from the monitor
- if (alreadyReceivedPortNames.size() == getOutputPorts().size()) {
-
- // request deregistration of processor nodes (arguably we don't
- // need
- // to do this and could just deregister the dataflow node in the
- // tree as that'll by definition detach all the child nodes but
- // this
- // seems cleaner)
- for (Processor p : getEntities(Processor.class)) {
- MonitorManager.getInstance().deregisterNode(
- owningProcess + ":" + p.getLocalName());
- }
- MonitorManager.getInstance().deregisterNode(owningProcess);
-
- // Remove this entry from the active process map
- activeProcessIdentifiers.remove(owningProcess);
-
- }
- }
-
- }
-
- public FailureTransmitter getFailureTransmitter() {
- throw new UnsupportedOperationException(
- "Not implemented for DataflowImpl yet");
- }
-
- public boolean doTypeCheck() throws IterationTypeMismatchException {
- throw new UnsupportedOperationException(
- "Not implemented for DataflowImpl yet");
- }
-
- public void refreshInternalIdentifier() {
- internalIdentifier=UUID.randomUUID().toString();
- }
-
- public String getInternalIdentier() {
- return internalIdentifier;
- }
-
- protected void setInternalIndentifier(String id) {
- this.internalIdentifier=id;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowInputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowInputPortImpl.java
deleted file mode 100644
index 99cdb98..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowInputPortImpl.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-
-public class DataflowInputPortImpl extends AbstractEventHandlingInputPort
- implements DataflowInputPort {
-
- protected BasicEventForwardingOutputPort internalOutput;
-
- private int granularInputDepth;
-
- private Dataflow dataflow;
-
- DataflowInputPortImpl(String name, int depth, int granularDepth, Dataflow df) {
- super(name, depth);
- granularInputDepth = granularDepth;
- dataflow = df;
- internalOutput = new BasicEventForwardingOutputPort(name, depth,
- granularDepth);
- }
-
- public int getGranularInputDepth() {
- return granularInputDepth;
- }
-
- void setDepth(int depth) {
- this.depth = depth;
- internalOutput.setDepth(depth);
- }
-
- void setGranularDepth(int granularDepth) {
- this.granularInputDepth = granularDepth;
- internalOutput.setGranularDepth(granularDepth);
- }
-
- public EventForwardingOutputPort getInternalOutputPort() {
- return internalOutput;
- }
-
- /**
- * Receive an input event, relay it through the internal output port to all
- * connected entities
- */
- public void receiveEvent(WorkflowDataToken t) {
- WorkflowDataToken transformedToken = t.pushOwningProcess(dataflow.getLocalName());
- // I'd rather avoid casting to the implementation but in this
- // case we're in the same package - the only reason to do this
- // is to allow dummy implementations of parts of this
- // infrastructure during testing, in 'real' use this should
- // always be a dataflowimpl
- if (dataflow instanceof DataflowImpl) {
- ((DataflowImpl) dataflow).tokenReceived(transformedToken
- .getOwningProcess(), t.getContext());
- }
- for (Datalink dl : internalOutput.getOutgoingLinks()) {
- dl.getSink().receiveEvent(transformedToken);
- }
- }
-
- public Dataflow getDataflow() {
- return dataflow;
- }
-
- public void setName(String newName) {
- this.name = newName;
- internalOutput.setName(newName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowOutputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowOutputPortImpl.java
deleted file mode 100644
index 4aa6fee..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowOutputPortImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.facade.ResultListener;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-public class DataflowOutputPortImpl extends BasicEventForwardingOutputPort
- implements DataflowOutputPort {
-
- protected AbstractEventHandlingInputPort internalInput;
- protected List<ResultListener> resultListeners = new ArrayList<ResultListener>();
-
- private Dataflow dataflow;
-
- DataflowOutputPortImpl(final String portName, final Dataflow dataflow) {
- super(portName, -1, -1);
- this.dataflow = dataflow;
- this.internalInput = new AbstractEventHandlingInputPort(name, -1) {
- /**
- * Forward the event through the output port Also informs any
- * ResultListeners on the output port to the new token.
- */
- public void receiveEvent(WorkflowDataToken token) {
- // Pull the dataflow process identifier from the owning process
- // and push the modified token out
- // I'd rather avoid casting to the implementation but in this
- // case we're in the same package - the only reason to do this
- // is to allow dummy implementations of parts of this
- // infrastructure during testing, in 'real' use this should
- // always be a dataflowimpl
- if (token.getIndex().length == 0
- && dataflow instanceof DataflowImpl) {
- ((DataflowImpl) dataflow).sentFinalToken(portName, token
- .getOwningProcess());
- }
- WorkflowDataToken newToken = token.popOwningProcess();
- sendEvent(newToken);
- for (ResultListener listener : resultListeners
- .toArray(new ResultListener[] {})) {
- listener.resultTokenProduced(newToken, this.getName());
- }
- }
-
- /**
- * Always copy the value of the enclosing dataflow output port
- */
- @Override
- public int getDepth() {
- return DataflowOutputPortImpl.this.getDepth();
- }
- };
- }
-
- public EventHandlingInputPort getInternalInputPort() {
- return this.internalInput;
- }
-
- public Dataflow getDataflow() {
- return this.dataflow;
- }
-
- void setDepths(int depth, int granularDepth) {
- this.depth = depth;
- this.granularDepth = granularDepth;
- }
-
- public void addResultListener(ResultListener listener) {
- resultListeners.add(listener);
- }
-
- public void removeResultListener(ResultListener listener) {
- resultListeners.remove(listener);
- }
-
- public void setName(String newName) {
- this.name = newName;
- internalInput.setName(newName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowValidationReportImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowValidationReportImpl.java
deleted file mode 100644
index b575d9e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DataflowValidationReportImpl.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.TokenProcessingEntity;
-
-/**
- * Simple implementation of the DataflowValidationReport interface
- *
- * @author Tom Oinn
- *
- */
-public class DataflowValidationReportImpl implements DataflowValidationReport {
-
- private final List<TokenProcessingEntity> failed;
- private final Map<TokenProcessingEntity, DataflowValidationReport> invalidDataflows;
- private final List<DataflowOutputPort> unresolvedOutputs;
- private final List<TokenProcessingEntity> unsatisfied;
- private boolean valid;
- private boolean isWorkflowIncomplete; // whether a workflow is incomplete (contains no processors and no output ports), in which case it also must be invalid
-
- DataflowValidationReportImpl(boolean isValid, boolean isWorkflowIncomplete,
- List<TokenProcessingEntity> failedProcessors,
- List<TokenProcessingEntity> unsatisfiedProcessors,
- List<DataflowOutputPort> unresolvedOutputs, Map<TokenProcessingEntity, DataflowValidationReport> invalidDataflows) {
- this.valid = isValid;
- this.isWorkflowIncomplete = isWorkflowIncomplete;
- this.invalidDataflows = Collections.unmodifiableMap(invalidDataflows);
- this.failed = Collections.unmodifiableList(failedProcessors);
- this.unsatisfied = Collections.unmodifiableList(unsatisfiedProcessors);
- this.unresolvedOutputs = Collections.unmodifiableList(unresolvedOutputs);
- }
-
- public List<? extends TokenProcessingEntity> getFailedEntities() {
- return failed;
- }
-
- public Map<TokenProcessingEntity, DataflowValidationReport> getInvalidDataflows() {
- return invalidDataflows;
- }
-
- public List<? extends DataflowOutputPort> getUnresolvedOutputs() {
- return unresolvedOutputs;
- }
-
- public List<? extends TokenProcessingEntity> getUnsatisfiedEntities() {
- return unsatisfied;
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public boolean isWorkflowIncomplete() {
- return isWorkflowIncomplete;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DatalinkImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DatalinkImpl.java
deleted file mode 100644
index d28fa0e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DatalinkImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-/**
- * Naive bean implementation of Datalink
- *
- * @author Tom Oinn
- *
- */
-public class DatalinkImpl extends AbstractAnnotatedThing<Datalink> implements
- Datalink {
-
- private EventForwardingOutputPort source;
-
- private EventHandlingInputPort sink;
-
- private transient int resolvedDepth = -1;
-
- public int getResolvedDepth() {
- return this.resolvedDepth;
- }
-
- protected void setResolvedDepth(int newResolvedDepth) {
- this.resolvedDepth = newResolvedDepth;
- }
-
- protected DatalinkImpl(EventForwardingOutputPort source,
- EventHandlingInputPort sink) {
- this.source = source;
- this.sink = sink;
- }
-
- public EventHandlingInputPort getSink() {
- return sink;
- }
-
- public EventForwardingOutputPort getSource() {
- return source;
- }
-
- @Override
- public String toString() {
- return "link("+resolvedDepth+")"+source.getName()+":"+sink.getName();
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEdit.java
deleted file mode 100644
index d84f973..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEdit.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.impl.AddDispatchLayerEdit;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.impl.DispatchStackImpl;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry;
-
-public class DefaultDispatchStackEdit extends AbstractProcessorEdit {
- private Edit<?> compoundEdit=null;
- private static final int MAX_JOBS = 1;
- private static final long BACKOFF_FACTOR = (long) 1.1;
- private static final int MAX_DELAY = 5000;
- private static final int INITIAL_DELAY = 1000;
- private static final int MAX_RETRIES = 0;
-
- public DefaultDispatchStackEdit(Processor processor) {
- super(processor);
- DispatchStackImpl stack = ((ProcessorImpl)processor).getDispatchStack();
- // Top level parallelise layer
- int layer = 0;
- List<Edit<?>> edits = new ArrayList<Edit<?>>();
-
- edits.add(new AddDispatchLayerEdit(stack, new Parallelize(MAX_JOBS), layer++));
- edits.add(new AddDispatchLayerEdit(stack, new ErrorBounce(), layer++));
- edits.add(new AddDispatchLayerEdit(stack, new Failover(), layer++));
- edits.add(new AddDispatchLayerEdit(stack, new Retry(MAX_RETRIES, INITIAL_DELAY,
- MAX_DELAY, BACKOFF_FACTOR), layer++));
- edits.add(new AddDispatchLayerEdit(stack, new Invoke(), layer++));
- compoundEdit=new CompoundEdit(edits);
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- compoundEdit.doEdit();
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- compoundEdit.undo();
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DisconnectDatalinkEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DisconnectDatalinkEdit.java
deleted file mode 100644
index 49e5453..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/DisconnectDatalinkEdit.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-/**
- * Disconnect a datalink from its source and sink.
- *
- * @author David Withers
- *
- */
-public class DisconnectDatalinkEdit extends AbstractDatalinkEdit {
-
- public DisconnectDatalinkEdit(Datalink datalink) {
- super(datalink);
- }
-
- @Override
- protected void doEditAction(DatalinkImpl datalink) throws EditException {
- EventForwardingOutputPort source = datalink.getSource();
- EventHandlingInputPort sink = datalink.getSink();
- if (source instanceof BasicEventForwardingOutputPort) {
- ((BasicEventForwardingOutputPort) source).removeOutgoingLink(datalink);
- }
- if (sink instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort) sink).setIncomingLink(null);
- }
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- EventForwardingOutputPort source = datalink.getSource();
- EventHandlingInputPort sink = datalink.getSink();
- if (source instanceof BasicEventForwardingOutputPort) {
- ((BasicEventForwardingOutputPort) source).addOutgoingLink(datalink);
- }
- if (sink instanceof AbstractEventHandlingInputPort) {
- ((AbstractEventHandlingInputPort) sink).setIncomingLink(datalink);
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/EditsImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/EditsImpl.java
deleted file mode 100644
index a460b95..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/EditsImpl.java
+++ /dev/null
@@ -1,486 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.AddAnnotationAssertionEdit;
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationAssertionImpl;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.annotation.AnnotationChainImpl;
-import net.sf.taverna.t2.annotation.AnnotationRole;
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-import net.sf.taverna.t2.annotation.CurationEvent;
-import net.sf.taverna.t2.annotation.Person;
-import net.sf.taverna.t2.facade.WorkflowInstanceFacade;
-import net.sf.taverna.t2.facade.impl.WorkflowInstanceFacadeImpl;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Configurable;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InvalidDataflowException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.OrderedPair;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.impl.ActivityInputPortImpl;
-import net.sf.taverna.t2.workflowmodel.processor.activity.impl.ActivityOutputPortImpl;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.impl.AddDispatchLayerEdit;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.impl.DeleteDispatchLayerEdit;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-
-/**
- * Implementation of {@link Edits}
- *
- */
-public class EditsImpl implements Edits {
-
- public Dataflow createDataflow() {
- return new DataflowImpl();
- }
-
- public Datalink createDatalink(EventForwardingOutputPort source,
- EventHandlingInputPort sink) {
- return new DatalinkImpl(source, sink);
- }
-
- public DataflowInputPort createDataflowInputPort(String name, int depth,
- int granularDepth, Dataflow dataflow) {
- return new DataflowInputPortImpl(name, depth, granularDepth, dataflow);
- }
-
- public DataflowOutputPort createDataflowOutputPort(String name,
- Dataflow dataflow) {
- return new DataflowOutputPortImpl(name, dataflow);
- }
-
- public MergeInputPort createMergeInputPort(Merge merge, String name,
- int depth) {
- if (merge instanceof MergeImpl) {
- return new MergeInputPortImpl((MergeImpl) merge, name, depth);
- } else {
- return null;
- }
- }
-
- public ProcessorOutputPort createProcessorOutputPort(Processor processor,
- String name, int depth, int granularDepth) {
- return new ProcessorOutputPortImpl((ProcessorImpl) processor, name,
- depth, granularDepth);
- }
-
- public ProcessorInputPort createProcessorInputPort(Processor processor,
- String name, int depth) {
- return new ProcessorInputPortImpl((ProcessorImpl) processor, name,
- depth);
- }
-
- public Edit<Dataflow> getAddProcessorEdit(Dataflow dataflow,
- Processor processor) {
- return new AddProcessorEdit(dataflow, processor);
- }
-
- public Edit<Dataflow> getAddMergeEdit(Dataflow dataflow, Merge merge) {
- return new AddMergeEdit(dataflow, merge);
- }
-
- public Edit<DispatchStack> getAddDispatchLayerEdit(DispatchStack stack,
- DispatchLayer<?> layer, int position) {
- return new AddDispatchLayerEdit(stack, layer, position);
- }
-
- public Edit<Processor> getAddActivityEdit(Processor processor,
- Activity<?> activity) {
- return new AddActivityEdit(processor, activity);
- }
-
- public Edit<Processor> getAddProcessorInputPortEdit(Processor processor,
- ProcessorInputPort port) {
- return new AddProcessorInputPortEdit(processor, port);
- }
-
- public Edit<Processor> getAddProcessorOutputPortEdit(Processor processor,
- ProcessorOutputPort port) {
- return new AddProcessorOutputPortEdit(processor, port);
- }
-
- public Edit<Dataflow> getCreateDataflowInputPortEdit(Dataflow dataflow,
- String portName, int portDepth, int granularDepth) {
- return new CreateDataflowInputPortEdit(dataflow, portName, portDepth,
- granularDepth);
- }
-
- public Edit<Dataflow> getCreateDataflowOutputPortEdit(Dataflow dataflow,
- String portName) {
- return new CreateDataflowOutputPortEdit(dataflow, portName);
- }
-
- public Edit<DispatchStack> getDeleteDispatchLayerEdit(DispatchStack stack,
- DispatchLayer<?> layer) {
- return new DeleteDispatchLayerEdit(stack, layer);
- }
-
- public Edit<Merge> getRenameMergeEdit(Merge merge,
- String newName) {
- return new RenameMergeEdit(merge, newName);
- }
-
- public Edit<Processor> getRenameProcessorEdit(Processor processor,
- String newName) {
- return new RenameProcessorEdit(processor, newName);
- }
-
- public Edit<DataflowInputPort> getRenameDataflowInputPortEdit(
- DataflowInputPort dataflowInputPort, String newName) {
- return new RenameDataflowInputPortEdit(dataflowInputPort, newName);
- }
-
- public Edit<DataflowOutputPort> getRenameDataflowOutputPortEdit(
- DataflowOutputPort dataflowOutputPort, String newName) {
- return new RenameDataflowOutputPortEdit(dataflowOutputPort, newName);
- }
-
- public Edit<DataflowInputPort> getChangeDataflowInputPortDepthEdit(
- DataflowInputPort dataflowInputPort, int depth) {
- return new ChangeDataflowInputPortDepthEdit(dataflowInputPort, depth);
- }
-
- public Edit<DataflowInputPort> getChangeDataflowInputPortGranularDepthEdit(
- DataflowInputPort dataflowInputPort, int granularDepth) {
- return new ChangeDataflowInputPortGranularDepthEdit(dataflowInputPort,
- granularDepth);
- }
-
- public Edit<Processor> getConnectProcessorOutputEdit(Processor processor,
- String outputPortName, EventHandlingInputPort targetPort) {
- return new ConnectProcesorOutputEdit(processor, outputPortName,
- targetPort);
- }
-
- public Edit<Datalink> getConnectDatalinkEdit(Datalink datalink) {
- return new ConnectDatalinkEdit(datalink);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationChain> getAddAnnotationAssertionEdit(
- AnnotationChain annotationChain,
- AnnotationAssertion annotationAssertion) {
- return new AddAnnotationAssertionEdit(annotationChain,
- annotationAssertion);
- }
-
- /**
- * Creates a MergeImpl instance. Merge names are generated as 'Merge0',
- * 'Merge1', 'Merge2', etc. The next merge to be added always gets the name
- * as the previous merge in the list with its index incremented by one. If a
- * merge is deleted, that is not taken into account when generating merges'
- * names.
- */
- public Merge createMerge(Dataflow dataflow) {
-
- String mergeName;
-
- // Get all merges for a workflow
- List<? extends Merge> merges = (List<? extends Merge>) dataflow
- .getMerges();
-
- if (merges.isEmpty()) {
- mergeName = "Merge0"; // the first merge to be added to the list
- } else {
- String lastMergeName = merges.get(merges.size() - 1).getLocalName();
- // Get the index of the last Merge
- int lastMergeIndex = Integer.parseInt(lastMergeName.substring(5));
- mergeName = "Merge" + String.valueOf((lastMergeIndex + 1));
- }
-
- return new MergeImpl(mergeName);
- }
-
- /**
- * @return a new instance of ConnectMergedDatalinkEdit constructed from the
- * provided parameters.
- *
- * @param merge
- * a Merge instance
- * @param sourcePort
- * the source port from which a link is to be created.
- * @param sinkPort
- * the sink port to which the link is to be created.
- */
- public Edit<Merge> getConnectMergedDatalinkEdit(Merge merge,
- EventForwardingOutputPort sourcePort,
- EventHandlingInputPort sinkPort) {
- return new ConnectMergedDatalinkEdit(merge, sourcePort, sinkPort);
- }
-
- public Edit<OrderedPair<Processor>> getCreateConditionEdit(
- Processor control, Processor target) {
- return new CreateConditionEdit(control, target);
- }
-
- public Edit<OrderedPair<Processor>> getRemoveConditionEdit(
- Processor control, Processor target) {
- return new RemoveConditionEdit(control, target);
- }
-
- public Processor createProcessor(String name) {
- ProcessorImpl processor = new ProcessorImpl();
- processor.setName(name);
- return processor;
- }
-
- /**
- * Builds an instance of {@link ActivityInputPortImpl}
- */
- public ActivityInputPort createActivityInputPort(
- String portName,
- int portDepth,
- boolean allowsLiteralValues,
- List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes,
- Class<?> translatedElementClass) {
- return new ActivityInputPortImpl(portName, portDepth,
- allowsLiteralValues, handledReferenceSchemes,
- translatedElementClass);
- }
-
- /**
- * Builds an instance of {@link ActivityOutputPortImpl}
- */
- public OutputPort createActivityOutputPort(String portName, int portDepth,
- int portGranularDepth) {
- return new ActivityOutputPortImpl(portName, portDepth,
- portGranularDepth);
- }
-
- public WorkflowInstanceFacade createWorkflowInstanceFacade(
- Dataflow dataflow, InvocationContext context, String parentProcess)
- throws InvalidDataflowException {
- return new WorkflowInstanceFacadeImpl(dataflow, context, parentProcess);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationBean(
- AnnotationAssertion annotationAssertion,
- AnnotationBeanSPI annotationBean) {
- return new AddAnnotationBeanEdit(annotationAssertion, annotationBean);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddCurationEvent(
- AnnotationAssertion annotationAssertion, CurationEvent curationEvent) {
- return new AddCurationEventEdit(annotationAssertion, curationEvent);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationRole(
- AnnotationAssertion annotationAssertion,
- AnnotationRole annotationRole) {
- return new AddAnnotationRoleEdit(annotationAssertion, annotationRole);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddAnnotationSource(
- AnnotationAssertion annotationAssertion,
- AnnotationSourceSPI annotationSource) {
- return new AddAnnotationSourceEdit(annotationAssertion,
- annotationSource);
- }
-
- @SuppressWarnings("unchecked")
- public Edit<AnnotationAssertion> getAddCreator(
- AnnotationAssertion annotationAssertion, Person person) {
- return new AddCreatorEdit(annotationAssertion, person);
- }
-
- public Edit<?> getAddAnnotationChainEdit(Annotated<?> annotated,
- AnnotationBeanSPI annotation) {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
- AnnotationAssertion<?> annotationAssertion = new AnnotationAssertionImpl();
- editList.add(getAddAnnotationBean(annotationAssertion, annotation));
-
- AnnotationChain annotationChain = new AnnotationChainImpl();
- editList.add(getAddAnnotationAssertionEdit(annotationChain,
- annotationAssertion));
-
- editList.add(annotated.getAddAnnotationEdit(annotationChain));
-
- return new CompoundEdit(editList);
- }
-
- public Edit<Dataflow> getUpdateDataflowNameEdit(Dataflow dataflow,
- String newName) {
- return new UpdateDataflowNameEdit(dataflow, newName);
- }
-
- public Edit<Dataflow> getUpdateDataflowInternalIdentifierEdit(
- Dataflow dataflow, String newId) {
- return new UpdateDataflowInternalIdentifierEdit(dataflow, newId);
- }
-
- public Edit<Datalink> getDisconnectDatalinkEdit(Datalink datalink) {
- return new DisconnectDatalinkEdit(datalink);
- }
-
- public Edit<Dataflow> getRemoveDataflowInputPortEdit(Dataflow dataflow,
- DataflowInputPort dataflowInputPort) {
- return new RemoveDataflowInputPortEdit(dataflow, dataflowInputPort);
- }
-
- public Edit<Dataflow> getRemoveDataflowOutputPortEdit(Dataflow dataflow,
- DataflowOutputPort dataflowOutputPort) {
- return new RemoveDataflowOutputPortEdit(dataflow, dataflowOutputPort);
- }
-
- public Edit<Dataflow> getRemoveProcessorEdit(Dataflow dataflow,
- Processor processor) {
- return new RemoveProcessorEdit(dataflow, processor);
- }
-
- public Edit<Dataflow> getRemoveMergeEdit(Dataflow dataflow, Merge merge) {
- return new RemoveMergeEdit(dataflow, merge);
- }
-
- public Edit<Dataflow> getAddDataflowInputPortEdit(Dataflow dataflow,
- DataflowInputPort dataflowInputPort) {
- return new AddDataflowInputPortEdit(dataflow, dataflowInputPort);
- }
-
- public Edit<Dataflow> getAddDataflowOutputPortEdit(Dataflow dataflow,
- DataflowOutputPort dataflowOutputPort) {
- return new AddDataflowOutputPortEdit(dataflow, dataflowOutputPort);
- }
-
- public Edit<Activity<?>> getAddActivityInputPortEdit(Activity<?> activity,
- ActivityInputPort activityInputPort) {
- return new AddActivityInputPortEdit(activity, activityInputPort);
- }
-
- public Edit<Activity<?>> getAddActivityInputPortMappingEdit(
- Activity<?> activity, String processorPortName,
- String activityPortName) {
- return new AddActivityInputPortMappingEdit(activity, processorPortName,
- activityPortName);
- }
-
- public Edit<Activity<?>> getAddActivityOutputPortEdit(Activity<?> activity,
- OutputPort activityOutputPort) {
- return new AddActivityOutputPortEdit(activity, activityOutputPort);
- }
-
- public Edit<Activity<?>> getAddActivityOutputPortMappingEdit(
- Activity<?> activity, String processorPortName,
- String activityPortName) {
- return new AddActivityOutputPortMappingEdit(activity,
- processorPortName, activityPortName);
- }
-
- public Edit<Activity<?>> getRemoveActivityInputPortEdit(
- Activity<?> activity, ActivityInputPort activityInputPort) {
- return new RemoveActivityInputPortEdit(activity, activityInputPort);
- }
-
- public Edit<Activity<?>> getRemoveActivityInputPortMappingEdit(
- Activity<?> activity, String processorPortName) {
- return new RemoveActivityInputPortMappingEdit(activity,
- processorPortName);
- }
-
- public Edit<Activity<?>> getRemoveActivityOutputPortEdit(
- Activity<?> activity, OutputPort activityOutputPort) {
- return new RemoveActivityOutputPortEdit(activity, activityOutputPort);
- }
-
- public Edit<Activity<?>> getRemoveActivityOutputPortMappingEdit(
- Activity<?> activity, String processorPortName) {
- return new RemoveActivityOutputPortMappingEdit(activity,
- processorPortName);
- }
-
- public Edit<Merge> getAddMergeInputPortEdit(Merge merge,
- MergeInputPort mergeInputPort) {
- return new AddMergeInputPortEdit(merge, mergeInputPort);
- }
-
- @SuppressWarnings("unchecked")
- public <ConfigurationBean> Edit<Activity<?>> getConfigureActivityEdit(
- Activity<ConfigurationBean> activity,
- ConfigurationBean configurationBean) {
- return new ConfigureActivityEdit(activity, configurationBean);
- }
-
- public Edit<Processor> getRemoveProcessorInputPortEdit(Processor processor,
- ProcessorInputPort port) {
- return new RemoveProcessorInputPortEdit(processor, port);
- }
-
- public Edit<Processor> getRemoveProcessorOutputPortEdit(
- Processor processor, ProcessorOutputPort port) {
- return new RemoveProcessorOutputPortEdit(processor, port);
- }
-
- public Edit<Processor> getMapProcessorPortsForActivityEdit(
- Processor processor) {
- return new MapProcessorPortsForActivityEdit(processor);
- }
-
- public Edit<Processor> getDefaultDispatchStackEdit(Processor processor) {
- return new DefaultDispatchStackEdit(processor);
- }
-
- public Edit<Processor> getSetIterationStrategyStackEdit(
- Processor processor, IterationStrategyStack iterationStrategyStack) {
- return new SetIterationStrategyStackEdit(processor,
- iterationStrategyStack);
- }
-
- public <ConfigurationType> Edit<? extends Configurable<ConfigurationType>> getConfigureEdit(
- Configurable<ConfigurationType> configurable,
- ConfigurationType configBean) {
- return new ConfigureEdit<Configurable<ConfigurationType>, Configurable<ConfigurationType>>(
- Configurable.class, configurable, configBean);
- }
-
- public Edit<Merge> getReorderMergeInputPortsEdit(Merge merge,
- List<MergeInputPort> reorderedMergeInputPortList) {
- return new ReorderMergeInputPortsEdit(merge, reorderedMergeInputPortList);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsForActivityEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsForActivityEdit.java
deleted file mode 100644
index 95f12df..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsForActivityEdit.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-
-public class MapProcessorPortsForActivityEdit implements Edit<Processor> {
-
- private final ProcessorImpl processor;
- CompoundEdit compoundEdit = null;
-
-
- public MapProcessorPortsForActivityEdit(Processor processor) {
- this.processor = (ProcessorImpl)processor;
- }
-
- public Processor doEdit() throws EditException {
- EditsImpl editsImpl = new EditsImpl();
- List<Edit<?>> edits = new ArrayList<Edit<?>>();
- Activity<?> a = processor.getActivityList().get(0);
-
- List<? extends ProcessorInputPort> inputPortsForRemoval = determineInputPortsForRemoval(processor,a);
- List<? extends ProcessorOutputPort> outputPortsForRemoval = determineOutputPortsForRemoval(processor,a);
-// List<ActivityInputPort> changedInputPorts = determineChangedInputPorts(processor,a);
-// List<OutputPort> changedOutputPorts = determineChangedOutputPorts(processor,a);
-// List<ActivityInputPort> newInputPorts = determineNewInputPorts(processor,a);
-// List<OutputPort> newOutputPorts = determineNewOutputPorts(processor,a);
-
- for (ProcessorInputPort ip : inputPortsForRemoval) {
- if (ip.getIncomingLink()!=null) {
- edits.add(editsImpl.getDisconnectDatalinkEdit(ip.getIncomingLink()));
- }
- edits.add(editsImpl.getRemoveProcessorInputPortEdit(processor, ip));
- if (a.getInputPortMapping().containsKey(ip.getName())) {
- edits.add(new RemoveActivityInputPortMappingEdit(a,ip.getName()));
- }
- }
-
- for (ProcessorOutputPort op : outputPortsForRemoval) {
- if (op.getOutgoingLinks().size()>0) {
- for (Datalink link : op.getOutgoingLinks())
- edits.add(editsImpl.getDisconnectDatalinkEdit(link));
- }
- edits.add(editsImpl.getRemoveProcessorOutputPortEdit(processor, op));
- if (a.getOutputPortMapping().containsKey(op.getName())) {
- edits.add(new RemoveActivityOutputPortMappingEdit(a,op.getName()));
- }
- }
-
-// for (ActivityInputPort ip : changedInputPorts) {
-// ProcessorInputPort pPort = processor.getInputPortWithName(ip.getName());
-// edits.add(new ChangeProcessorInputPortDepthEdit(pPort,ip.getDepth()));
-// }
-//
-// for (OutputPort op : changedOutputPorts) {
-// ProcessorOutputPort pPort = processor.getOutputPortWithName(op.getName());
-// if (pPort.getDepth() != op.getDepth()) {
-// edits.add(new ChangeProcessorOutputPortDepthEdit(pPort,op.getDepth()));
-// }
-// if (pPort.getGranularDepth() != op.getGranularDepth()) {
-// edits.add(new ChangeProcessorOutputPortGranularDepthEdit(pPort,op.getGranularDepth()));
-// }
-// }
-
-// for (ActivityInputPort ip : newInputPorts) {
-// ProcessorInputPort processorInputPort = editsImpl.createProcessorInputPort(processor, ip.getName(), ip.getDepth());
-// edits.add(editsImpl.getAddProcessorInputPortEdit(processor, processorInputPort));
-// edits.add(new AddActivityInputPortMapping(a,ip.getName(),ip.getName()));
-// }
-//
-// for (OutputPort op : newOutputPorts) {
-// ProcessorOutputPort processorOutputPort = editsImpl.createProcessorOutputPort(processor, op.getName(), op.getDepth(), op.getGranularDepth());
-// edits.add(editsImpl.getAddProcessorOutputPortEdit(processor, processorOutputPort));
-// edits.add(new AddActivityOutputPortMapping(a,op.getName(),op.getName()));
-// }
-
- compoundEdit = new CompoundEdit(edits);
- compoundEdit.doEdit();
- return processor;
- }
-
- public Object getSubject() {
- return processor;
- }
-
- public boolean isApplied() {
- return (compoundEdit!=null && compoundEdit.isApplied());
- }
-
- public void undo() {
- compoundEdit.undo();
- }
-
- private List<ProcessorInputPort> determineInputPortsForRemoval(Processor p,Activity<?>a) {
-
- List<ProcessorInputPort> result = new ArrayList<ProcessorInputPort>();
- for (ProcessorInputPort pPort : p.getInputPorts()) {
- boolean found=false;
- for (ActivityInputPort aPort : a.getInputPorts()) {
- if (aPort.getName().equals(pPort.getName())) {
- if (pPort.getDepth() == aPort.getDepth()) {
- found=true;
- }
- break;
- }
- }
- if (!found) {
- result.add(pPort);
- }
- }
- return result;
- }
-
- private List<ProcessorOutputPort> determineOutputPortsForRemoval(Processor p,Activity<?>a) {
- List<ProcessorOutputPort> result = new ArrayList<ProcessorOutputPort>();
- for (ProcessorOutputPort pPort : p.getOutputPorts()) {
- boolean found=false;
- for (OutputPort aPort : a.getOutputPorts()) {
- if (aPort.getName().equals(pPort.getName())) {
- if (pPort.getDepth() == aPort.getDepth() && pPort.getGranularDepth() == aPort.getGranularDepth()) {
- found=true;
- }
- break;
- }
- }
- if (!found) {
- result.add(pPort);
- }
- }
- return result;
- }
-
-// private List<ActivityInputPort> determineChangedInputPorts(ProcessorImpl p,Activity<?>a) {
-//
-// List<ActivityInputPort> result = new ArrayList<ActivityInputPort>();
-// for (ActivityInputPort aPort : a.getInputPorts()) {
-// ProcessorInputPort pPort = p.getInputPortWithName(aPort.getName());
-//
-// if (pPort!=null && pPort.getDepth()!=aPort.getDepth()) {
-// result.add(aPort);
-// }
-// }
-// return result;
-// }
-//
-// private List<OutputPort> determineChangedOutputPorts(ProcessorImpl p,Activity<?>a) {
-// List<OutputPort> result = new ArrayList<OutputPort>();
-// for (OutputPort aPort : a.getOutputPorts()) {
-// ProcessorOutputPort pPort = p.getOutputPortWithName(aPort.getName());
-//
-// if (pPort!=null && (pPort.getDepth()!=aPort.getDepth() || pPort.getGranularDepth()!=aPort.getGranularDepth())) {
-// result.add(aPort);
-// }
-// }
-// return result;
-// }
-
-// private List<ActivityInputPort> determineNewInputPorts(ProcessorImpl p,Activity<?> a) {
-// List<ActivityInputPort> result = new ArrayList<ActivityInputPort>();
-// for (ActivityInputPort aPort : a.getInputPorts()) {
-// ProcessorInputPort pPort = p.getInputPortWithName(aPort.getName());
-//
-// if (pPort==null) {
-// result.add(aPort);
-// }
-// }
-//
-// return result;
-// }
-//
-// private List<OutputPort> determineNewOutputPorts(ProcessorImpl p,Activity<?> a) {
-// List<OutputPort> result = new ArrayList<OutputPort>();
-// for (OutputPort aPort : a.getOutputPorts()) {
-// ProcessorOutputPort pPort = p.getOutputPortWithName(aPort.getName());
-//
-// if (pPort==null) {
-// result.add(aPort);
-// }
-// }
-//
-// return result;
-// }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeImpl.java
deleted file mode 100644
index adfd382..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeImpl.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.reference.IdentifiedList;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-
-import org.apache.log4j.Logger;
-
-/**
- * Implementation of {@link Merge}
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public class MergeImpl implements Merge {
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(MergeImpl.class);
-
- private List<MergeInputPortImpl> inputs = new ArrayList<MergeInputPortImpl>();
-
- private String name;
-
- private BasicEventForwardingOutputPort output;
-
- private Map<String, List<T2Reference>> partialOutputsByProcess = new HashMap<String, List<T2Reference>>();
-
- public MergeImpl(String mergeName) {
- super();
- this.name = mergeName;
- this.output = new MergeOutputPortImpl(this, name+"_output", 0, 0);
- }
-
- public String getLocalName() {
- return this.name;
- }
-
- protected void setName(String name) {
- this.name = name;
- }
-
- /**
- * Adds a new input port to the internal list of ports.
- *
- * @param inputPort
- * the MergeInputPortImpl
- */
- public void addInputPort(MergeInputPortImpl inputPort) {
- inputs.add(inputPort);
- }
-
- /**
- * Removes an input port from the internal list of ports.
- *
- * @param inputPort
- */
- public void removeInputPort(MergeInputPortImpl inputPort) {
- inputs.remove(inputPort);
- }
-
- public List<? extends MergeInputPort> getInputPorts() {
- return inputs;
- }
-
- public EventForwardingOutputPort getOutputPort() {
- return this.output;
- }
-
- /**
- * Return the index of the port with the specified name, or -1 if the port
- * can't be found (this is a bad thing!)
- *
- * @param portName
- * @return
- */
- private int inputPortNameToIndex(String portName) {
- int i = 0;
- for (InputPort ip : inputs) {
- if (ip.getName().equals(portName)) {
- return i;
- }
- i++;
- }
- return -1; // FIXME: as the javadoc states, this is a bad thing!
- }
-
-
- protected void receiveEvent(WorkflowDataToken token, String portName) {
- List<T2Reference> outputList;
- String owningProcess = token.getOwningProcess();
- synchronized (partialOutputsByProcess) {
- outputList = partialOutputsByProcess.get(owningProcess);
- if (outputList == null) {
- int numPorts = getInputPorts().size();
- outputList = new ArrayList<T2Reference>(Collections.nCopies(numPorts, (T2Reference)null));
- partialOutputsByProcess.put(owningProcess, outputList);
- }
- }
- int portIndex = inputPortNameToIndex(portName);
- if (portIndex == -1) {
- throw new WorkflowStructureException(
- "Received event on unknown port " + portName);
- }
- int[] currentIndex = token.getIndex();
- int[] newIndex = new int[currentIndex.length + 1];
- newIndex[0] = portIndex;
- for (int i = 0; i < currentIndex.length; i++) {
- newIndex[i + 1] = currentIndex[i];
- }
- InvocationContext context = token.getContext();
- output.sendEvent(new WorkflowDataToken(owningProcess,
- newIndex, token.getData(), context));
- if (token.getIndex().length == 0) {
- // Add to completion list
- synchronized (outputList) {
- if (outputList.size() <= portIndex) {
- // Ports changed after initiating running as our list is
- // smaller than portIndex
- throw new WorkflowStructureException(
- "Unexpected addition of output port " + portName
- + " at " + portIndex);
- }
- if (outputList.get(portIndex) != null) {
- throw new WorkflowStructureException(
- "Already received completion for port " + portName
- + " " + outputList.get(portIndex));
- }
- outputList.set(portIndex, token.getData());
- if (!outputList.contains(null)) {
- // We're finished, let's register and send out the list
- ListService listService = context.getReferenceService()
- .getListService();
- IdentifiedList<T2Reference> registeredList = listService
- .registerList(outputList);
- WorkflowDataToken workflowDataToken = new WorkflowDataToken(
- owningProcess, new int[0], registeredList.getId(),
- context);
- synchronized (partialOutputsByProcess) {
- partialOutputsByProcess.remove(owningProcess);
- }
- output.sendEvent(workflowDataToken);
- }
- }
- }
- }
-
- /**
- * There is only ever a single output from a merge node but the token
- * processing entity interface defines a list, in this case it always
- * contains exactly one item.
- */
- public List<? extends EventForwardingOutputPort> getOutputPorts() {
- List<EventForwardingOutputPort> result = new ArrayList<EventForwardingOutputPort>();
- result.add(output);
- return result;
- }
-
- public boolean doTypeCheck() throws IterationTypeMismatchException {
- if (inputs.size() == 0) {
- // Arguable, but technically a merge with no inputs is valid, it may
- // make more sense to throw an exception here though as it has no
- // actual meaning.
- return true;
- }
- // Return false if we have unbound input ports or bound ports where the
- // resolved depth hasn't been calculated yet
- for (MergeInputPort ip : inputs) {
- if (ip.getIncomingLink() == null
- || ip.getIncomingLink().getResolvedDepth() == -1) {
- return false;
- }
- }
- // Got all input ports, now scan for input depths
- int inputDepth = inputs.get(0).getIncomingLink().getResolvedDepth();
- for (MergeInputPort ip : inputs) {
- if (ip.getIncomingLink().getResolvedDepth() != inputDepth) {
- throw new IterationTypeMismatchException();
- }
- }
- // Got to here so all the input resolved depths match, push depth+1 to
- // all outgoing links and return true
- for (DatalinkImpl dli : output.outgoingLinks) {
- dli.setResolvedDepth(inputDepth+1);
- }
- return true;
- }
-
- @SuppressWarnings("unchecked")
- public void reorderInputPorts(
- List<? extends MergeInputPort> reorderedInputPortList) {
- // Just set the inputs to the already reordered list of ports
- inputs = (List<MergeInputPortImpl>) reorderedInputPortList;
- }
-
- @Override
- public String toString() {
- return "Merge " + getLocalName();
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeInputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeInputPortImpl.java
deleted file mode 100644
index e8597e6..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeInputPortImpl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-
-public class MergeInputPortImpl extends AbstractEventHandlingInputPort implements MergeInputPort {
-
- private MergeImpl parent;
-
- protected MergeInputPortImpl(MergeImpl merge, String name, int depth) {
- super(name, depth);
- this.parent = merge;
- }
-
- public void receiveEvent(WorkflowDataToken t) {
- parent.receiveEvent(t, this.name);
- }
-
- /**
- * Deprecated - use {@link #getMerge()}
- *
- * @see #getMerge()
- * @return
- */
- @Deprecated
- public Merge getMergeInstance() {
- return parent;
- }
-
-
- public Merge getMerge() {
- return parent;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeOutputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeOutputPortImpl.java
deleted file mode 100644
index 4b6b550..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/MergeOutputPortImpl.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeOutputPort;
-
-public class MergeOutputPortImpl extends BasicEventForwardingOutputPort implements MergeOutputPort {
-
- private Merge merge;
-
- public MergeOutputPortImpl(Merge merge,String portName, int portDepth, int granularDepth) {
- super(portName, portDepth, granularDepth);
- this.merge=merge;
- }
-
- public Merge getMerge() {
- return merge;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorCrystalizerImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorCrystalizerImpl.java
deleted file mode 100644
index 6dd506e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorCrystalizerImpl.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * AbstractCrystalizer bound to a specific ProcessorImpl
- *
- * @author Tom Oinn
- *
- */
-public class ProcessorCrystalizerImpl extends AbstractCrystalizer {
-
- private ProcessorImpl parent;
-
- /**
- * Create and bind to the specified ProcessorImpl
- *
- * @param parent
- */
- protected ProcessorCrystalizerImpl(ProcessorImpl parent) {
- this.parent = parent;
- }
-
- public void completionCreated(Completion completion) {
- throw new WorkflowStructureException(
- "Should never see this if everything is working,"
- + "if this occurs it is likely that the internal "
- + "logic is broken, talk to Tom");
- }
-
- public void jobCreated(Job outputJob) {
- for (String outputPortName : outputJob.getData().keySet()) {
- WorkflowDataToken token = new WorkflowDataToken(outputJob
- .getOwningProcess(), outputJob.getIndex(), outputJob
- .getData().get(outputPortName), outputJob.getContext());
- parent.getOutputPortWithName(outputPortName).receiveEvent(token);
- }
- }
-
- @Override
- /**
- * Used to construct a Job of empty lists at the appropriate depth in the
- * event of a completion hitting the crystalizer before it sees a child
- * node, i.e. the result of iterating over an empty collection structure of
- * some kind.
- */
- public Job getEmptyJob(String owningProcess, int[] index,
- InvocationContext context) {
- int wrappingDepth = parent.resultWrappingDepth;
- if (wrappingDepth < 0)
- throw new RuntimeException(
- "Processor ["+owningProcess+"] hasn't been configured, cannot emit empty job");
- // The wrapping depth is the length of index array that would be used if
- // a single item of the output port type were returned. We can examine
- // the index array for the node we're trying to create and use this to
- // work out how much we need to add to the output port depth to create
- // empty lists of the right type given the index array.
- int depth = wrappingDepth - index.length;
- // TODO - why was this incrementing?
- // depth++;
-
- ReferenceService rs = context.getReferenceService();
- Map<String, T2Reference> emptyJobMap = new HashMap<String, T2Reference>();
- for (OutputPort op : parent.getOutputPorts()) {
- emptyJobMap.put(op.getName(), rs.getListService()
- .registerEmptyList(depth + op.getDepth()).getId());
- }
- return new Job(owningProcess, index, emptyJobMap, context);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthChecker.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthChecker.java
deleted file mode 100644
index 3609c1d..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthChecker.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.health.HealthChecker;
-import net.sf.taverna.t2.workflowmodel.health.HealthCheckerFactory;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport.Status;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * A Health Checker associated with Processors. This iterates over the processor activities
- * invoking each HealthChecker available for each Activity to generate an overal ProcessorHealthReport
- * @author Stuart Owen
- *
- */
-public class ProcessorHealthChecker implements HealthChecker<Processor> {
-
- public boolean canHandle(Object subject) {
- return subject!=null && subject instanceof Processor;
- }
-
- @SuppressWarnings("unchecked")
- public HealthReport checkHealth(Processor subject) {
- List<HealthReport> activityReports = new ArrayList<HealthReport>();
- for (Activity<?> a : subject.getActivityList()) {
- List<HealthChecker<?>> checkers = HealthCheckerFactory
- .getInstance().getHealthCheckersForObject(a);
- if (checkers.size() > 0) {
- List<HealthReport> reports = new ArrayList<HealthReport>();
- for (HealthChecker checker : checkers) {
- reports.add(checker.checkHealth(a));
- }
- if (reports.size() == 1) {
- activityReports.add(reports.get(0));
- } else {
- activityReports.add(new HealthReport("Activity tests...", "",
- Status.OK, reports));
- }
- }
- }
- HealthReport processorHealthReport = new ProcessorHealthReport(
- subject.getLocalName() + " Processor", activityReports);
- return processorHealthReport;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReport.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReport.java
deleted file mode 100644
index 68e1186..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReport.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-
-/**
- * A HealthReport assocatied with Processors.<br>
- * In particular the behaviour for producing an overall status is specialised.
- * @author Stuart Owen
- *
- * @see ProcessorHealthReport#getStatus()
- */
-public class ProcessorHealthReport extends HealthReport {
-
- public ProcessorHealthReport(String subject,List<HealthReport> activityHealthReports) {
- super(subject,"",Status.OK,activityHealthReports);
-
- }
-
- /**
- * the overall status is SEVERE if all sub reports are SEVERE, OK if all are OK, otherwise WARNING.
- * return
- */
- @Override
- public Status getStatus() {
- Status result = super.getStatus();
- int severeCount = 0;
- for (HealthReport report : getSubReports()) {
- if (report.getStatus()!=Status.OK) {
- result = Status.WARNING;
- }
- if (report.getStatus()==Status.SEVERE) severeCount++;
- }
- if (severeCount==getSubReports().size()) result=Status.SEVERE;
- return result;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorImpl.java
deleted file mode 100644
index f03060c..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorImpl.java
+++ /dev/null
@@ -1,408 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.raven.log.Log;
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.lang.observer.MultiCaster;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorManager;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.InvalidDataflowException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorFinishedEvent;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-import net.sf.taverna.t2.workflowmodel.processor.activity.NestedDataflow;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.PropertyContributingDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.impl.DispatchStackImpl;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.MissingIterationInputException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-/**
- * Implementation of Processor
- *
- * @author Tom Oinn
- * @author Stuart Owen
- * @author Alex Nenadic
- *
- */
-public final class ProcessorImpl extends AbstractAnnotatedThing<Processor>
- implements Processor{
-
- protected List<ConditionImpl> conditions = new ArrayList<ConditionImpl>();
-
- protected List<ConditionImpl> controlledConditions = new ArrayList<ConditionImpl>();
-
- protected List<ProcessorInputPortImpl> inputPorts = new ArrayList<ProcessorInputPortImpl>();
-
- protected List<ProcessorOutputPortImpl> outputPorts = new ArrayList<ProcessorOutputPortImpl>();
-
- protected List<Activity<?>> activityList = new ArrayList<Activity<?>>();
-
- protected AbstractCrystalizer crystalizer;
-
- protected DispatchStackImpl dispatchStack;
-
- protected IterationStrategyStackImpl iterationStack;
-
- private static int pNameCounter = 0;
-
- protected String name;
-
- public transient int resultWrappingDepth = -1;
-
- protected transient Map<String, Set<MonitorableProperty<?>>> monitorables = new HashMap<String, Set<MonitorableProperty<?>>>();
-
- private static Log logger = Log.getLogger(ProcessorImpl.class);
-
- private MultiCaster<ProcessorFinishedEvent> processorFinishedMultiCaster = new MultiCaster<ProcessorFinishedEvent>(this);
-
- /**
- * <p>
- * Create a new processor implementation with default blank iteration
- * strategy and dispatch stack.
- * </p>
- * <p>
- * This constructor is protected to enforce that an instance can only be
- * created via the {@link EditsImpl#createProcessor(String)} method.
- * </p>
- */
-
- @SuppressWarnings("unchecked")
- protected ProcessorImpl() {
-
- // Set a default name
- name = "UnnamedProcessor" + (pNameCounter++);
-
- // Create iteration stack, configure it to send jobs and completion
- // events to the dispatch stack.
- iterationStack = new IterationStrategyStackImpl() {
- @Override
- protected void receiveEventFromStrategy(IterationInternalEvent e) {
- dispatchStack.receiveEvent(e);
- }
- };
- iterationStack.addStrategy(new IterationStrategyImpl());
-
- // Configure dispatch stack to push output events to the crystalizer
- dispatchStack = new DispatchStackImpl() {
-
- @Override
- protected String getProcessName() {
- return ProcessorImpl.this.name;
- }
-
- public Processor getProcessor() {
- return ProcessorImpl.this;
- }
-
- /**
- * Called when an event bubbles out of the top of the dispatch
- * stack. In this case we pass it into the crystalizer.
- */
- @Override
- protected void pushEvent(IterationInternalEvent e) {
- crystalizer.receiveEvent(e);
- }
-
- /**
- * Iterate over all the preconditions and return true if and only if
- * all are satisfied for the given process identifier.
- */
- @Override
- protected boolean conditionsSatisfied(String owningProcess) {
- for (Condition c : conditions) {
- if (c.isSatisfied(owningProcess) == false) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- protected List<? extends Activity<?>> getActivities() {
- return ProcessorImpl.this.getActivityList();
- }
-
- /**
- * We've finished here, set the satisfied property on any controlled
- * condition objects to true and notify the targets.
- */
- @Override
- protected void finishedWith(String owningProcess) {
- if (! controlledConditions.isEmpty()) {
- String enclosingProcess = owningProcess.substring(0,
- owningProcess.lastIndexOf(':'));
- for (ConditionImpl ci : controlledConditions) {
- ci.satisfy(enclosingProcess);
- ci.getTarget().getDispatchStack().satisfyConditions(
- enclosingProcess);
- }
- }
- // Tell whoever is interested that the processor has finished executing
- processorFinishedMultiCaster.notify(new ProcessorFinishedEvent(this.getProcessor(), owningProcess));
- }
-
- public void receiveMonitorableProperty(MonitorableProperty<?> prop,
- String processID) {
- synchronized (monitorables) {
- Set<MonitorableProperty<?>> props = monitorables
- .get(processID);
- if (props == null) {
- props = new HashSet<MonitorableProperty<?>>();
- monitorables.put(processID, props);
- }
- props.add(prop);
- }
- }
- };
-
- // Configure crystalizer to send realized events to the output ports
- crystalizer = new ProcessorCrystalizerImpl(this);
-
- }
-
- /**
- * When called this method configures input port filters and the
- * crystalizer, pushing cardinality information into outgoing datalinks.
- *
- * @return true if the typecheck was successful or false if the check failed
- * because there were preconditions missing such as unsatisfied
- * input types
- * @throws IterationTypeMismatchException
- * if the typing occured but didn't match because of an
- * iteration mismatch
- * @throws InvalidDataflowException
- * if the entity depended on a dataflow that was not valid
- */
- public boolean doTypeCheck() throws IterationTypeMismatchException, InvalidDataflowException {
-
- // Check for any nested dataflows, they should all be valid
- for (Activity<?> activity : getActivityList()) {
- if (activity instanceof NestedDataflow) {
- NestedDataflow nestedDataflowActivity = (NestedDataflow) activity;
- Dataflow nestedDataflow = nestedDataflowActivity.getNestedDataflow();
- DataflowValidationReport validity = nestedDataflow.checkValidity();
- if (! validity.isValid()) {
- throw new InvalidDataflowException(nestedDataflow, validity);
- }
- }
- }
-
- // Check whether all our input ports have inbound links
- Map<String, Integer> inputDepths = new HashMap<String, Integer>();
- for (ProcessorInputPortImpl input : inputPorts) {
- if (input.getIncomingLink() == null) {
- return false;
- } else {
- if (input.getIncomingLink().getResolvedDepth() == -1) {
- // Incoming link hasn't been resolved yet, can't do this
- // processor at the moment
- return false;
- }
- // Get the conceptual resolved depth of the datalink
- inputDepths.put(input.getName(), input.getIncomingLink()
- .getResolvedDepth());
- // Configure the filter with the finest grained item from the
- // link source
- input.setFilterDepth(input.getIncomingLink().getSource()
- .getGranularDepth());
- }
- }
- // Got here so we have all the inputs, now test whether the iteration
- // strategy typechecks correctly
- try {
- this.resultWrappingDepth = iterationStack
- .getIterationDepth(inputDepths);
- for (BasicEventForwardingOutputPort output : outputPorts) {
- for (DatalinkImpl outgoingLink : output.outgoingLinks) {
- // Set the resolved depth on each output edge
- outgoingLink.setResolvedDepth(this.resultWrappingDepth
- + output.getDepth());
- }
- }
-
- } catch (MissingIterationInputException e) {
- // This should never happen as we only get here if we've already
- // checked that all the inputs have been provided. If it does happen
- // we've got some deeper issues.
- logger.error(e);
- return false;
- }
-
- // If we get to here everything has been configured appropriately
- return true;
- }
-
- /* Utility methods */
-
- protected ProcessorInputPortImpl getInputPortWithName(String name) {
- for (ProcessorInputPortImpl p : inputPorts) {
- String portName = p.getName();
- if (portName.equals(name)) {
- return p;
- }
- }
- return null;
- }
-
- protected ProcessorOutputPortImpl getOutputPortWithName(String name) {
- for (ProcessorOutputPortImpl p : outputPorts) {
- String portName = p.getName();
- if (portName.equals(name)) {
- return p;
- }
- }
- return null;
- }
-
- /* Implementations of Processor interface */
-
- public void fire(String enclosingProcess, InvocationContext context) {
- Job newJob = new Job(enclosingProcess + ":" + this.name, new int[0],
- new HashMap<String, T2Reference>(), context);
- dispatchStack.receiveEvent(newJob);
- }
-
- public List<? extends Condition> getPreconditionList() {
- return Collections.unmodifiableList(conditions);
- }
-
- public List<? extends Condition> getControlledPreconditionList() {
- return Collections.unmodifiableList(controlledConditions);
- }
-
- public DispatchStackImpl getDispatchStack() {
- return dispatchStack;
- }
-
- public IterationStrategyStackImpl getIterationStrategy() {
- return iterationStack;
- }
-
- public List<? extends ProcessorInputPort> getInputPorts() {
- return Collections.unmodifiableList(inputPorts);
- }
-
- public List<? extends ProcessorOutputPort> getOutputPorts() {
- return Collections.unmodifiableList(outputPorts);
- }
-
- public List<? extends Activity<?>> getActivityList() {
- return Collections.unmodifiableList(activityList);
- }
-
- protected void setName(String newName) {
- this.name = newName;
- }
-
- public String getLocalName() {
- return this.name;
- }
-
- /**
- * Called by the DataflowImpl containing this processor requesting that it
- * register itself with the monitor tree under the specified process
- * identifier.
- *
- * @param dataflowOwningProcess
- * the process identifier of the parent dataflow, the processor
- * must register with this as the base path plus the local name
- */
- void registerWithMonitor(String dataflowOwningProcess) {
- // Given the dataflow process identifier, so append local name to get
- // the process identifier that will be applied to incoming data tokens
- String processID = dataflowOwningProcess + ":" + getLocalName();
-
- // The set of monitorable (and steerable) properties for this processor
- // level monitor node
- Set<MonitorableProperty<?>> properties = new HashSet<MonitorableProperty<?>>();
-
- // If any dispatch layers implement PropertyContributingDispatchLayer
- // then message them to push their properties into the property store
- // within the dispatch stack. In this case the anonymous inner class
- // implements this by storing them in a protected map within
- // ProcessoImpl from where they can be recovered after the iteration has
- // finished.
- for (DispatchLayer<?> layer : dispatchStack.getLayers()) {
- if (layer instanceof PropertyContributingDispatchLayer) {
- ((PropertyContributingDispatchLayer<?>) layer)
- .injectPropertiesFor(processID);
- }
- }
- // All layers have now injected properties into the parent dispatch
- // stack, which has responded by building an entry in the monitorables
- // map in this class. We can pull everything out of it and remove the
- // entry quite safely at this point.
- synchronized (monitorables) {
- Set<MonitorableProperty<?>> layerProps = monitorables
- .get(processID);
- if (layerProps != null) {
- for (MonitorableProperty<?> prop : layerProps) {
- properties.add(prop);
- }
- monitorables.remove(processID);
- }
- }
-
- // Register the node with the monitor tree, including any aggregated
- // properties from layers.
- MonitorManager.getInstance().registerNode(this,
- dataflowOwningProcess + ":" + getLocalName(), properties);
- }
-
- public void addObserver(Observer<ProcessorFinishedEvent> observer) {
- processorFinishedMultiCaster.addObserver(observer);
- }
-
- public List<Observer<ProcessorFinishedEvent>> getObservers() {
- return processorFinishedMultiCaster.getObservers();
- }
-
- public void removeObserver(Observer<ProcessorFinishedEvent> observer) {
- processorFinishedMultiCaster.removeObserver(observer);
- }
-
- @Override
- public String toString() {
- return "Processor " + getLocalName();
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorInputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorInputPortImpl.java
deleted file mode 100644
index 96f312c..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorInputPortImpl.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-
-/**
- * An implementation of the filtering input port interface used as an input for
- * a ProcessorImpl. If the filter level is undefined this input port will always
- * throw workflow structure exceptions when you push data into it. This port
- * must be linked to a crystalizer or something which offers the same
- * operational contract, it requires a full hierarchy of data tokens (i.e. if
- * you push something in with an index you must at some point subsequent to that
- * push at least a single list in with the empty index)
- *
- * @author Tom Oinn
- *
- */
-public class ProcessorInputPortImpl extends AbstractFilteringInputPort implements
- ProcessorInputPort {
-
- private ProcessorImpl parent;
-
- protected ProcessorInputPortImpl(ProcessorImpl parent, String name,
- int depth) {
- super(name, depth);
- this.parent = parent;
- }
-
- @Override
- public String transformOwningProcess(String oldOwner) {
- return oldOwner + ":" + parent.getLocalName();
- }
-
- @Override
- protected void pushCompletion(String portName, String owningProcess, int[] index, InvocationContext context) {
- parent.iterationStack.receiveCompletion(portName, owningProcess, index, context);
- }
-
- @Override
- protected void pushData(String portName, String owningProcess, int[] index, T2Reference data, InvocationContext context) {
- parent.iterationStack.receiveData(portName, owningProcess, index, data, context);
- }
-
- public Processor getProcessor() {
- return this.parent;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorOutputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorOutputPortImpl.java
deleted file mode 100644
index 5ec6afb..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorOutputPortImpl.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-
-/**
- * Extension of AbstractOutputPort for use as the output port on a
- * ProcessorImpl. Contains additional logic to relay workflow data tokens from
- * the internal crystalizer to each in a set of target FilteringInputPort
- * instances.
- *
- * @author Tom Oinn
- * @author Stuart Owen
- *
- */
-public class ProcessorOutputPortImpl extends BasicEventForwardingOutputPort implements ProcessorOutputPort{
-
- private ProcessorImpl parent = null;
-
- protected ProcessorOutputPortImpl(ProcessorImpl parent,String portName, int portDepth,
- int granularDepth) {
- super(portName, portDepth, granularDepth);
- this.parent = parent;
- }
-
- /**
- * Strip off the last id in the owning process stack (as this will have been
- * pushed onto the stack on entry to the processor) and relay the event to
- * the targets.
- *
- */
- protected void receiveEvent(WorkflowDataToken token) {
- sendEvent(token.popOwningProcess());
- }
-
- public Processor getProcessor() {
- return this.parent;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortEdit.java
deleted file mode 100644
index 47dc064..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-
-/**
- * Removes an activity input port from an activity.
- *
- * @author David Withers
- */
-public class RemoveActivityInputPortEdit extends AbstractActivityEdit {
-
- private ActivityInputPort activityInputPort;
-
- public RemoveActivityInputPortEdit(Activity<?> activity, ActivityInputPort activityInputPort) {
- super(activity);
- this.activityInputPort = activityInputPort;
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity) throws EditException {
- activity.getInputPorts().remove(activityInputPort);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getInputPorts().add(activityInputPort);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortMappingEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortMappingEdit.java
deleted file mode 100644
index 3a366f0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityInputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class RemoveActivityInputPortMappingEdit extends AbstractActivityEdit {
-
- private final String processorPortName;
- private String oldValue=null;
-
- public RemoveActivityInputPortMappingEdit(Activity<?>activity, String processorPortName) {
- super(activity);
- this.processorPortName = processorPortName;
-
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity)
- throws EditException {
- if (!activity.getInputPortMapping().containsKey(processorPortName)) throw new EditException("The input port mapping for the processor port name:"+processorPortName+" doesn't exist");
- oldValue=activity.getInputPortMapping().get(processorPortName);
- activity.getInputPortMapping().remove(processorPortName);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getInputPortMapping().put(processorPortName, oldValue);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortEdit.java
deleted file mode 100644
index 2622245..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortEdit.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Removes an output port from an activity.
- *
- * @author David Withers
- */
-public class RemoveActivityOutputPortEdit extends AbstractActivityEdit {
-
- private OutputPort activityOutputPort;
-
- public RemoveActivityOutputPortEdit(Activity<?> activity, OutputPort activityInputPort) {
- super(activity);
- this.activityOutputPort = activityInputPort;
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity) throws EditException {
- activity.getOutputPorts().remove(activityOutputPort);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getOutputPorts().add(activityOutputPort);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortMappingEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortMappingEdit.java
deleted file mode 100644
index 91766ed..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveActivityOutputPortMappingEdit.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-public class RemoveActivityOutputPortMappingEdit extends AbstractActivityEdit {
-
- private final String processorPortName;
- private String oldValue=null;
-
- public RemoveActivityOutputPortMappingEdit(Activity<?>activity, String processorPortName) {
- super(activity);
- this.processorPortName = processorPortName;
-
- }
-
- @Override
- protected void doEditAction(AbstractActivity<?> activity)
- throws EditException {
- if (!activity.getOutputPortMapping().containsKey(processorPortName)) throw new EditException("The output port mapping for the processor port name:"+processorPortName+" doesn't exist");
- oldValue=activity.getOutputPortMapping().get(processorPortName);
- activity.getOutputPortMapping().remove(processorPortName);
- }
-
- @Override
- protected void undoEditAction(AbstractActivity<?> activity) {
- activity.getOutputPortMapping().put(processorPortName, oldValue);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveConditionEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveConditionEdit.java
deleted file mode 100644
index e72adb7..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveConditionEdit.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Remove the condition serializing execution between the specified control and
- * target processors.
- *
- * @author Tom Oinn
- *
- */
-public class RemoveConditionEdit extends AbstractBinaryProcessorEdit {
-
- private ConditionImpl condition = null;
-
- public RemoveConditionEdit(Processor control, Processor target) {
- super(control, target);
-
- }
-
- @Override
- protected void doEditAction(ProcessorImpl control, ProcessorImpl target)
- throws EditException {
- for (ConditionImpl c : control.controlledConditions) {
- if (c.getTarget() == target) {
- this.condition = c;
- break;
- }
- }
- if (this.condition == null) {
- throw new EditException(
- "Can't remove a control link as it doesn't exist");
- }
-
- control.controlledConditions.remove(condition);
- target.conditions.remove(condition);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl control, ProcessorImpl target) {
- control.controlledConditions.add(condition);
- target.conditions.add(condition);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowInputPortEdit.java
deleted file mode 100644
index dcc8e0c..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowInputPortEdit.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Removes a dataflow input port from a dataflow.
- *
- * @author David Withers
- *
- */
-public class RemoveDataflowInputPortEdit extends AbstractDataflowEdit {
-
- private DataflowInputPort dataflowInputPort;
-
- public RemoveDataflowInputPortEdit(Dataflow dataflow, DataflowInputPort dataflowInputPort) {
- super(dataflow);
- this.dataflowInputPort = dataflowInputPort;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.removeDataflowInputPort(dataflowInputPort);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (dataflowInputPort instanceof DataflowInputPortImpl) {
- try {
- dataflow.addInputPort((DataflowInputPortImpl) dataflowInputPort);
- } catch (EditException e) {
- //shouldn't happen as a port with this name has been removed
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowOutputPortEdit.java
deleted file mode 100644
index 95a3a25..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Removes a dataflow output port from a dataflow.
- *
- * @author David Withers
- *
- */
-public class RemoveDataflowOutputPortEdit extends AbstractDataflowEdit {
-
- private DataflowOutputPort dataflowOutputPort;
-
- public RemoveDataflowOutputPortEdit(Dataflow dataflow, DataflowOutputPort dataflowOutputPort) {
- super(dataflow);
- this.dataflowOutputPort = dataflowOutputPort;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.removeDataflowOutputPort(dataflowOutputPort);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (dataflowOutputPort instanceof DataflowOutputPortImpl) {
- try {
- dataflow.addOutputPort((DataflowOutputPortImpl) dataflowOutputPort);
- } catch (EditException e) {
- //shouldn't happen as a port with this name has been removed
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveMergeEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveMergeEdit.java
deleted file mode 100644
index ebddefe..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveMergeEdit.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.NamingException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-
-/**
- * Removes a merge from a dataflow.
- *
- * @author David Withers
- */
-public class RemoveMergeEdit extends AbstractDataflowEdit{
-
- private Merge merge;
-
- public RemoveMergeEdit(Dataflow dataflow, Merge merge) {
- super(dataflow);
- this.merge = merge;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.removeMerge(merge);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (merge instanceof MergeImpl) {
- try {
- dataflow.addMerge((MergeImpl) merge);
- } catch (NamingException e) {
- //a merge with this name has already been removed
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorEdit.java
deleted file mode 100644
index d38d6fd..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorEdit.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.NamingException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Removes a processor from a dataflow.
- *
- * @author David Withers
- */
-public class RemoveProcessorEdit extends AbstractDataflowEdit{
-
- private Processor processor;
-
- public RemoveProcessorEdit(Dataflow dataflow, Processor processor) {
- super(dataflow);
- this.processor = processor;
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.removeProcessor(processor);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- if (processor instanceof ProcessorImpl) {
- try {
- dataflow.addProcessor((ProcessorImpl) processor);
- } catch (NamingException e) {
- //a processor with this name has already been removed
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEdit.java
deleted file mode 100644
index de54c9b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEdit.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-
-import org.apache.log4j.Logger;
-
-public class RemoveProcessorInputPortEdit extends AbstractProcessorEdit {
-
- private final ProcessorInputPort port;
- private static Logger logger = Logger
- .getLogger(RemoveProcessorInputPortEdit.class);
-
- public RemoveProcessorInputPortEdit(Processor processor, ProcessorInputPort port) {
- super(processor);
- this.port = port;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- if (processor.getInputPortWithName(port.getName())==null) throw new EditException("The processor doesn't have a port named:"+port.getName());
- for (IterationStrategyImpl is : processor.iterationStack.getStrategies()) {
- is.removeInputByName(port.getName());
- }
- processor.inputPorts.remove(port);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- try {
- new EditsImpl().getAddProcessorInputPortEdit(processor, port).doEdit();
- } catch (EditException e) {
- logger.error("There was an error adding an input port to a Processor whilst undoing a remove");
- }
- }
-
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEdit.java
deleted file mode 100644
index f25ca5c..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-
-import org.apache.log4j.Logger;
-
-public class RemoveProcessorOutputPortEdit extends AbstractProcessorEdit {
-
- private final ProcessorOutputPort port;
- private static Logger logger = Logger
- .getLogger(RemoveProcessorOutputPortEdit.class);
-
- public RemoveProcessorOutputPortEdit(Processor processor, ProcessorOutputPort port) {
- super(processor);
- this.port = port;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- if (processor.getOutputPortWithName(port.getName())==null) throw new EditException("The processor doesn't have a port named:"+port.getName());
- processor.outputPorts.remove(port);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- try {
- new EditsImpl().getAddProcessorOutputPortEdit(processor, port).doEdit();
- } catch (EditException e) {
- logger.error("There was an error adding an input port to a Processor whilst undoing a remove");
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowInputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowInputPortEdit.java
deleted file mode 100644
index 94565d9..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowInputPortEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Rename the specified DataflowInputPort
- *
- * @author David Withers
- *
- */
-public class RenameDataflowInputPortEdit extends AbstractDataflowInputPortEdit {
-
- private String newName;
-
- private String oldName = null;
-
- public RenameDataflowInputPortEdit(DataflowInputPort dataflowInputPort, String newName) {
- super(dataflowInputPort);
- this.newName = newName;
- }
-
- @Override
- protected void doEditAction(DataflowInputPortImpl dataflowInputPort) throws EditException {
- oldName = dataflowInputPort.getName();
- dataflowInputPort.setName(newName);
- }
-
- @Override
- protected void undoEditAction(DataflowInputPortImpl dataflowInputPort) {
- dataflowInputPort.setName(oldName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowOutputPortEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowOutputPortEdit.java
deleted file mode 100644
index 15047be..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Rename the specified DataflowOutputPort
- *
- * @author David Withers
- *
- */
-public class RenameDataflowOutputPortEdit extends AbstractDataflowOutputPortEdit {
-
- private String newName;
-
- private String oldName = null;
-
- public RenameDataflowOutputPortEdit(DataflowOutputPort dataflowOutputPort, String newName) {
- super(dataflowOutputPort);
- this.newName = newName;
- }
-
- @Override
- protected void doEditAction(DataflowOutputPortImpl dataflowOutputPort) throws EditException {
- oldName = dataflowOutputPort.getName();
- dataflowOutputPort.setName(newName);
- }
-
- @Override
- protected void undoEditAction(DataflowOutputPortImpl dataflowOutputPort) {
- dataflowOutputPort.setName(oldName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameMergeEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameMergeEdit.java
deleted file mode 100644
index 1a97f30..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameMergeEdit.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-
-/**
- * Rename a merge
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class RenameMergeEdit extends AbstractMergeEdit {
-
- String newName;
-
- String oldName = null;
-
- public RenameMergeEdit(Merge p, String newName) {
- super(p);
- this.newName = newName;
- }
-
- @Override
- protected void doEditAction(MergeImpl merge) throws EditException {
- oldName = merge.getLocalName();
- merge.setName(newName);
- }
-
- @Override
- protected void undoEditAction(MergeImpl merge) {
- merge.setName(oldName);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameProcessorEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameProcessorEdit.java
deleted file mode 100644
index f8d8c81..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/RenameProcessorEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Rename the specified processor
- *
- * @author Tom Oinn
- *
- */
-public class RenameProcessorEdit extends AbstractProcessorEdit {
-
- String newName;
-
- String oldName = null;
-
- public RenameProcessorEdit(Processor p, String newName) {
- super(p);
- this.newName = newName;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- oldName = processor.getLocalName();
- processor.setName(newName);
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- processor.setName(oldName);
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ReorderMergeInputPortsEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ReorderMergeInputPortsEdit.java
deleted file mode 100644
index be2e44d..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/ReorderMergeInputPortsEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-
-public class ReorderMergeInputPortsEdit extends AbstractMergeEdit {
-
- private List<? extends MergeInputPort> previousInputPortList; // needed for undo
- private List<? extends MergeInputPort> reorderedInputPortList;
-
- public ReorderMergeInputPortsEdit(Merge merge, List<? extends MergeInputPort> reorderedInputPortList) {
- super(merge);
- this.reorderedInputPortList = reorderedInputPortList;
- this.previousInputPortList = merge.getInputPorts();
- }
-
- @Override
- protected void doEditAction(MergeImpl mergeImpl) throws EditException {
- if (mergeImpl instanceof MergeImpl) {
- mergeImpl.reorderInputPorts(reorderedInputPortList);
- }
- else {
- throw new EditException("The Merge is of the wrong implementation, it should be of type MergeImpl");
- }
- }
-
- @Override
- protected void undoEditAction(MergeImpl mergeImpl) {
- mergeImpl.reorderInputPorts(previousInputPortList);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/SetIterationStrategyStackEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/SetIterationStrategyStackEdit.java
deleted file mode 100644
index 3b784cc..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/SetIterationStrategyStackEdit.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-/**
- * Set the iteration strategy
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class SetIterationStrategyStackEdit extends AbstractProcessorEdit {
-
- private final IterationStrategyStack iterationStrategyStack;
- private IterationStrategyStackImpl oldStrategyStack;
-
- public SetIterationStrategyStackEdit(Processor processor,
- IterationStrategyStack iterationStrategyStack) {
- super(processor);
- this.iterationStrategyStack = iterationStrategyStack;
- }
-
- @Override
- protected void doEditAction(ProcessorImpl processor) throws EditException {
- oldStrategyStack = processor.getIterationStrategy();
-
- if (!(iterationStrategyStack instanceof IterationStrategyStackImpl)) {
- throw new EditException(
- "Unknown implementation of iteration strategy "
- + iterationStrategyStack);
- }
- processor.iterationStack = (IterationStrategyStackImpl) iterationStrategyStack;
- }
-
- @Override
- protected void undoEditAction(ProcessorImpl processor) {
- processor.iterationStack = oldStrategyStack;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Tools.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Tools.java
deleted file mode 100644
index 81d158d..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/Tools.java
+++ /dev/null
@@ -1,591 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import net.sf.taverna.raven.Raven;
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.ArtifactNotFoundException;
-import net.sf.taverna.raven.repository.ArtifactStateException;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-import net.sf.taverna.raven.repository.impl.LocalArtifactClassLoader;
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.Format;
-import org.jdom.output.XMLOutputter;
-
-/**
- *
- * Contains static methods concerned with legacy Processor construction and XML
- * handling for the various configurable types such as Activity and
- * DispatchLayer.
- * <p>
- * Not to be confused with the probably more helpful
- * {@link net.sf.taverna.t2.workflowmodel.utils.Tools}.
- *
- * @author Tom Oinn
- * @author Stuart Owen
- *
- */
-public class Tools {
-
- private static Logger logger = Logger
- .getLogger(Tools.class);
-
- // XML element names
- private static final String LAYER = "layer";
- private static final String ACTIVITY = "activity";
- private static final String JAVA = "java";
- private static final String OUTPUT_MAP = "outputMap";
- private static final String TO = "to";
- private static final String FROM = "from";
- private static final String MAP = "map";
- private static final String INPUT_MAP = "inputMap";
- private static final String CLASS = "class";
- private static final String VERSION = "version";
- private static final String ARTIFACT = "artifact";
- private static final String GROUP = "group";
- private static final String RAVEN = "raven";
- private static final String ANNOTATIONS = "annotations";
- @SuppressWarnings("unused")
- private static final String ANNOTATION = "annotation";
-
-
-
- /**
- * Build a JDOM <activity> Element corresponding to the given
- * {@link Activity} implementation. Relies on the {@link XMLEncoder} based
- * serialisation of the configuration bean to store configuration data.
- *
- * @param activity
- * {@link Activity} to serialise
- * @return JDOM <activity> Element
- * @throws JDOMException
- * @throws IOException
- */
- @Deprecated
- public static Element activityAsXML(Activity<?> activity)
- throws JDOMException, IOException {
- Element activityElem = new Element(ACTIVITY);
-
- ClassLoader cl = activity.getClass().getClassLoader();
- if (cl instanceof LocalArtifactClassLoader) {
- activityElem
- .addContent(ravenElement((LocalArtifactClassLoader) cl));
- }
- Element classNameElement = new Element(CLASS);
- classNameElement.setText(activity.getClass().getName());
- activityElem.addContent(classNameElement);
-
- // Write out the mappings (processor input -> activity input, activity
- // output -> processor output)
- Element ipElement = new Element(INPUT_MAP);
- for (String processorInputName : activity.getInputPortMapping()
- .keySet()) {
- Element mapElement = new Element(MAP);
- mapElement.setAttribute(FROM, processorInputName);
- mapElement.setAttribute(TO, activity.getInputPortMapping().get(
- processorInputName));
- ipElement.addContent(mapElement);
- }
- activityElem.addContent(ipElement);
-
- Element opElement = new Element(OUTPUT_MAP);
- for (String activityOutputName : activity.getOutputPortMapping()
- .keySet()) {
- Element mapElement = new Element(MAP);
- mapElement.setAttribute(FROM, activityOutputName);
- mapElement.setAttribute(TO, activity.getOutputPortMapping().get(
- activityOutputName));
- opElement.addContent(mapElement);
- }
- activityElem.addContent(opElement);
-
- // Get element for configuration
- Object o = activity.getConfiguration();
- Element configElement = beanAsElement(o);
- activityElem.addContent(configElement);
-
- return activityElem;
-
- }
-
- /**
- * Iterates over all the processors in the dataflow, returning the first processor found to contain the given activity.
- * @param dataflow
- * @param activity
- * @return the processor to which the activity is attached, or null if it cannot be found
- */
- public Processor findProcessorForActivity(Dataflow dataflow, Activity<?> activity) {
- for (Processor p : dataflow.getProcessors()) {
- for (Activity<?> a : p.getActivityList()) {
- if (a==activity) return p;
- }
- }
- return null;
- }
-
- /**
- * Add the annotations contained in the specified <annotations>
- * element to the specified instance of a MutableAnnotated object.
- *
- * @param annotations
- * {@link Element} to extract 'annotation' elements from
- * @param annotated
- * {@link MutableAnnotated} to be annotated
- */
- @SuppressWarnings("unchecked")
- @Deprecated
- public static void annotateObject(Element annotations, Annotated annotated) {
- // TODO - implement for new annotation chain framework
- /**
- for (Element e : (List<Element>) annotations.getChildren(ANNOTATION)) {
- ClassLoader cl = Tools.class.getClassLoader();
- Element ravenElement = e.getChild(RAVEN);
- if (ravenElement != null) {
- try {
- cl = getRavenLoader(ravenElement);
- } catch (Exception ex) {
- logger.error(ex);
- // TODO - handle this properly, either by logging correctly
- // or by going back to the repository and attempting to
- // fetch the offending missing artifacts
- }
- }
- Object annotationBean = createBean(e.getChild(JAVA), cl);
- if (annotationBean instanceof WorkflowAnnotation) {
- WorkflowAnnotation newAnnotation = (WorkflowAnnotation) annotationBean;
- try {
- annotated.getAddAnnotationEdit(newAnnotation).doEdit();
- } catch (EditException e1) {
- logger.error(e1);
- }
- } else {
- System.out.println("Found non annotation bean inside an"
- + " annotation element, something's not right here");
- }
- }
- */
-
- }
-
- /**
- * Get the <java> element from the {@link XMLEncoder} for the given
- * bean as a JDOM {@link Element}.
- *
- * @see net.sf.taverna.t2.util.beanable.jaxb.BeanSerialiser
- * @param obj
- * Object to serialise
- * @return <java> element for serialised bean
- * @throws JDOMException
- * @throws IOException
- *
- */
- @Deprecated
- public static Element beanAsElement(Object obj) throws JDOMException,
- IOException {
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- XMLEncoder xenc = new XMLEncoder(bos);
- xenc.writeObject(obj);
- xenc.close();
- byte[] bytes = bos.toByteArray();
- ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
- Element configElement = new SAXBuilder().build(bis).getRootElement();
- configElement.getParent().removeContent(configElement);
- return configElement;
- }
-
- /**
- * Build an Activity instance from the specified <activity> JDOM
- * Element using reflection to assemble the configuration bean and configure
- * the new Activity object. If the <activity> has a <raven>
- * child element the metadata in that element will be used to locate an
- * appropriate ArtifactClassLoader, if absent the ClassLoader used will be
- * the one used to load this utility class.
- *
- * @param element
- * <activity> JDOM from where to build the Activity
- * @return Built {@link Activity} instance
- * @throws ClassNotFoundException
- * @throws InstantiationException
- * @throws IllegalAccessException
- * @throws ActivityConfigurationException
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public static Activity buildActivity(Element element)
- throws ClassNotFoundException, InstantiationException,
- IllegalAccessException, ActivityConfigurationException {
- Element ravenElement = element.getChild(RAVEN);
- ClassLoader cl = Tools.class.getClassLoader();
- if (ravenElement != null) {
- try {
- cl = getRavenLoader(ravenElement);
- } catch (Exception ex) {
- logger.error("Exception loading raven classloader "
- + "for Activity instance", ex);
- }
- }
- String className = element.getChild(CLASS).getTextTrim();
- Class<? extends Activity> c = (Class<? extends Activity>) cl
- .loadClass(className);
- Activity<Object> activity = c.newInstance();
-
- Element ipElement = element.getChild(INPUT_MAP);
- for (Element mapElement : (List<Element>) (ipElement.getChildren(MAP))) {
- String processorInputName = mapElement.getAttributeValue(FROM);
- String activityInputName = mapElement.getAttributeValue(TO);
- activity.getInputPortMapping().put(processorInputName,
- activityInputName);
- }
-
- Element opElement = element.getChild(OUTPUT_MAP);
- for (Element mapElement : (List<Element>) (opElement.getChildren(MAP))) {
- String activityOutputName = mapElement.getAttributeValue(FROM);
- String processorOutputName = mapElement.getAttributeValue(TO);
- activity.getOutputPortMapping().put(activityOutputName,
- processorOutputName);
- }
-
- // Handle the configuration of the activity
- Element configElement = element.getChild(JAVA);
- Object configObject = createBean(configElement, cl);
- activity.configure(configObject);
- return activity;
- }
-
- /**
- * Build a {@link DispatchLayer} object from the specified JDOM
- * <layer> {@link Element}.
- *
- * @param element
- * <layer> {@link Element}
- * @return A {@link DispatchLayer} built from the element
- * @throws ClassNotFoundException
- * @throws IllegalAccessException
- * @throws InstantiationException
- *
- */
- @Deprecated
- @SuppressWarnings("unchecked")
- public static DispatchLayer buildDispatchLayer(Element element)
- throws ClassNotFoundException, InstantiationException,
- IllegalAccessException {
- Element ravenElement = element.getChild(RAVEN);
- ClassLoader cl = Tools.class.getClassLoader();
- if (ravenElement != null) {
- try {
- cl = getRavenLoader(ravenElement);
- } catch (Exception ex) {
- logger.error("Exception loading raven classloader "
- + "for Activity instance", ex);
- // TODO - handle this properly, either by logging correctly or
- // by going back to the repository and attempting to fetch the
- // offending missing artifacts
- }
- }
- String className = element.getChild(CLASS).getTextTrim();
- Class<? extends DispatchLayer> c = (Class<? extends DispatchLayer>) cl
- .loadClass(className);
- DispatchLayer<Object> layer = c.newInstance();
-
- // Handle the configuration of the dispatch layer
- Element configElement = element.getChild(JAVA);
- Object configObject = createBean(configElement, cl);
- try {
- layer.configure(configObject);
- } catch (ConfigurationException e) {
- logger.error("", e);
- // TODO - handle this properly
- }
-
- return layer;
- }
-
- /**
- * Construct a new {@link Processor} with a single {@link Activity} and
- * overall processor inputs and outputs mapped to the activity inputs and
- * outputs. This is intended to be equivalent to the processor creation in
- * Taverna1 where the concepts of Processor and Activity were somewhat
- * confused; it also inserts retry, parallelise and failover layers
- * configured as a Taverna1 process would be.
- * <p>
- * Modifies the given activity object, adding the mappings for input and
- * output port names (these will all be fooport->fooport but they're still
- * needed)
- *
- * @param activity
- * the {@link Activity} to use to build the new processor around
- * @return An initialised {@link ProcessorImpl}
- */
- public static ProcessorImpl buildFromActivity(Activity<?> activity)
- throws EditException {
- EditsImpl edits = new EditsImpl();
- ProcessorImpl processor = (ProcessorImpl)edits.createProcessor("");
- new DefaultDispatchStackEdit(processor).doEdit();
- // Add the Activity to the processor
- processor.activityList.add(activity);
- // Create processor inputs and outputs corresponding to activity inputs
- // and outputs and set the mappings in the Activity object.
- activity.getInputPortMapping().clear();
- activity.getOutputPortMapping().clear();
- for (InputPort ip : activity.getInputPorts()) {
- ProcessorInputPort pip = edits.createProcessorInputPort(processor,ip.getName(), ip.getDepth());
- new AddProcessorInputPortEdit(processor, pip).doEdit();
- activity.getInputPortMapping().put(ip.getName(), ip.getName());
- }
- for (OutputPort op : activity.getOutputPorts()) {
- ProcessorOutputPort pop=edits.createProcessorOutputPort(processor,op.getName(), op
- .getDepth(), op.getGranularDepth());
- new AddProcessorOutputPortEdit(processor, pop).doEdit();
- activity.getOutputPortMapping().put(op.getName(), op.getName());
- }
-
- return processor;
- }
-
- /**
- * Use the XMLDecoder to build an arbitrary java bean from the <java>
- * JDOM Element object. Uses the supplied {@link ClassLoader} to accommodate
- * systems such as {@link Raven}.
- *
- * @param element
- * <java> JDOM {@link Element} from where to build the bean
- * @param classLoader
- * {@link ClassLoader} from where to find the bean's classes
- * @return The deserialised bean
- */
- @Deprecated
- public static Object createBean(Element element, ClassLoader classLoader) {
- String beanXML = new XMLOutputter(Format.getRawFormat())
- .outputString(element);
- XMLDecoder decoder = new XMLDecoder(new ByteArrayInputStream(beanXML
- .getBytes()), null, null, classLoader);
- Object bean = decoder.readObject();
- return bean;
- }
-
- /**
- * Make a JDOM <layer> {@link Element} serialising the given
- * {@link DispatchLayer}.
- *
- * @param layer
- * layer to serialise
- * @return <:layer>: {@link Element} describing the
- * {@link DispatchLayer}
- */
- @Deprecated
- public static Element dispatchLayerAsXML(DispatchLayer<?> layer)
- throws JDOMException, IOException {
- Element layerElem = new Element(LAYER);
-
- ClassLoader cl = layer.getClass().getClassLoader();
- if (cl instanceof LocalArtifactClassLoader) {
- layerElem.addContent(ravenElement((LocalArtifactClassLoader) cl));
- }
- Element classNameElement = new Element(CLASS);
- classNameElement.setText(layer.getClass().getName());
- layerElem.addContent(classNameElement);
-
- // Get element for configuration
- Object o = layer.getConfiguration();
- Element configElement = beanAsElement(o);
- layerElem.addContent(configElement);
- return layerElem;
- }
-
- /**
- * Return the <annotation> element for a specified {@link Annotated}
- * entity.
- *
- * @see net.sf.taverna.t2.util.beanable.jaxb.BeanSerialiser
- * @param annotated
- * the workflow entity to serialise annotations for
- * @return a JDOM {@link Element} object containing the annotations
- */
- @Deprecated
- public static Element getAnnotationsElement(Annotated<?> annotated) {
- Element result = new Element(ANNOTATIONS);
- // TODO - implement for new annotation chain framework
- /**
- * for (WorkflowAnnotation annotation : annotated.getAnnotations()) {
- * Element annotationElement = new Element(ANNOTATION); // If this was
- * loaded by raven then store the artifact details if
- * (annotation.getClass().getClassLoader() instanceof
- * LocalArtifactClassLoader) { LocalArtifactClassLoader lacl =
- * (LocalArtifactClassLoader) annotation .getClass().getClassLoader();
- * annotationElement.addContent(ravenElement(lacl)); } try {
- * annotationElement.addContent(beanAsElement(annotation)); } catch
- * (JDOMException e) { // Auto-generated catch block but should never
- * see this e.printStackTrace(); } catch (IOException e) { //
- * Auto-generated catch block but should never see this
- * e.printStackTrace(); } result.addContent(annotationElement); }
- */
- return result;
- }
-
- /**
- * Get the {@link ClassLoader} for loading classes from the artifact
- * specified by the <raven> element.
- * <p>
- * If this class wasn't loaded by Raven then this ignores the element
- * entirely and defaults to using the same classloader as
- * {@link Tools this class} was loaded by. This is probably not what you
- * want but it's a sensible enough fallback position
- *
- * @param ravenElement
- * <raven> element describing artifact
- * @return Resolved {@link LocalArtifactClassLoader} or current
- * {@link ClassLoader}
- * @throws ArtifactNotFoundException
- * If the element (directly or indirectly) specified an unknown
- * artifact
- * @throws ArtifactStateException
- * If something went wrong when fetching artifact
- */
- public static ClassLoader getRavenLoader(Element ravenElement)
- throws ArtifactNotFoundException, ArtifactStateException {
- // Try to get the current Repository object, if there isn't one we can't
- // do this here
- Repository repository = null;
- try {
- LocalArtifactClassLoader lacl = (LocalArtifactClassLoader) (Tools.class
- .getClassLoader());
- repository = lacl.getRepository();
-
- } catch (ClassCastException cce) {
- return Tools.class.getClassLoader();
- // TODO - should probably warn that this is happening as it's likely
- // to be because of an error in API usage. There are times it won't
- // be though so leave it for now.
- }
- String groupId = ravenElement.getChildTextTrim(GROUP);
- String artifactId = ravenElement.getChildTextTrim(ARTIFACT);
- String version = ravenElement.getChildTextTrim(VERSION);
- Artifact artifact = new BasicArtifact(groupId, artifactId, version);
- return repository.getLoader(artifact, null);
- }
-
- /**
- * Insert the element produce by {@link #getAnnotationsElement(Annotated)}
- * into the specified {@link Element}. If the annotation set is empty this
- * does nothing - this is to prevent copy and paste code of the style 'if
- * there are annotations add...'
- *
- * @param element
- * {@link Element} where to inject annotations
- * @param annotated
- * {@link Annotated} from where to find annotations
- */
- @Deprecated
- public static void injectAnnotations(Element element, Annotated<?> annotated) {
- if (!annotated.getAnnotations().isEmpty()) {
- element.addContent(getAnnotationsElement(annotated));
- }
- }
-
- /**
- * Populate annotations of a {@link MutableAnnotated} from an
- * {@link Element} containing a child 'annotations'. If the annotations
- * element is not present this method does nothing.
- *
- * @see #injectAnnotations(Element, Annotated)
- * @param parent
- * Element from where to find the 'annotations' child
- * @param annotated
- * {@link MutableAnnotated} to be annotated
- */
- @Deprecated
- public static void populateAnnotationsFromParent(Element parent,
- Annotated<?> annotated) {
- Element annotationsElement = parent.getChild(ANNOTATIONS);
- if (annotationsElement != null) {
- annotateObject(annotationsElement, annotated);
- }
- }
-
- /**
- * Create the <raven> element for a given local artifact classloader.
- *
- * @param classLoader
- * The {@link LocalArtifactClassLoader} for the artifact
- * @return Populated <raven> element
- */
- public static Element ravenElement(LocalArtifactClassLoader classLoader) {
- Element element = new Element(RAVEN);
- Artifact artifact = classLoader.getArtifact();
- // Group
- Element groupIdElement = new Element(GROUP);
- groupIdElement.setText(artifact.getGroupId());
- element.addContent(groupIdElement);
- // Artifact ID
- Element artifactIdElement = new Element(ARTIFACT);
- artifactIdElement.setText(artifact.getArtifactId());
- element.addContent(artifactIdElement);
- // Version
- Element versionElement = new Element(VERSION);
- versionElement.setText(artifact.getVersion());
- element.addContent(versionElement);
- // Return assembled raven element
- return element;
- }
-
- /**
- *
- * @see net.sf.taverna.t2.workflowmodel.utils.Tools#uniqueProcessorName(String, Dataflow)
- */
- @Deprecated
- public static String uniqueProcessorName(String preferredName,
- Dataflow dataflow) {
- return net.sf.taverna.t2.workflowmodel.utils.Tools.uniqueProcessorName(preferredName, dataflow);
- }
-
-
-
- /**
- * Protected constructor, use static methods only.
- */
- protected Tools() {
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEdit.java
deleted file mode 100644
index c78d90b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEdit.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-public class UpdateDataflowInternalIdentifierEdit extends AbstractDataflowEdit {
-
- private String newId;
- private String oldId;
-
- public UpdateDataflowInternalIdentifierEdit(Dataflow dataflow,String newId) {
- super(dataflow);
- this.newId=newId;
- this.oldId=dataflow.getInternalIdentier();
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.internalIdentifier=newId;
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- dataflow.internalIdentifier=oldId;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowNameEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowNameEdit.java
deleted file mode 100644
index 25bed3a..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowNameEdit.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-public class UpdateDataflowNameEdit extends AbstractDataflowEdit {
-
- private String newName;
- private String oldName;
-
- public UpdateDataflowNameEdit(Dataflow dataflow,String newName) {
- super(dataflow);
- this.newName=newName;
- this.oldName=dataflow.getLocalName();
- }
-
- @Override
- protected void doEditAction(DataflowImpl dataflow) throws EditException {
- dataflow.setLocalName(newName);
- }
-
- @Override
- protected void undoEditAction(DataflowImpl dataflow) {
- dataflow.setLocalName(oldName);
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/package.html
deleted file mode 100644
index 46b9fee..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Implementation package for workflow entities
-</body>
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityInputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityInputPortImpl.java
deleted file mode 100644
index 7f77328..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityInputPortImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.impl;
-
-import java.util.Collections;
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.AbstractPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-
-/**
- * An input port on an Activity instance. Simply used as a bean to hold port
- * name and depth properties.
- *
- * @author Tom Oinn
- * @author Stuart Owen
- *
- */
-public class ActivityInputPortImpl extends AbstractPort implements
- ActivityInputPort {
-
- private Class<?> translatedElementClass;
- private List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes;
- boolean allowsLiteralValues;
-
- /**
- * Constructs an Activity input port instance with the provided name and
- * depth.
- *
- * @param portName
- * @param portDepth
- */
- public ActivityInputPortImpl(String portName, int portDepth) {
- super(portName, portDepth);
- }
-
- /**
- * Constructs an Activity input port with the provided name and depth,
- * together with a list of predetermined annotations.
- *
- * @param portName
- * @param portDepth
- */
- public ActivityInputPortImpl(String portName, int portDepth,
- boolean allowsLiteralValues,
- List<Class<? extends ExternalReferenceSPI>> handledReferenceSchemes,
- Class<?> translatedElementClass) {
- this(portName, portDepth);
- this.allowsLiteralValues = allowsLiteralValues;
- this.handledReferenceSchemes = handledReferenceSchemes;
- this.translatedElementClass = translatedElementClass;
- }
-
- public boolean allowsLiteralValues() {
- return this.allowsLiteralValues();
- }
-
- public List<Class<? extends ExternalReferenceSPI>> getHandledReferenceSchemes() {
- return Collections.unmodifiableList(this.handledReferenceSchemes);
- }
-
- public Class<?> getTranslatedElementClass() {
- return this.translatedElementClass;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityOutputPortImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityOutputPortImpl.java
deleted file mode 100644
index d037058..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/ActivityOutputPortImpl.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.activity.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.raven.log.Log;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.workflowmodel.AbstractOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.DispatchLayerXMLDeserializer;
-
-/**
- * An output port on an Activity instance, used as a bean to hold port name,
- * depth and granular depth properties.
- *
- * @author Tom Oinn
- *
- */
-public class ActivityOutputPortImpl extends AbstractOutputPort implements ActivityOutputPort {
-
- private static Log logger = Log.getLogger(ActivityOutputPortImpl.class);
-
-
- /**
- * Constructs an Activity output port instance with the provided name,depth
- * and granular depth.
- *
- * @param portName
- * @param portDepth
- * @param granularDepth
- */
- public ActivityOutputPortImpl(String portName, int portDepth,
- int granularDepth) {
- super(portName, portDepth, granularDepth);
- }
-
- /**
- * Constructs an Activity input port with the provided name, depth and
- * granularDepth together with a list of predetermined annotations.
- *
- * @param portName
- * @param portDepth
- * @param granularDepth
- * @param annotations
- */
- public ActivityOutputPortImpl(String portName, int portDepth,
- int granularDepth, Set<AnnotationChain> annotations) {
- this(portName, portDepth, granularDepth);
- for (AnnotationChain newAnnotation : annotations) {
- try {
- getAddAnnotationEdit(newAnnotation).doEdit();
- } catch (EditException e) {
- // TODO Auto-generated catch block
- logger.error(e);
- }
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/package.html
deleted file mode 100644
index c985eee..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/activity/impl/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Contains specific implementations of the Activity Ports, together with an implementation of ActivityPortBuilder which is responsible for building them.
-</body>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AbstractDispatchLayerEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AbstractDispatchLayerEdit.java
deleted file mode 100644
index a459753..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AbstractDispatchLayerEdit.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-
-/**
- * Abstraction of an edit acting on a DispatchLayer instance. Handles the check to
- * see that the DispatchLayer supplied is really a DispatchLayerImpl.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractDispatchLayerEdit implements Edit<DispatchStack> {
-
- private boolean applied = false;
-
- private DispatchStack stack;
-
- protected AbstractDispatchLayerEdit(DispatchStack s) {
- if (s == null) {
- throw new RuntimeException(
- "Cannot construct a dispatch stack edit with null dispatch stack");
- }
- this.stack = s;
- }
-
- public final DispatchStack doEdit() throws EditException {
- if (applied) {
- throw new EditException("Edit has already been applied!");
- }
- if (stack instanceof DispatchStackImpl == false) {
- throw new EditException(
- "Edit cannot be applied to a DispatchStack which isn't an instance of DispatchStackImpl");
- }
- DispatchStackImpl dsi = (DispatchStackImpl) stack;
- try {
- synchronized (dsi) {
- doEditAction(dsi);
- applied = true;
- return this.stack;
- }
- } catch (EditException ee) {
- applied = false;
- throw ee;
- }
- }
-
- /**
- * Do the actual edit here
- *
- * @param processor
- * The ProcessorImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DispatchStackImpl stack)
- throws EditException;
-
- /**
- * Undo any edit effects here
- */
- protected abstract void undoEditAction(DispatchStackImpl stack);
-
- public final DispatchStack getSubject() {
- return stack;
- }
-
- public final boolean isApplied() {
- return this.applied;
- }
-
- public final void undo() {
- if (!applied) {
- throw new RuntimeException(
- "Attempt to undo edit that was never applied");
- }
- DispatchStackImpl dsi = (DispatchStackImpl) stack;
- synchronized (dsi) {
- undoEditAction(dsi);
- applied = false;
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AddDispatchLayerEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AddDispatchLayerEdit.java
deleted file mode 100644
index 6b1a7f8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/AddDispatchLayerEdit.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-
-/**
- * Edit object to add a new DispatchLayer instance to a DispatchStackImpl
- *
- * @author Tom Oinn
- *
- */
-public class AddDispatchLayerEdit extends AbstractDispatchLayerEdit {
-
- private DispatchLayer<?> layer;
-
- private int index;
-
- public AddDispatchLayerEdit(DispatchStack stack, DispatchLayer<?> newLayer,
- int index) {
- super(stack);
- this.layer = newLayer;
- this.index = index;
- }
-
- @Override
- protected void doEditAction(DispatchStackImpl stack) throws EditException {
- stack.addLayer(this.layer, this.index);
- }
-
- @Override
- protected void undoEditAction(DispatchStackImpl stack) {
- stack.removeLayer(layer);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DeleteDispatchLayerEdit.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DeleteDispatchLayerEdit.java
deleted file mode 100644
index 73c2c12..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DeleteDispatchLayerEdit.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-
-/**
- * Edit implementation to remove a DispatchLayer from a DispatchStackImpl
- *
- * @author Tom Oinn
- *
- */
-public class DeleteDispatchLayerEdit extends AbstractDispatchLayerEdit {
-
- private DispatchLayer<?> layer;
-
- private int index;
-
- public DeleteDispatchLayerEdit(DispatchStack stack,
- DispatchLayer<?> removeLayer) {
- super(stack);
- this.layer = removeLayer;
- }
-
- @Override
- protected void doEditAction(DispatchStackImpl stack) throws EditException {
- index = stack.removeLayer(layer);
- }
-
- @Override
- protected void undoEditAction(DispatchStackImpl stack) {
- stack.addLayer(layer, index);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DispatchStackImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DispatchStackImpl.java
deleted file mode 100644
index 7f0ea96..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/DispatchStackImpl.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.NotifiableLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * The dispatch stack is responsible for consuming a queue of jobs from the
- * iteration strategy and dispatching those jobs through a stack based control
- * flow to an appropriate invocation target. Conceptually the queue and
- * description of activities enter the stack at the top, travel down to an
- * invocation layer at the bottom from which results, errors and completion
- * events rise back up to the top layer. Dispatch stack layers are stored as an
- * ordered list with index 0 being the top of the stack.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public abstract class DispatchStackImpl extends
- AbstractAnnotatedThing<DispatchStack> implements DispatchStack {
-
- private static Logger logger = Logger.getLogger(DispatchStackImpl.class);
-
- private Map<String, BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>>> queues = new HashMap<String, BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>>>();
-
- private List<DispatchLayer<?>> dispatchLayers = new ArrayList<DispatchLayer<?>>();
-
- /**
- * Override to return the list of activities to be used by this dispatch
- * stack.
- *
- * @return list of activities to be used by jobs in this dispatch stack
- */
- protected abstract List<? extends Activity<?>> getActivities();
-
- /**
- * Called when an event (Completion or Job) hits the top of the dispatch
- * stack and needs to be pushed out of the processor
- *
- * @param e
- */
- protected abstract void pushEvent(
- IterationInternalEvent<? extends IterationInternalEvent<?>> e);
-
- /**
- * Called to determine whether all the preconditions for this dispatch stack
- * are satisfied. Jobs with the given owningProcess are not processed by the
- * dispatch stack until this returns true. Once it has returned true for a
- * given owning process it must always return true, the precondition is not
- * allowed to change from true back to false.
- *
- * @param owningProcess
- * @return whether all preconditions to invocation are satisfied.
- */
- protected abstract boolean conditionsSatisfied(String owningProcess);
-
- /**
- * Called when the specified owning process is finished with, that is to say
- * all invocation has been performed and any layer state caches have been
- * purged.
- *
- * @param owningProcess
- */
- protected abstract void finishedWith(String owningProcess);
-
- /**
- * Defines the enclosing process name, usually Processor.getName() on the
- * parent
- */
- protected abstract String getProcessName();
-
- private DispatchLayer<Object> topLayer = new TopLayer();
-
- /**
- * Receive an event to be fed into the top layer of the dispatch stack for
- * processing. This has the effect of creating a queue if there isn't one
- * already, honouring any conditions that may be defined by an enclosing
- * processor through the conditionsSatisfied() check method.
- * <p>
- * Because the condition checking logic must check against the enclosing
- * process any attempt to call this method with an owning process without a
- * colon in will fail with an index array out of bounds error. All owning
- * process identifiers must resemble 'enclosingProcess:processorName' at the
- * minimum.
- *
- * @param event
- */
- @SuppressWarnings("unchecked")
- public void receiveEvent(IterationInternalEvent event) {
- BlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>> queue = null;
- String owningProcess = event.getOwningProcess();
- synchronized (queues) {
- String enclosingProcess = owningProcess.substring(0, owningProcess
- .lastIndexOf(':'));
- if (!queues.containsKey(owningProcess)) {
- queue = new LinkedBlockingQueue<IterationInternalEvent<? extends IterationInternalEvent<?>>>();
- queues.put(owningProcess, queue);
- queue.add(event);
-
- // If all preconditions are satisfied push the queue to the
- // dispatch layer
- if (conditionsSatisfied(enclosingProcess)) {
- firstLayer().receiveJobQueue(
- new DispatchJobQueueEvent(owningProcess, event
- .getContext(), queue, getActivities()));
- }
- } else {
- queue = queues.get(owningProcess);
- queue.add(event);
-
- // If all preconditions are satisfied then notify the queue
- // addition to any NotifiableLayer instances. If the
- // preconditions are not satisfied the queue isn't visible to
- // the dispatch stack yet so do nothing.
- if (conditionsSatisfied(enclosingProcess)) {
- for (DispatchLayer layer : dispatchLayers) {
- if (layer instanceof NotifiableLayer) {
- ((NotifiableLayer) layer).eventAdded(owningProcess);
- }
- }
- }
- }
- }
- }
-
-
-
- /**
- * Called when a set of conditions which were unsatisfied in the context of
- * a given owning process become satisfied. At this point any jobs in the
- * queue for that owning process identifier should be pushed through to the
- * dispatch mechanism. As the queue itself will not have been pushed through
- * at this point this just consists of messaging the first layer with the
- * queue and activity set.
- *
- * @param owningProcess
- */
- public void satisfyConditions(String enclosingProcess) {
- if (conditionsSatisfied(enclosingProcess)) {
- String owningProcess = enclosingProcess + ":" + getProcessName();
- synchronized (queues) {
- if (queues.containsKey(owningProcess)) {
- /**
- * At least one event has been received with this process ID
- * and a queue exists for it.
- */
- firstLayer()
- .receiveJobQueue(
- new DispatchJobQueueEvent(owningProcess,
- queues.get(owningProcess).peek()
- .getContext(), queues
- .get(owningProcess),
- getActivities()));
- } else {
- /**
- * Do nothing, if the conditions are satisfied before any
- * jobs are received this mechanism is effectively redundant
- * and the normal notification system for the events will
- * let everything work through as per usual
- */
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack#getLayers()
- */
- public List<DispatchLayer<?>> getLayers() {
- return Collections.unmodifiableList(this.dispatchLayers);
- }
-
- public void addLayer(DispatchLayer<?> newLayer) {
- dispatchLayers.add(newLayer);
- newLayer.setDispatchStack(this);
- }
-
- public void addLayer(DispatchLayer<?> newLayer, int index) {
- dispatchLayers.add(index, newLayer);
- newLayer.setDispatchStack(this);
- }
-
- public int removeLayer(DispatchLayer<?> layer) {
- int priorIndex = dispatchLayers.indexOf(layer);
- dispatchLayers.remove(layer);
- return priorIndex;
- }
-
- /**
- * Return the layer above (lower index!) the specified layer, or a reference
- * to the internal top layer dispatch layer if there is no layer above the
- * specified one. Remember - input data and activities go down, results,
- * errors and completion events bubble back up the dispatch stack.
- * <p>
- * The top layer within the dispatch stack is always invisible and is held
- * within the DispatchStackImpl object itself, being used to route data out
- * of the entire stack
- *
- * @param layer
- * @return
- */
- public DispatchLayer<?> layerAbove(DispatchLayer<?> layer) {
- int layerIndex = dispatchLayers.indexOf(layer);
- if (layerIndex > 0) {
- return dispatchLayers.get(layerIndex - 1);
- } else if (layerIndex == 0) {
- return topLayer;
- } else {
- return null;
- }
- }
-
- /**
- * Return the layer below (higher index) the specified layer, or null if
- * there are no layers below this one
- */
- public DispatchLayer<?> layerBelow(DispatchLayer<?> layer) {
- int layerIndex = dispatchLayers.indexOf(layer);
- if (layerIndex < dispatchLayers.size() - 1) {
- return dispatchLayers.get(layerIndex + 1);
- } else {
- return null;
- }
- }
-
- protected DispatchLayer<?> firstLayer() {
- return dispatchLayers.get(0);
- }
-
- protected class TopLayer extends AbstractDispatchLayer<Object> {
-
- @Override
- public void receiveResult(DispatchResultEvent resultEvent) {
- DispatchStackImpl.this.pushEvent(new Job(resultEvent
- .getOwningProcess(), resultEvent.getIndex(), resultEvent
- .getData(), resultEvent.getContext()));
- if (resultEvent.getIndex().length == 0) {
- sendCachePurge(resultEvent.getOwningProcess());
- }
- }
-
- // TODO - implement top level error handling, if an error bubbles up to
- // the top layer of the dispatch stack it's trouble and probably fails
- // this process
- @Override
- public void receiveError(DispatchErrorEvent errorEvent) {
- logger.error("Error received in dispatch stack on owningProcess:"
- + errorEvent.getOwningProcess() + ", msg:"
- + errorEvent.getMessage(), errorEvent.getCause());
- if (errorEvent.getIndex().length == 0) {
- sendCachePurge(errorEvent.getOwningProcess());
- }
- }
-
- @Override
- public void receiveResultCompletion(
- DispatchCompletionEvent completionEvent) {
- Completion c = new Completion(completionEvent.getOwningProcess(),
- completionEvent.getIndex(), completionEvent.getContext());
- DispatchStackImpl.this.pushEvent(c);
- if (c.isFinal()) {
- sendCachePurge(c.getOwningProcess());
- }
- }
-
- private void sendCachePurge(String owningProcess) {
- for (DispatchLayer<?> layer : dispatchLayers) {
- layer.finishedWith(owningProcess);
- }
- DispatchStackImpl.this.finishedWith(owningProcess);
- }
-
- public void configure(Object config) {
- // TODO Auto-generated method stub
-
- }
-
- public Object getConfiguration() {
- // TODO Auto-generated method stub
- return null;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/package.html
deleted file mode 100644
index 52dcb5a..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/impl/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<body>
-Implementation package for the dispatch stack interfaces. Contains
-DispatchStack implementation and edit objects to modify it, actual
-dispatch layer implementations are held elsewhere (in third party
-plugins and in the
-net.sf.taverna.t2.workflowmodel.processor.dispatch.layers package for
-internal layers)
-</body>
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ErrorBounce.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ErrorBounce.java
deleted file mode 100644
index b3bac7b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ErrorBounce.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.CREATE_PROCESS_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.NO_EFFECT;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.UPDATE_PROCESS_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.RESULT;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.TimerTask;
-
-import net.sf.taverna.t2.invocation.Event;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.monitor.NoSuchPropertyException;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.PropertyContributingDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerErrorReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerJobReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultCompletionReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.SupportsStreamedResult;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Receives job events, checks to see whether any parameters in the job are
- * error tokens or collections which contain errors. If so then sends a
- * corresponding result message back where all outputs are error tokens having
- * registered such with the invocation context's data manager. It also re-writes
- * any failure messages as result messages containing error tokens at the
- * appropriate depth - this means that it must be placed above any error
- * handling layers in order for those to have an effect at all. In general this
- * layer should be placed immediately below the parallelize layer in most
- * default cases (this will guarantee the processor never sees a failure message
- * though, which may or may not be desirable)
- *
- * @author Tom Oinn
- *
- */
-@DispatchLayerErrorReaction(emits = { RESULT }, relaysUnmodified = false, stateEffects = {
- CREATE_PROCESS_STATE, UPDATE_PROCESS_STATE })
-@DispatchLayerJobReaction(emits = { RESULT }, relaysUnmodified = true, stateEffects = {
- CREATE_PROCESS_STATE, UPDATE_PROCESS_STATE, NO_EFFECT })
-@DispatchLayerResultReaction(emits = {}, relaysUnmodified = true, stateEffects = {})
-@DispatchLayerResultCompletionReaction(emits = {}, relaysUnmodified = true, stateEffects = {})
-@SupportsStreamedResult
-public class ErrorBounce extends AbstractDispatchLayer<Object> implements
- PropertyContributingDispatchLayer<Object> {
-
- /**
- * Track the number of reflected and translated errors handled by this error
- * bounce instance
- */
- private Map<String, ErrorBounceState> state = new HashMap<String, ErrorBounceState>();
-
-
-
- private synchronized ErrorBounceState getState(String owningProcess) {
- if (state.containsKey(owningProcess)) {
- return state.get(owningProcess);
- } else {
- ErrorBounceState ebs = new ErrorBounceState();
- state.put(owningProcess, ebs);
- return ebs;
- }
- }
-
- /**
- * If the job contains errors, or collections which contain errors
- * themselves then bounce a result message with error documents in back up
- * to the layer above
- */
- @Override
- public void receiveJob(DispatchJobEvent jobEvent) {
- Set<T2Reference> errorReferences = new HashSet<T2Reference>();
- for (T2Reference ei : jobEvent.getData().values()) {
- if (ei.containsErrors()) {
- errorReferences.add(ei);
- }
- }
- if (errorReferences.isEmpty()) {
- // relay the message down...
- getBelow().receiveJob(jobEvent);
- } else {
- getState(jobEvent.getOwningProcess())
- .incrementErrorsReflected();
- sendErrorOutput(jobEvent, null, errorReferences);
- }
-
- }
-
- /**
- * Always send the error document job result on receiving a failure, at
- * least for now! This should be configurable, in effect this is the part
- * that ensures the processor never sees a top level failure.
- */
- @Override
- public void receiveError(DispatchErrorEvent errorEvent) {
- getState(errorEvent.getOwningProcess()).incrementErrorsTranslated();
- sendErrorOutput(errorEvent, errorEvent.getCause(), null);
- }
-
- /**
- * Construct and send a new result message with error documents in place of
- * all outputs at the appropriate depth
- *
- * @param event
- * @param cause
- * @param errorReferences
- */
- private void sendErrorOutput(Event<?> event, Throwable cause, Set<T2Reference> errorReferences) {
- ReferenceService rs = event.getContext().getReferenceService();
-
- Processor p = dispatchStack.getProcessor();
- Map<String, T2Reference> outputDataMap = new HashMap<String, T2Reference>();
- String[] owningProcessArray = event.getOwningProcess().split(":");
- String processor = owningProcessArray[owningProcessArray.length - 1];
- for (OutputPort op : p.getOutputPorts()) {
- String message = "Processor '" + processor + "' - Port '" + op.getName() + "'";
- if (event instanceof DispatchErrorEvent) {
- message += ": " + ((DispatchErrorEvent) event).getMessage();
- }
- if (cause != null) {
- outputDataMap.put(op.getName(), rs.getErrorDocumentService()
- .registerError(message, cause, op.getDepth()).getId());
- } else {
- outputDataMap.put(op.getName(), rs.getErrorDocumentService()
- .registerError(message, errorReferences, op.getDepth()).getId());
- }
- }
- DispatchResultEvent dre = new DispatchResultEvent(event.getOwningProcess(),
- event.getIndex(), event.getContext(), outputDataMap, false);
- getAbove().receiveResult(dre);
- }
-
- public void configure(Object config) {
- // Do nothing - no configuration required
- }
-
- public Object getConfiguration() {
- // Layer has no configuration associated
- return null;
- }
-
- public void finishedWith(final String owningProcess) {
- // Delay the removal of the state to give the monitor
- // a chance to poll
- cleanupTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- state.remove(owningProcess);
- }
- }, CLEANUP_DELAY_MS);
- }
-
- /**
- * Two properties, dispatch.errorbounce.reflected(integer) is the number of
- * incoming jobs which have been bounced back as results with errors,
- * dispatch.errorbounce.translated(integer) is the number of failures from
- * downstream in the stack that have been re-written as complete results
- * containing error documents.
- */
- public void injectPropertiesFor(final String owningProcess) {
-
- MonitorableProperty<Integer> errorsReflectedProperty = new MonitorableProperty<Integer>() {
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "dispatch", "errorbounce", "reflected" };
- }
-
- public Integer getValue() throws NoSuchPropertyException {
- ErrorBounceState ebs = state.get(owningProcess);
- if (ebs == null) {
- return 0;
- } else {
- return ebs.getErrorsReflected();
- }
- }
- };
- dispatchStack.receiveMonitorableProperty(errorsReflectedProperty,
- owningProcess);
-
- MonitorableProperty<Integer> errorsTranslatedProperty = new MonitorableProperty<Integer>() {
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "dispatch", "errorbounce", "translated" };
- }
-
- public Integer getValue() throws NoSuchPropertyException {
- ErrorBounceState ebs = state.get(owningProcess);
- if (ebs == null) {
- return 0;
- } else {
- return ebs.getErrorsTranslated();
- }
- }
- };
- dispatchStack.receiveMonitorableProperty(errorsTranslatedProperty,
- owningProcess);
-
- }
-
- class ErrorBounceState {
- private int errorsReflected = 0;
- private int errorsTranslated = 0;
-
- /**
- * Number of times the bounce layer has converted an incoming job event
- * where the input data contained error tokens into a result event
- * containing all errors.
- */
- int getErrorsReflected() {
- return this.errorsReflected;
- }
-
- /**
- * Number of times the bounce layer has converted an incoming failure
- * event into a result containing error tokens
- */
- int getErrorsTranslated() {
- return this.errorsTranslated;
- }
-
- synchronized void incrementErrorsReflected() {
- errorsReflected++;
- }
-
- synchronized void incrementErrorsTranslated() {
- errorsTranslated++;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Failover.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Failover.java
deleted file mode 100644
index f963ba2..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Failover.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractErrorHandlerLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerErrorReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerJobReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.*;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.*;
-
-/**
- * Failure handling dispatch layer, consumes job events with multiple activities
- * and emits the same job but with only the first activity. On failures the job
- * is resent to the layer below with a new activity list containing the second
- * in the original list and so on. If a failure is received and there are no
- * further activities to use the job fails and the failure is sent back up to
- * the layer above.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- *
- */
-@DispatchLayerErrorReaction(emits = { JOB }, relaysUnmodified = true, stateEffects = {
- UPDATE_LOCAL_STATE, REMOVE_LOCAL_STATE })
-@DispatchLayerJobReaction(emits = {}, relaysUnmodified = true, stateEffects = { CREATE_LOCAL_STATE })
-@DispatchLayerResultReaction(emits = {}, relaysUnmodified = true, stateEffects = { REMOVE_LOCAL_STATE })
-public class Failover extends AbstractErrorHandlerLayer<Object> {
-
- @Override
- protected JobState getStateObject(DispatchJobEvent jobEvent) {
- return new FailoverState(jobEvent);
- }
-
- /**
- * Receive a job from the layer above, store it in the state map then relay
- * it to the layer below with a modified activity list containing only the
- * activity at index 0
- */
- @Override
- public void receiveJob(DispatchJobEvent jobEvent) {
- addJobToStateList(jobEvent);
- List<Activity<?>> newActivityList = new ArrayList<Activity<?>>();
- newActivityList.add(jobEvent.getActivities().get(0));
- getBelow().receiveJob(
- new DispatchJobEvent(jobEvent.getOwningProcess(), jobEvent
- .getIndex(), jobEvent.getContext(), jobEvent.getData(),
- newActivityList));
- }
-
- class FailoverState extends JobState {
-
- int currentActivityIndex = 0;
-
- public FailoverState(DispatchJobEvent jobEvent) {
- super(jobEvent);
- }
-
- @Override
- public boolean handleError() {
- currentActivityIndex++;
- if (currentActivityIndex == jobEvent.getActivities().size()) {
- return false;
- } else {
- List<Activity<?>> newActivityList = new ArrayList<Activity<?>>();
- newActivityList.add(jobEvent.getActivities().get(
- currentActivityIndex));
- getBelow().receiveJob(
- new DispatchJobEvent(jobEvent.getOwningProcess(),
- jobEvent.getIndex(), jobEvent.getContext(),
- jobEvent.getData(), newActivityList));
- return true;
- }
- }
- }
-
- public void configure(Object config) {
- // Do nothing - there is no configuration to do
- }
-
- public Object getConfiguration() {
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/IntermediateProvenance.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/IntermediateProvenance.java
deleted file mode 100644
index d5018a8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/IntermediateProvenance.java
+++ /dev/null
@@ -1,513 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import java.beans.XMLDecoder;
-import java.beans.XMLEncoder;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.Map.Entry;
-
-import net.sf.taverna.t2.invocation.Event;
-import net.sf.taverna.t2.provenance.item.ActivityProvenanceItem;
-import net.sf.taverna.t2.provenance.item.ErrorProvenanceItem;
-import net.sf.taverna.t2.provenance.item.InputDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.IterationProvenanceItem;
-import net.sf.taverna.t2.provenance.item.OutputDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.ProcessProvenanceItem;
-import net.sf.taverna.t2.provenance.item.ProcessorProvenanceItem;
-import net.sf.taverna.t2.provenance.item.ProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.provenance.reporter.ProvenanceReporter;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * Sits above the {@link Invoke} layer and collects information about the
- * current workflow run to be stored by the {@link ProvenanceConnector}.
- *
- * @author Ian Dunlop
- * @author Stian Soiland-Reyes
- *
- */
-public class IntermediateProvenance extends AbstractDispatchLayer<String> {
-
- Logger logger = Logger.getLogger(IntermediateProvenance.class);
-
- private ProvenanceReporter reporter;
-
- Map<String, Map<String, IterationProvenanceItem>> processToIndexes = new HashMap<String, Map<String, IterationProvenanceItem>>();
-
- private Map<ActivityProvenanceItem, List<Object>> activityProvenanceItemMap = new HashMap<ActivityProvenanceItem, List<Object>>();
-
- private Map<InputDataProvenanceItem, List<Object>> inputDataProvenanceItemMap = new HashMap<InputDataProvenanceItem, List<Object>>();
-
- // private List<ActivityProvenanceItem> activityProvenanceItemList = new
- // ArrayList<ActivityProvenanceItem>();
- //
- // private List<InputDataProvenanceItem> inputDataProvenanceItemList = new
- // ArrayList<InputDataProvenanceItem>();
-
- private WorkflowProvenanceItem workflowItem;
-
- public void configure(String o) {
- }
-
- /**
- * A set of provenance events for a particular owning process has been
- * finished with so you can remove all the {@link IterationProvenanceItem}s
- * from the map
- */
- @Override
- public void finishedWith(String owningProcess) {
- processToIndexes.remove(owningProcess);
- }
-
- public String getConfiguration() {
- return null;
- }
-
- protected Map<String, IterationProvenanceItem> getIndexesByProcess(
- String owningProcess) {
- synchronized (processToIndexes) {
- Map<String, IterationProvenanceItem> indexes = processToIndexes
- .get(owningProcess);
- if (indexes == null) {
- indexes = new HashMap<String, IterationProvenanceItem>();
- processToIndexes.put(owningProcess, indexes);
- }
- return indexes;
- }
- }
-
- protected IterationProvenanceItem getIterationProvItem(Event<?> event) {
- String owningProcess = event.getOwningProcess();
- int[] originalIndex = event.getIndex();
- int[] index = event.getIndex();
- String indexStr = indexStr(index);
- Map<String, IterationProvenanceItem> indexes = getIndexesByProcess(owningProcess);
- IterationProvenanceItem iterationProvenanceItem = null;
- synchronized (indexes) {
- // find the iteration item for the int index eg [1]
- iterationProvenanceItem = indexes.get(indexStr);
- // if it is null then strip the index and look again
-
- while (iterationProvenanceItem == null) {
- try {
- index = removeLastIndex(index);
- iterationProvenanceItem = indexes.get(indexStr(index));
- // if we have a 'parent' iteration then create a new
- // iteration for the original index and link it to the
- // activity and the input data
- // FIXME should this be linked to the parent iteration
- // instead?
- if (iterationProvenanceItem != null) {
- // set the index to the one from the event
- IterationProvenanceItem iterationProvenanceItem1 = new IterationProvenanceItem();
- iterationProvenanceItem1.setIteration(originalIndex);
- iterationProvenanceItem1.setProcessId(owningProcess);
- iterationProvenanceItem1.setIdentifier(UUID
- .randomUUID().toString());
- iterationProvenanceItem1.setWorkflowId(workflowItem.getParentId());
-
- for (Entry<ActivityProvenanceItem, List<Object>> entrySet : activityProvenanceItemMap
- .entrySet()) {
- List<Object> value = entrySet.getValue();
- int[] newIndex = (int[]) value.get(0);
- String owner = (String) value.get(1);
- String indexString = indexStr(newIndex);
- String indexString2 = indexStr(index);
-
- if (owningProcess.equalsIgnoreCase(owner)
- && indexString
- .equalsIgnoreCase(indexString2)) {
- iterationProvenanceItem1.setParentId(entrySet
- .getKey().getIdentifier());
- }
- }
-
- for (Entry<InputDataProvenanceItem, List<Object>> entrySet : inputDataProvenanceItemMap
- .entrySet()) {
- List<Object> value = entrySet.getValue();
- int[] newIndex = (int[]) value.get(0);
- String owner = (String) value.get(1);
- String indexString = indexStr(newIndex);
- String indexString2 = indexStr(index);
- if (owningProcess.equalsIgnoreCase(owner)
- && indexString
- .equalsIgnoreCase(indexString2)) {
- iterationProvenanceItem1
- .setInputDataItem(entrySet.getKey());
- }
-
- }
-
- // for (ActivityProvenanceItem item :
- // activityProvenanceItemList) {
- // if (owningProcess.equalsIgnoreCase(item
- // .getProcessId())) {
- // iterationProvenanceItem1.setParentId(item
- // .getIdentifier());
- // }
- // }
- // for (InputDataProvenanceItem item :
- // inputDataProvenanceItemList) {
- // if (owningProcess.equalsIgnoreCase(item
- // .getProcessId())) {
- // iterationProvenanceItem1.setInputDataItem(item);
- // }
- // indexes.put(indexStr, iterationProvenanceItem1);
- // return iterationProvenanceItem1;
- // // }
- // }
-
- // add this new iteration item to the map
- getIndexesByProcess(event.getOwningProcess()).put(
- indexStr(event.getIndex()),
- iterationProvenanceItem1);
- return iterationProvenanceItem1;
- }
- // if we have not found an iteration items and the index
- // is
- // [] then something is wrong
- // remove the last index in the int array before we go
- // back
- // through the while
- } catch (IllegalStateException e) {
- logger
- .warn("Cannot find a parent iteration with index [] for owning process: "
- + owningProcess
- + "Workflow invocation is in an illegal state");
- throw e;
- }
- }
-
- // if (iterationProvenanceItem == null) {
- // logger.info("Iteration item was null for: "
- // + event.getOwningProcess() + " " + event.getIndex());
- // System.out.println("Iteration item was null for: "
- // + event.getOwningProcess() + " " + event.getIndex());
- // iterationProvenanceItem = new IterationProvenanceItem(index);
- // iterationProvenanceItem.setProcessId(owningProcess);
- // iterationProvenanceItem.setIdentifier(UUID.randomUUID()
- // .toString());
- // // for (ActivityProvenanceItem
- // item:activityProvenanceItemList)
- // // {
- // // if (owningProcess.equalsIgnoreCase(item.getProcessId())) {
- // // iterationProvenanceItem.setParentId(item.getIdentifier());
- // // }
- // // }
- // // for (InputDataProvenanceItem item:
- // // inputDataProvenanceItemList) {
- // // if (owningProcess.equalsIgnoreCase(item.getProcessId())) {
- // // iterationProvenanceItem.setInputDataItem(item);
- // // }
- // // }
- // indexes.put(indexStr, iterationProvenanceItem);
-
- }
- return iterationProvenanceItem;
- }
-
- private String indexStr(int[] index) {
- String indexStr = "";
- for (int ind : index) {
- indexStr += ":" + ind;
- }
- return indexStr;
- }
-
- /**
- * Remove the last index of the int array in the form 1:2:3 etc
- *
- * @param index
- * @return
- */
- @SuppressWarnings("unused")
- private String[] stripLastIndex(int[] index) {
- String indexStr = "";
- for (int ind : index) {
- indexStr += ":" + ind;
- }
- // will be in form :1:2:3
- String[] split = indexStr.split(":");
-
- return split;
- }
-
- /**
- * Remove the last value in the int array
- *
- * @param index
- * @return
- */
- private int[] removeLastIndex(int[] index) {
- if (index.length == 0) {
- throw new IllegalStateException(
- "There is no parent iteration of index [] for this result");
- }
- int[] newIntArray = new int[index.length - 1];
- for (int i = 0; i < index.length - 1; i++) {
- newIntArray[i] = index[i];
- }
- return newIntArray;
- }
-
- /**
- * Create an {@link ErrorProvenanceItem} and send across to the
- * {@link ProvenanceConnector}
- */
- @Override
- public void receiveError(DispatchErrorEvent errorEvent) {
- IterationProvenanceItem iterationProvItem = getIterationProvItem(errorEvent);
- // get using errorEvent.getOwningProcess();
-
- ErrorProvenanceItem errorItem = new ErrorProvenanceItem();
- errorItem.setCause(errorEvent
- .getCause());
- errorItem.setErrorType(errorEvent
- .getFailureType().toString());
- errorItem.setMessage(errorEvent.getMessage());
-
- errorItem.setProcessId(errorEvent.getOwningProcess());
- errorItem.setIdentifier(UUID.randomUUID().toString());
- errorItem.setParentId(iterationProvItem.getIdentifier());
- // iterationProvItem.setErrorItem(errorItem);
- // FIXME don't need to add to the processor item earlier
- getReporter().addProvenanceItem(errorItem);
- super.receiveError(errorEvent);
- }
-
- /**
- * Create the {@link ProvenanceItem}s and send them all across to the
- * {@link ProvenanceConnector} except for the
- * {@link IterationProvenanceItem}, this one is told what it's inputs are
- * but has to wait until the results are received before being sent across.
- * Each item has a unique identifier and also knows who its parent item is
- */
- @Override
- public void receiveJob(DispatchJobEvent jobEvent) {
-
- // FIXME do we need this ProcessProvenanceItem?
- ProcessProvenanceItem provenanceItem;
- String[] split = jobEvent.getOwningProcess().split(":");
- provenanceItem = new ProcessProvenanceItem();
- //FIXME are the facade id and dataflow name really needed?
- String parentDataflowId = workflowItem.getParentId();
- provenanceItem.setWorkflowId(parentDataflowId);
- provenanceItem.setFacadeID(split[0]);
- provenanceItem.setDataflowID(split[1]);
- provenanceItem.setProcessId(jobEvent.getOwningProcess());
- provenanceItem.setIdentifier(UUID.randomUUID().toString());
- provenanceItem.setParentId(workflowItem.getIdentifier());
- ProcessorProvenanceItem processorProvItem;
- processorProvItem = new ProcessorProvenanceItem();
- processorProvItem.setWorkflowId(parentDataflowId);
- processorProvItem.setProcessId(jobEvent
- .getOwningProcess());
- processorProvItem.setIdentifier(UUID.randomUUID().toString());
- processorProvItem.setParentId(provenanceItem.getIdentifier());
- provenanceItem.setProcessId(jobEvent.getOwningProcess());
- getReporter().addProvenanceItem(provenanceItem);
- getReporter().addProvenanceItem(processorProvItem);
-
- IterationProvenanceItem iterationProvItem = null;
- iterationProvItem = new IterationProvenanceItem();
- iterationProvItem.setWorklfowId(parentDataflowId);
- iterationProvItem.setIteration(jobEvent.getIndex());
- iterationProvItem.setIdentifier(UUID.randomUUID().toString());
- ReferenceService referenceService = jobEvent.getContext()
- .getReferenceService();
-
- InputDataProvenanceItem inputDataItem = new InputDataProvenanceItem();
- inputDataItem.setDataMap(jobEvent.getData());
- inputDataItem.setReferenceService(referenceService);
- inputDataItem.setIdentifier(UUID.randomUUID().toString());
- inputDataItem.setParentId(iterationProvItem.getIdentifier());
- inputDataItem.setProcessId(jobEvent.getOwningProcess());
-
- List<Object> inputIndexOwnerList = new ArrayList<Object>();
- inputIndexOwnerList.add(jobEvent.getIndex());
- inputIndexOwnerList.add(jobEvent.getOwningProcess());
- inputDataProvenanceItemMap.put(inputDataItem, inputIndexOwnerList);
-
- // inputDataProvenanceItemList.add(inputDataItem);
- iterationProvItem.setInputDataItem(inputDataItem);
- iterationProvItem.setIteration(jobEvent.getIndex());
- iterationProvItem.setProcessId(jobEvent.getOwningProcess());
-
- for (Activity<?> activity : jobEvent.getActivities()) {
- if (activity instanceof AsynchronousActivity) {
- ActivityProvenanceItem activityProvItem = new ActivityProvenanceItem();
- activityProvItem.setWorkflowId(parentDataflowId);
- activityProvItem.setIdentifier(UUID.randomUUID().toString());
- iterationProvItem.setParentId(activityProvItem.getIdentifier());
- // getConnector().addProvenanceItem(iterationProvItem);
- activityProvItem.setParentId(processorProvItem.getIdentifier());
- // processorProvItem.setActivityProvenanceItem(activityProvItem);
- activityProvItem.setProcessId(jobEvent.getOwningProcess());
- List<Object> activityIndexOwnerList = new ArrayList<Object>();
- activityIndexOwnerList.add(jobEvent.getOwningProcess());
- activityIndexOwnerList.add(jobEvent.getIndex());
- activityProvenanceItemMap.put(activityProvItem,
- inputIndexOwnerList);
- // activityProvenanceItemList.add(activityProvItem);
- // activityProvItem.setIterationProvenanceItem(iterationProvItem);
- getReporter().addProvenanceItem(activityProvItem);
- break;
- }
- }
- getIndexesByProcess(jobEvent.getOwningProcess()).put(
- indexStr(jobEvent.getIndex()), iterationProvItem);
- super.receiveJob(jobEvent);
- }
-
- @Override
- public void receiveJobQueue(DispatchJobQueueEvent jobQueueEvent) {
-
- super.receiveJobQueue(jobQueueEvent);
- }
-
- /**
- * Populate an {@link OutputDataProvenanceItem} with the results and attach
- * it to the appropriate {@link IterationProvenanceItem}. Then send the
- * {@link IterationProvenanceItem} across to the {@link ProvenanceConnector}
- */
- @Override
- public void receiveResult(DispatchResultEvent resultEvent) {
- try {
- // FIXME use the connector from the result event context
- IterationProvenanceItem iterationProvItem = getIterationProvItem(resultEvent);
-
- ReferenceService referenceService = resultEvent.getContext()
- .getReferenceService();
-
-
- OutputDataProvenanceItem outputDataItem = new OutputDataProvenanceItem();
- outputDataItem.setDataMap(resultEvent.getData());
- outputDataItem.setReferenceService(referenceService);
- outputDataItem.setIdentifier(UUID.randomUUID().toString());
- outputDataItem.setProcessId(resultEvent.getOwningProcess());
- outputDataItem.setParentId(iterationProvItem.getIdentifier());
- iterationProvItem.setOutputDataItem(outputDataItem);
-
- getReporter().addProvenanceItem(iterationProvItem);
- // getConnector().addProvenanceItem(outputDataItem);
-
- // PM -- testing
- // add xencoding of data value here??
- // Map<String, T2Reference> inputDataMap = iterationProvItem.getInputDataItem().getDataMap();
- // for(Map.Entry<String, T2Reference> entry:inputDataMap.entrySet()) {
- //
- // // create a simpler bean that we can serialize?
- //
- // T2Reference ref = entry.getValue();
- //
- // SimplerT2Reference t2RefBean = new SimplerT2Reference();
- // t2RefBean.setReferenceType(ref.getReferenceType());
- // t2RefBean.setDepth(ref.getDepth());
- // t2RefBean.setLocalPart(ref.getLocalPart());
- // t2RefBean.setNamespacePart(ref.getNamespacePart());
- //
- // System.out.println("data ref: "+ref);
- // String serializedInput = SerializeParam(t2RefBean);
- // System.out.println("serialized reference:" + serializedInput);
- //
- // System.out.println(referenceService.renderIdentifier(entry.getValue(), String.class, resultEvent.getContext()));
-// }
- } catch (Exception ex) {
- logger.error("Could not store provenance for "
- + resultEvent.getOwningProcess() + " "
- + Arrays.toString(resultEvent.getIndex()), ex);
- // But don't break super.receiveResult() !!
- }
- super.receiveResult(resultEvent);
- }
-
-
-
- @Override
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent) {
- // TODO Auto-generated method stub
- super.receiveResultCompletion(completionEvent);
- }
-
- /**
- * Tell this layer what {@link ProvenanceConnector} implementation is being
- * used to capture the {@link ProvenanceItem}s. NOTE: should probably use
- * the connector from the result events context where possible
- *
- * @param connector
- */
- public void setReporter(ProvenanceReporter connector) {
- this.reporter = connector;
- }
-
- public ProvenanceReporter getReporter() {
- return reporter;
- }
-
- /**
- * So that the {@link ProvenanceItem}s know which {@link Dataflow} has been
- * enacted this layer has to know about the {@link WorkflowProvenanceItem}
- *
- * @param workflowItem
- */
- public void setWorkflow(WorkflowProvenanceItem workflowItem) {
- this.workflowItem = workflowItem;
- }
-
-
- public static String SerializeParam(Object ParamValue) {
- ByteArrayOutputStream BStream = new ByteArrayOutputStream();
- XMLEncoder encoder = new XMLEncoder(BStream);
- encoder.writeObject(ParamValue);
- encoder.close();
- return BStream.toString();
- }
-
- public static Object DeserializeParam (String SerializedParam) {
- InputStream IStream = new ByteArrayInputStream(SerializedParam.getBytes());
- XMLDecoder decoder = new XMLDecoder(IStream);
- Object output = decoder.readObject();
- decoder.close();
- return output;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Invoke.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Invoke.java
deleted file mode 100644
index 96e0f56..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Invoke.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.ERROR;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.RESULT;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.RESULT_COMPLETION;
-
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.monitor.MonitorManager;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.ControlBoundary;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import net.sf.taverna.t2.workflowmodel.processor.activity.MonitorableAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerJobReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Context free invoker layer, does not pass index arrays of jobs into activity
- * instances.
- * <p>
- * This layer will invoke the first invokable activity in the activity list, so
- * any sane dispatch stack will have narrowed this down to a single item list by
- * this point, i.e. by the insertion of a failover layer.
- * <p>
- * Currently only handles activities implementing {@link AsynchronousActivity}.
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-@DispatchLayerJobReaction(emits = { ERROR, RESULT_COMPLETION, RESULT }, relaysUnmodified = false, stateEffects = {})
-@ControlBoundary
-public class Invoke extends AbstractDispatchLayer<Object> {
-
- private static Logger logger = Logger.getLogger(Invoke.class);
-
- private static Long invocationCount = 0L;
-
- private static String getNextProcessID() {
- synchronized (invocationCount) {
- invocationCount = invocationCount + 1L;
- }
- return "invocation" + invocationCount;
- }
-
- public Invoke() {
- super();
- }
-
- public void configure(Object config) {
- // No configuration, do nothing
- }
-
- public Object getConfiguration() {
- return null;
- }
-
- /**
- * Receive a job from the layer above and pick the first concrete activity
- * from the list to invoke. Invoke this activity, creating a callback which
- * will wrap up the result messages in the appropriate collection depth
- * before sending them on (in general activities are not aware of their
- * invocation context and should not be responsible for providing correct
- * index arrays for results)
- * <p>
- * This layer will invoke the first invokable activity in the activity list,
- * so any sane dispatch stack will have narrowed this down to a single item
- * list by this point, i.e. by the insertion of a failover layer.
- */
- @Override
- public void receiveJob(final DispatchJobEvent jobEvent) {
- for (Activity<?> activity : jobEvent.getActivities()) {
-
- if (activity instanceof AsynchronousActivity) {
- // Register with the monitor
- final String invocationProcessIdentifier = jobEvent
- .pushOwningProcess(getNextProcessID())
- .getOwningProcess();
- MonitorManager.getInstance().registerNode(activity,
- invocationProcessIdentifier.split(":"),
- new HashSet<MonitorableProperty<?>>());
-
- // The activity is an AsynchronousActivity so we invoke it with
- // an AsynchronousActivityCallback object containing appropriate
- // callback methods to push results, completions and failures
- // back to the invocation layer.
- final AsynchronousActivity<?> asyncActivity = (AsynchronousActivity<?>) activity;
-
- // Get the registered DataManager for this process. In most
- // cases this will just be a single DataManager for the entire
- // workflow system but it never hurts to generalize
-
- final ReferenceService refService = jobEvent.getContext()
- .getReferenceService();
-
- // Create a Map of EntityIdentifiers named appropriately given
- // the activity mapping
- Map<String, T2Reference> inputData = new HashMap<String, T2Reference>();
- for (String inputName : jobEvent.getData().keySet()) {
- String activityInputName = asyncActivity
- .getInputPortMapping().get(inputName);
- if (activityInputName != null) {
- inputData.put(activityInputName, jobEvent.getData()
- .get(inputName));
- }
- }
-
- // Create a callback object to receive events, completions and
- // failure notifications from the activity
- AsynchronousActivityCallback callback = new InvokeCallBack(
- jobEvent, refService, invocationProcessIdentifier,
- asyncActivity);
-
- if (asyncActivity instanceof MonitorableAsynchronousActivity<?>) {
- // Monitorable activity so get the monitorable properties
- // and push them into the state tree after launching the job
- MonitorableAsynchronousActivity<?> maa = (MonitorableAsynchronousActivity<?>) asyncActivity;
- Set<MonitorableProperty<?>> props = maa
- .executeAsynchWithMonitoring(inputData, callback);
- MonitorManager.getInstance().addPropertiesToNode(
- invocationProcessIdentifier.split(":"), props);
- } else {
- // Run the job, passing in the callback we've just created
- // along with the (possibly renamed) input data map
- asyncActivity.executeAsynch(inputData, callback);
- }
- return;
- }
- }
- }
-
- protected class InvokeCallBack implements AsynchronousActivityCallback {
- protected final AsynchronousActivity<?> asyncActivity;
- protected final String invocationProcessIdentifier;
- protected final DispatchJobEvent jobEvent;
- protected final ReferenceService refService;
- protected boolean sentJob = false;
-
- protected InvokeCallBack(DispatchJobEvent jobEvent,
- ReferenceService refService,
- String invocationProcessIdentifier,
- AsynchronousActivity<?> asyncActivity) {
- this.jobEvent = jobEvent;
- this.refService = refService;
- this.invocationProcessIdentifier = invocationProcessIdentifier;
- this.asyncActivity = asyncActivity;
- }
-
- public void fail(String message) {
- fail(message, null);
- }
-
- public void fail(String message, Throwable t) {
- fail(message, t, DispatchErrorType.INVOCATION);
- }
-
- public void fail(String message, Throwable t,
- DispatchErrorType errorType) {
- logger.warn("Failed (" + errorType + ") invoking " + asyncActivity
- + " for job " + jobEvent + ": " + message, t);
- MonitorManager.getInstance().deregisterNode(
- invocationProcessIdentifier);
- getAbove().receiveError(
- new DispatchErrorEvent(jobEvent.getOwningProcess(),
- jobEvent.getIndex(), jobEvent.getContext(),
- message, t, errorType, asyncActivity));
- }
-
- public InvocationContext getContext() {
- return jobEvent.getContext();
- }
-
- public String getParentProcessIdentifier() {
- return invocationProcessIdentifier;
- }
-
- public void receiveCompletion(int[] completionIndex) {
- if (completionIndex.length == 0) {
- // Final result, clean up monitor state
- MonitorManager.getInstance().deregisterNode(
- invocationProcessIdentifier);
- }
- if (sentJob) {
- int[] newIndex;
- if (completionIndex.length == 0) {
- newIndex = jobEvent.getIndex();
- } else {
- newIndex = new int[jobEvent.getIndex().length
- + completionIndex.length];
- int i = 0;
- for (int indexValue : jobEvent.getIndex()) {
- newIndex[i++] = indexValue;
- }
- for (int indexValue : completionIndex) {
- newIndex[i++] = indexValue;
- }
- }
- DispatchCompletionEvent c = new DispatchCompletionEvent(
- jobEvent.getOwningProcess(), newIndex, jobEvent
- .getContext());
- getAbove().receiveResultCompletion(c);
- } else {
- // We haven't sent any 'real' data prior to
- // completing a stream. This in effect means we're
- // sending an empty top level collection so we need
- // to register empty collections for each output
- // port with appropriate depth (by definition if
- // we're streaming all outputs are collection types
- // of some kind)
- Map<String, T2Reference> emptyListMap = new HashMap<String, T2Reference>();
- for (OutputPort op : asyncActivity.getOutputPorts()) {
- String portName = op.getName();
- int portDepth = op.getDepth();
- emptyListMap.put(portName, refService.getListService()
- .registerEmptyList(portDepth).getId());
- }
- receiveResult(emptyListMap, new int[0]);
- }
-
- }
-
- public void receiveResult(Map<String, T2Reference> data, int[] index) {
-
- if (index.length == 0) {
- // Final result, clean up monitor state
- MonitorManager.getInstance().deregisterNode(
- invocationProcessIdentifier);
- }
-
- // Construct a new result map using the activity mapping
- // (activity output name to processor output name)
- Map<String, T2Reference> resultMap = new HashMap<String, T2Reference>();
- for (String outputName : data.keySet()) {
- String processorOutputName = asyncActivity
- .getOutputPortMapping().get(outputName);
- if (processorOutputName != null) {
- resultMap.put(processorOutputName, data.get(outputName));
- }
- }
- // Construct a new index array if the specified index is
- // non zero length, otherwise just use the original
- // job's index array (means we're not streaming)
- int[] newIndex;
- boolean streaming = false;
- if (index.length == 0) {
- newIndex = jobEvent.getIndex();
- } else {
- streaming = true;
- newIndex = new int[jobEvent.getIndex().length + index.length];
- int i = 0;
- for (int indexValue : jobEvent.getIndex()) {
- newIndex[i++] = indexValue;
- }
- for (int indexValue : index) {
- newIndex[i++] = indexValue;
- }
- }
- DispatchResultEvent resultEvent = new DispatchResultEvent(jobEvent
- .getOwningProcess(), newIndex, jobEvent.getContext(),
- resultMap, streaming);
- // Push the modified data to the layer above in the
- // dispatch stack
- getAbove().receiveResult(resultEvent);
-
- sentJob = true;
- }
-
- public void requestRun(Runnable runMe) {
- String newThreadName = jobEvent.toString();
- Thread thread = new Thread(runMe, newThreadName);
- thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler(){
- public void uncaughtException(Thread t, Throwable e) {
- fail("Uncaught exception while invoking " + asyncActivity, e);
- }});
- thread.start();
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Loop.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Loop.java
deleted file mode 100644
index 1c29f30..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Loop.java
+++ /dev/null
@@ -1,422 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import java.lang.Thread.UncaughtExceptionHandler;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.AbstractDispatchEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorType;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * A layer that allows while-style loops.
- * <p>
- * The layer is configured with a {@link LoopConfiguration}, where an activity
- * has been set as the
- * {@link LoopConfiguration#setCondition(net.sf.taverna.t2.workflowmodel.processor.activity.Activity)
- * condition}.
- * </p>
- * <p>
- * After a job has been successful further down the dispatch stack, the loop
- * layer will invoke the conditional activity to determine if the job will be
- * invoked again. If {@link LoopConfiguration#isRunFirst()} is false, this test
- * will be performed even before the first invocation. (The default
- * runFirst=true is equivalent to a do..while construct, while runFirst=false is
- * equivalent to a while.. construct.)
- * </p>
- * <p>
- * A job will be resent down the dispatch stack only if the conditional activity
- * returns a reference to a string equal to "true" on its output port "loop".
- * </p>
- * <p>
- * If a job or the conditional activity fails, the while-loop is interrupted and
- * the error is sent further up.
- * </p>
- * <p>
- * Note that the LoopLayer will be invoked for each item in an iteration, if you
- * want to do the loop for the whole collection (ie. re-iterating if the
- * loop-condition fails after processing the full list) - create a nested
- * workflow with the desired depths on it's input ports and insert this
- * LoopLayer in the stack of the nested workflow's processor in parent workflow.
- * </p>
- * <p>
- * It is recommended that the LoopLayer is to be inserted after the
- * {@link ErrorBounce} layer, as this layer is needed for registering errors
- * produced by the LoopLayer. If the user requires {@link Retry retries} and
- * {@link Failover failovers} before checking the while condition, such layers
- * should be below LoopLayer.
- * </p>
- *
- * @author Stian Soiland-Reyes
- *
- */
-
-@SuppressWarnings("unchecked")
-public class Loop extends AbstractDispatchLayer<LoopConfiguration> {
-
- private static Logger logger = Logger.getLogger(Loop.class);
-
- private LoopConfiguration config = new LoopConfiguration();
-
- protected Map<String, AbstractDispatchEvent> incomingJobs = new HashMap<String, AbstractDispatchEvent>();
-
- protected Map<String, AbstractDispatchEvent> outgoingJobs = new HashMap<String, AbstractDispatchEvent>();
-
- public void configure(LoopConfiguration config) {
- this.config = config;
- }
-
- @Override
- public void finishedWith(String owningProcess) {
- String prefix = owningProcess + "[";
- synchronized (outgoingJobs) {
- for (String key : new ArrayList<String>(outgoingJobs.keySet())) {
- if (key.startsWith(prefix)) {
- outgoingJobs.remove(key);
- }
- }
- }
- synchronized (incomingJobs) {
- for (String key : new ArrayList<String>(incomingJobs.keySet())) {
- if (key.startsWith(prefix)) {
- incomingJobs.remove(key);
- }
- }
- }
- }
-
- public LoopConfiguration getConfiguration() {
- return config;
- }
-
- @Override
- public void receiveJob(DispatchJobEvent jobEvent) {
- synchronized (incomingJobs) {
- incomingJobs.put(jobIdentifier(jobEvent), jobEvent);
- }
- if (config.isRunFirst()) {
- // We'll do the conditional in receiveResult instead
- super.receiveJob(jobEvent);
- return;
- }
- checkCondition(jobEvent);
- }
-
- @Override
- public void receiveJobQueue(DispatchJobQueueEvent jobQueueEvent) {
- synchronized (incomingJobs) {
- incomingJobs.put(jobIdentifier(jobQueueEvent), jobQueueEvent);
- }
- if (config.isRunFirst()) {
- // We'll do the conditional in receiveResult instead
- super.receiveJobQueue(jobQueueEvent);
- return;
- }
- checkCondition(jobQueueEvent);
- }
-
- @Override
- public void receiveResult(DispatchResultEvent resultEvent) {
- Activity<?> condition = config.getCondition();
- if (condition == null) {
- super.receiveResult(resultEvent);
- return;
- }
- synchronized (outgoingJobs) {
- outgoingJobs.put(jobIdentifier(resultEvent), resultEvent);
- }
- checkCondition(resultEvent);
- }
-
- @Override
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent) {
- Activity<?> condition = config.getCondition();
- if (condition == null) {
- super.receiveResultCompletion(completionEvent);
- return;
- }
- synchronized (outgoingJobs) {
- outgoingJobs.put(jobIdentifier(completionEvent), completionEvent);
- }
- checkCondition(completionEvent);
- }
-
- private void checkCondition(AbstractDispatchEvent event) {
- Activity<?> condition;
- condition = config.getCondition();
- if (condition == null) {
- super.receiveError(new DispatchErrorEvent(event.getOwningProcess(),
- event.getIndex(), event.getContext(),
- "Can't invoke condition service: null", null,
- DispatchErrorType.INVOCATION, condition));
- return;
- }
- if (!(condition instanceof AbstractAsynchronousActivity)) {
- DispatchErrorEvent errorEvent = new DispatchErrorEvent(
- event.getOwningProcess(),
- event.getIndex(),
- event.getContext(),
- "Can't invoke condition service "
- + condition
- + " is not an instance of AbstractAsynchronousActivity",
- null, DispatchErrorType.INVOCATION, condition);
- super.receiveError(errorEvent);
- return;
- }
- AbstractAsynchronousActivity asyncCondition = (AbstractAsynchronousActivity) condition;
- String jobIdentifier = jobIdentifier(event);
- Map<String, T2Reference> inputs = prepareInputs(asyncCondition,
- jobIdentifier);
- AsynchronousActivityCallback callback = new ConditionCallBack(
- jobIdentifier);
- asyncCondition.executeAsynch(inputs, callback);
- }
-
- private Map<String, T2Reference> prepareInputs(
- AbstractAsynchronousActivity asyncCondition, String jobIdentifier) {
- Map<String, T2Reference> inputs = new HashMap<String, T2Reference>();
- Map<String, T2Reference> inData = getInData(jobIdentifier);
- Map<String, T2Reference> outData = getOutData(jobIdentifier);
-
- Set<ActivityInputPort> inputPorts = asyncCondition.getInputPorts();
- for (ActivityInputPort conditionIn : inputPorts) {
- String conditionPort = conditionIn.getName();
- if (outData.containsKey(conditionPort)) {
- // Copy from previous output
- inputs.put(conditionPort, outData.get(conditionPort));
- } else if (inData.containsKey(conditionPort)) {
- // Copy from original input
- inputs.put(conditionPort, inData.get(conditionPort));
- }
- }
- return inputs;
- }
-
- private Map<String, T2Reference> getInData(String jobIdentifier) {
- AbstractDispatchEvent inEvent;
- synchronized (incomingJobs) {
- inEvent = incomingJobs.get(jobIdentifier);
- }
- Map<String, T2Reference> inData = new HashMap<String, T2Reference>();
- if (inEvent instanceof DispatchJobEvent) {
- inData = ((DispatchJobEvent) inEvent).getData();
- }
- return inData;
- }
-
- private Map<String, T2Reference> getOutData(String jobIdentifier) {
- AbstractDispatchEvent outEvent;
- synchronized (outgoingJobs) {
- outEvent = outgoingJobs.get(jobIdentifier);
- }
- Map<String, T2Reference> outData = new HashMap<String, T2Reference>();
- if (outEvent instanceof DispatchResultEvent) {
- outData = ((DispatchResultEvent) outEvent).getData();
- }
- return outData;
- }
-
- private String jobIdentifier(AbstractDispatchEvent event) {
- String jobId = event.getOwningProcess()
- + Arrays.toString(event.getIndex());
- return jobId;
- }
-
- public static final String LOOP_PORT = "loop";
-
-
- public class ConditionCallBack implements AsynchronousActivityCallback {
- private InvocationContext context;
- private final String jobIdentifier;
- private String processId;
-
- public ConditionCallBack(String jobIdentifier) {
- this.jobIdentifier = jobIdentifier;
- AbstractDispatchEvent originalEvent;
- synchronized (incomingJobs) {
- originalEvent = incomingJobs.get(jobIdentifier);
- }
- context = originalEvent.getContext();
- processId = originalEvent.getOwningProcess() + ":condition";
- }
-
- public void fail(String message) {
- fail(message, null, DispatchErrorType.INVOCATION);
- }
-
- public void fail(String message, Throwable t) {
- fail(message, t, DispatchErrorType.INVOCATION);
- }
-
- public void fail(String message, Throwable t,
- DispatchErrorType errorType) {
- logger.warn("Failed (" + errorType + ") invoking condition service "
- + jobIdentifier + ":" + message, t);
-
- AbstractDispatchEvent originalEvent;
- synchronized (incomingJobs) {
- originalEvent = incomingJobs.get(jobIdentifier);
- }
- receiveError(new DispatchErrorEvent(originalEvent
- .getOwningProcess(), originalEvent.getIndex(),
- originalEvent.getContext(),
- "Can't invoke condition service ", t,
- DispatchErrorType.INVOCATION, null));
- }
-
- public InvocationContext getContext() {
- return context;
- }
-
- public String getParentProcessIdentifier() {
- return processId;
- }
-
- public void receiveCompletion(int[] completionIndex) {
- // Ignore streaming
- }
-
- public void receiveResult(Map<String, T2Reference> data, int[] index) {
- if (index.length > 0) {
- // Ignore streaming
- return;
- }
- T2Reference loopRef = data.get(LOOP_PORT);
- if (loopRef == null) {
- fail("Condition service didn't contain output port " + LOOP_PORT);
- return;
- }
- if (loopRef.containsErrors()) {
- fail("Condition service failed: " + loopRef);
- return;
- }
- if (loopRef.getDepth() != 0) {
- fail("Condition service output " + LOOP_PORT
- + " depth is not 0, but " + loopRef.getDepth());
- }
- ReferenceService referenceService = context.getReferenceService();
- String loop = (String) referenceService.renderIdentifier(loopRef,
- String.class, context);
-
- if (Boolean.parseBoolean(loop)) {
- // Push it down again
- AbstractDispatchEvent dispatchEvent;
- synchronized (incomingJobs) {
- dispatchEvent = incomingJobs.get(jobIdentifier);
- }
- if (dispatchEvent == null) {
- fail("Unknown job identifier " + jobIdentifier);
- }
- if (dispatchEvent instanceof DispatchJobEvent) {
- DispatchJobEvent newJobEvent = prepareNewJobEvent(data,
- dispatchEvent);
- getBelow().receiveJob(newJobEvent);
- } else if (dispatchEvent instanceof DispatchJobQueueEvent) {
- getBelow().receiveJobQueue(
- (DispatchJobQueueEvent) dispatchEvent);
- } else {
- fail("Unknown type of incoming event " + dispatchEvent);
- }
- return;
-
- } else {
- // We'll push it up, end of loop for now
-
- AbstractDispatchEvent outgoingEvent;
- synchronized (outgoingJobs) {
- outgoingEvent = outgoingJobs.get(jobIdentifier);
- }
- if (outgoingEvent == null && !config.isRunFirst()) {
- fail("Initial loop condition failed");
- }
- if (outgoingEvent instanceof DispatchCompletionEvent) {
- getAbove().receiveResultCompletion(
- (DispatchCompletionEvent) outgoingEvent);
- } else if (outgoingEvent instanceof DispatchResultEvent) {
- getAbove().receiveResult(
- (DispatchResultEvent) outgoingEvent);
- } else {
- fail("Unknown type of outgoing event " + outgoingEvent);
- }
- }
-
- }
-
- private DispatchJobEvent prepareNewJobEvent(
- Map<String, T2Reference> data,
- AbstractDispatchEvent dispatchEvent) {
- DispatchJobEvent dispatchJobEvent = (DispatchJobEvent) dispatchEvent;
- Map<String, T2Reference> newInputs = new HashMap<String, T2Reference>(
- dispatchJobEvent.getData());
- newInputs.putAll(data);
- DispatchJobEvent newJobEvent = new DispatchJobEvent(dispatchEvent
- .getOwningProcess(), dispatchEvent.getIndex(),
- dispatchEvent.getContext(), newInputs,
- ((DispatchJobEvent) dispatchEvent).getActivities());
- // TODO: Should this be registered as an incomingJobs? If so the
- // conditional
- // could even feed to itself, and we should also keep a list of
- // originalJobs.
- return newJobEvent;
- }
-
- public void requestRun(Runnable runMe) {
- String newThreadName = "Condition service "
- + getParentProcessIdentifier();
- Thread thread = new Thread(runMe, newThreadName);
- thread.setUncaughtExceptionHandler(new UncaughtExceptionHandler() {
- public void uncaughtException(Thread t, Throwable e) {
- fail("Uncaught exception while invoking " + jobIdentifier,
- e);
- }
- });
- thread.start();
- }
- }
-
- public Processor getProcessor() {
- if (dispatchStack == null) {
- return null;
- }
- return dispatchStack.getProcessor();
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/LoopConfiguration.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/LoopConfiguration.java
deleted file mode 100644
index 8944135..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/LoopConfiguration.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Properties;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.ActivityXMLDeserializer;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.ActivityXMLSerializer;
-
-import org.apache.log4j.Logger;
-import org.jdom.Document;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-import org.jdom.output.XMLOutputter;
-
-/**
- * Configuration bean for the {@link Loop}.
- * <p>
- * Set the {@link #setCondition(Activity)} for an activity with an output port
- * called "loop". The LoopLayer will re-send a job only if this port exist and
- * it's output can be dereferenced to a string equal to "true".
- * </p>
- * <p>
- * If {@link #isRunFirst()} is false, the loop layer will check the condition
- * before invoking the job for the first time, otherwise the condition will be
- * invoked after the job has come back with successful results.
- * </p>
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class LoopConfiguration implements Cloneable {
-
- transient private static Logger logger = Logger
- .getLogger(LoopConfiguration.class);
-
- /**
- * Transient - will be stored as XML
- */
- transient private Activity<?> condition = null;
- private String conditionXML;
- private Boolean runFirst;
- private Properties properties;
-
- public Properties getProperties() {
- synchronized (this) {
- if (properties == null) {
- properties = new Properties();
- }
- }
- return properties;
- }
-
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-
- @Override
- public LoopConfiguration clone() {
- LoopConfiguration clone;
- try {
- clone = (LoopConfiguration) super.clone();
- clone.condition = null;
- } catch (CloneNotSupportedException e) {
- throw new RuntimeException("Unexpected CloneNotSupportedException",
- e);
- }
- return clone;
- }
-
- public Activity<?> getCondition() {
- SAXBuilder builder = new SAXBuilder();
-
- synchronized (this) {
- if (condition == null && conditionXML != null) {
- try {
- Document document = builder.build(new StringReader(
- conditionXML));
- Element conditionElement = document.getRootElement();
- ActivityXMLDeserializer deserializer = ActivityXMLDeserializer
- .getInstance();
- this.condition = deserializer.deserializeActivity(
- conditionElement, new HashMap<String, Element>());
- } catch (Exception e) {
- logger.warn("Can't deserialise condition service", e);
- }
- }
- }
- return condition;
- }
-
- public boolean isRunFirst() {
- if (runFirst == null) {
- return true;
- }
- return runFirst;
- }
-
- public void setCondition(Activity<?> activity) {
- ActivityXMLSerializer serializer = ActivityXMLSerializer.getInstance();
-
- this.condition = activity;
-
- try {
- if (condition != null) {
- Element conditionElement = serializer.activityToXML(activity);
- XMLOutputter xmlOutputter = new XMLOutputter();
- conditionXML = xmlOutputter.outputString(conditionElement);
- } else {
- conditionXML = null;
- }
- } catch (JDOMException e) {
- logger.warn("Can't serialise activity " + activity, e);
- conditionXML = null;
- } catch (IOException e) {
- logger.warn("Can't serialise activity " + activity, e);
- conditionXML = null;
- }
- }
-
- public void setRunFirst(boolean runFirst) {
- this.runFirst = runFirst;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Parallelize.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Parallelize.java
deleted file mode 100644
index 4e8999c..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Parallelize.java
+++ /dev/null
@@ -1,462 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.CREATE_PROCESS_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.NO_EFFECT;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.REMOVE_PROCESS_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.JOB;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TimerTask;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.monitor.NoSuchPropertyException;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.NotifiableLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.PropertyContributingDispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerErrorReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerJobQueueReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultCompletionReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.SupportsStreamedResult;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchErrorEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobQueueEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-import org.apache.log4j.Logger;
-
-/**
- * Dispatch layer which consumes a queue of events and fires off a fixed number
- * of simultaneous jobs to the layer below. It observes failure, data and
- * completion events coming up and uses these to determine when to push more
- * jobs downwards into the stack as well as when it can safely emit completion
- * events from the queue.
- *
- * @author Tom Oinn
- *
- */
-@DispatchLayerErrorReaction(emits = {}, relaysUnmodified = true, stateEffects = {
- REMOVE_PROCESS_STATE, NO_EFFECT })
-@DispatchLayerJobQueueReaction(emits = { JOB }, relaysUnmodified = false, stateEffects = { CREATE_PROCESS_STATE })
-@DispatchLayerResultReaction(emits = {}, relaysUnmodified = true, stateEffects = {
- REMOVE_PROCESS_STATE, NO_EFFECT })
-@DispatchLayerResultCompletionReaction(emits = {}, relaysUnmodified = true, stateEffects = {
- REMOVE_PROCESS_STATE, NO_EFFECT })
-@SupportsStreamedResult
-public class Parallelize extends AbstractDispatchLayer<ParallelizeConfig>
- implements NotifiableLayer,
- PropertyContributingDispatchLayer<ParallelizeConfig> {
-
- private static Logger logger = Logger.getLogger(Parallelize.class);
-
- private Map<String, StateModel> stateMap = new HashMap<String, StateModel>();
-
- private ParallelizeConfig config = new ParallelizeConfig();
-
- int sentJobsCount = 0;
-
- int completedJobsCount = 0;
-
- public Parallelize() {
- super();
- }
-
- /**
- * Test constructor, only used by unit tests, should probably not be public
- * access here?
- *
- * @param maxJobs
- */
- public Parallelize(int maxJobs) {
- super();
- config.setMaximumJobs(maxJobs);
- }
-
- public void eventAdded(String owningProcess) {
- StateModel stateModel;
- synchronized (stateMap) {
- stateModel = stateMap.get(owningProcess);
- }
- if (stateModel == null) {
- /*
- * Should never see this here, it means we've had duplicate
- * completion events from upstream
- */
- throw new WorkflowStructureException(
- "Unknown owning process " + owningProcess);
- }
- synchronized (stateModel) {
- stateModel.fillFromQueue();
- }
- }
-
- @Override
- public void receiveJobQueue(DispatchJobQueueEvent queueEvent) {
- StateModel model = new StateModel(queueEvent, config.getMaximumJobs());
- synchronized(stateMap) {
- stateMap.put(queueEvent.getOwningProcess(), model);
- }
- model.fillFromQueue();
- }
-
- public void receiveJob(Job job, List<? extends Activity<?>> activities) {
- throw new WorkflowStructureException(
- "Parallelize layer cannot handle job events");
- }
-
-
- @Override
- public void receiveError(DispatchErrorEvent errorEvent) {
- StateModel model;
- String owningProcess = errorEvent.getOwningProcess();
- synchronized(stateMap) {
- model = stateMap.get(owningProcess);
- }
- getAbove().receiveError(errorEvent);
- if (model == null) {
- logger.warn("Error received for unknown owning process: " + owningProcess);
- return;
- }
- model.finishWith(errorEvent.getIndex());
- }
-
- @Override
- @SuppressWarnings("unchecked")
- public void receiveResult(DispatchResultEvent resultEvent) {
- StateModel model;
- String owningProcess = resultEvent.getOwningProcess();
- synchronized(stateMap) {
- model = stateMap.get(owningProcess);
- }
- DispatchLayer above = getAbove();
- above.receiveResult(resultEvent);
- if (model == null) {
- logger.warn("Error received for unknown owning process: " + owningProcess);
- return;
- }
- model.finishWith(resultEvent.getIndex());
- }
-
- /**
- * Only going to receive this if the activity invocation was streaming, in
- * which case we need to handle all completion events and pass them up the
- * stack.
- */
- @Override
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent) {
- StateModel model;
- String owningProcess = completionEvent.getOwningProcess();
- synchronized(stateMap) {
- model = stateMap.get(owningProcess);
- }
- getAbove().receiveResultCompletion(completionEvent);
- if (model == null) {
- logger.warn("Error received for unknown owning process: " + owningProcess);
- return;
- }
- model.finishWith(completionEvent.getIndex());
- }
-
- @Override
- public void finishedWith(final String owningProcess) {
- // Delay the removal of the state to give the monitor
- // a chance to poll
- cleanupTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- synchronized(stateMap) {
- stateMap.remove(owningProcess);
- }
- }
- }, CLEANUP_DELAY_MS);
- }
-
- public void configure(ParallelizeConfig config) {
- this.config = config;
- }
-
- public ParallelizeConfig getConfiguration() {
- return this.config;
- }
-
- /**
- * Injects the following properties into its parent processor's property set
- * :
- * <ul>
- * <li><code>dispatch.parallelize.queuesize [Integer]</code><br/>The current
- * size of the incomming job queue, or -1 if the state isn't defined for the
- * registered process identifier (which will be the case if the process
- * hasn't started or has had its state purged after a final completion of
- * some kind.</li>
- * </ul>
- */
- public void injectPropertiesFor(final String owningProcess) {
- /**
- * Property for the queue depth, will evaluate to -1 if there isn't a
- * queue in the state model for this identifier (which will be the case
- * if we haven't created the state yet or the queue has been collected)
- */
- MonitorableProperty<Integer> queueSizeProperty = new MonitorableProperty<Integer>() {
-
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "dispatch", "parallelize", "queuesize" };
- }
-
- public Integer getValue() throws NoSuchPropertyException {
-
- StateModel model;
- synchronized(stateMap) {
- model = stateMap.get(owningProcess);
- }
- if (model != null) {
- return model.queueSize();
- } else {
- return -1;
- }
- }
-
- };
- dispatchStack.receiveMonitorableProperty(queueSizeProperty,
- owningProcess);
-
- MonitorableProperty<Integer> sentJobsProperty = new MonitorableProperty<Integer>() {
-
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "dispatch", "parallelize", "sentjobs" };
- }
-
- public Integer getValue() throws NoSuchPropertyException {
- return sentJobsCount;
- }
-
- };
- dispatchStack.receiveMonitorableProperty(sentJobsProperty,
- owningProcess);
-
- MonitorableProperty<Integer> completedJobsProperty = new MonitorableProperty<Integer>() {
-
- public Date getLastModified() {
- return new Date();
- }
-
- public String[] getName() {
- return new String[] { "dispatch", "parallelize",
- "completedjobs" };
- }
-
- public Integer getValue() throws NoSuchPropertyException {
- return completedJobsCount;
- }
-
- };
- dispatchStack.receiveMonitorableProperty(completedJobsProperty,
- owningProcess);
-
- }
-
- /**
- * Holds the state for a given owning process
- *
- * @author Tom Oinn
- *
- */
- class StateModel {
-
- private DispatchJobQueueEvent queueEvent;
-
- @SuppressWarnings("unchecked")
- // suppressed to avoid jdk1.5 error messages caused by the declaration
- // IterationInternalEvent<? extends IterationInternalEvent<?>> e
- private BlockingQueue<IterationInternalEvent> pendingEvents = new LinkedBlockingQueue<IterationInternalEvent>();
-
- private int activeJobs = 0;
-
- private int maximumJobs;
-
- /**
- * Construct state model for a particular owning process
- *
- * @param owningProcess
- * Process to track parallel execution
- * @param queue
- * reference to the queue into which jobs are inserted by the
- * iteration strategy
- * @param activities
- * activities to pass along with job events down into the
- * stack below
- * @param maxJobs
- * maximum number of concurrent jobs to keep 'hot' at any
- * given point
- */
- protected StateModel(DispatchJobQueueEvent queueEvent, int maxJobs) {
- this.queueEvent = queueEvent;
- this.maximumJobs = maxJobs;
- }
-
- Integer queueSize() {
- return queueEvent.getQueue().size();
- }
-
- /**
- * Poll the queue repeatedly until either the queue is empty or we have
- * enough jobs pulled from it. The semantics for this are:
- * <ul>
- * <li>If the head of the queue is a Job and activeJobs < maximumJobs
- * then increment activeJobs, add the Job to the pending events list at
- * the end and send the message down the stack
- * <li>If the head of the queue is a Completion and the pending jobs
- * list is empty then send it to the layer above
- * <li>If the head of the queue is a Completion and the pending jobs
- * list is not empty then add the Completion to the end of the pending
- * jobs list and return
- * </ul>
- */
- @SuppressWarnings("unchecked")
- // suppressed to avoid jdk1.5 error messages caused by the declaration
- // IterationInternalEvent<? extends IterationInternalEvent<?>> e
- protected void fillFromQueue() {
- synchronized (this) {
- while (queueEvent.getQueue().peek() != null
- && activeJobs < maximumJobs) {
- final IterationInternalEvent e = queueEvent.getQueue()
- .remove();
-
- if (e instanceof Completion && pendingEvents.peek() == null) {
- new Thread(new Runnable() {
- public void run() {
- getAbove().receiveResultCompletion(
- new DispatchCompletionEvent(e
- .getOwningProcess(), e
- .getIndex(), e.getContext()));
- }
- }, "Parallelize " + e.getOwningProcess()).start();
- // getAbove().receiveResultCompletion((Completion) e);
- } else {
- pendingEvents.add(e);
- }
- if (e instanceof Job) {
- synchronized (this) {
- activeJobs++;
- }
- sentJobsCount++;
- getBelow()
- .receiveJob(
- new DispatchJobEvent(e
- .getOwningProcess(), e
- .getIndex(), e.getContext(),
- ((Job) e).getData(), queueEvent
- .getActivities()));
- }
- }
- }
- }
-
- /**
- * Returns true if the index matched an existing Job exactly, if this
- * method returns false then you have a partial completion event which
- * should be sent up the stack without modification.
- *
- * @param index
- * @return
- */
- @SuppressWarnings("unchecked")
- // suppressed to avoid jdk1.5 error messages caused by the declaration
- // IterationInternalEvent<? extends IterationInternalEvent<?>> e
- protected boolean finishWith(int[] index) {
- synchronized (this) {
-
- for (IterationInternalEvent e : new ArrayList<IterationInternalEvent>(
- pendingEvents)) {
- if (e instanceof Job) {
- Job j = (Job) e;
- if (arrayEquals(j.getIndex(), index)) {
- // Found a job in the pending events list which has
- // the same index, remove it and decrement the
- // current count of active jobs
- pendingEvents.remove(e);
- activeJobs--;
- completedJobsCount++;
- // Now pull any completion events that have reached
- // the head of the queue - this indicates that all
- // the job events which came in before them have
- // been processed and we can emit the completions
- while (pendingEvents.peek() != null
- && pendingEvents.peek() instanceof Completion) {
- Completion c = (Completion) pendingEvents
- .remove();
- getAbove().receiveResultCompletion(
- new DispatchCompletionEvent(c
- .getOwningProcess(), c
- .getIndex(), c.getContext()));
-
- }
- // Refresh from the queue; as we've just decremented
- // the active job count there should be a worker
- // available
- fillFromQueue();
- // Return true to indicate that we removed a job
- // event from the queue, that is to say that the
- // index wasn't that of a partial completion.
- return true;
- }
- }
- }
- }
- return false;
- }
-
- private boolean arrayEquals(int[] a, int[] b) {
- if (a.length != b.length) {
- return false;
- }
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i]) {
- return false;
- }
- }
- return true;
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ParallelizeConfig.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ParallelizeConfig.java
deleted file mode 100644
index 102eb24..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/ParallelizeConfig.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-/**
- * Bean to hold the configuration for the parallelize layer, specifically a
- * single int property defining the number of concurrent jobs in that processor
- * instance per owning process ID.
- *
- * @author Tom Oinn
- *
- */
-public class ParallelizeConfig {
-
- private int maxJobs;
-
- public ParallelizeConfig() {
- super();
- this.maxJobs = 5;
- }
-
- public void setMaximumJobs(int maxJobs) {
- this.maxJobs = maxJobs;
- }
-
- public int getMaximumJobs() {
- return this.maxJobs;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Retry.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Retry.java
deleted file mode 100644
index 07e828f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/Retry.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.CREATE_LOCAL_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.REMOVE_LOCAL_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerStateEffect.UPDATE_LOCAL_STATE;
-import static net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchMessageType.JOB;
-
-import java.util.Timer;
-import java.util.TimerTask;
-
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.AbstractErrorHandlerLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerErrorReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerJobReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.description.DispatchLayerResultReaction;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchJobEvent;
-
-/**
- * Implements retry policy with delay between retries and exponential backoff
- * <p>
- * Default properties are as follows :
- * <ul>
- * <li>maxRetries = 0 (int)</li>
- * <li>initialDelay = 1000 (milliseconds)</li>
- * <li>maxDelay = 2000 (milliseconds)</li>
- * <li>backoffFactor = 1.0 (float)</li>
- * </ul>
- *
- * @author Tom Oinn
- *
- */
-@DispatchLayerErrorReaction(emits = { JOB }, relaysUnmodified = true, stateEffects = {
- UPDATE_LOCAL_STATE, REMOVE_LOCAL_STATE })
-@DispatchLayerJobReaction(emits = {}, relaysUnmodified = true, stateEffects = { CREATE_LOCAL_STATE })
-@DispatchLayerResultReaction(emits = {}, relaysUnmodified = true, stateEffects = { REMOVE_LOCAL_STATE })
-public class Retry extends AbstractErrorHandlerLayer<RetryConfig> {
-
- private RetryConfig config = new RetryConfig();
-
- private static Timer retryTimer = new Timer("Retry timer", true);
-
- public Retry() {
- super();
- }
-
- public Retry(int maxRetries, int initialDelay, int maxDelay,
- float backoffFactor) {
- super();
- this.config.setMaxRetries(maxRetries);
- this.config.setInitialDelay(initialDelay);
- this.config.setMaxDelay(maxDelay);
- this.config.setBackoffFactor(backoffFactor);
- }
-
- class RetryState extends JobState {
-
- int currentRetryCount = 0;
-
- public RetryState(DispatchJobEvent jobEvent) {
- super(jobEvent);
- }
-
- /**
- * Try to schedule a retry, returns true if a retry is scheduled, false
- * if the retry count has already been reached (in which case no retry
- * is scheduled
- *
- * @return
- */
- @Override
- public boolean handleError() {
- if (currentRetryCount == config.getMaxRetries()) {
- return false;
- }
- int delay = (int) (config.getInitialDelay() * (Math.pow(config.getBackoffFactor(), currentRetryCount)));
- if (delay > config.getMaxDelay()) {
- delay = config.getMaxDelay();
- }
- TimerTask task = new TimerTask() {
- @Override
- public void run() {
- currentRetryCount++;
- getBelow().receiveJob(jobEvent);
- }
-
- };
- retryTimer.schedule(task, delay);
- return true;
- }
-
- }
-
- @Override
- protected JobState getStateObject(DispatchJobEvent jobEvent) {
- return new RetryState(jobEvent);
- }
-
- public void configure(RetryConfig config) {
- this.config = config;
- }
-
- public RetryConfig getConfiguration() {
- return this.config;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/RetryConfig.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/RetryConfig.java
deleted file mode 100644
index 3d90034..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/RetryConfig.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-public class RetryConfig {
-
- private float backoffFactor = 1f;
- private int initialDelay = 1000;
- private int maxDelay = 2000;
- private int maxRetries = 0;
-
- /**
- * Factor by which the initial delay is multiplied for each retry after the
- * first, this allows for exponential backoff of retry times up to a certain
- * ceiling
- *
- * @return
- */
- public float getBackoffFactor() {
- return this.backoffFactor;
- }
-
- /**
- * Delay in milliseconds between the initial failure message and the first
- * attempt to retry the failed job
- *
- * @return
- */
- public int getInitialDelay() {
- return this.initialDelay;
- }
-
- /**
- * Maximum delay in milliseconds between failure reception and retry. This
- * acts as a ceiling for the exponential backoff factor allowing the retry
- * delay to initially increase to a certain value then remain constant after
- * that point rather than exploding to unreasonable levels.
- */
- public int getMaxDelay() {
- return this.maxDelay;
- }
-
- /**
- * Maximum number of retries for a failing process
- *
- * @return
- */
- public int getMaxRetries() {
- return this.maxRetries;
- }
-
- public void setBackoffFactor(float factor) {
- this.backoffFactor = factor;
- }
-
- public void setInitialDelay(int delay) {
- this.initialDelay = delay;
- }
-
- public void setMaxDelay(int delay) {
- this.maxDelay = delay;
- }
-
- public void setMaxRetries(int max) {
- this.maxRetries = max;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/SimplerT2Reference.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/SimplerT2Reference.java
deleted file mode 100644
index 02196d1..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/SimplerT2Reference.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.processor.dispatch.layers;
-
-import net.sf.taverna.t2.reference.T2ReferenceType;
-
-class SimplerT2Reference {
-
- private String localPart;
- private String namespacePart;
-// private boolean containsErrors = false;
- private T2ReferenceType referenceType = T2ReferenceType.ReferenceSet;
- private int depth = 0;
- /**
- * @return the localPart
- */
- public String getLocalPart() {
- return localPart;
- }
- /**
- * @param localPart the localPart to set
- */
- public void setLocalPart(String localPart) {
- this.localPart = localPart;
- }
- /**
- * @return the namespacePart
- */
- public String getNamespacePart() {
- return namespacePart;
- }
- /**
- * @param namespacePart the namespacePart to set
- */
- public void setNamespacePart(String namespacePart) {
- this.namespacePart = namespacePart;
- }
- /**
- * @return the containsErrors
- */
-// public boolean isContainsErrors() {
-// return containsErrors;
-// }
-// /**
-// * @param containsErrors the containsErrors to set
-// */
-// public void setContainsErrors(boolean containsErrors) {
-// this.containsErrors = containsErrors;
-// }
- /**
- * @return the referenceType
- */
- public T2ReferenceType getReferenceType() {
- return referenceType;
- }
- /**
- * @param referenceType the referenceType to set
- */
- public void setReferenceType(T2ReferenceType referenceType) {
- this.referenceType = referenceType;
- }
- /**
- * @return the depth
- */
- public int getDepth() {
- return depth;
- }
- /**
- * @param depth the depth to set
- */
- public void setDepth(int depth) {
- this.depth = depth;
- }
-
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/package.html
deleted file mode 100644
index fe6e73f..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/layers/package.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<body>
-Contains implementations of DispatchLayer defined by the core Taverna 2
-specification.
-</body>
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyImpl.java
deleted file mode 100644
index 8a90aa4..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyImpl.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration.impl;
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.swing.tree.TreeNode;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.reference.ContextualizedT2Reference;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.AbstractIterationStrategyNode;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.CrossProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.DotProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategy;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.NamedInputPortNode;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.PrefixDotProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.TerminalNode;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializationConstants;
-
-import org.jdom.Element;
-
-/**
- * A single layer of iteration strategy, consuming individual named inputs and
- * combining these into Job objects to be consumed by the dispatch stack
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public class IterationStrategyImpl implements IterationStrategy {
-
- Set<NamedInputPortNode> inputs;
-
- private boolean wrapping = false;
-
- protected IterationStrategyStackImpl stack = null;
-
- private TerminalNodeImpl terminal = new TerminalNodeImpl();
-
- /**
- * The terminal node is used internally as the root of the iteration
- * strategy tree, it is responsible for forwarding all events up to the
- * iteration strategy itself which can then propogate them to the strategy
- * stack.
- */
- public class TerminalNodeImpl extends TerminalNode {
-
- public void receiveCompletion(int inputIndex, Completion completion) {
- if (wrapping) {
- pushEvent(completion.popIndex());
- } else {
- pushEvent(completion);
- }
-
- }
-
- public void receiveJob(int inputIndex, Job newJob) {
- if (wrapping) {
- pushEvent(newJob.popIndex());
- } else {
- pushEvent(newJob);
- }
- }
-
- public void receiveBypassCompletion(Completion completion) {
- pushEvent(completion);
- }
-
- private void pushEvent(
- IterationInternalEvent<? extends IterationInternalEvent<?>> e) {
- if (stack != null) {
- IterationStrategyImpl below = stack
- .layerBelow(IterationStrategyImpl.this);
- if (below == null) {
- stack.receiveEventFromStrategy(e);
- } else {
- below.receiveEvent(e);
- }
- }
- }
-
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException {
- if (getChildCount() == 0) {
- return -1;
- } else {
- return getChildAt(0).getIterationDepth(inputDepths);
- }
- }
-
- }
-
- public IterationStrategyImpl() {
- inputs = new HashSet<NamedInputPortNode>();
- }
-
- public TerminalNode getTerminalNode() {
- return terminal;
- }
-
- /**
- * Get the XML element defining the state of this iteration strategy
- *
- * @return
- */
- protected Element asXML() {
- Element strategyElement = new Element("strategy",
- XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- if (terminal.getChildCount() > 0) {
- AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) (terminal
- .getChildAt(0));
- strategyElement.addContent(elementForNode(node));
- }
- return strategyElement;
- }
-
- private static Element elementForNode(AbstractIterationStrategyNode node) {
- Element nodeElement = null;
- if (node instanceof DotProduct) {
- nodeElement = new Element("dot",
- XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- } else if (node instanceof CrossProduct) {
- nodeElement = new Element("cross",
- XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- } else if (node instanceof PrefixDotProduct) {
- nodeElement = new Element("prefix",
- XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- } else if (node instanceof NamedInputPortNode) {
- NamedInputPortNode nipn = (NamedInputPortNode) node;
- nodeElement = new Element("port",
- XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- nodeElement.setAttribute("name", nipn.getPortName());
- nodeElement.setAttribute("depth", nipn.getCardinality() + "");
- } else {
- throw new IllegalArgumentException("Unknown node " + node);
- }
- Enumeration<?> children = node.children();
- while (children.hasMoreElements()) {
- TreeNode tn = (TreeNode) children.nextElement();
- nodeElement
- .addContent(elementForNode((AbstractIterationStrategyNode) tn));
- }
- return nodeElement;
- }
-
- /**
- * Configure from an XML element
- *
- * @param strategyElement
- */
- @SuppressWarnings("unchecked")
- protected void configureFromXML(Element strategyElement) {
- inputs.clear();
- terminal.clear();
- if (!strategyElement.getChildren().isEmpty()) {
- for (Element childElement : (List<Element>) strategyElement
- .getChildren()) {
- AbstractIterationStrategyNode node = nodeForElement(childElement);
- node.setParent(terminal);
- }
- }
- }
-
- private AbstractIterationStrategyNode nodeForElement(Element e) {
- AbstractIterationStrategyNode node = null;
- String eName = e.getName();
- if (eName.equals("dot")) {
- node = new DotProduct();
- } else if (eName.equals("cross")) {
- node = new CrossProduct();
- } else if (eName.equals("prefix")) {
- node = new PrefixDotProduct();
- } else if (eName.equals("port")) {
- String portName = e.getAttributeValue("name");
- int portDepth = Integer.parseInt(e.getAttributeValue("depth"));
- node = new NamedInputPortNode(portName, portDepth);
- addInput((NamedInputPortNode) node);
- }
- for (Object child : e.getChildren()) {
- Element childElement = (Element) child;
- nodeForElement(childElement).setParent(node);
- }
- return node;
- }
-
- /**
- * Receive a single job from an upstream IterationStrategyImpl in the stack.
- * This job will have one or more data parts where the cardinality doesn't
- * match that defined by the NamedInputPortNode and will need to be split up
- * appropriately
- *
- * @param j
- */
- @SuppressWarnings("unchecked")
- // suppressed to avoid jdk1.5 compilation errors caused by the declaration
- // IterationInternalEvent<? extends IterationInternalEvent<?>> e
- protected void receiveEvent(IterationInternalEvent e) {
- // If we ever get this method called we know we're not the top layer in
- // the dispatch stack and that we need to perform wrap / unwrap of data
- // as it comes in. This boolean flag informs the behaviour of the
- // terminal
- // node in the strategy.
- wrapping = true;
- // If this is a Job object then we'll need to split it up and push it
- // through the iteration system to get multiple child jobs followed by a
- // completion event otherwise we can just push the completion event all
- // the way through the system.
- if (e instanceof Job) {
- Job j = ((Job) e).pushIndex();
- // Now have to split this job up into a number of distinct events!
- String owningProcess = j.getOwningProcess();
- for (String portName : j.getData().keySet()) {
- T2Reference dataRef = j.getData().get(portName);
- ReferenceService rs = e.getContext().getReferenceService();
- NamedInputPortNode ipn = nodeForName(portName);
- int desiredDepth = ipn.getCardinality();
- Iterator<ContextualizedT2Reference> ids = rs.traverseFrom(
- dataRef, desiredDepth);
- while (ids.hasNext()) {
- ContextualizedT2Reference ci = ids.next();
- int[] indexArray = ci.getIndex();
- T2Reference childDataRef = ci.getReference();
- receiveData(portName, owningProcess, indexArray,
- childDataRef, e.getContext());
- }
- receiveCompletion(portName, owningProcess, new int[] {}, e
- .getContext());
- }
- }
- // Event was a completion event, push it through unmodified to the
- // terminal node. Intermediate completion events from the split of an
- // input Job into multiple events through data structure traversal are
- // unwrapped but as this one is never wrapped in the first place we need
- // a way to mark it as such, the call to the bypass method achieves this
- else {
- terminal.receiveBypassCompletion((Completion) e);
- }
- }
-
- /**
- * Receive a single data event from an upstream process. This method is only
- * ever called on the first layer in the IterationStrategyStackImpl, other
- * layers are passed entire Job objects
- *
- * @param inputPortName
- * @param owningProcess
- * @param indexArray
- * @param dataReference
- * @throws WorkflowStructureException
- */
- public void receiveData(String inputPortName, String owningProcess,
- int[] indexArray, T2Reference dataReference,
- InvocationContext context) throws WorkflowStructureException {
- Map<String, T2Reference> dataMap = new HashMap<String, T2Reference>();
- dataMap.put(inputPortName, dataReference);
- Job newJob = new Job(owningProcess, indexArray, dataMap, context);
- nodeForName(inputPortName).receiveJob(0, newJob);
- }
-
- public void receiveCompletion(String inputPortName, String owningProcess,
- int[] completionArray, InvocationContext context)
- throws WorkflowStructureException {
- nodeForName(inputPortName).receiveCompletion(0,
- new Completion(owningProcess, completionArray, context));
- }
-
- public void addInput(NamedInputPortNode nipn) {
- synchronized (inputs) {
- this.inputs.add(nipn);
- }
- }
-
- public void removeInput(NamedInputPortNode nipn) {
- synchronized (inputs) {
- this.inputs.remove(nipn);
- }
- }
-
- public void removeInputByName(String name) {
- synchronized (inputs) {
- NamedInputPortNode removeMe = null;
- for (NamedInputPortNode nipn : inputs) {
- if (nipn.getPortName().equals(name)) {
- removeMe = nipn;
- }
- }
- if (removeMe != null) {
- this.inputs.remove(removeMe);
- removeMe.removeFromParent();
- }
- }
- }
-
- private NamedInputPortNode nodeForName(String portName)
- throws WorkflowStructureException {
- for (NamedInputPortNode node : inputs) {
- if (node.getPortName().equals(portName)) {
- return node;
- }
- }
- throw new WorkflowStructureException("No port found with name '"
- + portName + "'");
- }
-
- public void setIterationStrategyStack(IterationStrategyStackImpl stack) {
- this.stack = stack;
- }
-
- /**
- * Connect up a new named input port node to the first child of the terminal
- * node. If the terminal node doesn't have any children then create a new
- * cross product node, connect it to the terminal and connect the new input
- * port node to the cross product (saneish default behaviour)
- *
- * @param nipn
- */
- public synchronized void connectDefault(NamedInputPortNode nipn) {
- if (terminal.getChildCount() == 0) {
- CrossProduct cp = new CrossProduct();
- cp.setParent(terminal);
- nipn.setParent(cp);
- } else {
- AbstractIterationStrategyNode node = (AbstractIterationStrategyNode) (terminal
- .getChildAt(0));
- nipn.setParent(node);
- }
- }
-
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException {
- return getTerminalNode().getIterationDepth(inputDepths);
- }
-
- public Map<String, Integer> getDesiredCardinalities() {
- Map<String, Integer> result = new HashMap<String, Integer>();
- for (NamedInputPortNode nipn : inputs) {
- result.put(nipn.getPortName(), nipn.getCardinality());
- }
- return result;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyStackImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyStackImpl.java
deleted file mode 100644
index 15a80b9..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationStrategyStackImpl.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration.impl;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.WorkflowStructureException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategy;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.MissingIterationInputException;
-import net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializationConstants;
-
-import org.jdom.Element;
-
-/**
- * Contains an ordered list of IterationStrategyImpl objects. The top of the
- * list is fed data directly, all other nodes are fed complete Job objects and
- * Completion events from the layer above. The bottom layer pushes events onto
- * the processor event queue to be consumed by the dispatch stack.
- *
- * @author Tom Oinn
- *
- */
-public class IterationStrategyStackImpl implements IterationStrategyStack {
-
- private List<IterationStrategyImpl> strategies = new ArrayList<IterationStrategyImpl>();
-
- /**
- * The iteration depth here is calculated by taking first the top iteration
- * strategy and applying the actual input types to it, then for each
- * subsequent strategy in the stack using the 'desired cardinality' of the
- * input nodes for each layer to work out the increase in index array
- * length.
- *
- * @param inputDepths
- * @return
- * @throws IterationTypeMismatchException
- */
- public int getIterationDepth(Map<String, Integer> inputDepths)
- throws IterationTypeMismatchException,
- MissingIterationInputException {
- // If there are no iteration strategies or no inputs then by definition
- // there's no iteration, no wrapping and the depth of wrapping must be
- // zero
- if (strategies.isEmpty()) {
- return 0;
- }
- if (strategies.get(0).inputs.isEmpty()) {
- return 0;
- }
- IterationStrategyImpl strategy = strategies.get(0);
- int depth = strategy.getIterationDepth(inputDepths);
- for (int index = 1; index < strategies.size(); index++) {
- // Construct the input depths for the staged iteration strategies
- // after the first one by looking at the previous iteration
- // strategy's desired cardinalities on its input ports.
- Map<String, Integer> stagedInputDepths = strategy
- .getDesiredCardinalities();
- strategy = strategies.get(index);
- depth += strategy.getIterationDepth(stagedInputDepths);
- }
- return depth;
- }
-
- public void addStrategy(IterationStrategy is) {
- if (is instanceof IterationStrategyImpl) {
- IterationStrategyImpl isi = (IterationStrategyImpl) is;
- strategies.add(isi);
- isi.setIterationStrategyStack(this);
- } else {
- throw new WorkflowStructureException(
- "IterationStrategyStackImpl can only hold IterationStrategyImpl objects");
- }
- }
-
- public List<IterationStrategyImpl> getStrategies() {
- return Collections.unmodifiableList(this.strategies);
- }
-
- public void clear() {
- strategies.clear();
- }
-
- public void receiveData(String inputPortName, String owningProcess,
- int[] indexArray, T2Reference dataReference, InvocationContext context) {
- if (!strategies.isEmpty()) {
- strategies.get(0).receiveData(inputPortName, owningProcess,
- indexArray, dataReference, context);
- }
- }
-
- public void receiveCompletion(String inputPortName, String owningProcess,
- int[] completionArray, InvocationContext context) {
- if (!strategies.isEmpty()) {
- strategies.get(0).receiveCompletion(inputPortName, owningProcess,
- completionArray, context);
- }
- }
-
- public Element asXML() {
- Element strategyStackElement = new Element("iteration",XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- for (IterationStrategyImpl is : strategies) {
- strategyStackElement.addContent(is.asXML());
- }
- return strategyStackElement;
- }
-
- public void configureFromElement(Element e) {
- strategies.clear();
- for (Object child : e.getChildren("strategy",XMLSerializationConstants.T2_WORKFLOW_NAMESPACE)) {
- Element strategyElement = (Element) child;
- IterationStrategyImpl strategy = new IterationStrategyImpl();
- strategy.configureFromXML(strategyElement);
- addStrategy(strategy);
- }
- }
-
- /**
- * Return the layer below the specified one, or null if there is no lower
- * layer
- *
- * @return
- */
- protected IterationStrategyImpl layerBelow(IterationStrategyImpl that) {
- int index = strategies.indexOf(that);
- if (index == (strategies.size() - 1)) {
- return null;
- } else {
- return strategies.get(index + 1);
- }
- }
-
- /**
- * Called by the final iteration strategy to push events onto the
- * dispatcher's queue
- *
- * @param e
- */
- protected void receiveEventFromStrategy(IterationInternalEvent<? extends IterationInternalEvent<?>> e) {
- // TODO - push events onto dispatch queue
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/package.html
deleted file mode 100644
index 86a65ae..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-Implementation logic for the iteration system.
-</body>
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializer.java
deleted file mode 100644
index 17219e3..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializer.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.raven.appconfig.ApplicationRuntime;
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.ArtifactNotFoundException;
-import net.sf.taverna.raven.repository.ArtifactStateException;
-import net.sf.taverna.raven.repository.BasicArtifact;
-import net.sf.taverna.raven.repository.Repository;
-import net.sf.taverna.raven.repository.impl.DummyRepository;
-import net.sf.taverna.raven.spi.Profile;
-import net.sf.taverna.raven.spi.ProfileFactory;
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-/**
- * An abstract base class that contains deserialisation methods common across all dataflow elements.
- *
- * @author Stuart Owen
- *
- */
-public abstract class AbstractXMLDeserializer implements
- XMLSerializationConstants {
-
- private static final String T2_ACTIVITIES_GROUPID = "net.sf.taverna.t2.activities";
-
- private static final String T2_GROUPID = "net.sf.taverna.t2";
-
- private static Logger logger = Logger.getLogger(AbstractXMLDeserializer.class);
-
- protected Edits edits = new EditsImpl();
-
- protected Object createBean(Element element, ClassLoader cl) {
- Element configElement;
-
- // Note - don't check for CONFIG_BEAN/T2_WORKFLOW_NAMESPACE as
- // the annotations are such beans, but they are not in a <configBean> element.
-
- // Instead, we simply check if the "encoding" attribute is there, which it
- // should be
- if (element.getAttribute(BEAN_ENCODING) != null) {
- configElement = element;
- } else {
- // Find it one element below
- configElement = element
- .getChild(CONFIG_BEAN, T2_WORKFLOW_NAMESPACE);
- if (configElement == null) {
- throw new IllegalArgumentException("Can't find bean element {" +
- T2_WORKFLOW_NAMESPACE + "}" + CONFIG_BEAN);
- }
- }
-
- String encoding = configElement.getAttributeValue(BEAN_ENCODING);
- Object result = null;
- if (encoding.equals(XSTREAM_ENCODING)) {
- if (configElement.getChildren().isEmpty()) {
- throw new IllegalArgumentException("XStream encoding expected in element");
- }
- Element beanElement = (Element) configElement.getChildren().get(0);
- XStream xstream = new XStream(new DomDriver());
- xstream.setClassLoader(cl);
- result = xstream.fromXML(new XMLOutputter()
- .outputString(beanElement));
- } else if (encoding.equals(JDOMXML_ENCODING)) {
- if (configElement.getChildren().isEmpty()) {
- throw new IllegalArgumentException("XML encoding expected in element");
- }
- result = (Element) configElement.getChildren().get(0);
- //} else if (encoding.equals(DATAFLOW_ENCODING)) {
- // // Oh noe
- } else {
- throw new IllegalArgumentException("Unknown encoding " + encoding);
- }
-
- return result;
-
- }
-
- protected ClassLoader getRavenLoader(Element element)
- throws ArtifactNotFoundException, ArtifactStateException {
- // Try to get the current Repository object, if there isn't one we can't
- // do this here
- Repository repository = ApplicationRuntime.getInstance().getRavenRepository();
- if (repository instanceof DummyRepository) {
- return myClassLoader();
- // TODO - should probably warn that this is happening as it's likely
- // to be because of an error in API usage. There are times it won't
- // be though so leave it for now.
- }
-
- Element ravenElement;
- if (element.getName().equals(RAVEN) && element.getNamespace().equals(T2_WORKFLOW_NAMESPACE)) {
- ravenElement = element;
- } else {
- ravenElement = element.getChild(RAVEN, T2_WORKFLOW_NAMESPACE);
- if (ravenElement == null) {
- // Not found in XML
- return myClassLoader();
- }
- }
-
- String groupId = ravenElement.getChildTextTrim(GROUP,
- T2_WORKFLOW_NAMESPACE);
- String artifactId = ravenElement.getChildTextTrim(ARTIFACT,
- T2_WORKFLOW_NAMESPACE);
- String version = ravenElement.getChildTextTrim(VERSION,
- T2_WORKFLOW_NAMESPACE);
-
- Artifact artifact;
- // Always use the version of the profile
- Profile profile = ProfileFactory.getInstance().getProfile();
- artifact = profile.discoverArtifact(groupId, artifactId, repository);
- if (artifact == null && groupId.equals(T2_GROUPID)) {
- logger.info("Could not find artifact for " + groupId + ":" + artifactId
- + ", attempting compatability groupID " + T2_ACTIVITIES_GROUPID);
- artifact = profile.discoverArtifact(T2_ACTIVITIES_GROUPID, artifactId, repository);
- }
-
- if (artifact != null) {
- if (! (artifact.getVersion().equals(version))) {
- String desired = groupId + ":" + artifactId + ":" + version;
- String actual = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion();
- logger.warn("XML specified " + desired + " instead using from profile " + actual);
- // TODO: pop up an actual warning box
- }
-
- } else {
- logger.warn("Can't discover artifact for " + groupId + ":" + artifactId);
- artifact = new BasicArtifact(groupId, artifactId, version);
- }
- return repository.getLoader(artifact, null);
- }
-
- private ClassLoader myClassLoader() {
- ClassLoader classLoader = getClass().getClassLoader();
- if (classLoader != null) {
- return classLoader;
- }
- return ClassLoader.getSystemClassLoader();
- }
-
- protected String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
- @SuppressWarnings("unchecked")
- protected void annotationsFromXml(Annotated<?> annotated, Element parent,
- ClassLoader cl) {
- Element annotationsElement = parent.getChild(ANNOTATIONS,
- T2_WORKFLOW_NAMESPACE);
- if (annotationsElement != null) {
- Set<AnnotationChain> newAnnotationChains = new HashSet<AnnotationChain>();
- for (Element annotationChainElement : (List<Element>) (annotationsElement
- .getChildren(ANNOTATION_CHAIN, T2_WORKFLOW_NAMESPACE))) {
- if (annotationChainElement == null) {
- logger.info("annotationChainElement is null");
- continue;
- }
- if (cl == null) {
- logger.info("ClassLoader is null");
- continue;
- }
- AnnotationChain ac = (AnnotationChain) createBean(
- annotationChainElement, XMLDeserializerImpl.class
- .getClassLoader());
- if ((ac == null) || (ac.getAssertions() == null)
- || (ac.getAssertions().size() == 0)) {
- logger.warn("Null or empty annotation chain");
- continue;
- }
- newAnnotationChains.add(ac);
-
- }
- annotated.setAnnotations(newAnnotationChains);
- }
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializer.java
deleted file mode 100644
index 9deacb8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializer.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-import java.io.StringReader;
-
-import net.sf.taverna.raven.repository.Artifact;
-import net.sf.taverna.raven.repository.impl.LocalArtifactClassLoader;
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.JDOMException;
-import org.jdom.input.SAXBuilder;
-
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.xml.DomDriver;
-
-/**
- * An abstract base class that contains serialisation methods common across all dataflow elements.
- *
- * @author Stuart Owen
- *
- */
-public abstract class AbstractXMLSerializer implements XMLSerializationConstants {
-
- @SuppressWarnings("unused")
- private static Logger logger = Logger.getLogger(AbstractXMLSerializer.class);
-
- /**
- * Create the <raven> element for a given local artifact classloader.
- *
- * @param classLoader
- * The {@link LocalArtifactClassLoader} for the artifact
- * @return Populated <raven> element
- */
- protected Element ravenElement(LocalArtifactClassLoader classLoader) {
- Element element = new Element(RAVEN, T2_WORKFLOW_NAMESPACE);
- Artifact artifact = classLoader.getArtifact();
- // Group
- Element groupIdElement = new Element(GROUP, T2_WORKFLOW_NAMESPACE);
- groupIdElement.setText(artifact.getGroupId());
- element.addContent(groupIdElement);
- // Artifact ID
- Element artifactIdElement = new Element(ARTIFACT, T2_WORKFLOW_NAMESPACE);
- artifactIdElement.setText(artifact.getArtifactId());
- element.addContent(artifactIdElement);
- // Version
- Element versionElement = new Element(VERSION, T2_WORKFLOW_NAMESPACE);
- versionElement.setText(artifact.getVersion());
- element.addContent(versionElement);
- // Return assembled raven element
- return element;
- }
-
- protected Element beanAsElement(Object obj) throws JDOMException,
- IOException {
- Element bean = new Element(CONFIG_BEAN, T2_WORKFLOW_NAMESPACE);
- if (obj instanceof Element) {
- populateBeanElementForElement((Element)obj, bean);
- }
- else if (obj instanceof Dataflow) {
- populateBeanElementForDataflow((Dataflow)obj, bean);
- }
- else {
- populateBeanElementFromXStream(obj, bean);
- }
- return bean;
- }
-
- private void populateBeanElementFromXStream(Object obj, Element bean)
- throws JDOMException, IOException {
- bean.setAttribute(BEAN_ENCODING, XSTREAM_ENCODING);
- XStream xstream = new XStream(new DomDriver());
- SAXBuilder builder = new SAXBuilder();
- Element configElement = builder.build(
- new StringReader(xstream.toXML(obj))).getRootElement();
- configElement.getParent().removeContent(configElement);
- bean.addContent(configElement);
- }
-
- private void populateBeanElementForDataflow(Dataflow dataflow, Element bean) {
-
- bean.setAttribute(BEAN_ENCODING,DATAFLOW_ENCODING);
- Element dataflowElement = new Element(DATAFLOW,T2_WORKFLOW_NAMESPACE);
-
- dataflowElement.setAttribute(DATAFLOW_REFERENCE,dataflow.getInternalIdentier());
-
- bean.addContent(dataflowElement);
- }
-
- private void populateBeanElementForElement(Element el, Element bean) {
- bean.setAttribute(BEAN_ENCODING, JDOMXML_ENCODING);
- bean.addContent((Element)el.clone());
- }
-
- protected Element annotationsToXML(Annotated<?> annotated) throws JDOMException, IOException {
- Element result = new Element(ANNOTATIONS, T2_WORKFLOW_NAMESPACE);
- for (AnnotationChain a : annotated.getAnnotations()) {
- Element annotationChainElement = new Element(ANNOTATION_CHAIN,T2_WORKFLOW_NAMESPACE);
- populateBeanElementFromXStream(a, annotationChainElement);
- result.addContent(annotationChainElement);
- }
- return result;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializer.java
deleted file mode 100644
index a2702f0..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializer.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-public class ActivityXMLDeserializer extends AbstractXMLDeserializer {
- private static ActivityXMLDeserializer instance = new ActivityXMLDeserializer();
-
- private static Logger logger = Logger.getLogger(ActivityXMLDeserializer.class);
-
- public static ActivityXMLDeserializer getInstance() {
- return instance;
- }
-
- protected ActivityXMLDeserializer() {
-
- }
-
- @SuppressWarnings("unchecked")
- public Activity<?> deserializeActivity(Element element,
- Map<String, Element> innerDataflowElements, ClassLoader classLoader) throws ClassNotFoundException, InstantiationException, IllegalAccessException, EditException, DeserializationException, ActivityConfigurationException {
- Element ravenElement = element.getChild(RAVEN, T2_WORKFLOW_NAMESPACE);
- ClassLoader cl = classLoader;
- if (cl == null) {
- cl = getClass().getClassLoader();
- }
- if (ravenElement != null) {
- try {
- cl = getRavenLoader(ravenElement);
- } catch (Exception ex) {
- logger.warn("Could not load raven classloader " + ravenElement + " for activity", ex);
- // TODO - handle this properly, either by logging correctly or
- // by going back to the repository and attempting to fetch the
- // offending missing artifacts
- }
- }
- String className = element.getChild(CLASS, T2_WORKFLOW_NAMESPACE)
- .getTextTrim();
- Class<? extends Activity> c = (Class<? extends Activity>) cl
- .loadClass(className);
- Activity<Object> activity = c.newInstance();
-
- // Handle the configuration of the activity
- Element configElement = element.getChild(CONFIG_BEAN,
- T2_WORKFLOW_NAMESPACE);
- Object configObject=null;
- if (DATAFLOW_ENCODING.equals(configElement.getAttributeValue(BEAN_ENCODING))) {
- String ref = configElement.getChild(DATAFLOW,T2_WORKFLOW_NAMESPACE).getAttributeValue(DATAFLOW_REFERENCE);
- configObject = resolveDataflowReference(ref,innerDataflowElements);
- }
- else {
- configObject = createBean(configElement, cl);
- }
- activity.configure(configObject);
-
- //port mappings
- Element ipElement = element.getChild(INPUT_MAP, T2_WORKFLOW_NAMESPACE);
- for (Element mapElement : (List<Element>) (ipElement.getChildren(MAP,
- T2_WORKFLOW_NAMESPACE))) {
- String processorInputName = mapElement.getAttributeValue(FROM);
- String activityInputName = mapElement.getAttributeValue(TO);
- activity.getInputPortMapping().put(processorInputName,
- activityInputName);
- }
-
- Element opElement = element.getChild(OUTPUT_MAP, T2_WORKFLOW_NAMESPACE);
- for (Element mapElement : (List<Element>) (opElement.getChildren(MAP,
- T2_WORKFLOW_NAMESPACE))) {
- String activityOutputName = mapElement.getAttributeValue(FROM);
- String processorOutputName = mapElement.getAttributeValue(TO);
- activity.getOutputPortMapping().put(activityOutputName,
- processorOutputName);
- }
-
- annotationsFromXml(activity, element, activity.getClass().getClassLoader());
- return activity;
- }
-
- public Activity<?> deserializeActivity(Element element,Map<String,Element> innerDataflowElements)
- throws ActivityConfigurationException, ClassNotFoundException,
- InstantiationException, IllegalAccessException, EditException, DeserializationException {
- return deserializeActivity(element, innerDataflowElements, null);
- }
-
- private Object resolveDataflowReference(String ref,
- Map<String, Element> innerDataflowElements) throws EditException, DeserializationException, ActivityConfigurationException, ClassNotFoundException, InstantiationException, IllegalAccessException {
- Element dfElement = innerDataflowElements.get(ref);
- return DataflowXMLDeserializer.getInstance().deserializeDataflow(dfElement, innerDataflowElements);
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializer.java
deleted file mode 100644
index 89988d8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializer.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-
-import net.sf.taverna.raven.repository.impl.LocalArtifactClassLoader;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-public class ActivityXMLSerializer extends AbstractXMLSerializer {
- private static ActivityXMLSerializer instance = new ActivityXMLSerializer();
-
- public static ActivityXMLSerializer getInstance() {
- return instance;
- }
-
- public Element activityToXML(Activity<?> activity) throws JDOMException,
- IOException {
- Element activityElem = new Element(ACTIVITY, T2_WORKFLOW_NAMESPACE);
-
- ClassLoader cl = activity.getClass().getClassLoader();
- if (cl instanceof LocalArtifactClassLoader) {
- activityElem
- .addContent(ravenElement((LocalArtifactClassLoader) cl));
- }
- Element classNameElement = new Element(CLASS, T2_WORKFLOW_NAMESPACE);
- classNameElement.setText(activity.getClass().getName());
- activityElem.addContent(classNameElement);
-
- // Write out the mappings (processor input -> activity input, activity
- // output -> processor output)
- Element ipElement = new Element(INPUT_MAP, T2_WORKFLOW_NAMESPACE);
- for (String processorInputName : activity.getInputPortMapping()
- .keySet()) {
- Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
- mapElement.setAttribute(FROM, processorInputName);
- mapElement.setAttribute(TO, activity.getInputPortMapping().get(
- processorInputName));
- ipElement.addContent(mapElement);
- }
- activityElem.addContent(ipElement);
-
- Element opElement = new Element(OUTPUT_MAP, T2_WORKFLOW_NAMESPACE);
- for (String activityOutputName : activity.getOutputPortMapping()
- .keySet()) {
- Element mapElement = new Element(MAP, T2_WORKFLOW_NAMESPACE);
- mapElement.setAttribute(FROM, activityOutputName);
- mapElement.setAttribute(TO, activity.getOutputPortMapping().get(
- activityOutputName));
- opElement.addContent(mapElement);
- }
- activityElem.addContent(opElement);
-
- // Get element for configuration
- Object o = activity.getConfiguration();
- Element configElement = beanAsElement(o);
- activityElem.addContent(configElement);
-
- // annotations
- activityElem.addContent(annotationsToXML(activity));
-
- return activityElem;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLDeserializer.java
deleted file mode 100644
index 697c726..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLDeserializer.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.jdom.Element;
-
-public class ConditionXMLDeserializer extends AbstractXMLDeserializer {
- private static ConditionXMLDeserializer instance = new ConditionXMLDeserializer();
-
- private ConditionXMLDeserializer() {
-
- }
-
- public static ConditionXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public void buildConditions(Dataflow df, Element conditionsElement,
- Map<String, Processor> createdProcessors) throws DeserializationException, EditException {
- for (Element conditionElement : (List<Element>)conditionsElement.getChildren(CONDITION,T2_WORKFLOW_NAMESPACE)) {
- String control=conditionElement.getAttributeValue("control");
- String target=conditionElement.getAttributeValue("target");
- Processor controlProcessor=createdProcessors.get(control);
- Processor targetProcessor=createdProcessors.get(target);
- if (controlProcessor==null) throw new DeserializationException("Unable to find start service for control link, named:"+control);
- if (targetProcessor==null) throw new DeserializationException("Unable to find target service for control link, named:"+target);
- edits.getCreateConditionEdit(controlProcessor, targetProcessor).doEdit();
- }
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializer.java
deleted file mode 100644
index 94ec6fc..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializer.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-import org.jdom.Element;
-
-public class ConditionXMLSerializer extends AbstractXMLSerializer {
- private static ConditionXMLSerializer instance = new ConditionXMLSerializer();
-
- private ConditionXMLSerializer() {
-
- }
-
- public static ConditionXMLSerializer getInstance() {
- return instance;
- }
-
- public Element conditionsToXML(List<? extends Processor> processors) {
- Element result = new Element(CONDITIONS, T2_WORKFLOW_NAMESPACE);
-
- // gather conditions
- Set<Condition> conditions = new HashSet<Condition>();
- for (Processor p : processors) {
- for (Condition c : p.getControlledPreconditionList()) {
- conditions.add(c);
- }
- }
- for (Condition c : conditions) {
- Element conditionElement = new Element(CONDITION,
- T2_WORKFLOW_NAMESPACE);
- conditionElement.setAttribute("control", c.getControl()
- .getLocalName());
- conditionElement.setAttribute("target", c.getTarget()
- .getLocalName());
- result.addContent(conditionElement);
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializer.java
deleted file mode 100644
index c7faee1..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.jdom.Element;
-
-public class DataflowXMLDeserializer extends AbstractXMLDeserializer {
- private static DataflowXMLDeserializer instance = new DataflowXMLDeserializer();
-
- private DataflowXMLDeserializer() {
-
- }
-
- public static DataflowXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public Dataflow deserializeDataflow(Element element,Map<String,Element> innerDataflowElements) throws EditException, DeserializationException, ActivityConfigurationException, ClassNotFoundException, InstantiationException, IllegalAccessException {
- Dataflow df = edits.createDataflow();
-
- String name = element.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- String id = element.getAttributeValue(DATAFLOW_ID);
- edits.getUpdateDataflowNameEdit(df, name).doEdit();
- edits.getUpdateDataflowInternalIdentifierEdit(df, id).doEdit();
-
- Element inputPorts = element.getChild(DATAFLOW_INPUT_PORTS,T2_WORKFLOW_NAMESPACE);
- Element outputPorts = element.getChild(DATAFLOW_OUTPUT_PORTS,T2_WORKFLOW_NAMESPACE);
-
- //dataflow ports
- addDataflowPorts(df,inputPorts,outputPorts);
-
- Map<String,Processor> createdProcessors = new HashMap<String, Processor>();
- //processors
- Element processorsElement = element.getChild(PROCESSORS,T2_WORKFLOW_NAMESPACE);
- for(Element procElement : (List<Element>)processorsElement.getChildren(PROCESSOR,T2_WORKFLOW_NAMESPACE)) {
- Processor p = ProcessorXMLDeserializer.getInstance().deserializeProcessor(procElement,innerDataflowElements);
- createdProcessors.put(p.getLocalName(),p);
- edits.getAddProcessorEdit(df, p).doEdit();
- }
-
- //conditions
- Element conditions = element.getChild(CONDITIONS,T2_WORKFLOW_NAMESPACE);
- ConditionXMLDeserializer.getInstance().buildConditions(df,conditions,createdProcessors);
-
- //datalinks
- Element datalinks = element.getChild(DATALINKS,T2_WORKFLOW_NAMESPACE);
- DatalinksXMLDeserializer.getInstance().buildDatalinks(df,createdProcessors,datalinks);
-
- //annotations
- annotationsFromXml(df, element, df.getClass().getClassLoader());
- return df;
- }
-
- @SuppressWarnings("unchecked")
- private void addDataflowPorts(Dataflow df, Element inputPortsElement,Element outputPortsElement) throws EditException {
- for (Element port : (List<Element>)inputPortsElement.getChildren(DATAFLOW_PORT,T2_WORKFLOW_NAMESPACE)) {
- String name=port.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- int portDepth = Integer.valueOf(port.getChildText(DEPTH,T2_WORKFLOW_NAMESPACE));
- int granularDepth = Integer.valueOf(port.getChildText(GRANULAR_DEPTH,T2_WORKFLOW_NAMESPACE));
- DataflowInputPort dataflowInputPort = edits.createDataflowInputPort(name, portDepth, granularDepth, df);
- // add annotations
- annotationsFromXml(dataflowInputPort, port, df.getClass().getClassLoader());
- edits.getAddDataflowInputPortEdit(df, dataflowInputPort).doEdit();
-// edits.getCreateDataflowInputPortEdit(df, name, portDepth, granularDepth).doEdit();
- }
-
- for (Element port : (List<Element>)outputPortsElement.getChildren(DATAFLOW_PORT,T2_WORKFLOW_NAMESPACE)) {
- String name=port.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- DataflowOutputPort dataflowOutputPort = edits.createDataflowOutputPort(name, df);
- // add annotations
- annotationsFromXml(dataflowOutputPort, port, df.getClass().getClassLoader());
- edits.getAddDataflowOutputPortEdit(df, dataflowOutputPort).doEdit();
-// edits.getCreateDataflowOutputPortEdit(df, name).doEdit();
- }
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializer.java
deleted file mode 100644
index edbbcc4..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.serialization.SerializationException;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-public class DataflowXMLSerializer extends AbstractXMLSerializer {
- private static DataflowXMLSerializer instance = new DataflowXMLSerializer();
-
- private DataflowXMLSerializer() {
-
- }
-
- public static DataflowXMLSerializer getInstance() {
- return instance;
- }
-
- public Element serializeDataflow(Dataflow df)
- throws SerializationException {
- Element result = new Element(DATAFLOW, T2_WORKFLOW_NAMESPACE);
- result.setAttribute(DATAFLOW_ID,df.getInternalIdentier());
- try {
-
- Element name=new Element(NAME,T2_WORKFLOW_NAMESPACE);
- name.setText(df.getLocalName());
- result.addContent(name);
-
- // do dataflow inputs and outputs
- result.addContent(dataflowInputPorts(df.getInputPorts()));
- result.addContent(dataflowOutputPorts(df.getOutputPorts()));
- // do processors
- Element processors = new Element(PROCESSORS, T2_WORKFLOW_NAMESPACE);
-
- for (Processor processor : df.getProcessors()) {
- processors.addContent(processorToXML(processor));
- }
- result.addContent(processors);
-
- // do conditions
- result.addContent(conditionsToXML(df.getProcessors()));
- // do datalinks
- result.addContent(DatalinksXMLSerializer.getInstance().datalinksToXML(df.getLinks()));
- // do annotations
- result.addContent(annotationsToXML(df));
-
- }
- // FIXME: improve error reporting
- catch (JDOMException jdomException) {
- throw new SerializationException(
- "There was a problem generating the XML for the workflow: " + jdomException.toString(),
- jdomException);
- } catch (IOException ioException) {
- throw new SerializationException(
- "There was a problem generating the XML for the workflow: " + ioException.toString(),
- ioException);
- }
- return result;
- }
-
- private Element conditionsToXML(List<? extends Processor> processors) {
- return ConditionXMLSerializer.getInstance().conditionsToXML(processors);
- }
-
- private Element processorToXML(Processor processor) throws IOException,
- JDOMException {
- return ProcessorXMLSerializer.getInstance().processorToXML(processor);
- }
-
- protected Element dataflowInputPorts(
- List<? extends DataflowInputPort> inputPorts) throws JDOMException, IOException {
- Element result = new Element(DATAFLOW_INPUT_PORTS,
- T2_WORKFLOW_NAMESPACE);
- for (DataflowInputPort port : inputPorts) {
- Element portElement = new Element(DATAFLOW_PORT,
- T2_WORKFLOW_NAMESPACE);
- Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
- Element depth = new Element(DEPTH, T2_WORKFLOW_NAMESPACE);
- Element granularDepth = new Element(GRANULAR_DEPTH,
- T2_WORKFLOW_NAMESPACE);
-
- name.setText(port.getName());
- depth.setText(String.valueOf(port.getDepth()));
- granularDepth.setText(String.valueOf(port.getGranularInputDepth()));
-
- portElement.addContent(name);
- portElement.addContent(depth);
- portElement.addContent(granularDepth);
- // do annotations
- portElement.addContent(annotationsToXML(port));
- result.addContent(portElement);
- }
- return result;
- }
-
- protected Element dataflowOutputPorts(
- List<? extends DataflowOutputPort> outputPorts) throws JDOMException, IOException {
- Element result = new Element(DATAFLOW_OUTPUT_PORTS,
- T2_WORKFLOW_NAMESPACE);
- for (DataflowOutputPort port : outputPorts) {
- Element portElement = new Element(DATAFLOW_PORT,
- T2_WORKFLOW_NAMESPACE);
- Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
- name.setText(port.getName());
-
- portElement.addContent(name);
- // do annotations
- portElement.addContent(annotationsToXML(port));
- result.addContent(portElement);
- }
- return result;
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLDeserializer.java
deleted file mode 100644
index 7ae6363..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLDeserializer.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeOutputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.jdom.Element;
-
-public class DatalinksXMLDeserializer extends AbstractXMLDeserializer {
- private static DatalinksXMLDeserializer instance = new DatalinksXMLDeserializer();
-
- private Log logger = LogFactory.getLog(DatalinksXMLDeserializer.class);
-
-
- private DatalinksXMLDeserializer() {
-
- }
-
- public static DatalinksXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public void buildDatalinks(Dataflow dataflow,
- Map<String, Processor> createdProcessors, Element datalinks)
- throws DeserializationException, EditException {
- for (Element datalink : (List<Element>) datalinks.getChildren(DATALINK,
- T2_WORKFLOW_NAMESPACE)) {
- Element sink = datalink.getChild(SINK, T2_WORKFLOW_NAMESPACE);
- Element source = datalink.getChild(SOURCE, T2_WORKFLOW_NAMESPACE);
- if (sink == null)
- throw new DeserializationException(
- "No sink defined for datalink:"
- + elementToString(datalink));
- if (source == null)
- throw new DeserializationException(
- "No source defined for datalink:"
- + elementToString(datalink));
- String sinkType = sink.getAttributeValue(DATALINK_TYPE);
-
- EventForwardingOutputPort sourcePort = determineLinkSourcePort(
- source, dataflow, createdProcessors);
- EventHandlingInputPort sinkPort = determineLinkSinkPort(sink,
- dataflow, createdProcessors);
-
- if (sourcePort == null)
- throw new DeserializationException(
- "Unable to determine source port for:"
- + elementToString(datalink));
- if (sinkPort == null)
- throw new DeserializationException(
- "Unable to determine sink port for:"
- + elementToString(datalink));
- if (sinkType.equals(DATALINK_TYPES.MERGE.toString())) {
- Merge merge;
- if (sinkPort.getIncomingLink() == null) {
- merge = edits.createMerge(dataflow);
- edits.getAddMergeEdit(dataflow, merge).doEdit();
- } else {
- if (sinkPort.getIncomingLink().getSource() instanceof MergeOutputPort) {
- merge = ((MergeOutputPort) sinkPort.getIncomingLink()
- .getSource()).getMerge();
- } else {
- throw new DeserializationException(
- "There was a merge port execpted to be connected to "
- + sinkPort);
- }
- }
- if (merge == null)
- throw new DeserializationException(
- "Unable to find or create Merge for "
- + elementToString(datalink));
- try {
- edits.getConnectMergedDatalinkEdit(merge, sourcePort, sinkPort)
- .doEdit();
- }
- catch(Exception e) {
- logger.error(e);
- }
- } else {
- Datalink link = edits.createDatalink(sourcePort, sinkPort);
- edits.getConnectDatalinkEdit(link).doEdit();
- }
- }
-
- }
-
- private EventForwardingOutputPort determineLinkSourcePort(Element source,
- Dataflow dataflow, Map<String, Processor> createdProcessors)
- throws DeserializationException, EditException {
- EventForwardingOutputPort result = null;
- String sourceType = source.getAttributeValue(DATALINK_TYPE);
- String portName = source.getChildText(PORT, T2_WORKFLOW_NAMESPACE);
- if (sourceType.equals(DATALINK_TYPES.PROCESSOR.toString())) {
- String processorName = source.getChildText(PROCESSOR,
- T2_WORKFLOW_NAMESPACE);
- result = findProcessorOutputPort(createdProcessors, portName,
- processorName);
- } else if (sourceType.equals(DATALINK_TYPES.DATAFLOW.toString())) {
- for (DataflowInputPort port : dataflow.getInputPorts()) {
- if (port.getName().equals(portName)) {
- result = port.getInternalOutputPort();
- break;
- }
- }
- } else if (sourceType.equals(DATALINK_TYPES.MERGE.toString())) {
- throw new DeserializationException(
- "The source type is marked as merge for:"
- + elementToString(source) + " but should never be");
- } else {
- throw new DeserializationException(
- "Unable to recognise datalink type:" + sourceType);
- }
- return result;
- }
-
- private EventHandlingInputPort determineLinkSinkPort(Element sink,
- Dataflow dataflow, Map<String, Processor> createdProcessors)
- throws DeserializationException, EditException {
- EventHandlingInputPort result = null;
- String portName = sink.getChildText(PORT, T2_WORKFLOW_NAMESPACE);
- String processorName = sink.getChildText(PROCESSOR, T2_WORKFLOW_NAMESPACE);
- if ((processorName == null) || processorName.equals("")) {
- for (DataflowOutputPort port : dataflow.getOutputPorts()) {
- if (port.getName().equals(portName)) {
- result = port.getInternalInputPort();
- break;
- }
- }
- } else {
- EventHandlingInputPort processorInputPort = findProcessorInputPort(
- createdProcessors, portName, processorName);
- result = processorInputPort;
- }
- return result;
- }
-
- private EventHandlingInputPort findProcessorInputPort(
- Map<String, Processor> createdProcessors, String portName,
- String processorName) throws DeserializationException {
- EventHandlingInputPort result = null;
- Processor p = createdProcessors.get(processorName);
- if (p == null)
- throw new DeserializationException(
- "Unable to find processor named:" + processorName);
- for (ProcessorInputPort port : p.getInputPorts()) {
- if (port.getName().equals(portName)) {
- result = port;
- break;
- }
- }
- return result;
- }
-
- private EventForwardingOutputPort findProcessorOutputPort(
- Map<String, Processor> createdProcessors, String portName,
- String processorName) throws DeserializationException {
- EventForwardingOutputPort result = null;
- Processor p = createdProcessors.get(processorName);
- if (p == null)
- throw new DeserializationException(
- "Unable to find processor named:" + processorName);
- for (ProcessorOutputPort port : p.getOutputPorts()) {
- if (port.getName().equals(portName)) {
- result = port;
- break;
- }
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializer.java
deleted file mode 100644
index 2d8a850..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializer.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.MergeOutputPort;
-import net.sf.taverna.t2.workflowmodel.Port;
-import net.sf.taverna.t2.workflowmodel.ProcessorPort;
-import net.sf.taverna.t2.workflowmodel.impl.BasicEventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.MergeInputPortImpl;
-import net.sf.taverna.t2.workflowmodel.serialization.SerializationException;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-
-public class DatalinksXMLSerializer extends AbstractXMLSerializer {
- private static DatalinksXMLSerializer instance = new DatalinksXMLSerializer();
-
- private static Logger logger = Logger.getLogger(DatalinksXMLSerializer.class);
-
-
- private DatalinksXMLSerializer() {
-
- }
-
- public static DatalinksXMLSerializer getInstance() {
- return instance;
- }
-
- public Element datalinkToXML(Datalink link) throws SerializationException {
- Element element = new Element(DATALINK, T2_WORKFLOW_NAMESPACE);
- Element sink = new Element(SINK, T2_WORKFLOW_NAMESPACE);
- Element source = new Element(SOURCE, T2_WORKFLOW_NAMESPACE);
-
- DATALINK_TYPES dataLinkSinkType = determineDatalinkType(link.getSink());
- sink.setAttribute(DATALINK_TYPE, dataLinkSinkType.toString());
- Datalink effectiveLink = link;
-
- if (dataLinkSinkType == DATALINK_TYPES.MERGE) {
- Merge m = ((MergeInputPortImpl) link.getSink()).getMerge();
- effectiveLink = (Datalink) m
- .getOutputPort().getOutgoingLinks().toArray()[0];
- dataLinkSinkType = determineDatalinkType(effectiveLink.getSink());
- }
-
- if (dataLinkSinkType == DATALINK_TYPES.PROCESSOR) {
- ProcessorPort port = (ProcessorPort) effectiveLink.getSink();
- Element proc = new Element(PROCESSOR, T2_WORKFLOW_NAMESPACE);
- proc.setText(port.getProcessor().getLocalName());
- sink.addContent(proc);
- Element portElement = new Element(PROCESSOR_PORT,
- T2_WORKFLOW_NAMESPACE);
- portElement.setText(effectiveLink.getSink().getName());
- sink.addContent(portElement);
- } else if (dataLinkSinkType == DATALINK_TYPES.DATAFLOW) {
- Element portElement = new Element(PORT, T2_WORKFLOW_NAMESPACE);
- portElement.setText(effectiveLink.getSink().getName());
- sink.addContent(portElement);
- }
-
- DATALINK_TYPES dataLinkSourceType = determineDatalinkType(link
- .getSource());
- source.setAttribute(DATALINK_TYPE, dataLinkSourceType.toString());
-
- if (dataLinkSourceType == DATALINK_TYPES.PROCESSOR) {
- ProcessorPort port = (ProcessorPort) link.getSource();
- Element proc = new Element(PROCESSOR, T2_WORKFLOW_NAMESPACE);
- proc.setText(port.getProcessor().getLocalName());
- source.addContent(proc);
- Element portElement = new Element(PROCESSOR_PORT,
- T2_WORKFLOW_NAMESPACE);
- portElement.setText(link.getSource().getName());
- source.addContent(portElement);
- } else if (dataLinkSourceType == DATALINK_TYPES.MERGE) {
- logger.error("Not expecting DATALINK_TYPES.MERGE");
- } else if (dataLinkSourceType == DATALINK_TYPES.DATAFLOW) {
- Element portElement = new Element(PORT, T2_WORKFLOW_NAMESPACE);
- portElement.setText(link.getSource().getName());
- source.addContent(portElement);
- }
-
- element.addContent(sink);
- element.addContent(source);
-
- return element;
- }
-
- private DATALINK_TYPES determineDatalinkType(Port port)
- throws SerializationException {
- if (port instanceof MergeInputPort || port instanceof MergeOutputPort) {
- return DATALINK_TYPES.MERGE;
- } else if (port instanceof ProcessorPort) {
- return DATALINK_TYPES.PROCESSOR;
- } else if (port instanceof BasicEventForwardingOutputPort
- || port instanceof EventHandlingInputPort) {
- return DATALINK_TYPES.DATAFLOW;
- } else {
- throw new SerializationException(
- "Unable to determine link type connected to/from " + port);
- }
- }
-
- public Element datalinksToXML(List<? extends Datalink> links)
- throws SerializationException {
- Element result = new Element(DATALINKS, T2_WORKFLOW_NAMESPACE);
- for (Datalink link : links) {
- if (determineDatalinkType(link.getSource()) != DATALINK_TYPES.MERGE) {
- result.addContent(datalinkToXML(link));
- }
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializer.java
deleted file mode 100644
index 65849a4..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import net.sf.taverna.raven.log.Log;
-import net.sf.taverna.raven.repository.impl.LocalRepository;
-import net.sf.taverna.t2.workflowmodel.ConfigurationException;
-import net.sf.taverna.t2.workflowmodel.impl.Tools;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-
-import org.jdom.Element;
-
-public class DispatchLayerXMLDeserializer extends AbstractXMLDeserializer {
- private static DispatchLayerXMLDeserializer instance = new DispatchLayerXMLDeserializer();
-
- private static Log logger = Log.getLogger(DispatchLayerXMLDeserializer.class);
-
- private DispatchLayerXMLDeserializer() {
-
- }
-
- public static DispatchLayerXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public DispatchLayer<?> deserializeDispatchLayer(Element element) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
- Element ravenElement = element.getChild(RAVEN,T2_WORKFLOW_NAMESPACE);
- ClassLoader cl = Tools.class.getClassLoader();
- if (ravenElement != null) {
- try {
- cl = getRavenLoader(ravenElement);
- } catch (Exception ex) {
- logger.error(ex);
- // TODO - handle this properly, either by logging correctly or
- // by going back to the repository and attempting to fetch the
- // offending missing artifacts
- }
- }
- String className = element.getChild(CLASS,T2_WORKFLOW_NAMESPACE).getTextTrim();
- Class<? extends DispatchLayer> c = (Class<? extends DispatchLayer>) cl
- .loadClass(className);
- DispatchLayer<Object> layer = c.newInstance();
-
- // Handle the configuration of the dispatch layer
- Element configElement = element.getChild(CONFIG_BEAN,T2_WORKFLOW_NAMESPACE);
- Object configObject = createBean(configElement, cl);
- try {
- layer.configure(configObject);
- } catch (ConfigurationException e) {
- // TODO - handle this properly
- logger.error(e);
- }
-
- return layer;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializer.java
deleted file mode 100644
index dfda7bb..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-
-import net.sf.taverna.raven.repository.impl.LocalArtifactClassLoader;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-public class DispatchLayerXMLSerializer extends AbstractXMLSerializer {
-
- private static DispatchLayerXMLSerializer instance = new DispatchLayerXMLSerializer();
-
- public static DispatchLayerXMLSerializer getInstance() {
- return instance;
- }
-
- public Element dispatchLayerToXML(DispatchLayer<?> layer)
- throws IOException, JDOMException {
- Element result = new Element(DISPATCH_LAYER, T2_WORKFLOW_NAMESPACE);
-
- appendObjectDetails(layer, result);
-
- // Get element for configuration
- Object o = layer.getConfiguration();
- Element configElement = beanAsElement(o);
- result.addContent(configElement);
- return result;
- }
-
- private void appendObjectDetails(DispatchLayer<?> layer, Element result) {
- ClassLoader cl = layer.getClass().getClassLoader();
- if (cl instanceof LocalArtifactClassLoader) {
- result.addContent(ravenElement((LocalArtifactClassLoader) cl));
- }
- Element classNameElement = new Element(CLASS, T2_WORKFLOW_NAMESPACE);
- classNameElement.setText(layer.getClass().getName());
- result.addContent(classNameElement);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializer.java
deleted file mode 100644
index d16b894..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-
-import org.jdom.Element;
-
-public class DispatchStackXMLDeserializer extends AbstractXMLDeserializer {
- private static DispatchStackXMLDeserializer instance = new DispatchStackXMLDeserializer();
-
- private DispatchStackXMLDeserializer() {
-
- }
-
- public static DispatchStackXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public void deserializeDispatchStack(Processor processor,
- Element dispatchStack) throws ClassNotFoundException, InstantiationException, IllegalAccessException, EditException {
- int layers=0;
- for (Element layer : (List<Element>)dispatchStack.getChildren(DISPATCH_LAYER,T2_WORKFLOW_NAMESPACE)) {
- DispatchLayer<?> dispatchLayer = DispatchLayerXMLDeserializer.getInstance().deserializeDispatchLayer(layer);
- edits.getAddDispatchLayerEdit(processor.getDispatchStack(), dispatchLayer, layers++).doEdit();
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializer.java
deleted file mode 100644
index bc7f698..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializer.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-public class DispatchStackXMLSerializer extends AbstractXMLSerializer {
-
- private static DispatchStackXMLSerializer instance = new DispatchStackXMLSerializer();
-
- public static DispatchStackXMLSerializer getInstance() {
- return instance;
- }
-
- public Element dispatchStackToXML(DispatchStack stack) throws IOException,
- JDOMException {
- Element result = new Element(DISPATCH_STACK, T2_WORKFLOW_NAMESPACE);
- for (DispatchLayer<?> layer : stack.getLayers()) {
- result.addContent(dispatchLayerToXML(layer));
- }
- return result;
- }
-
- protected Element dispatchLayerToXML(DispatchLayer<?> layer)
- throws IOException, JDOMException {
- return DispatchLayerXMLSerializer.getInstance().dispatchLayerToXML(
- layer);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLDeserializer.java
deleted file mode 100644
index fc02ea9..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLDeserializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-import org.jdom.Element;
-
-public class IterationStrategyStackXMLDeserializer implements XMLSerializationConstants{
- private static IterationStrategyStackXMLDeserializer instance = new IterationStrategyStackXMLDeserializer();
-
- private IterationStrategyStackXMLDeserializer() {
-
- }
-
- public static IterationStrategyStackXMLDeserializer getInstance() {
- return instance;
- }
-
- public void deserializeIterationStrategyStack(Element element,IterationStrategyStack stack) {
- ((IterationStrategyStackImpl)stack).configureFromElement(element.getChild(ITERATION_STRATEGY,T2_WORKFLOW_NAMESPACE));
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializer.java
deleted file mode 100644
index 5f2d269..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializer.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-import org.jdom.Element;
-
-public class IterationStrategyStackXMLSerializer extends AbstractXMLSerializer {
-
- private static IterationStrategyStackXMLSerializer instance = new IterationStrategyStackXMLSerializer();
-
- private IterationStrategyStackXMLSerializer() {
-
- }
-
- public Element iterationStrategyStackToXML(
- IterationStrategyStack strategyStack) {
- Element result = new Element(ITERATION_STRATEGY_STACK,
- T2_WORKFLOW_NAMESPACE);
- result.addContent(((IterationStrategyStackImpl) strategyStack).asXML());
- return result;
- }
-
- public static IterationStrategyStackXMLSerializer getInstance() {
- return instance;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializer.java
deleted file mode 100644
index caa684b..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.jdom.Element;
-
-public class ProcessorXMLDeserializer extends AbstractXMLDeserializer {
- private static ProcessorXMLDeserializer instance = new ProcessorXMLDeserializer();
-
- private ProcessorXMLDeserializer() {
-
- }
-
- public static ProcessorXMLDeserializer getInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- public Processor deserializeProcessor(Element el,Map<String,Element>innerDataflowElements) throws EditException, ActivityConfigurationException, ClassNotFoundException, InstantiationException, IllegalAccessException, DeserializationException {
- String name=el.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- Processor result=edits.createProcessor(name);
-
- //activities
- Element activities=el.getChild(ACTIVITIES,T2_WORKFLOW_NAMESPACE);
- for (Element activity : (List<Element>)activities.getChildren(ACTIVITY,T2_WORKFLOW_NAMESPACE)) {
- Activity<?> a = ActivityXMLDeserializer.getInstance().deserializeActivity(activity,innerDataflowElements);
- edits.getAddActivityEdit(result, a).doEdit();
- }
-
- //ports
- Element inputPorts = el.getChild(PROCESSOR_INPUT_PORTS,T2_WORKFLOW_NAMESPACE);
- Element outputPorts = el.getChild(PROCESSOR_OUTPUT_PORTS,T2_WORKFLOW_NAMESPACE);
-
- for (Element inputPort : (List<Element>)inputPorts.getChildren(PROCESSOR_PORT,T2_WORKFLOW_NAMESPACE)) {
- String portName=inputPort.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- int portDepth = Integer.valueOf(inputPort.getChildText(DEPTH,T2_WORKFLOW_NAMESPACE));
- ProcessorInputPort port = edits.createProcessorInputPort(result, portName, portDepth);
- edits.getAddProcessorInputPortEdit(result, port).doEdit();
- }
-
- for (Element outputPort : (List<Element>)outputPorts.getChildren(PROCESSOR_PORT,T2_WORKFLOW_NAMESPACE)) {
- String portName=outputPort.getChildText(NAME,T2_WORKFLOW_NAMESPACE);
- int portDepth = Integer.valueOf(outputPort.getChildText(DEPTH,T2_WORKFLOW_NAMESPACE));
- int granularDepth = Integer.valueOf(outputPort.getChildText(GRANULAR_DEPTH,T2_WORKFLOW_NAMESPACE));
- ProcessorOutputPort port = edits.createProcessorOutputPort(result, portName, portDepth, granularDepth);
- edits.getAddProcessorOutputPortEdit(result,port).doEdit();
- }
-
- //TODO: annotations
-
- //Dispatch stack
- Element dispatchStack = el.getChild(DISPATCH_STACK,T2_WORKFLOW_NAMESPACE);
- DispatchStackXMLDeserializer.getInstance().deserializeDispatchStack(result, dispatchStack);
-
-
- //Iteration strategy
- Element iterationStrategyStack = el.getChild(ITERATION_STRATEGY_STACK,T2_WORKFLOW_NAMESPACE);
- IterationStrategyStackXMLDeserializer.getInstance().deserializeIterationStrategyStack(iterationStrategyStack, result.getIterationStrategy());
-
- return result;
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializer.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializer.java
deleted file mode 100644
index 19c2dd5..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializer.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-
-import org.jdom.Element;
-import org.jdom.JDOMException;
-
-public class ProcessorXMLSerializer extends AbstractXMLSerializer {
- private static ProcessorXMLSerializer instance = new ProcessorXMLSerializer();
-
- private ProcessorXMLSerializer() {
-
- }
-
- public static ProcessorXMLSerializer getInstance() {
- return instance;
- }
-
- public Element processorToXML(Processor processor) throws IOException,
- JDOMException {
-
- Element result = new Element(PROCESSOR, T2_WORKFLOW_NAMESPACE);
- Element nameElement = new Element(NAME, T2_WORKFLOW_NAMESPACE);
- nameElement.setText(processor.getLocalName());
- result.addContent(nameElement);
-
- // input and output ports
- Element inputPorts = processorInputPortsToXML(processor);
- Element outputPorts = processorOutputPortsToXML(processor);
- result.addContent(inputPorts);
- result.addContent(outputPorts);
-
- // annotations
- result.addContent(annotationsToXML(processor));
-
- // list of activities
- Element activities = new Element(ACTIVITIES, T2_WORKFLOW_NAMESPACE);
- for (Activity<?> activity : processor.getActivityList()) {
- activities.addContent(activityToXML(activity));
- }
- result.addContent(activities);
-
- // dispatch stack
- result.addContent(dispatchStackToXML(processor.getDispatchStack()));
-
- // iteration strategy
- result.addContent(iterationStrategyStackToXML(processor
- .getIterationStrategy()));
-
- return result;
- }
-
- protected Element dispatchStackToXML(DispatchStack stack)
- throws IOException, JDOMException {
- return DispatchStackXMLSerializer.getInstance().dispatchStackToXML(
- stack);
- }
-
- protected Element iterationStrategyStackToXML(
- IterationStrategyStack strategyStack) {
- return IterationStrategyStackXMLSerializer.getInstance()
- .iterationStrategyStackToXML(strategyStack);
- }
-
- protected Element activityToXML(Activity<?> activity) throws JDOMException,
- IOException {
- return ActivityXMLSerializer.getInstance().activityToXML(activity);
- }
-
- private Element processorOutputPortsToXML(Processor processor) {
- Element outputPorts = new Element(PROCESSOR_OUTPUT_PORTS,
- T2_WORKFLOW_NAMESPACE);
- for (ProcessorOutputPort port : processor.getOutputPorts()) {
- Element portElement = new Element(PROCESSOR_PORT,
- T2_WORKFLOW_NAMESPACE);
- Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
- Element depth = new Element(DEPTH, T2_WORKFLOW_NAMESPACE);
- Element granularDepth = new Element(GRANULAR_DEPTH,
- T2_WORKFLOW_NAMESPACE);
- name.setText(port.getName());
- depth.setText(String.valueOf(port.getDepth()));
- granularDepth.setText(String.valueOf(port.getGranularDepth()));
- portElement.addContent(name);
- portElement.addContent(depth);
- portElement.addContent(granularDepth);
- outputPorts.addContent(portElement);
- }
- return outputPorts;
- }
-
- private Element processorInputPortsToXML(Processor processor) {
- Element inputPorts = new Element(PROCESSOR_INPUT_PORTS,
- T2_WORKFLOW_NAMESPACE);
- for (ProcessorInputPort port : processor.getInputPorts()) {
- Element portElement = new Element(PROCESSOR_PORT,
- T2_WORKFLOW_NAMESPACE);
- Element name = new Element(NAME, T2_WORKFLOW_NAMESPACE);
- Element depth = new Element(DEPTH, T2_WORKFLOW_NAMESPACE);
- name.setText(port.getName());
- depth.setText(String.valueOf(port.getDepth()));
- portElement.addContent(name);
- portElement.addContent(depth);
- inputPorts.addContent(portElement);
- }
- return inputPorts;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerImpl.java
deleted file mode 100644
index 85802ea..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLDeserializerImpl.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.serialization.DeserializationException;
-
-import org.jdom.Element;
-
-/**
- * Implementation class that acts as the main entry point for deserialising a complete XML dataflow document into a dataflow instance.
- * @author Stuart Owen
- *
- */
-public class XMLDeserializerImpl implements XMLDeserializer, XMLSerializationConstants {
-
- Edits edits = new EditsImpl();
-
- public XMLDeserializerImpl() {
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializer#deserializeDataflow(org.jdom.Element)
- */
- public Dataflow deserializeDataflow(Element element)
- throws DeserializationException,EditException {
- Element topDataflow = findTopDataflow(element);
- if (topDataflow==null) throw new DeserializationException("No top level workflow defined in the XML document");
- Map<String,Element> innerDataflowElements = gatherInnerDataflows(element);
- try {
- return DataflowXMLDeserializer.getInstance().deserializeDataflow(topDataflow,innerDataflowElements);
- } catch (Exception e) {
- throw new DeserializationException("An error occurred deserializing the workflow:"+e.getMessage(),e);
- }
- }
-
- private Element findTopDataflow(Element element) {
- Element result = null;
- for (Object elObj : element.getChildren(DATAFLOW,T2_WORKFLOW_NAMESPACE)) {
- Element dataflowElement = (Element)elObj;
- if (DATAFLOW_ROLE_TOP.equals(dataflowElement.getAttribute(DATAFLOW_ROLE).getValue())) {
- result=dataflowElement;
- }
- }
- return result;
- }
-
- private Map<String, Element> gatherInnerDataflows(Element element) throws DeserializationException {
- Map<String,Element> result=new HashMap<String, Element>();
- for (Object elObj : element.getChildren(DATAFLOW,T2_WORKFLOW_NAMESPACE)) {
- Element dataflowElement = (Element)elObj;
- if (DATAFLOW_ROLE_NESTED.equals(dataflowElement.getAttribute(DATAFLOW_ROLE).getValue())) {
- String id = dataflowElement.getAttributeValue(DATAFLOW_ID);
- if (result.containsKey(id)) throw new DeserializationException("Duplicate workflow id:"+id);
- result.put(id,dataflowElement);
- }
- }
- return result;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializationConstants.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializationConstants.java
deleted file mode 100644
index 017dab8..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializationConstants.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import org.jdom.Namespace;
-
-public interface XMLSerializationConstants {
-
- static final String WORKFLOW_DOCUMENT_MIMETYPE="application/vnd.taverna.t2flow+xml";
-
- static final Namespace T2_WORKFLOW_NAMESPACE=Namespace.getNamespace("http://taverna.sf.net/2008/xml/t2flow");
-
- // XML element names
- static final String WORKFLOW = "workflow";
- static final String WORKFLOW_VERSION = "version";
-
-
- static final String DATAFLOW = "dataflow";
- static final String DATAFLOW_INPUT_PORTS="inputPorts";
- static final String DATAFLOW_OUTPUT_PORTS="outputPorts";
- static final String DATAFLOW_PORT="port";
-
- static final String PROCESSOR = "processor";
- static final String PROCESSORS = "processors";
- static final String PROCESSOR_INPUT_PORTS = "inputPorts";
- static final String PROCESSOR_OUTPUT_PORTS = "outputPorts";
-
- static final String DISPATCH_LAYER = "dispatchLayer";
-
- static final String ACTIVITIES = "activities";
- static final String ACTIVITY = "activity";
- static final String CONFIG_BEAN="configBean";
-
- static final String NAME="name";
-
- static final String JAVA = "java";
- static final String OUTPUT_MAP = "outputMap";
- static final String TO = "to";
- static final String FROM = "from";
- static final String MAP = "map";
- static final String INPUT_MAP = "inputMap";
- static final String CLASS = "class";
- static final String VERSION = "version";
- static final String ARTIFACT = "artifact";
- static final String GROUP = "group";
- static final String RAVEN = "raven";
- static final String DISPATCH_STACK = "dispatchStack";
- static final String ITERATION_STRATEGY_STACK = "iterationStrategyStack";
- static final String ITERATION_STRATEGY = "iteration";
- static final String CONDITIONS = "conditions";
- static final String CONDITION = "condition";
- static final String ANNOTATIONS = "annotations";
- static final String ANNOTATION = "annotation";
- static final String ANNOTATION_CHAIN = "annotation_chain";
-
- static final String DATALINK = "datalink";
- static final String DATALINKS = "datalinks";
- static final String DATALINK_TYPE="type";
-
- public enum DATALINK_TYPES {
- PROCESSOR("processor"),
- DATAFLOW("dataflow"),
- MERGE("merge");
-
- String value;
- DATALINK_TYPES(String value) {
- this.value=value;
- }
-
- public String toString() {
- return value;
- }
- };
-
- static final String SINK = "sink";
- static final String SOURCE = "source";
- static final String PORT = "port";
- static final String PROCESSOR_PORT = "port";
- static final String DEPTH="depth";
- static final String GRANULAR_DEPTH="granularDepth";
-
- static final String MERGE="merge";
- static final String MERGES="merges";
-
- //Attribute names
- static final String BEAN_ENCODING="encoding";
-
- static final String JDOMXML_ENCODING="jdomxml";
- static final String XSTREAM_ENCODING="xstream";
- static final String DATAFLOW_ENCODING="dataflow";
-
- static final String DATAFLOW_ROLE="role";
- static final String DATAFLOW_REFERENCE="ref";
- static final String DATAFLOW_ID="id";
-
- static final String PRODUCED_BY="producedBy";
-
- //Attribute values
- static final String DATAFLOW_ROLE_TOP="top";
- static final String DATAFLOW_ROLE_NESTED="nested";
- static final String UNSPECIFIED = "unspecified";
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerImpl.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerImpl.java
deleted file mode 100644
index a1b2c80..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/XMLSerializerImpl.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.serialization.SerializationException;
-
-import org.jdom.Element;
-
-/**
- * Implementation of the XML serialisation framework for serialising a dataflow instance into a jdom XML element.
- * <br>
- *
- * @author Stuart Owen
- *
- */
-public class XMLSerializerImpl implements XMLSerializer, XMLSerializationConstants {
-
- public XMLSerializerImpl() {
-
- }
-
- /* (non-Javadoc)
- * @see net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializer#serializeDataflow(net.sf.taverna.t2.workflowmodel.Dataflow)
- */
- public Element serializeDataflow(Dataflow dataflow)
- throws SerializationException {
- Set<Dataflow> innerDataflows = new HashSet<Dataflow>();
-
- gatherDataflows(dataflow,innerDataflows);
-
- Element result = new Element(WORKFLOW, T2_WORKFLOW_NAMESPACE);
- // For future use
- result.setAttribute(WORKFLOW_VERSION, "1");
- result.setAttribute(PRODUCED_BY, this.getProducedBy());
- Element dataflowElement = DataflowXMLSerializer.getInstance().serializeDataflow(dataflow);
- dataflowElement.setAttribute(DATAFLOW_ROLE, DATAFLOW_ROLE_TOP);
- result.addContent(dataflowElement);
-
- Set<String> outputIds = new HashSet<String>();
- for (Dataflow innerDataflow : innerDataflows) {
- String currentId = innerDataflow.getInternalIdentier();
- if (outputIds.add(currentId)) {
- Element innerDataflowElement = DataflowXMLSerializer.getInstance().serializeDataflow(innerDataflow);
- innerDataflowElement.setAttribute(DATAFLOW_ROLE,DATAFLOW_ROLE_NESTED);
- result.addContent(innerDataflowElement);
- }
- }
-
- return result;
- }
-
- private void gatherDataflows(Dataflow dataflow, Set<Dataflow> innerDataflows) {
- for (Processor p : dataflow.getProcessors()) {
- for (Activity<?> a : p.getActivityList()) {
- if (a.getConfiguration() instanceof Dataflow) {
- Dataflow df = (Dataflow) a.getConfiguration();
- if (!innerDataflows.contains(df)) {
- innerDataflows.add(df);
- gatherDataflows(df, innerDataflows);
- }
- }
- }
- }
-
- }
-
- private String producedBy = UNSPECIFIED;
-
- public void setProducedBy(String producedBy) {
- this.producedBy = producedBy;
- }
-
- public String getProducedBy() {
- return this.producedBy;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html
deleted file mode 100644
index a75ce76..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/serialization/xml/package.html
+++ /dev/null
@@ -1,3 +0,0 @@
-<body>
-A collection of utility classes responsible for the serialization/deserializtion to and from XML for a dataflow as a whole, and its internal components.
-</body>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/AnnotationTools.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/AnnotationTools.java
deleted file mode 100644
index 37014bd..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/AnnotationTools.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.utils;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import net.sf.taverna.raven.appconfig.ApplicationRuntime;
-import net.sf.taverna.raven.spi.SpiRegistry;
-import net.sf.taverna.t2.annotation.Annotated;
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.annotation.AppliesTo;
-import net.sf.taverna.t2.annotation.annotationbeans.AbstractTextualValueAssertion;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-
-import org.apache.log4j.Logger;
-
-public class AnnotationTools {
-
- private static Logger logger = Logger.getLogger(AnnotationTools.class);
-
- @SuppressWarnings("unchecked")
- private Iterable<Class> annotationBeanRegistry;
-
- private Edits edits;
-
- public AnnotationTools() {
- setAnnotationBeanRegistry(getSpiRegistry());
- setEdits(EditsRegistry.getEdits());
- }
-
- protected static Iterable<Class> getSpiRegistry() {
- return new SpiRegistry(ApplicationRuntime
- .getInstance().getRavenRepository(), AnnotationBeanSPI.class
- .getCanonicalName(), AnnotationTools.class.getClassLoader());
- }
-
- @SuppressWarnings("unchecked")
- public AnnotationTools(Iterable<Class> annotationBeanRegistry, Edits edits) {
- setAnnotationBeanRegistry(annotationBeanRegistry);
- setEdits(edits);
- }
-
- public Edit<?> addAnnotation(Annotated<?> annotated, AnnotationBeanSPI a) {
- return getEdits().getAddAnnotationChainEdit(annotated, a);
- }
-
- private Edits getEdits() {
- return edits;
- }
-
- @SuppressWarnings("unchecked")
- public AnnotationBeanSPI getAnnotation(Annotated<?> annotated,
- Class annotationClass) {
- AnnotationBeanSPI result = null;
- Date latestDate = null;
- for (AnnotationChain chain : annotated.getAnnotations()) {
- for (AnnotationAssertion<?> assertion : chain.getAssertions()) {
- AnnotationBeanSPI detail = assertion.getDetail();
- if (annotationClass.isInstance(detail)) {
- Date assertionDate = assertion.getCreationDate();
- if ((latestDate == null)
- || latestDate.before(assertionDate)) {
- result = detail;
- latestDate = assertionDate;
- }
- }
- }
- }
- return result;
- }
-
- @SuppressWarnings("unchecked")
- public Iterable<Class<? extends AnnotationBeanSPI>> getAnnotationBeanClasses() {
- // Mega casting mega trick!
- Iterable registry = getAnnotationBeanRegistry();
- return (Iterable<Class<? extends AnnotationBeanSPI>>) registry;
- }
-
- @SuppressWarnings("unchecked")
- public <T> List<Class<? extends T>> getAnnotationBeanClasses(
- Class<T> superClass) {
- List<Class<? extends T>> results = new ArrayList<Class<? extends T>>();
- for (Class<? extends AnnotationBeanSPI> annotationBeanClass : getAnnotationBeanClasses()) {
- if (superClass.isAssignableFrom(annotationBeanClass)) {
- results.add((Class<? extends T>) annotationBeanClass);
- }
- }
- return results;
- }
-
- @SuppressWarnings("unchecked")
- public List<Class> getAnnotatingClasses(Annotated annotated) {
- List<Class> result = new ArrayList<Class>();
- for (Class<? extends AbstractTextualValueAssertion> c : getAnnotationBeanClasses(AbstractTextualValueAssertion.class)) {
- AppliesTo appliesToAnnotation = (AppliesTo) c
- .getAnnotation(AppliesTo.class);
- if (appliesToAnnotation == null) {
- continue;
- }
- for (Class<?> target : appliesToAnnotation.targetObjectType()) {
- if (target.isInstance(annotated)) {
- result.add(c);
- }
- }
- }
- return result;
- }
-
- public Edit<?> setAnnotationString(Annotated<?> annotated, Class<?> c,
- String value) {
- AbstractTextualValueAssertion a = null;
- try {
- logger.info("Setting " + c.getCanonicalName() + " to " + value);
- a = (AbstractTextualValueAssertion) c.newInstance();
- } catch (InstantiationException e) {
- // TODO Auto-generated catch block
- logger.error(e);
- } catch (IllegalAccessException e) {
- // TODO Auto-generated catch block
- logger.error(e);
- }
- a.setText(value);
- return (addAnnotation(annotated, a));
- }
-
- @SuppressWarnings("unchecked")
- public String getAnnotationString(Annotated<?> annotated,
- Class annotationClass, String missingValue) {
- AbstractTextualValueAssertion a = (AbstractTextualValueAssertion) getAnnotation(
- annotated, annotationClass);
- if (a == null) {
- return missingValue;
- }
- return a.getText();
- }
-
- public void setEdits(Edits edits) {
- this.edits = edits;
- }
-
- public void setAnnotationBeanRegistry(Iterable<Class> annotationBeanRegistry) {
- this.annotationBeanRegistry = annotationBeanRegistry;
- }
-
- public Iterable<Class> getAnnotationBeanRegistry() {
- return annotationBeanRegistry;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/NamedWorkflowEntityComparator.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/NamedWorkflowEntityComparator.java
deleted file mode 100644
index a3fb9a7..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/NamedWorkflowEntityComparator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- **********************************************************************/
-package net.sf.taverna.t2.workflowmodel.utils;
-
-import java.util.Comparator;
-
-import net.sf.taverna.t2.workflowmodel.NamedWorkflowEntity;
-
-/**
- * Compare two named workflow entities (such as a Processor) by their local
- * name.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class NamedWorkflowEntityComparator implements
- Comparator<NamedWorkflowEntity> {
- public int compare(NamedWorkflowEntity o1, NamedWorkflowEntity o2) {
- return o1.getLocalName().compareToIgnoreCase(o2.getLocalName());
- }
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/PortComparator.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/PortComparator.java
deleted file mode 100644
index 9f42da2..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/PortComparator.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**********************************************************************
- * Copyright (C) 2009 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- **********************************************************************/
-package net.sf.taverna.t2.workflowmodel.utils;
-
-import java.util.Comparator;
-
-import net.sf.taverna.t2.workflowmodel.Port;
-
-/**
- * Compare two workflow ports by their name.
- *
- * @author Stian Soiland-Reyes
- *
- */
-public class PortComparator implements Comparator<Port> {
-
- public int compare(Port o1, Port o2) {
- return o1.getName().compareToIgnoreCase(o2.getName());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/Tools.java b/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/Tools.java
deleted file mode 100644
index 037581e..0000000
--- a/trunk/workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/utils/Tools.java
+++ /dev/null
@@ -1,955 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.utils;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Map.Entry;
-
-import net.sf.taverna.t2.workflowmodel.CompoundEdit;
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.InputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.MergeOutputPort;
-import net.sf.taverna.t2.workflowmodel.NamedWorkflowEntity;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.Port;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.TokenProcessingEntity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.NestedDataflow;
-
-/**
- * Various workflow model tools that can be helpful when constructing a
- * dataflow.
- * <p>
- * Not to be confused with the @deprecated
- * {@link net.sf.taverna.t2.workflowmodel.impl.Tools}
- *
- * @author David Withers
- * @author Stian Soiland-Reyes
- *
- */
-public class Tools {
-
- private static Edits edits = EditsRegistry.getEdits();
-
- /**
- * Find (and possibly create) an EventHandlingInputPort.
- * <p>
- * If the given inputPort is an instance of {@link EventHandlingInputPort},
- * it is returned directly. If it is an ActivityInputPort - the owning
- * processors (found by searching the dataflow) will be searced for a mapped
- * input port. If this cannot be found, one will be created and mapped. The
- * edits for this will be added to the editList and needs to be executed by
- * the caller.
- *
- * @see #findEventHandlingOutputPort(List, Dataflow, OutputPort)
- * @param editList
- * List of {@link Edit}s to append any required edits (yet to be
- * performed) to
- * @param dataflow
- * Dataflow containing the processors
- * @param inputPort
- * An EventHandlingInputPort or ActivityInputPort
- * @return The found or created EventHandlingInputPort
- */
- @SuppressWarnings("unchecked")
- protected static EventHandlingInputPort findEventHandlingInputPort(
- List<Edit<?>> editList, Dataflow dataflow, InputPort inputPort) {
- if (inputPort instanceof EventHandlingInputPort) {
- return (EventHandlingInputPort) inputPort;
- } else if (!(inputPort instanceof ActivityInputPort)) {
- throw new IllegalArgumentException("Unknown input port type for "
- + inputPort);
- }
- ActivityInputPort activityInput = (ActivityInputPort) inputPort;
- Collection<Processor> processors = Tools
- .getProcessorsWithActivityInputPort(dataflow, activityInput);
- if (processors.isEmpty()) {
- throw new IllegalArgumentException("Can't find ActivityInputPort "
- + activityInput.getName() + " in workflow " + dataflow);
- }
- // FIXME: Assumes only one matching processor
- Processor processor = processors.iterator().next();
- Activity activity = null;
- for (Activity checkActivity : processor.getActivityList()) {
- if (checkActivity.getInputPorts().contains(activityInput)) {
- activity = checkActivity;
- break;
- }
- }
- if (activity == null) {
- throw new IllegalArgumentException("Can't find activity for port "
- + activityInput.getName() + "within processor " + processor);
- }
-
- ProcessorInputPort input = Tools.getProcessorInputPort(processor,
- activity, activityInput);
- if (input != null) {
- return input;
- }
- // port doesn't exist so create a processor port and map it
- String processorPortName = uniquePortName(activityInput.getName(),
- processor.getInputPorts());
- ProcessorInputPort processorInputPort = edits.createProcessorInputPort(
- processor, processorPortName, activityInput.getDepth());
- editList.add(edits.getAddProcessorInputPortEdit(processor,
- processorInputPort));
- editList.add(edits.getAddActivityInputPortMappingEdit(activity,
- processorPortName, activityInput.getName()));
- return processorInputPort;
- }
-
- /**
- * Find (and possibly create) an EventForwardingOutputPort.
- * <p>
- * If the given outputPort is an instance of
- * {@link EventForwardingOutputPort}, it is returned directly. If it is an
- * ActivityOutputPort - the owning processors (found by searching the
- * dataflow) will be searced for a mapped output port. If this cannot be
- * found, one will be created and mapped. The edits for this will be added
- * to the editList and needs to be executed by the caller.
- *
- * @see #findEventHandlingInputPort(List, Dataflow, InputPort)
- * @param editList
- * List of {@link Edit}s to append any required edits (yet to be
- * performed) to
- * @param dataflow
- * Dataflow containing the processors
- * @param outputPort
- * An EventForwardingOutputPort or ActivityOutputPort
- * @return The found or created EventForwardingOutputPort
- */
- @SuppressWarnings("unchecked")
- protected static EventForwardingOutputPort findEventHandlingOutputPort(
- List<Edit<?>> editList, Dataflow dataflow, OutputPort outputPort) {
- if (outputPort instanceof EventForwardingOutputPort) {
- return (EventForwardingOutputPort) outputPort;
- } else if (!(outputPort instanceof ActivityOutputPort)) {
- throw new IllegalArgumentException("Unknown output port type for "
- + outputPort);
- }
- ActivityOutputPort activityOutput = (ActivityOutputPort) outputPort;
- Collection<Processor> processors = Tools
- .getProcessorsWithActivityOutputPort(dataflow, activityOutput);
- if (processors.isEmpty()) {
- throw new IllegalArgumentException("Can't find ActivityOutputPort "
- + activityOutput.getName() + " in workflow " + dataflow);
- }
- // FIXME: Assumes only one matching processor
- Processor processor = processors.iterator().next();
- Activity activity = null;
- for (Activity checkActivity : processor.getActivityList()) {
- if (checkActivity.getOutputPorts().contains(activityOutput)) {
- activity = checkActivity;
- break;
- }
- }
- if (activity == null) {
- throw new IllegalArgumentException("Can't find activity for port "
- + activityOutput.getName() + "within processor "
- + processor);
- }
-
- ProcessorOutputPort processorOutputPort = Tools.getProcessorOutputPort(
- processor, activity, activityOutput);
- if (processorOutputPort != null) {
- return processorOutputPort;
- }
- // port doesn't exist so create a processor port and map it
- String processorPortName = uniquePortName(activityOutput.getName(),
- processor.getOutputPorts());
- processorOutputPort = edits.createProcessorOutputPort(processor,
- processorPortName, activityOutput.getDepth(), activityOutput
- .getGranularDepth());
- editList.add(edits.getAddProcessorOutputPortEdit(processor,
- processorOutputPort));
- editList.add(edits.getAddActivityOutputPortMappingEdit(activity,
- processorPortName, activityOutput.getName()));
-
- return processorOutputPort;
- }
-
- /**
- * Creates an Edit that creates a Datalink between a source and sink port
- * and connects the Datalink.
- *
- * If the sink port already has a Datalink connected this method checks if a
- * new Merge is required and creates and connects the required Datalinks.
- *
- * @param dataflow
- * the Dataflow to add the Datalink to
- * @param source
- * the source of the Datalink
- * @param sink
- * the source of the Datalink
- * @return an Edit that creates a Datalink between a source and sink port
- * and connects the Datalink
- */
- public static Edit<?> getCreateAndConnectDatalinkEdit(Dataflow dataflow,
- EventForwardingOutputPort source, EventHandlingInputPort sink) {
- Edit<?> edit = null;
-
- Datalink incomingLink = sink.getIncomingLink();
- if (incomingLink == null) {
- Datalink datalink = edits.createDatalink(source, sink);
- edit = edits.getConnectDatalinkEdit(datalink);
- } else {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
-
- Merge merge = null;
- int counter = 0; // counter for merge input port names
- if (incomingLink.getSource() instanceof MergeOutputPort) {
- merge = ((MergeOutputPort) incomingLink.getSource()).getMerge();
- } else {
- merge = edits.createMerge(dataflow);
- editList.add(edits.getAddMergeEdit(dataflow, merge));
- editList.add(edits.getDisconnectDatalinkEdit(incomingLink));
- MergeInputPort mergeInputPort = edits.createMergeInputPort(
- merge, getUniqueMergeInputPortName(merge, incomingLink
- .getSource().getName()
- + "To" + merge.getLocalName() + "_input",
- counter++), incomingLink.getSink().getDepth());
- editList.add(edits.getAddMergeInputPortEdit(merge,
- mergeInputPort));
- Datalink datalink = edits.createDatalink(incomingLink
- .getSource(), mergeInputPort);
- editList.add(edits.getConnectDatalinkEdit(datalink));
- datalink = edits.createDatalink(merge.getOutputPort(),
- incomingLink.getSink());
- editList.add(edits.getConnectDatalinkEdit(datalink));
- }
- MergeInputPort mergeInputPort = edits.createMergeInputPort(merge,
- getUniqueMergeInputPortName(merge, source.getName() + "To"
- + merge.getLocalName() + "_input", counter), sink
- .getDepth());
- editList.add(edits.getAddMergeInputPortEdit(merge, mergeInputPort));
- Datalink datalink = edits.createDatalink(source, mergeInputPort);
- editList.add(edits.getConnectDatalinkEdit(datalink));
-
- edit = new CompoundEdit(editList);
- }
-
- return edit;
- }
-
- /**
- * Get an {@link Edit} that will link the given output port to the given
- * input port.
- * <p>
- * The output port can be an {@link EventForwardingOutputPort} (such as an
- * {@link ProcessorOutputPort}, or an {@link ActivityOutputPort}. The input
- * port can be an {@link EventHandlingInputPort} (such as an
- * {@link ProcessorInputPort}, or an {@link ActivityInputPort}.
- * <p>
- * If an input and/or output port is an activity port, processors in the
- * given dataflow will be searched for matching mappings, create the
- * processor port and mapping if needed, before constructing the edits for
- * adding the datalink.
- *
- * @param dataflow
- * Dataflow (indirectly) containing ports
- * @param outputPort
- * An {@link EventForwardingOutputPort} or an
- * {@link ActivityOutputPort}
- * @param inputPort
- * An {@link EventHandlingInputPort} or an
- * {@link ActivityInputPort}
- * @return A compound edit for creating and connecting the datalink and any
- * neccessary processor ports and mappings
- */
- public static Edit<?> getCreateAndConnectDatalinkEdit(Dataflow dataflow,
- OutputPort outputPort, InputPort inputPort) {
-
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- EventHandlingInputPort sink = findEventHandlingInputPort(editList,
- dataflow, inputPort);
- EventForwardingOutputPort source = findEventHandlingOutputPort(
- editList, dataflow, outputPort);
- editList.add(getCreateAndConnectDatalinkEdit(dataflow, source, sink));
- return new CompoundEdit(editList);
- }
-
- /**
- * Find a unique port name given a list of existing ports.
- * <p>
- * If needed, the returned port name will be prefixed with an underscore and a number,
- * starting from 2. (The original being 'number 1')
- * <p>
- * Although not strictly needed by Taverna, for added user friendliness the
- * case of the existing port names are ignored when checking for uniqueness.
- *
- * @see #uniqueProcessorName(String, Dataflow)
- *
- * @param suggestedPortName
- * Port name suggested for new port
- * @param existingPorts
- * Collection of existing {@link Port}s
- * @return A port name unique for the given collection of port
- */
- public static String uniquePortName(String suggestedPortName,
- Collection<? extends Port> existingPorts) {
- // Make sure we have a unique port name
- Set<String> existingNames = new HashSet<String>();
- for (Port existingPort : existingPorts) {
- existingNames.add(existingPort.getName().toLowerCase());
- }
- String candidateName = suggestedPortName;
- long counter = 2;
- while (existingNames.contains(candidateName.toLowerCase())) {
- candidateName = suggestedPortName + "_" + counter++;
- }
- return candidateName;
- }
-
- public static Edit<?> getMoveDatalinkSinkEdit(Dataflow dataflow,
- Datalink datalink, EventHandlingInputPort sink) {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- editList.add(edits.getDisconnectDatalinkEdit(datalink));
- if (datalink.getSink() instanceof ProcessorInputPort) {
- editList
- .add(getRemoveProcessorInputPortEdit((ProcessorInputPort) datalink
- .getSink()));
- }
- editList.add(getCreateAndConnectDatalinkEdit(dataflow, datalink
- .getSource(), sink));
- return new CompoundEdit(editList);
- }
-
- public static Edit<?> getDisconnectDatalinkAndRemovePortsEdit(
- Datalink datalink) {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- editList.add(edits.getDisconnectDatalinkEdit(datalink));
- if (datalink.getSource() instanceof ProcessorOutputPort) {
- ProcessorOutputPort processorOutputPort = (ProcessorOutputPort) datalink
- .getSource();
- if (processorOutputPort.getOutgoingLinks().size() == 1) {
- editList
- .add(getRemoveProcessorOutputPortEdit(processorOutputPort));
- }
- }
- if (datalink.getSink() instanceof ProcessorInputPort) {
- editList
- .add(getRemoveProcessorInputPortEdit((ProcessorInputPort) datalink
- .getSink()));
- }
- return new CompoundEdit(editList);
- }
-
- public static Edit<?> getRemoveProcessorOutputPortEdit(
- ProcessorOutputPort port) {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- Processor processor = port.getProcessor();
- editList.add(edits.getRemoveProcessorOutputPortEdit(
- port.getProcessor(), port));
- for (Activity<?> activity : processor.getActivityList()) {
- editList.add(edits.getRemoveActivityOutputPortMappingEdit(activity,
- port.getName()));
- }
- return new CompoundEdit(editList);
- }
-
- public static Edit<?> getRemoveProcessorInputPortEdit(
- ProcessorInputPort port) {
- List<Edit<?>> editList = new ArrayList<Edit<?>>();
- Processor processor = port.getProcessor();
- editList.add(edits.getRemoveProcessorInputPortEdit(port.getProcessor(),
- port));
- for (Activity<?> activity : processor.getActivityList()) {
- editList.add(edits.getRemoveActivityInputPortMappingEdit(activity,
- port.getName()));
- }
- return new CompoundEdit(editList);
- }
-
- public static ProcessorInputPort getProcessorInputPort(Processor processor,
- Activity<?> activity, InputPort activityInputPort) {
- ProcessorInputPort result = null;
- for (Entry<String, String> mapEntry : activity.getInputPortMapping()
- .entrySet()) {
- if (mapEntry.getValue().equals(activityInputPort.getName())) {
- for (ProcessorInputPort processorInputPort : processor
- .getInputPorts()) {
- if (processorInputPort.getName().equals(mapEntry.getKey())) {
- result = processorInputPort;
- break;
- }
- }
- break;
- }
- }
- return result;
- }
-
- public static ProcessorOutputPort getProcessorOutputPort(
- Processor processor, Activity<?> activity,
- OutputPort activityOutputPort) {
- ProcessorOutputPort result = null;
- for (Entry<String, String> mapEntry : activity.getOutputPortMapping()
- .entrySet()) {
- if (mapEntry.getValue().equals(activityOutputPort.getName())) {
- for (ProcessorOutputPort processorOutputPort : processor
- .getOutputPorts()) {
- if (processorOutputPort.getName().equals(mapEntry.getKey())) {
- result = processorOutputPort;
- break;
- }
- }
- break;
- }
- }
- return result;
- }
-
- public static ActivityInputPort getActivityInputPort(Activity<?> activity,
- String portName) {
- ActivityInputPort activityInputPort = null;
- for (ActivityInputPort inputPort : activity.getInputPorts()) {
- if (inputPort.getName().equals(portName)) {
- activityInputPort = inputPort;
- break;
- }
- }
- return activityInputPort;
- }
-
- public static OutputPort getActivityOutputPort(Activity<?> activity,
- String portName) {
- OutputPort activityOutputPort = null;
- for (OutputPort outputPort : activity.getOutputPorts()) {
- if (outputPort.getName().equals(portName)) {
- activityOutputPort = outputPort;
- break;
- }
- }
- return activityOutputPort;
- }
-
- public static String getUniqueMergeInputPortName(Merge merge, String name,
- int count) {
- String uniqueName = name + count;
- for (MergeInputPort mergeInputPort : merge.getInputPorts()) {
- if (mergeInputPort.getName().equals(uniqueName)) {
- return getUniqueMergeInputPortName(merge, name, ++count);
- }
- }
- return uniqueName;
- }
-
- public static Collection<Processor> getProcessorsWithActivity(
- Dataflow dataflow, Activity<?> activity) {
- Set<Processor> processors = new HashSet<Processor>();
- for (Processor processor : dataflow.getProcessors()) {
- if (processor.getActivityList().contains(activity)) {
- processors.add(processor);
- }
- }
- return processors;
-
- }
-
- public static Collection<Processor> getProcessorsWithActivityInputPort(
- Dataflow dataflow, ActivityInputPort inputPort) {
-
- Set<Processor> processors = new HashSet<Processor>();
- for (Processor processor : dataflow.getProcessors()) {
-
- // Does it contain a nested workflow?
- if (containsNestedWorkflow(processor)) {
- // Get the nested workflow and check all its nested processors
- Dataflow nestedWorkflow = ((NestedDataflow) processor
- .getActivityList().get(0)).getNestedDataflow();
- Collection<Processor> nested_processors = getProcessorsWithActivityInputPort(
- nestedWorkflow, inputPort);
- if (!nested_processors.isEmpty())
- processors.addAll(nested_processors);
- }
-
- // Check all processor's activities (even if the processor contained
- // a nested workflow,
- // as its dataflow activity still contains input and output ports)
- for (Activity<?> activity : processor.getActivityList()) {
-
- if (activity.getInputPorts().contains(inputPort)) {
- processors.add(processor);
- }
- }
- }
- return processors;
- }
-
- public static Collection<Processor> getProcessorsWithActivityOutputPort(
- Dataflow dataflow, OutputPort outputPort) {
- Set<Processor> processors = new HashSet<Processor>();
- for (Processor processor : dataflow.getProcessors()) {
-
- // Does it contain a nested workflow?
- if (containsNestedWorkflow(processor)) {
- // Get the nested workflow and check all its nested processors
- Dataflow nestedWorkflow = ((NestedDataflow) processor
- .getActivityList().get(0)).getNestedDataflow();
- Collection<Processor> nested_processors = getProcessorsWithActivityOutputPort(
- nestedWorkflow, outputPort);
- if (!nested_processors.isEmpty())
- processors.addAll(nested_processors);
- }
-
- // Check all processor's activities (even if the processor contained
- // a nested workflow,
- // as its dataflow activity still contains input and output ports)
- for (Activity<?> activity : processor.getActivityList()) {
-
- if (activity.getOutputPorts().contains(outputPort)) {
- processors.add(processor);
- }
- }
- }
- return processors;
- }
-
- /**
- * Get the TokenProcessingEntity (Processor, Merge or Dataflow) from the
- * workflow that contains the given EventForwardingOutputPort. This can be
- * an output port of a Processor or a Merge or an input port of a Dataflow
- * that has an internal EventForwardingOutputPort attached to it.
- *
- * @param port
- * @param workflow
- * @return
- */
- public static TokenProcessingEntity getTokenProcessingEntityWithEventForwardingOutputPort(
- EventForwardingOutputPort port, Dataflow workflow) {
-
- // First check the workflow's inputs
- for (DataflowInputPort input : workflow.getInputPorts()) {
- if (input.getInternalOutputPort().equals(port)) {
- return workflow;
- }
- }
-
- // Check workflow's merges
- List<? extends Merge> merges = workflow.getMerges();
- for (Merge merge : merges) {
- if (merge.getOutputPort().equals(port)) {
- return merge;
- }
- }
-
- // Check workflow's processors
- List<? extends Processor> processors = workflow.getProcessors();
- for (Processor processor : processors) {
- for (OutputPort output : processor.getOutputPorts()) {
- if (output.equals(port)) {
- return processor;
- }
- }
-
- // If processor contains a nested workflow - descend into it
- if (containsNestedWorkflow(processor)) {
- Dataflow nestedWorkflow = ((NestedDataflow) processor
- .getActivityList().get(0)).getNestedDataflow();
- TokenProcessingEntity entity = getTokenProcessingEntityWithEventForwardingOutputPort(
- port, nestedWorkflow);
- if (entity != null) {
- return entity;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Get the TokenProcessingEntity (Processor, Merge or Dataflow) from the
- * workflow that contains the given target EventHandlingInputPort. This can
- * be an input port of a Processor or a Merge or an output port of a
- * Dataflow that has an internal EventHandlingInputPort attached to it.
- *
- * @param port
- * @param workflow
- * @return
- */
- public static TokenProcessingEntity getTokenProcessingEntityWithEventHandlingInputPort(
- EventHandlingInputPort port, Dataflow workflow) {
-
- // First check the workflow's outputs
- for (DataflowOutputPort output : workflow.getOutputPorts()) {
- if (output.getInternalInputPort().equals(port)) {
- return workflow;
- }
- }
-
- // Check workflow's merges
- List<? extends Merge> merges = workflow.getMerges();
- for (Merge merge : merges) {
- for (EventHandlingInputPort input : merge.getInputPorts()) {
- if (input.equals(port)) {
- return merge;
- }
- }
- }
-
- // Check workflow's processors
- List<? extends Processor> processors = workflow.getProcessors();
- for (Processor processor : processors) {
- for (EventHandlingInputPort output : processor.getInputPorts()) {
- if (output.equals(port)) {
- return processor;
- }
- }
-
- // If processor contains a nested workflow - descend into it
- if (containsNestedWorkflow(processor)) {
- Dataflow nestedWorkflow = ((NestedDataflow) processor
- .getActivityList().get(0)).getNestedDataflow();
- TokenProcessingEntity entity = getTokenProcessingEntityWithEventHandlingInputPort(
- port, nestedWorkflow);
- if (entity != null) {
- return entity;
- }
- }
- }
-
- return null;
- }
-
- /**
- * Returns true if processor contains a nested workflow.
- */
- public static boolean containsNestedWorkflow(Processor processor) {
- return ((!processor.getActivityList().isEmpty()) && processor
- .getActivityList().get(0) instanceof NestedDataflow);
- }
-
- /**
- * Find processors that a given processor can connect to downstream.
- * <p>
- * This is calculated as all processors in the dataflow, except the
- * processor itself, and any processor <em>upstream</em>, following both
- * data links and conditional links.
- *
- * @see #possibleUpStreamProcessors(Dataflow, Processor)
- * @see #splitProcessors(Collection, Processor)
- *
- * @param dataflow
- * Dataflow from where to find processors
- * @param processor
- * Processor which is to be connected
- * @return A set of possible downstream processors
- */
- public static Set<Processor> possibleDownStreamProcessors(
- Dataflow dataflow, Processor processor) {
- ProcessorSplit splitProcessors = splitProcessors(dataflow
- .getProcessors(), processor);
- Set<Processor> possibles = new HashSet<Processor>(splitProcessors
- .getUnconnected());
- possibles.addAll(splitProcessors.getDownStream());
- return possibles;
- }
-
- /**
- * Find processors that a given processor can connect to upstream.
- * <p>
- * This is calculated as all processors in the dataflow, except the
- * processor itself, and any processor <em>downstream</em>, following both
- * data links and conditional links.
- *
- * @see #possibleDownStreamProcessors(Dataflow, Processor)
- * @see #splitProcessors(Collection, Processor)
- *
- * @param dataflow
- * Dataflow from where to find processors
- * @param processor
- * Processor which is to be connected
- * @return A set of possible downstream processors
- */
- public static Set<Processor> possibleUpStreamProcessors(Dataflow dataflow,
- Processor firstProcessor) {
- ProcessorSplit splitProcessors = splitProcessors(dataflow
- .getProcessors(), firstProcessor);
- Set<Processor> possibles = new HashSet<Processor>(splitProcessors
- .getUnconnected());
- possibles.addAll(splitProcessors.getUpStream());
- return possibles;
- }
-
- /**
- *
- * @param processors
- * @param splitPoint
- * @return
- */
- public static ProcessorSplit splitProcessors(
- Collection<? extends Processor> processors, Processor splitPoint) {
- Set<Processor> upStream = new HashSet<Processor>();
- Set<Processor> downStream = new HashSet<Processor>();
- Set<TokenProcessingEntity> queue = new HashSet<TokenProcessingEntity>();
-
- queue.add(splitPoint);
-
- // First let's go upstream
- while (!queue.isEmpty()) {
- TokenProcessingEntity investigate = queue.iterator().next();
- queue.remove(investigate);
- if (investigate instanceof Processor) {
- Processor processor = (Processor) investigate;
- List<? extends Condition> preConditions = processor
- .getPreconditionList();
- for (Condition condition : preConditions) {
- Processor upstreamProc = condition.getControl();
- if (!upStream.contains(upstreamProc)) {
- upStream.add(upstreamProc);
- queue.add(upstreamProc);
- }
- }
- }
- for (EventHandlingInputPort inputPort : investigate.getInputPorts()) {
- Datalink incomingLink = inputPort.getIncomingLink();
- if (incomingLink == null) {
- continue;
- }
- EventForwardingOutputPort source = incomingLink.getSource();
- if (source instanceof ProcessorOutputPort) {
- Processor upstreamProc = ((ProcessorOutputPort) source)
- .getProcessor();
- if (!upStream.contains(upstreamProc)) {
- upStream.add(upstreamProc);
- queue.add(upstreamProc);
- }
- } else if (source instanceof MergeOutputPort) {
- Merge merge = ((MergeOutputPort) source).getMerge();
- queue.add(merge);
- // The merge it self doesn't count as a processor
- } else {
- // Ignore
- }
- }
- }
- // Then downstream
- queue.add(splitPoint);
- while (!queue.isEmpty()) {
- TokenProcessingEntity investigate = queue.iterator().next();
- queue.remove(investigate);
- if (investigate instanceof Processor) {
- Processor processor = (Processor) investigate;
- List<? extends Condition> controlledConditions = processor
- .getControlledPreconditionList();
- for (Condition condition : controlledConditions) {
- Processor downstreamProc = condition.getTarget();
- if (!downStream.contains(downstreamProc)) {
- downStream.add(downstreamProc);
- queue.add(downstreamProc);
- }
- }
- }
-
- for (EventForwardingOutputPort outputPort : investigate
- .getOutputPorts()) {
- for (Datalink datalink : outputPort.getOutgoingLinks()) {
- EventHandlingInputPort sink = datalink.getSink();
- if (sink instanceof ProcessorInputPort) {
- Processor downstreamProcc = ((ProcessorInputPort) sink)
- .getProcessor();
- if (!downStream.contains(downstreamProcc)) {
- downStream.add(downstreamProcc);
- queue.add(downstreamProcc);
- }
- } else if (sink instanceof MergeInputPort) {
- Merge merge = ((MergeInputPort) sink).getMerge();
- queue.add(merge);
- // The merge it self doesn't count as a processor
- } else {
- // Ignore dataflow ports
- }
- }
- }
- }
- Set<Processor> undecided = new HashSet<Processor>(processors);
- undecided.remove(splitPoint);
- undecided.removeAll(upStream);
- undecided.removeAll(downStream);
- return new ProcessorSplit(splitPoint, upStream, downStream, undecided);
- }
-
- /**
- * Find the first processor that contains an activity that has the given
- * activity input port. See #get
- *
- * @param dataflow
- * @param targetPort
- * @return
- */
- public static Processor getFirstProcessorWithActivityInputPort(
- Dataflow dataflow, ActivityInputPort targetPort) {
- Collection<Processor> processorsWithActivityPort = getProcessorsWithActivityInputPort(
- dataflow, targetPort);
- for (Processor processor : processorsWithActivityPort) {
- return processor;
- }
- return null;
- }
-
- public static Processor getFirstProcessorWithActivityOutputPort(
- Dataflow dataflow, ActivityOutputPort targetPort) {
- Collection<Processor> processorsWithActivityPort = getProcessorsWithActivityOutputPort(
- dataflow, targetPort);
- for (Processor processor : processorsWithActivityPort) {
- return processor;
- }
- return null;
- }
-
- /**
- * Find a unique processor name for the supplied Dataflow, based upon the
- * preferred name. If needed, an underscore and a numeric suffix is added to
- * the preferred name, and incremented until it is unique, starting from 2.
- * (The original being 'number 1')
- * <p>
- * Note that this method checks the uniqueness against the names of all
- * {@link NamedWorkflowEntity}s, including {@link Merge}s.
- * <p>
- * Although not strictly needed by Taverna, for added user friendliness the
- * case of the existing port names are ignored when checking for uniqueness.
- *
- * @param preferredName
- * the preferred name for the Processor
- * @param dataflow
- * the dataflow for which the Processor name needs to be unique
- * @return A unique processor name
- */
- public static String uniqueProcessorName(String preferredName,
- Dataflow dataflow) {
-
- Set<String> existingNames = new HashSet<String>();
-
- for (NamedWorkflowEntity entity : dataflow
- .getEntities(NamedWorkflowEntity.class)) {
- existingNames.add(entity.getLocalName().toLowerCase());
- }
- String uniqueName = preferredName;
- long suffix = 2;
- while (existingNames.contains(uniqueName.toLowerCase())) {
- uniqueName = preferredName + "_" + suffix++;
- }
- return uniqueName;
- }
-
- /**
- * Result bean returned from
- * {@link Tools#splitProcessors(Collection, Processor)}.
- *
- * @author Stian Soiland-Reyes
- *
- */
- public static class ProcessorSplit {
-
- private final Processor splitPoint;
- private final Set<Processor> upStream;
- private final Set<Processor> downStream;
- private final Set<Processor> unconnected;
-
- /**
- * Processor that was used as a split point.
- *
- * @return Split point processor
- */
- public Processor getSplitPoint() {
- return splitPoint;
- }
-
- /**
- * Processors that are upstream from the split point.
- *
- * @return Upstream processors
- */
- public Set<Processor> getUpStream() {
- return upStream;
- }
-
- /**
- * Processors that are downstream from the split point.
- *
- * @return Downstream processors
- */
- public Set<Processor> getDownStream() {
- return downStream;
- }
-
- /**
- * Processors that are unconnected to the split point.
- * <p>
- * These are processors in the dataflow that are neither upstream,
- * downstream or the split point itself.
- * <p>
- * Note that this does not imply a total graph separation, for instance
- * processors in {@link #getUpStream()} might have some of these
- * unconnected processors downstream, but not along the path to the
- * {@link #getSplitPoint()}, or they could be upstream from any
- * processor in {@link #getDownStream()}.
- *
- * @return Processors unconnected from the split point
- */
- public Set<Processor> getUnconnected() {
- return unconnected;
- }
-
- /**
- * Construct a new processor split result.
- *
- * @param splitPoint
- * Processor used as split point
- * @param upStream
- * Processors that are upstream from split point
- * @param downStream
- * Processors that are downstream from split point
- * @param unconnected
- * The rest of the processors, that are by definition
- * unconnected to split point
- */
- public ProcessorSplit(Processor splitPoint, Set<Processor> upStream,
- Set<Processor> downStream, Set<Processor> unconnected) {
- this.splitPoint = splitPoint;
- this.upStream = upStream;
- this.downStream = downStream;
- this.unconnected = unconnected;
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationBeanSPI b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationBeanSPI
deleted file mode 100644
index 513d59e..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationBeanSPI
+++ /dev/null
@@ -1,8 +0,0 @@
-net.sf.taverna.t2.annotation.annotationbeans.Author
-net.sf.taverna.t2.annotation.annotationbeans.DescriptiveTitle
-net.sf.taverna.t2.annotation.annotationbeans.FreeTextDescription
-net.sf.taverna.t2.annotation.annotationbeans.HostInstitution
-#net.sf.taverna.t2.annotation.annotationbeans.MimeType
-net.sf.taverna.t2.annotation.annotationbeans.DocumentationUrl
-net.sf.taverna.t2.annotation.annotationbeans.Optional
-net.sf.taverna.t2.annotation.annotationbeans.ExampleValue
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationSourceSPI b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationSourceSPI
deleted file mode 100644
index 051c82b..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.AnnotationSourceSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.annotation.URISource
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.CurationEventBeanSPI b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.CurationEventBeanSPI
deleted file mode 100644
index e812aec..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.annotation.CurationEventBeanSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.annotation.DisputeEventDetails
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.Edits b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.Edits
deleted file mode 100644
index 96c39a9..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.Edits
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workflowmodel.impl.EditsImpl
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
deleted file mode 100644
index 66797ac..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.health.HealthChecker
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workflowmodel.impl.ProcessorHealthChecker
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializer b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializer
deleted file mode 100644
index e695d96..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializer
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workflowmodel.serialization.xml.XMLDeserializerImpl
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializer b/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializer
deleted file mode 100755
index 1333a57..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/META-INF/services/net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializer
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.workflowmodel.serialization.xml.XMLSerializerImpl
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/main/resources/provenanceContext.xml b/trunk/workflowmodel-impl/src/main/resources/provenanceContext.xml
deleted file mode 100644
index 9533e0f..0000000
--- a/trunk/workflowmodel-impl/src/main/resources/provenanceContext.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- Context providing ProvenanceItems for the workflow facade and dispatch stack -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:raven="http://taverna.sf.net/schema/artifact-support"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
- http://taverna.sf.net/schema/artifact-support
- http://taverna.sf.net/schema/artifact-support/artifact-support.xsd">
-
- <!--<import resource="context-parts/raven_local.xml" />
- <import resource="context-parts/dao_inmemory.xml" />
- <import resource="context-parts/componentservices.xml" />
- <import resource="context-parts/referenceservice.xml" />
-
- -->
- <bean id="workflowProvenanceItem"
- raven:artifact="net.sf.taverna.t2.core:provenanceconnector-impl:0.8"
- raven:repository="raven.repository"
- class="net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem" />
-
-</beans>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotationRegistries.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotationRegistries.java
deleted file mode 100644
index 206b97d..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotationRegistries.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import net.sf.taverna.t2.annotation.spi.AnnotationBeanRegistry;
-import net.sf.taverna.t2.annotation.spi.AnnotationSourceRegistry;
-import net.sf.taverna.t2.annotation.spi.CurationEventBeanRegistry;
-
-import org.junit.Test;
-
-public class TestAnnotationRegistries {
-
- @Test
- public void testAnnotationBeanSPI() {
-
- AnnotationBeanRegistry registry = new AnnotationBeanRegistry();
- for (AnnotationBeanSPI bean:registry.getInstances()){
- System.out.println(bean.getClass().getCanonicalName());
- }
-
- }
-
- @Test
- public void testAnnotationSourceSPICurationEventBeanSPI() {
-
- AnnotationSourceRegistry registry = new AnnotationSourceRegistry();
- for (AnnotationSourceSPI source:registry.getInstances()) {
- System.out.println(source.getClass().getCanonicalName());
- }
-
- }
-
- @Test
- public void testCurationEventBeanSPI() {
-
- CurationEventBeanRegistry registry = new CurationEventBeanRegistry();
- for (CurationEventBeanSPI bean:registry.getInstances()) {
- System.out.println(bean.getClass().getCanonicalName());
- }
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotations.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotations.java
deleted file mode 100644
index c1f8324..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/annotation/TestAnnotations.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation;
-
-import static org.junit.Assert.*;
-
-import java.lang.annotation.Annotation;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.annotation.annotationbeans.FreeTextDescription;
-import net.sf.taverna.t2.annotation.annotationbeans.MimeType;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-import net.sf.taverna.t2.workflowmodel.impl.DummyDataflow;
-
-import org.junit.Test;
-
-public class TestAnnotations {
-
- @SuppressWarnings("unchecked")
- @Test
- public void getAnnotationsForADataFlow() {
-
- Edits edits = EditsRegistry.getEdits();
-
- FreeTextDescription freeTextDescription = new FreeTextDescription();
- freeTextDescription.setText("i am the mime type for some object");
- MimeType mimeType = new MimeType();
- mimeType.setText("text/plain");
- Person person1 = new PersonImpl("A person");
- Person person2 = new PersonImpl("Another person");
- List<Person> personList = new ArrayList<Person>();
- personList.add(person1);
- personList.add(person2);
-
- @SuppressWarnings("unused")
- AnnotationSourceSPI annotationSource = null;
- try {
- annotationSource = new URISource(new URI("http://google.com"));
- } catch (URISyntaxException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- AnnotationAssertion annotationAssertionImpl = new AnnotationAssertionImpl();
- Edit<AnnotationAssertion> addAnnotationBean = edits
- .getAddAnnotationBean(annotationAssertionImpl,
- mimeType);
-
-
-
- try {
- addAnnotationBean.doEdit();
- } catch (EditException e2) {
- // TODO Auto-generated catch block
- e2.printStackTrace();
- }
-
- // AnnotationAssertion<FreeTextDescription> annotationAssertion = new
- // AnnotationAssertionImpl(
- // freeTextDescription, AnnotationRole.INITIAL_ASSERTION,
- // personList, annotationSource);
-
- AnnotationChain annotationChain = new AnnotationChainImpl();
- // not 100% convinced that the edits should be in the EditsImpl but it
- // doesn't seem to fit in with AbstractAnnotatedThing either
-
- Edit<AnnotationChain> addAnnotationAssertionEdit = edits
- .getAddAnnotationAssertionEdit(annotationChain,
- annotationAssertionImpl);
- try {
- addAnnotationAssertionEdit.doEdit();
- } catch (EditException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- assertFalse("There were no assertions", annotationChain.getAssertions().isEmpty());
-
- addAnnotationAssertionEdit.undo();
-
- assertTrue("There were assertions", annotationChain.getAssertions().isEmpty());
-
- try {
- addAnnotationAssertionEdit.doEdit();
- } catch (EditException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
-
- assertFalse("There were no assertions", annotationChain.getAssertions().isEmpty());
-
- Dataflow dataflow = new DummyDataflow();
-
- Edit<? extends Dataflow> addAnnotationEdit = dataflow
- .getAddAnnotationEdit(annotationChain);
-
- try {
- addAnnotationEdit.doEdit();
- } catch (EditException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- for (AnnotationChain chain : dataflow.getAnnotations()) {
- for (AnnotationAssertion assertion : chain.getAssertions()) {
- // assume we do some sort of SPI lookup to figure out the
- // classes!!
- AnnotationBeanSPI detail = assertion.getDetail();
- System.out.println(((MimeType) detail).getText());
- }
- }
-
- for (Annotation annotation : freeTextDescription.getClass()
- .getAnnotations()) {
- if (annotation.annotationType() == AppliesTo.class) {
- System.out.println("It's an applies to");
- Class<?>[] targetObjectType = ((AppliesTo) annotation)
- .targetObjectType();
- for (Class clazz : targetObjectType) {
- System.out.println(clazz.getCanonicalName());
- }
- }
- }
-
- for (AnnotationAssertion assertion : annotationChain.getAssertions()) {
- System.out.println(assertion.getDetail().getClass());
-
- }
-
- Set<? extends AnnotationChain> annotations = dataflow.getAnnotations();
-
- for (AnnotationChain chain : annotations) {
- for (AnnotationAssertion assertion : chain.getAssertions()) {
- System.out.println("class: " + assertion.getClass().getName());
- // Do we need some sort of SPI look up thing to do this because
- // we don't know what type of AnnotationBean we will be getting
- // System.out.println("Detail: "
- // + ((AnnotationAssertionImpl) assertion).getDetail()
- // .getText());
-
-
-
- System.out.println("Creation date: "
- + assertion.getCreationDate());
-
- // int x = 1;
- // for (Person person : assertion.getCreators()) {
- // System.out.println("Person " + x);
- // x++;
- // }
- // for (CurationEvent event : assertion.getCurationAssertions())
- // {
- // System.out
- // .println("CurationBeanSPI - what do you do with it?");
- // }
-
- System.out.println("Role: " + assertion.getRole());
-
- }
- }
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModelTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModelTest.java
deleted file mode 100644
index f9c7e90..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModelTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor.impl;
-
-import static org.junit.Assert.fail;
-
-import java.util.HashSet;
-
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-
-import org.junit.Test;
-
-public class MonitorTreeModelTest {
-
- @Test
- public void testAddNodes() throws InterruptedException {
- MonitorTreeModel m = MonitorTreeModel.getInstance();
- m.registerNode(this, new String[] { "foo" },
- new HashSet<MonitorableProperty<?>>());
- m.registerNode(this, new String[] { "foo", "bar" },
- new HashSet<MonitorableProperty<?>>());
- }
-
- @Test
- public void testAddNodesShouldFail() {
- MonitorTreeModel m = MonitorTreeModel.getInstance();
- m.registerNode(this, new String[] { "foo" },
- new HashSet<MonitorableProperty<?>>());
- try {
- m.registerNode(this, new String[] { "bar", "wibble" },
- new HashSet<MonitorableProperty<?>>());
- fail("Should have thrown index out of bounds exception");
- } catch (IndexOutOfBoundsException ioobe) {
- // Okay, should see this
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEditTest.java
deleted file mode 100644
index df07d9f..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEditTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class AbstractDatalinkEditTest {
-
- private Datalink datalink;
- private boolean editDone;
-
- @Before
- public void setUp() throws Exception {
- datalink = new DatalinkImpl(null, null);
- editDone = false;
- }
-
- @Test
- public void testAbstractDatalinkEdit() {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- assertEquals(datalink, edit.getSubject());
- }
-
- @Test(expected = RuntimeException.class)
- public void testAbstractDatalinkEditWithNull() {
- new AbstractDatalinkEdit(null) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- }
-
- @Test
- public void testDoEdit() throws EditException {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- editDone = true;
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- assertFalse(editDone);
- assertFalse(edit.isApplied());
- assertEquals(datalink, edit.doEdit());
- assertTrue(editDone);
- assertTrue(edit.isApplied());
- }
-
- @Test(expected = EditException.class)
- public void testDoEditTwice() throws EditException {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- edit.doEdit();
- edit.doEdit();
- }
-
- @Test(expected = EditException.class)
- public void testDoEditWithWrongImpl() throws EditException {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(new Datalink() {
-
- public int getResolvedDepth() {
- return 0;
- }
-
- public EventHandlingInputPort getSink() {
- return null;
- }
-
- public EventForwardingOutputPort getSource() {
- return null;
- }
-
- public Edit<? extends Datalink> getAddAnnotationEdit(
- AnnotationChain newAnnotation) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set<? extends AnnotationChain> getAnnotations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Edit<? extends Datalink> getRemoveAnnotationEdit(
- AnnotationChain annotationToRemove) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setAnnotations(Set<AnnotationChain> annotations) {
- // TODO Auto-generated method stub
-
- }
-
- }) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- edit.doEdit();
- }
-
- @Test
- public void testGetSubject() {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- assertEquals(datalink, edit.getSubject());
- }
-
- @Test
- public void testIsApplied() throws EditException {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- assertFalse(edit.isApplied());
- edit.doEdit();
- assertTrue(edit.isApplied());
- edit.undo();
- assertFalse(edit.isApplied());
- }
-
- @Test
- public void testUndo() throws EditException {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- editDone = true;
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- editDone = false;
- }
- };
- assertFalse(editDone);
- assertFalse(edit.isApplied());
- edit.doEdit();
- assertTrue(editDone);
- assertTrue(edit.isApplied());
- edit.undo();
- assertFalse(editDone);
- assertFalse(edit.isApplied());
- }
-
- @Test(expected = RuntimeException.class)
- public void testUndoBeforeDoEdit() {
- AbstractDatalinkEdit edit = new AbstractDatalinkEdit(datalink) {
- @Override
- protected void doEditAction(DatalinkImpl datalink)
- throws EditException {
- }
-
- @Override
- protected void undoEditAction(DatalinkImpl datalink) {
- }
- };
- edit.undo();
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEditTest.java
deleted file mode 100644
index d2def28..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/AddProcessorEditTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.NamingException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class AddProcessorEditTest {
-
- private Processor processor;
-
- @Before
- public void createProcessor() {
- processor = new EditsImpl().createProcessor("the_processor");
- }
-
- @Test
- public void testAddingOfProcessor() throws Exception {
- Dataflow f = new DataflowImpl();
-
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
-
- assertEquals(1,f.getProcessors().size());
- assertEquals(processor,f.getProcessors().get(0));
- }
-
- @Test(expected=EditException.class)
- public void testCantEditTwice() throws Exception {
- Dataflow f = new DataflowImpl();
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
- edit.doEdit();
- }
-
- @Test
- public void testUndo() throws Exception {
- Dataflow f = new DataflowImpl();
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
- edit.undo();
-
- assertEquals(0,f.getProcessors().size());
- }
-
- @Test
- public void testUndo2() throws Exception {
- //checks the right one is removed
- Dataflow f = new DataflowImpl();
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
-
- ProcessorImpl badProcessor = new ProcessorImpl();
- badProcessor.setName("bad_processor");
- AddProcessorEdit edit2 = new AddProcessorEdit(f,badProcessor);
- edit2.doEdit();
-
- assertEquals(2,f.getProcessors().size());
- edit2.undo();
- assertEquals(processor,f.getProcessors().get(0));
- }
-
- @Test(expected=NamingException.class)
- public void testDuplicateName() throws Exception {
- Dataflow f = new DataflowImpl();
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
-
- ProcessorImpl processor2=new ProcessorImpl();
- processor2.setName(processor.getLocalName());
- AddProcessorEdit edit2 = new AddProcessorEdit(f,processor2);
- edit2.doEdit();
- }
-
- @Test
- public void testThroughEditsImpl() throws Exception {
- //Essentially the same as testAddingOfProcessor, but a sanity test that it works correctly through the Edits API
- Dataflow f = new DataflowImpl();
- new EditsImpl().getAddProcessorEdit(f, processor).doEdit();
-
- assertEquals(1,f.getProcessors().size());
- assertEquals(processor,f.getProcessors().get(0));
- }
-
- @Test
- public void testRedo() throws Exception {
- Dataflow f = new DataflowImpl();
- AddProcessorEdit edit = new AddProcessorEdit(f,processor);
- edit.doEdit();
-
- assertEquals(1,f.getProcessors().size());
- assertEquals(processor,f.getProcessors().get(0));
-
- edit.undo();
-
- assertEquals(0,f.getProcessors().size());
-
- edit.doEdit();
-
- assertEquals(1,f.getProcessors().size());
- assertEquals(processor,f.getProcessors().get(0));
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEditTest.java
deleted file mode 100644
index 1263c28..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortDepthEditTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class ChangeDataflowInputPortDepthEditTest {
-
- private DataflowInputPortImpl dataflowInputPort;
-
- private int depth;
-
- private int granularDepth;
-
- @Before
- public void setUp() throws Exception {
- depth = 3;
- granularDepth = 1;
- dataflowInputPort = new DataflowInputPortImpl("port name", depth, granularDepth, null);
- }
-
- @Test
- public void testDoEditAction() throws EditException {
- int newDepth = 2;
- ChangeDataflowInputPortDepthEdit edit = new ChangeDataflowInputPortDepthEdit(dataflowInputPort, newDepth);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- edit.doEditAction(dataflowInputPort);
- assertEquals(newDepth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- }
-
- @Test
- public void testUndoEditAction() throws EditException {
- int newDepth = 2;
- ChangeDataflowInputPortDepthEdit edit = new ChangeDataflowInputPortDepthEdit(dataflowInputPort, newDepth);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- edit.doEditAction(dataflowInputPort);
- edit.undoEditAction(dataflowInputPort);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- }
-
- @Test
- public void testCreateDataflowInputPortEdit() {
- ChangeDataflowInputPortDepthEdit edit = new ChangeDataflowInputPortDepthEdit(dataflowInputPort, 0);
- assertEquals(dataflowInputPort, edit.getSubject());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEditTest.java
deleted file mode 100644
index 453e502..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ChangeDataflowInputPortGranularDepthEditTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class ChangeDataflowInputPortGranularDepthEditTest {
-
- private DataflowInputPortImpl dataflowInputPort;
-
- private int depth;
-
- private int granularDepth;
-
- @Before
- public void setUp() throws Exception {
- depth = 3;
- granularDepth = 1;
- dataflowInputPort = new DataflowInputPortImpl("port name", depth, granularDepth, null);
- }
-
- @Test
- public void testDoEditAction() throws EditException {
- int newGranularDepth = 2;
- ChangeDataflowInputPortGranularDepthEdit edit = new ChangeDataflowInputPortGranularDepthEdit(dataflowInputPort, newGranularDepth);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- edit.doEditAction(dataflowInputPort);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(newGranularDepth, dataflowInputPort.getGranularInputDepth());
- }
-
- @Test
- public void testUndoEditAction() throws EditException {
- int newGranularDepth = 2;
- ChangeDataflowInputPortGranularDepthEdit edit = new ChangeDataflowInputPortGranularDepthEdit(dataflowInputPort, newGranularDepth);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- edit.doEditAction(dataflowInputPort);
- edit.undoEditAction(dataflowInputPort);
- assertEquals(depth, dataflowInputPort.getDepth());
- assertEquals(granularDepth, dataflowInputPort.getGranularInputDepth());
- }
-
- @Test
- public void testCreateDataflowInputPortEdit() {
- ChangeDataflowInputPortDepthEdit edit = new ChangeDataflowInputPortDepthEdit(dataflowInputPort, 0);
- assertEquals(dataflowInputPort, edit.getSubject());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEditTest.java
deleted file mode 100644
index 929e6ea..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConfigureActivityEditTest.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.*;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConfigureActivityEditTest {
-
- DummyActivity activity;
-
- @Before
- public void setup() throws Exception {
- activity=new DummyActivity();
- }
-
- @Test
- public void testDoEdit() throws Exception {
- String bean = "bob";
- Edit<?> edit = new ConfigureActivityEdit(activity,bean);
- edit.doEdit();
- assertTrue(activity.isConfigured);
- assertEquals("bob",activity.getConfiguration());
- }
-
- @Test
- public void testUndo() throws Exception {
- String bean = "bob";
- activity.configure("fred");
- Edit<?> edit = new ConfigureActivityEdit(activity,bean);
- edit.doEdit();
-
- assertEquals("bob",activity.getConfiguration());
- edit.undo();
-
- assertEquals("fred",activity.getConfiguration());
- assertFalse(edit.isApplied());
- }
-
- @Test
- public void testIsApplied() throws Exception {
- String bean = "bob";
- Edit<?> edit = new ConfigureActivityEdit(activity,bean);
- assertFalse(edit.isApplied());
- edit.doEdit();
- assertTrue(edit.isApplied());
- }
-
- @Test
- public void testSubject() {
- String bean = "bob";
- Edit<?> edit = new ConfigureActivityEdit(activity,bean);
- assertEquals(activity,edit.getSubject());
- }
-
- class DummyActivity extends AbstractActivity<Object> {
- public boolean isConfigured=false;
- public Object configBean=null;
- @Override
- public void configure(Object conf)
- throws ActivityConfigurationException {
- isConfigured=true;
- configBean=conf;
- }
-
- @Override
- public Object getConfiguration() {
- return configBean;
- }
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEditTest.java
deleted file mode 100644
index 05156f6..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectDatalinkEditTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class ConnectDatalinkEditTest {
-
- private DatalinkImpl datalink;
- private EventForwardingOutputPort source;
- private EventHandlingInputPort sink;
-
- @Before
- public void setUp() throws Exception {
- source = new BasicEventForwardingOutputPort("output", 0, 0);
- sink = new DataflowInputPortImpl("input", 0, 0, null);
- datalink = new DatalinkImpl(source, sink);
- }
-
- @Test
- public void testDoEditAction() throws EditException {
- ConnectDatalinkEdit edit = new ConnectDatalinkEdit(datalink);
- assertEquals(0, datalink.getSource().getOutgoingLinks().size());
- assertNull(datalink.getSink().getIncomingLink());
- edit.doEditAction(datalink);
- assertEquals(1, datalink.getSource().getOutgoingLinks().size());
- assertEquals(datalink, datalink.getSource().getOutgoingLinks()
- .iterator().next());
- assertEquals(datalink, datalink.getSink().getIncomingLink());
- }
-
- @Test
- public void testUndoEditAction() throws EditException {
- ConnectDatalinkEdit edit = new ConnectDatalinkEdit(datalink);
- assertEquals(0, datalink.getSource().getOutgoingLinks().size());
- assertNull(datalink.getSink().getIncomingLink());
- edit.doEditAction(datalink);
- edit.undoEditAction(datalink);
- assertEquals(0, datalink.getSource().getOutgoingLinks().size());
- assertNull(datalink.getSink().getIncomingLink());
- }
-
- @Test
- public void testConnectDatalinkEdit() {
- ConnectDatalinkEdit edit = new ConnectDatalinkEdit(datalink);
- assertEquals(datalink, edit.getSubject());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEditTest.java
deleted file mode 100644
index 97a6d82..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ConnectMergedDatalinkEditTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.EventForwardingOutputPort;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.MergeOutputPort;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ConnectMergedDatalinkEditTest {
-
- EventForwardingOutputPort sourcePort;
- EventHandlingInputPort sinkPort;
- Merge merge;
-
-
- @Before
- public void setup() throws Exception {
- merge = new MergeImpl("theMerge");
- ProcessorImpl p1 = new ProcessorImpl();
- ProcessorImpl p2 = new ProcessorImpl();
- sourcePort=new ProcessorOutputPortImpl(p1,"source_port",0,0);
- sinkPort=new ProcessorInputPortImpl(p2,"sink_port",0);
- }
-
- @Test
- public void applyEdit() throws Exception {
- Edit<Merge> theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
- assertEquals(0,merge.getInputPorts().size());
- assertNotNull(merge.getOutputPort());
- assertTrue(merge.getOutputPort() instanceof MergeOutputPort);
- assertEquals(0,merge.getOutputPort().getOutgoingLinks().size());
-
- assertSame(merge,((MergeOutputPort)merge.getOutputPort()).getMerge());
-
- theEdit.doEdit();
- assertEquals(1,merge.getInputPorts().size());
- assertTrue(merge.getInputPorts().get(0) instanceof MergeInputPort);
- assertEquals("source_portTotheMerge_input0",merge.getInputPorts().get(0).getName());
- assertSame(sourcePort,merge.getInputPorts().get(0).getIncomingLink().getSource());
-
- assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
- assertSame(sinkPort,merge.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
-
- assertEquals(1,sourcePort.getOutgoingLinks().size());
- assertTrue(sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() instanceof MergeInputPort);
- assertTrue(sinkPort.getIncomingLink().getSource() instanceof MergeOutputPort);
-
- assertSame(merge.getInputPorts().get(0),sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
- assertSame(sinkPort.getIncomingLink().getSource(),merge.getOutputPort());
-
- ProcessorImpl p3=new ProcessorImpl();
- ProcessorOutputPortImpl sourcePort2=new ProcessorOutputPortImpl(p3,"source_port2",0,0);
-
- Edit<Merge> theEdit2 = new ConnectMergedDatalinkEdit(merge,sourcePort2,sinkPort);
- theEdit2.doEdit();
- assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
- assertEquals(2,merge.getInputPorts().size());
- assertTrue(merge.getInputPorts().get(1) instanceof MergeInputPort);
- assertEquals("source_port2TotheMerge_input0",merge.getInputPorts().get(1).getName());
- assertSame(sourcePort2,merge.getInputPorts().get(1).getIncomingLink().getSource());
- }
-
- @Test
- public void undo() throws Exception {
- Edit<Merge> theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
- theEdit.doEdit();
- theEdit.undo();
- assertEquals(0,merge.getInputPorts().size());
- assertEquals(0,merge.getOutputPort().getOutgoingLinks().size());
- assertEquals(0,sourcePort.getOutgoingLinks().size());
- assertNull(sinkPort.getIncomingLink());
- }
-
- /**
- * Check that the outgoing link to the sink port is retained when undoing a second merged input.
- */
- @Test
- public void undoSecond() throws Exception {
- Edit<Merge> theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
- theEdit.doEdit();
- ProcessorImpl p3=new ProcessorImpl();
- ProcessorOutputPortImpl sourcePort2=new ProcessorOutputPortImpl(p3,"source_port2",0,0);
- Edit<Merge> theEdit2 = new ConnectMergedDatalinkEdit(merge,sourcePort2,sinkPort);
- theEdit2.doEdit();
- theEdit2.undo();
- assertEquals(1,merge.getInputPorts().size());
- assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
- }
-
- @Test
- public void redo() throws Exception {
- Edit<Merge> theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
- theEdit.doEdit();
- theEdit.undo();
- theEdit.doEdit();
-
- assertEquals(1,merge.getInputPorts().size());
- assertTrue(merge.getInputPorts().get(0) instanceof MergeInputPort);
- assertSame(sourcePort,merge.getInputPorts().get(0).getIncomingLink().getSource());
-
- assertEquals(1,merge.getOutputPort().getOutgoingLinks().size());
- assertSame(sinkPort,merge.getOutputPort().getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
-
- assertEquals(1,sourcePort.getOutgoingLinks().size());
- assertTrue(sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink() instanceof MergeInputPort);
- assertTrue(sinkPort.getIncomingLink().getSource() instanceof MergeOutputPort);
-
- assertSame(merge.getInputPorts().get(0),sourcePort.getOutgoingLinks().toArray(new Datalink[]{})[0].getSink());
- assertSame(sinkPort.getIncomingLink().getSource(),merge.getOutputPort());
- }
-
- @Test(expected=RuntimeException.class)
- public void nullMerge() throws Exception {
- new ConnectMergedDatalinkEdit(null,sourcePort,sinkPort);
- }
-
- @Test(expected=RuntimeException.class)
- public void nullSourcePort() throws Exception {
- Merge merge = new MergeImpl("merge");
- new ConnectMergedDatalinkEdit(merge,sourcePort,null);
- }
-
- @Test(expected=RuntimeException.class)
- public void nullSinkPort() throws Exception {
- Merge merge = new MergeImpl("merge");
- new ConnectMergedDatalinkEdit(merge,null,sinkPort);
- }
-
- @Test(expected=EditException.class)
- public void invalidSinkPort() throws Exception {
- Edit<Merge> theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort);
- theEdit.doEdit();
-
- ProcessorImpl p2=new ProcessorImpl();
- ProcessorInputPortImpl sinkPort2=new ProcessorInputPortImpl(p2,"sink_port2",0);
- theEdit = new ConnectMergedDatalinkEdit(merge,sourcePort,sinkPort2);
- theEdit.doEdit();
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEditTest.java
deleted file mode 100644
index 41076f1..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowInputPortEditTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class CreateDataflowInputPortEditTest {
-
- private DataflowImpl dataflow;
-
- private String portName;
-
- private int portDepth;
-
- private int portGranularDepth;
-
- @Before
- public void setUp() throws Exception {
- dataflow = new DataflowImpl();
- portName = "port name";
- portDepth = 3;
- portGranularDepth = 2;
- }
-
- @Test
- public void testDoEditAction() throws EditException {
- CreateDataflowInputPortEdit edit = new CreateDataflowInputPortEdit(dataflow, portName, portDepth, portGranularDepth);
- assertEquals(0, dataflow.getInputPorts().size());
- edit.doEditAction(dataflow);
- assertEquals(1, dataflow.getInputPorts().size());
- DataflowInputPort inputPort = dataflow.getInputPorts().get(0);
- assertSame(dataflow, inputPort.getDataflow());
- assertEquals(portName, inputPort.getName());
- assertEquals(portDepth, inputPort.getDepth());
- assertEquals(portGranularDepth, inputPort.getGranularInputDepth());
- }
-
- @Test
- public void testUndoEditAction() throws EditException {
- CreateDataflowInputPortEdit edit = new CreateDataflowInputPortEdit(dataflow, portName, portDepth, portGranularDepth);
- assertEquals(0, dataflow.getInputPorts().size());
- edit.doEditAction(dataflow);
- edit.undoEditAction(dataflow);
- assertEquals(0, dataflow.getInputPorts().size());
- }
-
- @Test
- public void testCreateDataflowInputPortEdit() {
- CreateDataflowInputPortEdit edit = new CreateDataflowInputPortEdit(dataflow, portName, portDepth, portGranularDepth);
- assertEquals(dataflow, edit.getSubject());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEditTest.java
deleted file mode 100644
index f06d9e8..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/CreateDataflowOutputPortEditTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * @author David Withers
- *
- */
-public class CreateDataflowOutputPortEditTest {
-
- private DataflowImpl dataflow;
-
- private String portName;
-
- @Before
- public void setUp() throws Exception {
- dataflow = new DataflowImpl();
- portName = "port name";
- }
-
- @Test
- public void testDoEditAction() throws EditException {
- CreateDataflowOutputPortEdit edit = new CreateDataflowOutputPortEdit(dataflow, portName);
- assertEquals(0, dataflow.getOutputPorts().size());
- edit.doEditAction(dataflow);
- assertEquals(1, dataflow.getOutputPorts().size());
- DataflowOutputPort outputPort = dataflow.getOutputPorts().get(0);
- assertSame(dataflow, outputPort.getDataflow());
- assertEquals(portName, outputPort.getName());
- }
-
- @Test
- public void testUndoEditAction() throws EditException {
- CreateDataflowOutputPortEdit edit = new CreateDataflowOutputPortEdit(dataflow, portName);
- assertEquals(0, dataflow.getOutputPorts().size());
- edit.doEditAction(dataflow);
- edit.undoEditAction(dataflow);
- assertEquals(0, dataflow.getOutputPorts().size());
- }
-
- @Test
- public void testCreateDataflowOutputPortEdit() {
- CreateDataflowOutputPortEdit edit = new CreateDataflowOutputPortEdit(dataflow, portName);
- assertEquals(dataflow, edit.getSubject());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImplTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImplTest.java
deleted file mode 100644
index db2a88a..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DataflowImplTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-public class DataflowImplTest {
- DataflowImpl df = new DataflowImpl();
-
- @Test
- public void testInternalIdentifer() {
- assertNotNull("the identifier should be created at construction time",df.getInternalIdentier());
- }
-
- @Test
- public void testRefreshInternalIndentifier() {
- String oldId=df.getInternalIdentier();
- df.refreshInternalIdentifier();
- assertNotNull("the new identifier should not be null",df.getInternalIdentier());
- assertFalse("the identifier should have changed",oldId.equals(df.getInternalIdentier()));
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEditTest.java
deleted file mode 100644
index 1304f1b..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DefaultDispatchStackEditTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class DefaultDispatchStackEditTest {
-
- private ProcessorImpl processor;
- private DefaultDispatchStackEdit defaultDispatchStackEdit;
-
- @Before
- public void setup() {
- processor = new ProcessorImpl();
- defaultDispatchStackEdit = new DefaultDispatchStackEdit(processor);
- }
- @Test
- public void testEdit() throws Exception {
- assertEquals(0,processor.getDispatchStack().getLayers().size());
- defaultDispatchStackEdit.doEdit();
- assertTrue(processor.getDispatchStack().getLayers().size()>0);
- }
-
- @Test
- public void testUndo() throws Exception {
- defaultDispatchStackEdit.doEdit();
- assertTrue(processor.getDispatchStack().getLayers().size()>0);
- defaultDispatchStackEdit.undo();
- assertEquals(0,processor.getDispatchStack().getLayers().size());
- }
-
- @Test
- public void testSubject() throws Exception {
- assertSame(processor,defaultDispatchStackEdit.getSubject());
- defaultDispatchStackEdit.doEdit();
- assertSame(processor,defaultDispatchStackEdit.getSubject());
- defaultDispatchStackEdit.undo();
- assertSame(processor,defaultDispatchStackEdit.getSubject());
- defaultDispatchStackEdit.doEdit();
- assertSame(processor,defaultDispatchStackEdit.getSubject());
- }
-
- @Test
- public void testApplied() throws Exception {
- assertFalse(defaultDispatchStackEdit.isApplied());
- defaultDispatchStackEdit.doEdit();
- assertTrue(defaultDispatchStackEdit.isApplied());
- defaultDispatchStackEdit.undo();
- assertFalse(defaultDispatchStackEdit.isApplied());
- defaultDispatchStackEdit.doEdit();
- assertTrue(defaultDispatchStackEdit.isApplied());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflow.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflow.java
deleted file mode 100644
index 3292648..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflow.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.FailureTransmitter;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.NamedWorkflowEntity;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-
-public class DummyDataflow extends AbstractAnnotatedThing<Dataflow> implements
- Dataflow {
-
- public List<DataflowInputPort> inputPorts = new ArrayList<DataflowInputPort>();
- public List<DataflowOutputPort> outputPorts = new ArrayList<DataflowOutputPort>();
- public List<Processor> processors = new ArrayList<Processor>();
- public List<Merge> merges = new ArrayList<Merge>();
-
- public DataflowValidationReport checkValidity() {
- return new DummyValidationReport(true);
- }
-
- public <T extends NamedWorkflowEntity> List<? extends T> getEntities(
- Class<T> entityType) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends DataflowInputPort> getInputPorts() {
- return inputPorts;
- }
-
- public List<? extends Datalink> getLinks() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends DataflowOutputPort> getOutputPorts() {
- return outputPorts;
- }
-
- public List<? extends Processor> getProcessors() {
- return processors;
- }
-
- public List<? extends Merge> getMerges() {
- return merges;
- }
-
- public String getLocalName() {
- return "test_dataflow";
- }
-
- public void fire(String owningProcess, InvocationContext context) {
- String newOwningProcess = owningProcess + ":" + getLocalName();
- for (Processor p : processors) {
- if (p.getInputPorts().isEmpty()) {
- p.fire(newOwningProcess, context);
- }
- }
- }
-
- public FailureTransmitter getFailureTransmitter() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public boolean doTypeCheck() throws IterationTypeMismatchException {
- throw new UnsupportedOperationException(
- "Not implemented for this class");
- }
-
- public String getInternalIdentier() {
- return "an id";
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowInputPort.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowInputPort.java
deleted file mode 100644
index 4fe52ed..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowInputPort.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-public class DummyDataflowInputPort extends DataflowInputPortImpl {
-
- public String tokenOwningProcess;
-
- public DummyDataflowInputPort(String name, int depth, int granularDepth,
- Dataflow df) {
- super(name, depth, granularDepth, df);
- }
-
- @Override
- public void receiveEvent(WorkflowDataToken t) {
- tokenOwningProcess=t.getOwningProcess();
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowOutputPort.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowOutputPort.java
deleted file mode 100644
index a6a4496..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyDataflowOutputPort.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.List;
-
-import net.sf.taverna.t2.facade.ResultListener;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-
-public class DummyDataflowOutputPort extends DataflowOutputPortImpl {
-
- public DummyDataflowOutputPort(String portName, Dataflow dataflow) {
- super(portName, dataflow);
- }
-
- public List<ResultListener> getResultListeners() {
- return resultListeners;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyProcessor.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyProcessor.java
deleted file mode 100644
index 3224cea..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyProcessor.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.annotation.AnnotationChain;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorFinishedEvent;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-
-public class DummyProcessor implements Processor{
-
- public HealthReport checkProcessorHealth() {
- return new ProcessorHealthReport("",new ArrayList<HealthReport>());
- }
-
- public String firedOwningProcess = null;
-
- public List<Condition> preConditionList = new ArrayList<Condition>();
- public List<ProcessorInputPort> inputPorts = new ArrayList<ProcessorInputPort>();
-
- public boolean doTypeCheck() throws IterationTypeMismatchException {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void fire(String owningProcess, InvocationContext context) {
- firedOwningProcess=owningProcess;
-
- }
-
- public List<? extends Activity<?>> getActivityList() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends Condition> getControlledPreconditionList() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public DispatchStack getDispatchStack() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends ProcessorInputPort> getInputPorts() {
- return inputPorts;
- }
-
- public IterationStrategyStack getIterationStrategy() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends ProcessorOutputPort> getOutputPorts() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public List<? extends Condition> getPreconditionList() {
- return preConditionList;
- }
-
- public String getLocalName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Edit<? extends Processor> getAddAnnotationEdit(
- AnnotationChain newAnnotation) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Set<? extends AnnotationChain> getAnnotations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Edit<? extends Processor> getRemoveAnnotationEdit(
- AnnotationChain annotationToRemove) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setAnnotations(Set<AnnotationChain> annotations) {
- // TODO Auto-generated method stub
-
- }
-
- public void addObserver(Observer<ProcessorFinishedEvent> observer) {
- // TODO Auto-generated method stub
-
- }
-
- public List<Observer<ProcessorFinishedEvent>> getObservers() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void removeObserver(Observer<ProcessorFinishedEvent> observer) {
- // TODO Auto-generated method stub
-
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyValidationReport.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyValidationReport.java
deleted file mode 100644
index aca6300..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/DummyValidationReport.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- *
- */
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.TokenProcessingEntity;
-
-public class DummyValidationReport implements DataflowValidationReport {
- private final boolean valid;
-
- public DummyValidationReport(boolean valid) {
- this.valid = valid;
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public List<? extends TokenProcessingEntity> getUnsatisfiedEntities() {
- return null;
- }
-
- public List<? extends DataflowOutputPort> getUnresolvedOutputs() {
- return null;
- }
-
- public List<? extends TokenProcessingEntity> getFailedEntities() {
- return null;
- }
-
- public Map<TokenProcessingEntity, DataflowValidationReport> getInvalidDataflows() {
- return null;
- }
-
- public boolean isWorkflowIncomplete() {
- return false;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditRegistryTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditRegistryTest.java
deleted file mode 100644
index aa96425..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditRegistryTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.EditsRegistry;
-
-import org.junit.Test;
-import static org.junit.Assert.*;
-
-public class EditRegistryTest {
-
- @Test
- public void testOneAndOnlyOne() throws Exception {
- assertEquals("There should be 1 instance",1,EditsRegistry.getInstance().getInstances().size());
- }
- @Test
- public void testImplFound() {
- Edits edits = EditsRegistry.getEdits();
- assertTrue("The edit should be an instance of EditsImpl",edits instanceof EditsImpl);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditsImplTests.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditsImplTests.java
deleted file mode 100644
index 9aeea62..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EditsImplTests.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.processor.AsynchEchoActivity;
-import net.sf.taverna.t2.workflowmodel.processor.EchoConfig;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class EditsImplTests {
- public class InvalidDummyDataflow extends DummyDataflow {
- @Override
- public DataflowValidationReport checkValidity() {
- return new DummyValidationReport(false);
- }
- }
-
- private static Edits edits;
-
- @BeforeClass
- public static void createEditsInstance() {
- edits=new EditsImpl();
- }
-
- @Test
- public void createDataflow() {
- Dataflow df = edits.createDataflow();
- assertNotNull(df.getInternalIdentier());
- }
-
- @Test
- public void testGetConfigureActivityEdit() {
- Edit<?> edit = edits.getConfigureActivityEdit(new AsynchEchoActivity(), new EchoConfig());
- assertTrue(edit instanceof ConfigureActivityEdit);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EventKeeper.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EventKeeper.java
deleted file mode 100644
index ac615e6..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/EventKeeper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.processor.DiagnosticEventHandler;
-
-public final class EventKeeper extends DiagnosticEventHandler {
- public List<WorkflowDataToken> events = new ArrayList<WorkflowDataToken>();
-
- @Override
- public synchronized void receiveEvent(WorkflowDataToken token) {
- super.receiveEvent(token);
- events.add(token);
- }
-}
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsToActivityEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsToActivityEditTest.java
deleted file mode 100644
index cc96cff..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/MapProcessorPortsToActivityEditTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.*;
-
-import java.util.ArrayList;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.workflowmodel.OutputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
-import net.sf.taverna.t2.workflowmodel.serialization.DummyActivity;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class MapProcessorPortsToActivityEditTest {
-
- ProcessorImpl p;
- EditsImpl edits = new EditsImpl();
- MapProcessorPortsForActivityEdit edit;
-
- @Before
- public void setupProcessorAndEdit() throws Exception {
- p=new ProcessorImpl();
- ProcessorInputPort ip1=edits.createProcessorInputPort(p, "inputPort1", 1);
- ProcessorInputPort ip2=edits.createProcessorInputPort(p, "inputPort2", 1);
- ProcessorOutputPort op1 = edits.createProcessorOutputPort(p, "outputPort1", 1, 1);
- ProcessorOutputPort op2 = edits.createProcessorOutputPort(p, "outputPort2", 1, 1);
- edits.getAddProcessorOutputPortEdit(p, op1).doEdit();
- edits.getAddProcessorOutputPortEdit(p, op2).doEdit();
- edits.getAddProcessorInputPortEdit(p, ip1).doEdit();
- edits.getAddProcessorInputPortEdit(p, ip2).doEdit();
-
- Activity<?> a = new DummyActivity();
- ActivityInputPort aip1 = edits.createActivityInputPort("inputPort1", 1, true, new ArrayList<Class<? extends ExternalReferenceSPI>>(), String.class);
- ActivityInputPort aip2 = edits.createActivityInputPort("newInputPort", 0, true, new ArrayList<Class<? extends ExternalReferenceSPI>>(), String.class);
- edits.getAddActivityInputPortEdit(a, aip1).doEdit();
- edits.getAddActivityInputPortEdit(a, aip2).doEdit();
-
- OutputPort aop1 = edits.createActivityOutputPort("outputPort1", 1, 1);
- OutputPort aop2 = edits.createActivityOutputPort("newOutputPort", 0, 0);
- edits.getAddActivityOutputPortEdit(a, aop1).doEdit();
- edits.getAddActivityOutputPortEdit(a, aop2).doEdit();
-
- edits.getAddActivityEdit(p, a).doEdit();
-
- new AddActivityInputPortMappingEdit(a,"inputPort1","inputPort1").doEdit();
- new AddActivityInputPortMappingEdit(a,"inputPort2","inputPort2").doEdit();
- new AddActivityOutputPortMappingEdit(a,"outputPort1","outputPort1").doEdit();
- new AddActivityOutputPortMappingEdit(a,"outputPort2","outputPort2").doEdit();
-
- edit = new MapProcessorPortsForActivityEdit(p);
- }
-
-
- @Test
- public void testIsApplied() throws Exception {
- assertFalse(edit.isApplied());
- edit.doEdit();
- assertTrue(edit.isApplied());
- edit.undo();
- assertFalse(edit.isApplied());
- }
-
- @Test
- public void testDoEdit() throws Exception {
- edit.doEdit();
- assertEquals("there should now be 1 input port",1,p.getInputPorts().size());
- assertEquals("there should now be 1 output port",1,p.getOutputPorts().size());
- }
-
- @Test
- public void testUndo() throws Exception {
- edit.doEdit();
- edit.undo();
- assertEquals("there should now be 2 input ports",2,p.getInputPorts().size());
- assertEquals("there should now be 2 output ports",2,p.getOutputPorts().size());
- }
-
- @Test
- public void testMapping() throws Exception {
- Activity<?>a = p.getActivityList().get(0);
-
- assertEquals(2,a.getInputPortMapping().size());
- assertEquals("inputPort1",a.getInputPortMapping().get("inputPort1"));
- assertEquals("inputPort2",a.getInputPortMapping().get("inputPort2"));
- assertEquals(2,a.getOutputPortMapping().size());
- assertEquals("outputPort1",a.getOutputPortMapping().get("outputPort1"));
- assertEquals("outputPort2",a.getOutputPortMapping().get("outputPort2"));
-
- edit.doEdit();
-
- assertEquals(1,a.getInputPortMapping().size());
-
- assertEquals("inputPort1",a.getInputPortMapping().get("inputPort1"));
-
- assertEquals(1,a.getOutputPortMapping().size());
- assertEquals("outputPort1",a.getOutputPortMapping().get("outputPort1"));
-
- edit.undo();
-
- assertEquals(2,a.getInputPortMapping().size());
- assertEquals("inputPort1",a.getInputPortMapping().get("inputPort1"));
- assertEquals("inputPort2",a.getInputPortMapping().get("inputPort2"));
- assertEquals(2,a.getOutputPortMapping().size());
- assertEquals("outputPort1",a.getOutputPortMapping().get("outputPort1"));
- assertEquals("outputPort2",a.getOutputPortMapping().get("outputPort2"));
- }
-
- @Test
- public void testUnchangedPortsRemain() throws Exception {
- ProcessorOutputPort op1 = p.getOutputPortWithName("outputPort1");
- ProcessorInputPort ip1 = p.getInputPortWithName("inputPort1");
- edit.doEdit();
- assertSame(ip1,p.getInputPortWithName("inputPort1"));
- assertSame(op1,p.getOutputPortWithName("outputPort1"));
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReportTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReportTest.java
deleted file mode 100644
index 84b4823..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/ProcessorHealthReportTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport.Status;
-
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-
-public class ProcessorHealthReportTest {
-
- List<HealthReport> activityReports;
- ProcessorHealthReport report;
-
- @Before
- public void setUp() throws Exception {
- activityReports = new ArrayList<HealthReport>();
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.OK));
-
- report = new ProcessorHealthReport("processor subject",activityReports);
- }
-
- @Test
- public void testProcessorHealthReportImpl() {
- assertEquals("There should be 3 activity reports",3,report.getSubReports().size());
- }
-
- @Test
- public void testGetActivityHealthReports() {
- assertEquals("There should be 3 activity reports",3,report.getSubReports().size());
- assertSame(activityReports.get(0),report.getSubReports().get(0));
- assertSame(activityReports.get(1),report.getSubReports().get(1));
- assertSame(activityReports.get(2),report.getSubReports().get(2));
- }
-
- @Ignore("Not yet implented, flagged as Ignore to allow commit")
- @Test
- public void testGetMessage() {
- fail("Not yet implemented");
- }
-
- @Test
- public void testGetStatusAllOK() {
- List<HealthReport> activityReports = new ArrayList<HealthReport>();
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.OK));
-
- ProcessorHealthReport report = new ProcessorHealthReport("processor subject",activityReports);
-
- assertEquals("the status should be OK",Status.OK,report.getStatus());
- }
-
- @Test
- public void testGetStatusContainsWarning() {
- List<HealthReport> activityReports = new ArrayList<HealthReport>();
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.WARNING));
-
- ProcessorHealthReport report = new ProcessorHealthReport("processor subject",activityReports);
-
- assertEquals("the status should be WARNING",Status.WARNING,report.getStatus());
- }
-
- @Test
- public void testGetStatusContainsSevere() {
- List<HealthReport> activityReports = new ArrayList<HealthReport>();
- activityReports.add(new HealthReport("","",Status.OK));
- activityReports.add(new HealthReport("","",Status.SEVERE));
- activityReports.add(new HealthReport("","",Status.OK));
-
- ProcessorHealthReport report = new ProcessorHealthReport("",activityReports);
-
- assertEquals("the status should be WARNING",Status.WARNING,report.getStatus());
- }
-
- @Test
- public void testGetStatusAllSevere() {
- List<HealthReport> activityReports = new ArrayList<HealthReport>();
- activityReports.add(new HealthReport("","",Status.SEVERE));
- activityReports.add(new HealthReport("","",Status.SEVERE));
- activityReports.add(new HealthReport("","",Status.SEVERE));
-
- ProcessorHealthReport report = new ProcessorHealthReport("",activityReports);
-
- assertEquals("the status should be SEVERE",Status.SEVERE,report.getStatus());
- }
-
- @Test
- public void testGetSubject() {
- assertEquals("processor subject",report.getSubject());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEditTest.java
deleted file mode 100644
index e0c155e..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorInputPortEditTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class RemoveProcessorInputPortEditTest {
-
- EditsImpl edits = new EditsImpl();
- private Processor processor;
- private ProcessorInputPort inputPort;
- private RemoveProcessorInputPortEdit removeProcessorInputPortEdit;
-
- @Before
- public void setup() throws Exception {
- processor = edits.createProcessor("test");
- inputPort = edits.createProcessorInputPort(processor, "port", 1);
- edits.getAddProcessorInputPortEdit(processor, inputPort).doEdit();
- removeProcessorInputPortEdit = new RemoveProcessorInputPortEdit(processor,inputPort);
- }
-
- @Test
- public void testDoEdit() throws Exception {
- assertFalse(removeProcessorInputPortEdit.isApplied());
- Processor p = removeProcessorInputPortEdit.doEdit();
- assertTrue(removeProcessorInputPortEdit.isApplied());
- assertSame(p,processor);
- assertEquals(0,processor.getInputPorts().size());
- }
-
- @Test
- public void testUndo() throws Exception {
- assertFalse(removeProcessorInputPortEdit.isApplied());
- removeProcessorInputPortEdit.doEdit();
- assertTrue(removeProcessorInputPortEdit.isApplied());
- removeProcessorInputPortEdit.undo();
- assertFalse(removeProcessorInputPortEdit.isApplied());
- assertEquals(1,processor.getInputPorts().size());
- assertSame(inputPort,processor.getInputPorts().get(0));
- }
-
- @Test
- public void testSubject() throws Exception {
- assertSame(processor,removeProcessorInputPortEdit.getSubject());
- removeProcessorInputPortEdit.doEdit();
- assertSame(processor,removeProcessorInputPortEdit.getSubject());
- removeProcessorInputPortEdit.undo();
- assertSame(processor,removeProcessorInputPortEdit.getSubject());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEditTest.java
deleted file mode 100644
index 33bb46c..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/RemoveProcessorOutputPortEditTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class RemoveProcessorOutputPortEditTest {
-
- EditsImpl edits = new EditsImpl();
- private Processor processor;
- private ProcessorOutputPort outputPort;
- private RemoveProcessorOutputPortEdit removeProcessorOutputPortEdit;
-
- @Before
- public void setup() throws Exception {
- processor = edits.createProcessor("test");
- outputPort = edits.createProcessorOutputPort(processor, "port", 1,1);
- edits.getAddProcessorOutputPortEdit(processor, outputPort).doEdit();
- removeProcessorOutputPortEdit = new RemoveProcessorOutputPortEdit(processor,outputPort);
- }
-
- @Test
- public void testDoEdit() throws Exception {
- assertFalse(removeProcessorOutputPortEdit.isApplied());
- Processor p = removeProcessorOutputPortEdit.doEdit();
- assertTrue(removeProcessorOutputPortEdit.isApplied());
- assertSame(p,processor);
- assertEquals(0,processor.getOutputPorts().size());
- }
-
- @Test
- public void testUndo() throws Exception {
- assertFalse(removeProcessorOutputPortEdit.isApplied());
- removeProcessorOutputPortEdit.doEdit();
- assertTrue(removeProcessorOutputPortEdit.isApplied());
- removeProcessorOutputPortEdit.undo();
- assertFalse(removeProcessorOutputPortEdit.isApplied());
- assertEquals(1,processor.getOutputPorts().size());
- assertSame(outputPort,processor.getOutputPorts().get(0));
- }
-
- @Test
- public void testSubject() throws Exception {
- assertSame(processor,removeProcessorOutputPortEdit.getSubject());
- removeProcessorOutputPortEdit.doEdit();
- assertSame(processor,removeProcessorOutputPortEdit.getSubject());
- removeProcessorOutputPortEdit.undo();
- assertSame(processor,removeProcessorOutputPortEdit.getSubject());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEditTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEditTest.java
deleted file mode 100644
index 40b6a48..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/impl/UpdateDataflowInternalIdentifierEditTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edit;
-import net.sf.taverna.t2.workflowmodel.Edits;
-
-import org.junit.Test;
-
-
-public class UpdateDataflowInternalIdentifierEditTest {
- private static Edits edits = new EditsImpl();
-
- @Test
- public void testDoEdit() throws Exception {
- Dataflow df = edits.createDataflow();
- edits.getUpdateDataflowInternalIdentifierEdit(df, "123").doEdit();
- assertEquals("The internal id should be 123","123",df.getInternalIdentier());
- }
-
- @Test
- public void testUndo() throws Exception {
- Dataflow df = edits.createDataflow();
- Edit<?> edit = edits.getUpdateDataflowInternalIdentifierEdit(df, "123");
- String oldID=df.getInternalIdentier();
- edit.doEdit();
- edit.undo();
- assertEquals("The id should be reset to its original value",oldID,df.getInternalIdentier());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/AsynchEchoActivity.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/AsynchEchoActivity.java
deleted file mode 100644
index 896c8da..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/AsynchEchoActivity.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport;
-import net.sf.taverna.t2.workflowmodel.health.HealthReport.Status;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-public class AsynchEchoActivity extends
- AbstractAsynchronousActivity<EchoConfig> implements
- AsynchronousActivity<EchoConfig> {
-
- private EchoConfig config;
-
- @Override
- public void configure(EchoConfig conf) throws ActivityConfigurationException {
- addInput("input",0, true, new ArrayList<Class<? extends ExternalReferenceSPI>>(), String.class);
- addOutput("output",0,0);
- this.config = conf;
- }
-
- @Override
- public void executeAsynch(Map<String, T2Reference> data,
- AsynchronousActivityCallback callback) {
- T2Reference inputID = data.get("input");
- Map<String, T2Reference> outputMap = new HashMap<String, T2Reference>();
- outputMap.put("output", inputID);
- callback.receiveResult(outputMap, new int[0]);
- }
-
- @Override
- public EchoConfig getConfiguration() {
- return config;
- }
-
- public HealthReport checkActivityHealth() {
- return new HealthReport("AsynchEchoActivity",
- "Everything is hunky dorey", Status.OK);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/DiagnosticEventHandler.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/DiagnosticEventHandler.java
deleted file mode 100644
index ac14154..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/DiagnosticEventHandler.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-/**
- *
- */
-package net.sf.taverna.t2.workflowmodel.processor;
-
-import org.apache.log4j.Logger;
-
-import net.sf.taverna.t2.annotation.AbstractAnnotatedThing;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EventHandlingInputPort;
-import net.sf.taverna.t2.workflowmodel.Port;
-
-public class DiagnosticEventHandler extends AbstractAnnotatedThing<Port> implements EventHandlingInputPort {
-
- private static Logger logger = Logger.getLogger(DiagnosticEventHandler.class);
-
- protected int eventCount = 0;
-
- public synchronized void receiveEvent(WorkflowDataToken token) {
- eventCount++;
- logger.debug(token);
- }
-
- public int getEventCount() {
- return this.eventCount;
- }
-
- public synchronized void reset() {
- this.eventCount = 0;
- }
-
- public int getDepth() {
- return 0;
- }
-
- public String getName() {
- return "Test port";
- }
-
- public Datalink getIncomingLink() {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/EchoConfig.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/EchoConfig.java
deleted file mode 100644
index 10fd615..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/EchoConfig.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor;
-
-/**
- * Trivial property class to configure the echo activity. As the echo activity
- * actually has no configuration whatsoever I've put some dummy properties
- * in here to test the serialization framework.
- *
- * @author Tom
- *
- */
-public class EchoConfig {
-
- private String foo = "wibble!";
-
- public String getFoo() {
- return this.foo;
- }
-
- public void setFoo(String newFoo) {
- this.foo = newFoo;
- }
-
- public EchoConfig() {
- //
- }
-
- public EchoConfig(String newFoo) {
- super();
- this.foo = newFoo;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/NaiveProcessorConstructionTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/NaiveProcessorConstructionTest.java
deleted file mode 100644
index e98ce31..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/NaiveProcessorConstructionTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor;
-
-import java.io.IOException;
-
-import junit.framework.TestCase;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.impl.Tools;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-
-import org.jdom.JDOMException;
-
-/**
- * Tests the processor factory along with activity serialisation logic
- *
- * @author Tom Oinn
- *
- */
-public class NaiveProcessorConstructionTest extends TestCase {
-
- public void testProcessorFactory() throws EditException, JDOMException,
- IOException, ActivityConfigurationException {
- AsynchEchoActivity activity = new AsynchEchoActivity();
- activity.configure(new EchoConfig("blah"));
- Tools.buildFromActivity(activity);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DiagnosticLayer.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DiagnosticLayer.java
deleted file mode 100644
index f6a73aa..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/dispatch/DiagnosticLayer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.dispatch;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchCompletionEvent;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.events.DispatchResultEvent;
-
-/**
- * Debug dispatch stack layer, prints to stdout when it receives a result or
- * completion and when the cache purge message is sent from the parent dispatch
- * stack.
- *
- * @author Tom
- *
- */
-public class DiagnosticLayer extends AbstractDispatchLayer<Object> {
-
- public DiagnosticLayer() {
- super();
- }
-
- @Override
- public void receiveResult(DispatchResultEvent resultEvent) {
- System.out.println(" "
- + new Job(resultEvent.getOwningProcess(), resultEvent
- .getIndex(), resultEvent.getData(), resultEvent
- .getContext()));
- getAbove().receiveResult(resultEvent);
- }
-
- @Override
- public void receiveResultCompletion(DispatchCompletionEvent completionEvent) {
- System.out.println(" "
- + new Completion(completionEvent.getOwningProcess(),
- completionEvent.getIndex(), completionEvent
- .getContext()));
- getAbove().receiveResultCompletion(completionEvent);
- }
-
- @Override
- public void finishedWith(String process) {
- System.out.println(" Purging caches for " + process);
- }
-
- public void configure(Object config) {
- // Do nothing
- }
-
- public Object getConfiguration() {
- return null;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DiagnosticIterationStrategyNode.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DiagnosticIterationStrategyNode.java
deleted file mode 100644
index 3a9d276..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/DiagnosticIterationStrategyNode.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Iteration strategy node that logs job and completion events for analysis
- * during debugging.
- *
- * @author Tom Oinn
- *
- */
-@SuppressWarnings("unchecked") //suppressed to avoid jdk1.5 compilation errors caused by the declaration IterationInternalEvent<? extends IterationInternalEvent<?>> e
-public class DiagnosticIterationStrategyNode extends
- AbstractIterationStrategyNode {
-
- private Map<String, List<IterationInternalEvent>> ownerToJobList;
-
- public DiagnosticIterationStrategyNode() {
- this.ownerToJobList = new HashMap<String, List<IterationInternalEvent>>();
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- for (String owner : ownerToJobList.keySet()) {
- sb.append(owner + "\n");
- List<IterationInternalEvent> jobs = ownerToJobList.get(owner);
- for (IterationInternalEvent<?> w : jobs) {
- sb.append(" " + w.toString() + "\n");
- }
- }
- return sb.toString();
- }
-
- public int jobsReceived(String string) {
- if (ownerToJobList.containsKey(string) == false) {
- return 0;
- }
- int number = 0;
- for (IterationInternalEvent w : ownerToJobList.get(string)) {
- if (w instanceof Job) {
- number++;
- }
- }
- return number;
- }
-
- public boolean containsJob(String owningProcess, int[] jobIndex) {
- List<IterationInternalEvent> jobs = ownerToJobList.get(owningProcess);
- if (jobs == null) {
- return false;
- }
- for (IterationInternalEvent w : jobs) {
- if (w instanceof Job) {
- Job j = (Job)w;
- if (compareArrays(j.getIndex(), jobIndex)
- && j.getOwningProcess().equals(owningProcess)) {
- return true;
- }
- }
- }
- return false;
- }
-
- private static boolean compareArrays(int[] a1, int[] a2) {
- if (a1.length != a2.length) {
- return false;
- }
- for (int i = 0; i < a1.length; i++) {
- if (a1[i] != a2[i]) {
- return false;
- }
- }
- return true;
- }
-
- public synchronized void receiveCompletion(int inputIndex,
- Completion completion) {
- String owningProcess = completion.getOwningProcess();
- List<IterationInternalEvent> jobs = ownerToJobList.get(owningProcess);
- if (jobs == null) {
- jobs = new ArrayList<IterationInternalEvent>();
- ownerToJobList.put(owningProcess, jobs);
- }
- jobs.add(completion);
- }
-
- public synchronized void receiveJob(int inputIndex, Job newJob) {
- List<IterationInternalEvent> jobs = ownerToJobList.get(newJob.getOwningProcess());
- if (jobs == null) {
- jobs = new ArrayList<IterationInternalEvent>();
- ownerToJobList.put(newJob.getOwningProcess(), jobs);
- }
- jobs.add(newJob);
- }
-
- public int getIterationDepth(Map<String, Integer> inputDepths) throws IterationTypeMismatchException {
- // TODO Auto-generated method stub
- return 0;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationTypeCheckerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationTypeCheckerTest.java
deleted file mode 100644
index 26db007..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/processor/iteration/impl/IterationTypeCheckerTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.processor.iteration.impl;
-
-import net.sf.taverna.t2.workflowmodel.processor.iteration.CrossProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.DotProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationTypeMismatchException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.MissingIterationInputException;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.NamedInputPortNode;
-import junit.framework.TestCase;
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * Test the type check functionality now built into the iteration system,
- * exercises the iteration strategy and the strategy stack with a combination of
- * simple and staged iteration to check whether the type checker is getting
- * sensible results out.
- *
- * @author Tom Oinn
- *
- */
-public class IterationTypeCheckerTest extends TestCase {
-
- private IterationStrategyImpl getISDot(int depthA, int depthB) {
- IterationStrategyImpl is1 = new IterationStrategyImpl();
- NamedInputPortNode nipn1 = new NamedInputPortNode("a", depthA);
- NamedInputPortNode nipn2 = new NamedInputPortNode("b", depthB);
- is1.addInput(nipn1);
- is1.addInput(nipn2);
- DotProduct dp = new DotProduct();
- nipn1.setParent(dp);
- nipn2.setParent(dp);
- dp.setParent(is1.getTerminalNode());
- return is1;
- }
-
- private IterationStrategyImpl getISCross(int depthA, int depthB) {
- IterationStrategyImpl is1 = new IterationStrategyImpl();
- NamedInputPortNode nipn1 = new NamedInputPortNode("a", depthA);
- NamedInputPortNode nipn2 = new NamedInputPortNode("b", depthB);
- is1.addInput(nipn1);
- is1.addInput(nipn2);
- CrossProduct cp = new CrossProduct();
- nipn1.setParent(cp);
- nipn2.setParent(cp);
- cp.setParent(is1.getTerminalNode());
- return is1;
- }
-
- private Map<String, Integer> getDepths(String[] names, int[] depths) {
- Map<String, Integer> result = new HashMap<String, Integer>();
- for (int i = 0; i < names.length; i++) {
- result.put(names[i], depths[i]);
- }
- return result;
- }
-
- /**
- * Test simple iteration type check based on dot products
- *
- * @throws IterationTypeMismatchException
- */
- public void testDotUnstagedIteration()
- throws IterationTypeMismatchException {
- IterationStrategyImpl isi = getISDot(0, 0);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 1 })) == 1);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 2, 2 })) == 2);
-
- isi = getISDot(0, 1);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 2 })) == 1);
- }
-
- /**
- * Test a simple iteration based on a cross product
- *
- * @throws IterationTypeMismatchException
- */
- public void testCrossUnstagedIteration()
- throws IterationTypeMismatchException {
- IterationStrategyImpl isi = getISCross(0, 0);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 1 })) == 2);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 2, 2 })) == 4);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 2 })) == 3);
-
- isi = getISCross(0, 1);
-
- assertTrue(isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 2 })) == 2);
- }
-
- /**
- * Test that attempting to typecheck a mismatched dot product produces a
- * type mismatch exception
- *
- */
- public void testValidationFailureWithDot() {
- try {
- IterationStrategyImpl isi = getISDot(0, 0);
- isi.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 2 }));
- fail("should have failed due to mismatch");
- } catch (IterationTypeMismatchException itme) {
- // Correct behaviour, this should cause a mismatch
- }
- }
-
- /**
- * Fundamentally pointless, combining two cross product iteration strategies
- * is the same as using the last one directly but we can check this
- *
- * @throws IterationTypeMismatchException
- * @throws MissingIterationInputException
- */
- public void testStagedCombinationOfCross()
- throws IterationTypeMismatchException,
- MissingIterationInputException {
- IterationStrategyStackImpl iss;
-
- iss = new IterationStrategyStackImpl();
- iss.addStrategy(getISCross(1, 1));
- iss.addStrategy(getISCross(0, 0));
-
- assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 2, 2 })) == 4);
-
- }
-
- /**
- * Fundamentally pointless, combining two dot product iteration strategies
- * is the same as using the last one directly but we can check this
- *
- * @throws IterationTypeMismatchException
- * @throws MissingIterationInputException
- */
- public void testStagedCombinationOfDot()
- throws IterationTypeMismatchException,
- MissingIterationInputException {
- IterationStrategyStackImpl iss;
-
- iss = new IterationStrategyStackImpl();
- iss.addStrategy(getISDot(1, 1));
- iss.addStrategy(getISDot(0, 0));
-
- assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 2, 2 })) == 2);
-
- // Should pass because the single items (depth 0) are promoted to single
- // item lists before being passed into the iteration system so are
- // effectively both depth 1 going into the second stage which then
- // iterates to produce an index array length of 1
- assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 0, 0 })) == 1);
-
- // Slightly strange superficially that this should work, but in fact
- // what happens is that the first single item is lifted to a list before
- // being passed to the iteration strategy. The result is that it's fine
- // to match with the dot product against the other list as neither at
- // this point have index arrays, then in the second stage both are lists
- // to be iterated over and both have single length index arrays.
- assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 1, 0 })) == 1);
- }
-
- /**
- * Test whether Paul's example of iterating with dot product then cross
- * product can typecheck in a single staged iteration. This was an example
- * where the user had two lists of folders (a1, a2, b1, b2, c1, c2) and
- * wanted to compare all the contents of each 'a' folder with the other 'a'
- * folder and so on, doing a dot match to only compare a1 and a2 then a
- * cross product join within each pair to compare all contents of a1 with
- * all contents of a2. This appears to work!
- */
- public void testStagedCombinationOfDotAndCross()
- throws IterationTypeMismatchException,
- MissingIterationInputException {
- IterationStrategyStackImpl iss;
-
- iss = new IterationStrategyStackImpl();
- iss.addStrategy(getISDot(1, 1));
- iss.addStrategy(getISCross(0, 0));
-
- assertTrue(iss.getIterationDepth(getDepths(new String[] { "a", "b" },
- new int[] { 2, 2 })) == 3);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyActivity.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyActivity.java
deleted file mode 100644
index 85df25a..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyActivity.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-
-public class DummyActivity extends AbstractActivity<Integer> {
-
- private Integer bean=null;
-
- @Override
- public void configure(Integer conf) throws ActivityConfigurationException {
- bean=conf;
- }
-
- @Override
- public Integer getConfiguration() {
- return bean;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyBean.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyBean.java
deleted file mode 100644
index 3408090..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/DummyBean.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization;
-
-public class DummyBean {
- private int id;
- private String name;
- private InnerBean innerBean;
- public int getId() {
- return id;
- }
- public void setId(int id) {
- this.id = id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public InnerBean getInnerBean() {
- return innerBean;
- }
- public void setInnerBean(InnerBean innerBean) {
- this.innerBean = innerBean;
- }
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/InnerBean.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/InnerBean.java
deleted file mode 100644
index 9e8b28d..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/InnerBean.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization;
-
-public class InnerBean {
- private String stuff;
-
- public String getStuff() {
- return stuff;
- }
-
- public void setStuff(String stuff) {
- this.stuff = stuff;
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializerTest.java
deleted file mode 100644
index 15e08d4..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLDeserializerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.StringReader;
-
-import net.sf.taverna.t2.workflowmodel.serialization.DummyBean;
-
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-import org.junit.Test;
-
-public class AbstractXMLDeserializerTest {
- AbstractXMLDeserializer deserializer = new AbstractXMLDeserializer() {};
-
- @Test
- public void testCreateBeanSimple() throws Exception {
- Element el = new Element(XMLSerializationConstants.CONFIG_BEAN, XMLSerializationConstants.T2_WORKFLOW_NAMESPACE);
- el.setAttribute("encoding","xstream");
- Element elString = new Element("string");
- elString.setText("12345");
- el.addContent(elString);
-
- Object bean = deserializer.createBean(el, XMLDeserializerImpl.class.getClassLoader());
- assertTrue("bean should be a String",bean instanceof String);
- assertEquals("string should equal 12345","12345",((String)bean));
- }
-
- @Test
- public void testCreateBeanComplex() throws Exception {
- String xml="<configBean xmlns='http://taverna.sf.net/2008/xml/t2flow' encoding=\"xstream\"><net.sf.taverna.t2.workflowmodel.serialization.DummyBean><id>1</id><name>bob</name><innerBean><stuff>xyz</stuff></innerBean></net.sf.taverna.t2.workflowmodel.serialization.DummyBean></configBean>";
- Element el = new SAXBuilder().build(new StringReader(xml)).detachRootElement();
-
- Object bean = deserializer.createBean(el, XMLDeserializerImpl.class.getClassLoader());
- assertTrue("bean should be a DummyBean",bean instanceof DummyBean);
- DummyBean dummyBean = (DummyBean)bean;
-
- assertEquals("id should be 1",1,dummyBean.getId());
- assertEquals("namne should be bob","bob",dummyBean.getName());
- assertEquals("stuff should by xyz","xyz",dummyBean.getInnerBean().getStuff());
- }
-
- @Test
- public void testCreateBeanJDomXML() throws Exception {
- String xml="<configBean xmlns='http://taverna.sf.net/2008/xml/t2flow' encoding=\"jdomxml\"><fred><child1/><child2/></fred></configBean>";
- Element el = new SAXBuilder().build(new StringReader(xml)).detachRootElement();
-
- Object bean = deserializer.createBean(el, XMLDeserializerImpl.class.getClassLoader());
- assertNotNull("There bean should not be null",bean);
- assertTrue("Bean should be an instance of Element",bean instanceof Element);
- el = (Element)bean;
- assertEquals("The root element should be named fred","fred",el.getName());
- assertEquals("There should be 2 child elements",2,el.getChildren().size());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializerTest.java
deleted file mode 100644
index 1ff4d4c..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/AbstractXMLSerializerTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.serialization.DummyBean;
-import net.sf.taverna.t2.workflowmodel.serialization.InnerBean;
-
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-
-
-public class AbstractXMLSerializerTest {
- AbstractXMLSerializer serializer = new AbstractXMLSerializer() {};
-
- @Test
- public void testBeanAsElementComplex() throws Exception {
- DummyBean bean = new DummyBean();
- InnerBean bean2 = new InnerBean();
- bean.setName("name");
- bean.setId(5);
- bean2.setStuff("stuff");
- bean.setInnerBean(bean2);
- Element el = serializer.beanAsElement(bean);
- assertEquals("root should be configBean","configBean",el.getName());
- assertEquals("the type should be xstream","xstream",el.getAttribute("encoding").getValue());
- assertEquals("there should be 1 DummyBean child",1,el.getChildren("net.sf.taverna.t2.workflowmodel.serialization.DummyBean").size());
- Element beanElement = el.getChild("net.sf.taverna.t2.workflowmodel.serialization.DummyBean");
- assertNotNull("there should be a child id",beanElement.getChild("id"));
- assertEquals("id child should have value 5","5",beanElement.getChild("id").getText());
- assertNotNull("there should be a child name",beanElement.getChild("name"));
- assertEquals("name child should have text name","name",beanElement.getChild("name").getText());
- assertNotNull("there should be a child innerBean",beanElement.getChild("innerBean"));
- Element innerBeanElement = beanElement.getChild("innerBean");
- assertNotNull("innerBean should have a child stuff",innerBeanElement.getChild("stuff"));
- assertEquals("stuff child should have text stuff","stuff",innerBeanElement.getChild("stuff").getText());
-
- }
-
- @Test
- public void testElementBean() throws Exception {
- Element person = new Element("person");
- person.addContent(new Element("name"));
- person.getChild("name").setText("fred smith");
-
- Element el = serializer.beanAsElement(person);
- assertEquals("root should be configBean","configBean",el.getName());
- assertEquals("the type should be jdomxml","jdomxml",el.getAttribute("encoding").getValue());
- assertEquals("there should be 1 person",1,el.getChildren("person").size());
-
- Element person2=el.getChild("person");
-
- assertEquals("XML for person should match",elementToString(person),elementToString(person2));
-
- }
-
- @Test
- public void testBeanAsElementSimple() throws Exception {
- String helloWorld="hello world";
- Element el = serializer.beanAsElement(helloWorld);
- assertEquals("root should be configBean","configBean",el.getName());
- assertEquals("the type should be xstream","xstream",el.getAttribute("encoding").getValue());
- assertEquals("there should be 1 string",1,el.getChildren("string").size());
- String innerXML=elementToString(el.getChild("string"));
- assertEquals("Unexpected xml for the string","<string>hello world</string>",innerXML);
- }
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializerTest.java
deleted file mode 100644
index 033b6eb..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLDeserializerTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashMap;
-
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-import net.sf.taverna.t2.workflowmodel.serialization.DummyActivity;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-
-public class ActivityXMLDeserializerTest extends DeserializerTestsHelper {
- ActivityXMLDeserializer deserializer = ActivityXMLDeserializer.getInstance();
-
- @Test
- public void testActivityDeserialization() throws Exception {
- Element el = loadXMLFragment("activity.xml");
- Activity<?> activity = deserializer.deserializeActivity(el,new HashMap<String,Element>());
-
- assertNotNull("The activity should not be NULL",activity);
- assertTrue("should be a DummyActivity",activity instanceof DummyActivity);
- assertTrue("bean should be an Integer",activity.getConfiguration() instanceof Integer);
- assertEquals("bean should equal 5",5,((Integer)activity.getConfiguration()).intValue());
-
- assertEquals("there should be 1 input port mapping",1,activity.getInputPortMapping().size());
- assertEquals("there should be 1 output port mapping",1,activity.getOutputPortMapping().size());
-
- assertEquals("input in is mapped to in","in",activity.getInputPortMapping().get("in"));
- assertEquals("output out is mapped to out","out",activity.getOutputPortMapping().get("out"));
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializerTest.java
deleted file mode 100644
index 28c8081..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ActivityXMLSerializerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.serialization.DummyActivity;
-
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-
-public class ActivityXMLSerializerTest implements XMLSerializationConstants {
- ActivityXMLSerializer serializer = ActivityXMLSerializer.getInstance();
- Edits edits = new EditsImpl();
-
- @Test
- public void testActivitySerialization() throws Exception
- {
- DummyActivity activity=new DummyActivity();
- activity.getInputPortMapping().put("in", "in");
- activity.getOutputPortMapping().put("out", "out");
- activity.configure(new Integer(5));
- Element el = serializer.activityToXML(activity);
-
- assertEquals("root element should be activity","activity",el.getName());
- Element classChild = el.getChild("class",T2_WORKFLOW_NAMESPACE);
- assertNotNull("there should be a child called class",classChild);
- assertEquals("incorrect activity class name","net.sf.taverna.t2.workflowmodel.serialization.DummyActivity",classChild.getText());
- assertEquals("there should be 1 inputMap child",1,el.getChildren("inputMap",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be 1 outputMap child",1,el.getChildren("outputMap",T2_WORKFLOW_NAMESPACE).size());
-
- Element inputMap=el.getChild("inputMap",T2_WORKFLOW_NAMESPACE);
- Element outputMap=el.getChild("outputMap",T2_WORKFLOW_NAMESPACE);
-
- Element map=inputMap.getChild("map",T2_WORKFLOW_NAMESPACE);
- assertEquals("map to should be 'in'","in",map.getAttribute("to").getValue());
- assertEquals("map from should be 'in'","in",map.getAttribute("from").getValue());
-
- map=outputMap.getChild("map",T2_WORKFLOW_NAMESPACE);
- assertEquals("map to should be 'out'","out",map.getAttribute("to").getValue());
- assertEquals("map from should be 'out'","out",map.getAttribute("from").getValue());
-
- Element bean = el.getChild("configBean",T2_WORKFLOW_NAMESPACE);
- assertNotNull("there should be a child called configBean",bean);
-
- Element intChild = bean.getChild("int");
- assertNotNull("bean should have a child called int",intChild);
- assertEquals("java child should describe an int with value 5","<int>5</int>",elementToString(intChild));
- }
-
- @Test
- public void testDataflowBasedActivity() throws Exception {
- DummyDataflowActivity dummyDataflowActivity = new DummyDataflowActivity();
- Dataflow df = edits.createDataflow();
- ((DataflowImpl)df).setLocalName("test");
- dummyDataflowActivity.configure(df);
-
- Element el = serializer.activityToXML(dummyDataflowActivity);
-
- assertEquals("There should be 1 configBean child element",1,el.getChildren("configBean",T2_WORKFLOW_NAMESPACE).size());
-
- Element configBeanEl = el.getChild("configBean",T2_WORKFLOW_NAMESPACE);
- assertEquals("The encoding type should be dataflow","dataflow",configBeanEl.getAttribute("encoding").getValue());
- assertEquals("There should be 1 child called dataflow",1,configBeanEl.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).size());
- Element dataflowEl = configBeanEl.getChild("dataflow",T2_WORKFLOW_NAMESPACE);
- assertNotNull("there should be the attribute ref",dataflowEl.getAttribute("ref"));
- }
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializerTest.java
deleted file mode 100644
index f7ff90a..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ConditionXMLSerializerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-
-public class ConditionXMLSerializerTest implements XMLSerializationConstants {
-
- private ConditionXMLSerializer serializer = ConditionXMLSerializer.getInstance();
- private Edits edits = new EditsImpl();
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
- @Test
- public void testConditions() throws Exception {
- Processor control = edits.createProcessor("control");
- Processor target = edits.createProcessor("target");
- edits.getCreateConditionEdit(control, target).doEdit();
-
-
- List<Processor> processors = new ArrayList<Processor>();
- processors.add(control);
- processors.add(target);
-
- Element el = serializer.conditionsToXML(processors);
-
- assertEquals("root name should be conditions","conditions",el.getName());
- assertEquals("there should be 1 child condition",1,el.getChildren("condition",T2_WORKFLOW_NAMESPACE).size());
- Element condition = el.getChild("condition",T2_WORKFLOW_NAMESPACE);
- condition.setNamespace(null); //remove the default namespace
- assertEquals("incorrect condition xml","<condition control=\"control\" target=\"target\" />",elementToString(condition));
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializerTest.java
deleted file mode 100644
index 237818a..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLDeserializerTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import java.util.HashMap;
-
-import net.sf.taverna.t2.workflowmodel.Condition;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.MergeInputPort;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-public class DataflowXMLDeserializerTest extends DeserializerTestsHelper {
- DataflowXMLDeserializer deserializer = DataflowXMLDeserializer.getInstance();
-
- @Test
- public void testMerge() throws Exception {
- Element el = loadXMLFragment("dataflow_with_merge.xml");
- Dataflow df = deserializer.deserializeDataflow(el,new HashMap<String, Element>());
-
- assertEquals("There should be 2 processors",2,df.getProcessors().size());
- Processor top=df.getProcessors().get(0);
- Processor bottom=df.getProcessors().get(1);
-
- assertEquals("Top processor should be called top","top",top.getLocalName());
- assertEquals("Bottom processor should be called top","bottom",bottom.getLocalName());
-
- assertEquals("Top should have 1 output port",1,top.getOutputPorts().size());
-
- assertEquals("There should be 1 outgoing link",1,top.getOutputPorts().get(0).getOutgoingLinks().size());
-
- Datalink link = top.getOutputPorts().get(0).getOutgoingLinks().iterator().next();
-
- assertTrue("Link sink should be Merge port",link.getSink() instanceof MergeInputPort);
- }
-
- @Test
- public void testDataflowNameAndId() throws Exception {
- Element element = loadXMLFragment("empty_dataflow_with_ports.xml");
- Dataflow df = deserializer.deserializeDataflow(element,new HashMap<String, Element>());
- assertEquals("Dataflow should have an id of 123","123",df.getInternalIdentier());
- assertEquals("dataflow should have the name george","george",df.getLocalName());
- }
-
- @Test
- public void testDataflowPorts() throws Exception {
- Element element = loadXMLFragment("empty_dataflow_with_ports.xml");
- Dataflow df = deserializer.deserializeDataflow(element,new HashMap<String, Element>());
-
- assertEquals("there should be 2 input ports",2,df.getInputPorts().size());
- assertEquals("there should be 1 output port",1,df.getOutputPorts().size());
-
- DataflowInputPort port = df.getInputPorts().get(0);
- assertEquals("Name should be input1","input1",port.getName());
- assertEquals("depth should be 0",0,port.getDepth());
- assertEquals("granular depth should be 0",0,port.getGranularInputDepth());
-
- port = df.getInputPorts().get(1);
- assertEquals("Name should be input2","input2",port.getName());
- assertEquals("depth should be 1",1,port.getDepth());
- assertEquals("granular depth should be 1",1,port.getGranularInputDepth());
-
- DataflowOutputPort outputPort = df.getOutputPorts().get(0);
- assertEquals("Name should be output","output",outputPort.getName());
- }
-
- @Test
- public void testDataflowConditionLink() throws Exception {
- Element element = loadXMLFragment("dataflow_with_condition.xml");
- Dataflow df = deserializer.deserializeDataflow(element,new HashMap<String, Element>());
-
- assertEquals("There should be 2 processors",2,df.getProcessors().size());
- Processor pA = df.getProcessors().get(0);
- Processor pB = df.getProcessors().get(1);
- if (!pB.getLocalName().equals("b_processor")) {
- pB=df.getProcessors().get(0);
- pA=df.getProcessors().get(1);
- }
- assertEquals("There should be 1 precondition",1,pB.getPreconditionList().size());
- Condition con = pB.getPreconditionList().get(0);
- assertSame("the control processor shoudl be a_processor",pA, con.getControl());
- }
-
- @Test
- public void testDataflowProcessor() throws Exception {
- Element element = loadXMLFragment("dataflow_with_unlinked_processor.xml");
- Dataflow df = deserializer.deserializeDataflow(element,new HashMap<String, Element>());
- assertEquals("There should be 1 processor",1,df.getProcessors().size());
- assertEquals("Processor name should be a_processor","a_processor",df.getProcessors().get(0).getLocalName());
- }
-
-
- @Test
- public void testDataflowDataLinks() throws Exception {
- Element el = loadXMLFragment("dataflow_datalinks.xml");
- Dataflow df = deserializer.deserializeDataflow(el,new HashMap<String, Element>());
-
- assertEquals("There should be 2 processors",2,df.getProcessors().size());
- assertEquals("There should be 2 datalinks",2,df.getLinks().size());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializerTest.java
deleted file mode 100644
index 6c2f8af..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DataflowXMLSerializerTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-
-public class DataflowXMLSerializerTest implements XMLSerializationConstants {
- DataflowXMLSerializer serializer = DataflowXMLSerializer.getInstance();
- Edits edits = new EditsImpl();
-
- @Test
- public void testDataflowInputPorts() throws Exception {
- Dataflow df = edits.createDataflow();
- edits.getCreateDataflowInputPortEdit(df, "dataflow_in", 1, 0).doEdit();
-
- Element el = serializer.dataflowInputPorts(df.getInputPorts());
-
-
- assertEquals("root name should be inputPorts","inputPorts",el.getName());
- assertEquals("there should be 1 child called port",1,el.getChildren("port",T2_WORKFLOW_NAMESPACE).size());
- Element port=el.getChild("port",T2_WORKFLOW_NAMESPACE);
- assertEquals("name should be dataflow_in","dataflow_in",port.getChild("name",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("depth should be 1","1",port.getChild("depth",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("granular depth should be 0","0",port.getChild("granularDepth",T2_WORKFLOW_NAMESPACE).getText());
-
- }
-
- @Test
- public void testDataflowNameandId() throws Exception {
- Dataflow df = edits.createDataflow();
- ((DataflowImpl)df).setLocalName("the-name");
- Element el = serializer.serializeDataflow(df);
- assertEquals("there should be 1 child called name",1,el.getChildren("name",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("the name should be the-name","the-name",el.getChildText("name",T2_WORKFLOW_NAMESPACE));
- assertNotNull("there should be an id attribute set",el.getAttributeValue("id"));
- assertEquals("there should be an id attribute set that matches the dataflow",df.getInternalIdentier(),el.getAttributeValue("id"));
- }
-
- @Test
- public void testDataflowOutputPorts() throws Exception {
- Dataflow df = edits.createDataflow();
- edits.getCreateDataflowOutputPortEdit(df, "dataflow_out").doEdit();
- Element el = serializer.dataflowOutputPorts(df.getOutputPorts());
-
- assertEquals("root name should be outputPorts","outputPorts",el.getName());
- assertEquals("there should be 1 child called port",1,el.getChildren("port",T2_WORKFLOW_NAMESPACE).size());
- Element port=el.getChild("port",T2_WORKFLOW_NAMESPACE);
- assertEquals("name should be dataflow_out","dataflow_out",port.getChild("name",T2_WORKFLOW_NAMESPACE).getText());
- }
-
- @Test
- public void testDataflowNamespace() throws Exception {
- Dataflow df = edits.createDataflow();
- Element el = serializer.serializeDataflow(df);
- assertEquals("Incorrect namespace","http://taverna.sf.net/2008/xml/t2flow",el.getNamespace().getURI());
-
- Element child = el.getChild("inputPorts",T2_WORKFLOW_NAMESPACE);
- assertEquals("Children should also have the correct namespace","http://taverna.sf.net/2008/xml/t2flow",child.getNamespace().getURI());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializerTest.java
deleted file mode 100644
index 208a72b..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DatalinksXMLSerializerTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.Merge;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-public class DatalinksXMLSerializerTest implements XMLSerializationConstants {
- DatalinksXMLSerializer serializer = DatalinksXMLSerializer.getInstance();
- private Edits edits = new EditsImpl();
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
- @Test
- public void testDatalinks() throws Exception {
- Processor p = edits.createProcessor("top");
- Processor p2 = edits.createProcessor("bottom");
- ProcessorInputPort iPort = edits.createProcessorInputPort(p2, "input", 0);
- ProcessorOutputPort oPort = edits.createProcessorOutputPort(p, "output", 0, 0);
- edits.getAddProcessorInputPortEdit(p2, iPort).doEdit();
- edits.getAddProcessorOutputPortEdit(p, oPort).doEdit();
- Datalink link = edits.createDatalink(p.getOutputPorts().get(0), p2
- .getInputPorts().get(0));
- List<Datalink> links = new ArrayList<Datalink>();
- links.add(link);
-
- Element el = serializer.datalinksToXML(links);
-
- assertEquals("Root name should be datalinks", "datalinks", el.getName());
- assertEquals("there should be 1 child named datalink", 1, el
- .getChildren("datalink", T2_WORKFLOW_NAMESPACE).size());
-
- }
-
- @Test
- public void testDatalinkMerge() throws Exception {
- Dataflow df = edits.createDataflow();
- Processor p = edits.createProcessor("top");
- Processor p2 = edits.createProcessor("bottom");
- edits.getAddProcessorEdit(df, p).doEdit();
- edits.getAddProcessorEdit(df, p2).doEdit();
- ProcessorInputPort iPort = edits.createProcessorInputPort(p2, "input", 0);
- ProcessorOutputPort oPort = edits.createProcessorOutputPort(p, "output", 0, 0);
- edits.getAddProcessorInputPortEdit(p2, iPort).doEdit();
- edits.getAddProcessorOutputPortEdit(p, oPort).doEdit();
- Merge m = edits.createMerge(df);
- edits.getAddMergeEdit(df, m).doEdit();
-
- edits.getConnectMergedDatalinkEdit(m, p.getOutputPorts().get(0),
- p2.getInputPorts().get(0)).doEdit();
-
- Element el = serializer.datalinksToXML(df.getLinks());
-
- assertEquals("root element should be datalinks", "datalinks", el
- .getName());
- assertEquals("there should be 1 child datalink", 1, el.getChildren(
- "datalink", T2_WORKFLOW_NAMESPACE).size());
-
- String xml = elementToString(el);
- String expected = "<datalinks xmlns=\""
- + T2_WORKFLOW_NAMESPACE.getURI()
- + "\"><datalink><sink type=\"merge\"><processor>bottom</processor><port>input</port></sink><source type=\"processor\"><processor>top</processor><port>output</port></source></datalink></datalinks>";
- assertEquals("Unexpected xml generated", expected, xml);
- }
-
- @Test
- public void testLinkedDataflowInputPort() throws Exception {
- Dataflow df = edits.createDataflow();
- edits.getCreateDataflowInputPortEdit(df, "dataflow_in", 0, 0).doEdit();
- Processor p = edits.createProcessor("p");
- ProcessorInputPort port = edits.createProcessorInputPort(p,"p_in",0);
- edits.getAddProcessorInputPortEdit(p, port).doEdit();
- Datalink link = edits.createDatalink(df.getInputPorts().get(0)
- .getInternalOutputPort(), p.getInputPorts().get(0));
- edits.getConnectDatalinkEdit(link).doEdit();
- List<Datalink> links = new ArrayList<Datalink>();
- links.add(link);
-
- Element el = serializer.datalinksToXML(links);
-
- assertEquals("Root name should be datalinks", "datalinks", el.getName());
- assertEquals("there should be 1 child named datalink", 1, el
- .getChildren("datalink", T2_WORKFLOW_NAMESPACE).size());
- Element elLink = el.getChild("datalink", T2_WORKFLOW_NAMESPACE);
- assertEquals("There should be 1 sink", 1, elLink.getChildren("sink",
- T2_WORKFLOW_NAMESPACE).size());
- assertEquals("There should be 1 source", 1, elLink.getChildren(
- "source", T2_WORKFLOW_NAMESPACE).size());
-
- Element elSink = elLink.getChild("sink", T2_WORKFLOW_NAMESPACE);
- assertEquals("type should be processor", "processor", elSink
- .getAttribute("type").getValue());
- assertEquals("processor name should be p", "p", elSink.getChildText(
- "processor", T2_WORKFLOW_NAMESPACE));
- assertEquals("port name should be p_in", "p_in", elSink.getChildText(
- "port", T2_WORKFLOW_NAMESPACE));
-
- Element elSource = elLink.getChild("source", T2_WORKFLOW_NAMESPACE);
- assertEquals("type should be dataflow", "dataflow", elSource
- .getAttribute("type").getValue());
- assertEquals("port name should be dataflow_in", "dataflow_in", elSource
- .getChildText("port", T2_WORKFLOW_NAMESPACE));
-
- }
-
- @Test
- public void testLinkedDataflowOutputPort() throws Exception {
- Dataflow df = edits.createDataflow();
- edits.getCreateDataflowOutputPortEdit(df, "dataflow_out").doEdit();
- Processor p = edits.createProcessor("p");
- ProcessorOutputPort port = edits.createProcessorOutputPort(p, "p_out", 0, 0);
- edits.getAddProcessorOutputPortEdit(p, port).doEdit();
- Datalink link = edits.createDatalink(p.getOutputPorts().get(0), df
- .getOutputPorts().get(0).getInternalInputPort());
- edits.getConnectDatalinkEdit(link).doEdit();
- List<Datalink> links = new ArrayList<Datalink>();
- links.add(link);
-
- Element el = serializer.datalinksToXML(links);
-
- assertEquals("Root name should be datalinks", "datalinks", el.getName());
- assertEquals("there should be 1 child named datalink", 1, el
- .getChildren("datalink", T2_WORKFLOW_NAMESPACE).size());
- Element elLink = el.getChild("datalink", T2_WORKFLOW_NAMESPACE);
- assertEquals("There should be 1 sink", 1, elLink.getChildren("sink",
- T2_WORKFLOW_NAMESPACE).size());
- assertEquals("There should be 1 source", 1, elLink.getChildren(
- "source", T2_WORKFLOW_NAMESPACE).size());
-
- Element elSink = elLink.getChild("sink", T2_WORKFLOW_NAMESPACE);
- assertEquals("type should be dataflow", "dataflow", elSink
- .getAttribute("type").getValue());
- assertEquals("port name should be dataflow_out", "dataflow_out", elSink
- .getChildText("port", T2_WORKFLOW_NAMESPACE));
-
- Element elSource = elLink.getChild("source", T2_WORKFLOW_NAMESPACE);
- assertEquals("type should be processor", "processor", elSource
- .getAttribute("type").getValue());
- assertEquals("processor name should be p", "p", elSource.getChildText(
- "processor", T2_WORKFLOW_NAMESPACE));
- assertEquals("port name should be p_in", "p_out", elSource
- .getChildText("port", T2_WORKFLOW_NAMESPACE));
- }
-
- @Test
- public void testDatalink() throws Exception {
- Processor p = edits.createProcessor("top");
- Processor p2 = edits.createProcessor("bottom");
- ProcessorInputPort iPort = edits.createProcessorInputPort(p2, "input", 0);
- edits.getAddProcessorInputPortEdit(p2, iPort).doEdit();
- ProcessorOutputPort oPort = edits.createProcessorOutputPort(p, "output", 0, 0);
- edits.getAddProcessorOutputPortEdit(p, oPort).doEdit();
- Datalink link = edits.createDatalink(p.getOutputPorts().get(0), p2.getInputPorts().get(0));
- edits.getConnectDatalinkEdit(link).doEdit();
-
- Element el = serializer.datalinkToXML(link);
-
- assertEquals("root name should be datalink","datalink",el.getName());
- assertEquals("there should be 1 child called source",1,el.getChildren("source",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be 1 child called sink",1,el.getChildren("sink",T2_WORKFLOW_NAMESPACE).size());
- Element sink=el.getChild("sink",T2_WORKFLOW_NAMESPACE);
- Element source=el.getChild("source",T2_WORKFLOW_NAMESPACE);
-
- assertEquals("source processor should be called 'top'","top",source.getChild("processor",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("sink processor should be called 'bottom'","bottom",sink.getChild("processor",T2_WORKFLOW_NAMESPACE).getText());
-
- assertEquals("source port should be called 'output'","output",source.getChild("port",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("sink port should be called 'input'","input",sink.getChild("port",T2_WORKFLOW_NAMESPACE).getText());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerImplTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerImplTest.java
deleted file mode 100644
index c0f90b0..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerImplTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-
-import org.jdom.Element;
-import org.jdom.Namespace;
-import org.junit.Before;
-import org.junit.Test;
-
-public class DeserializerImplTest extends DeserializerTestsHelper {
-
- private XMLDeserializerImpl deserializer = new XMLDeserializerImpl();
-
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testDeserialize() throws Exception {
-
- Element element = new Element("workflow",Namespace.getNamespace("http://taverna.sf.net/2008/xml/t2flow"));
- Element innerDataflow = loadXMLFragment("empty_dataflow_with_ports.xml");
- innerDataflow.setAttribute("role","top");
- element.addContent(innerDataflow);
- Dataflow df = deserializer.deserializeDataflow(element);
-
- assertEquals("there should be 2 input ports",2,df.getInputPorts().size());
- assertEquals("there should be 1 output port",1,df.getOutputPorts().size());
-
- DataflowInputPort port = df.getInputPorts().get(0);
- assertEquals("Name should be input1","input1",port.getName());
- assertEquals("depth should be 0",0,port.getDepth());
- assertEquals("granular depth should be 0",0,port.getGranularInputDepth());
-
- port = df.getInputPorts().get(1);
- assertEquals("Name should be input2","input2",port.getName());
- assertEquals("depth should be 1",1,port.getDepth());
- assertEquals("granular depth should be 1",1,port.getGranularInputDepth());
-
- DataflowOutputPort outputPort = df.getOutputPorts().get(0);
- assertEquals("Name should be output","output",outputPort.getName());
-
- }
-
-
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerTestsHelper.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerTestsHelper.java
deleted file mode 100644
index 4da1717..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DeserializerTestsHelper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.jdom.Element;
-import org.jdom.input.SAXBuilder;
-
-public class DeserializerTestsHelper {
-
- protected Edits edits = new EditsImpl();
-
- protected Element loadXMLFragment(String resourceName) throws Exception {
- InputStream inStream = DeserializerImplTest.class
- .getResourceAsStream("/serialized-fragments/" + resourceName);
-
- if (inStream==null) throw new IOException("Unable to find resource for serialized fragment :"+resourceName);
- SAXBuilder builder = new SAXBuilder();
- return builder.build(inStream).detachRootElement();
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializerTest.java
deleted file mode 100644
index 43473e9..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLDeserializerTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-public class DispatchLayerXMLDeserializerTest extends DeserializerTestsHelper {
- DispatchLayerXMLDeserializer deserializer = DispatchLayerXMLDeserializer.getInstance();
-
- @Test
- public void testDispatchLayer() throws Exception {
- Element el = loadXMLFragment("dispatchLayer.xml");
- DispatchLayer<?> layer = deserializer.deserializeDispatchLayer(el);
- assertTrue("Should be a Parallelize layer",layer instanceof Parallelize);
- Parallelize para = (Parallelize)layer;
- assertTrue("config should be ParellizeConfig",para.getConfiguration() instanceof ParallelizeConfig);
- assertEquals("max jobs should be 7",7,((ParallelizeConfig)para.getConfiguration()).getMaximumJobs());
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializerTest.java
deleted file mode 100644
index d022322..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchLayerXMLSerializerTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-public class DispatchLayerXMLSerializerTest implements XMLSerializationConstants {
- DispatchLayerXMLSerializer serializer = DispatchLayerXMLSerializer.getInstance();
-
- @Test
- public void testDispatchLayerSerialization() throws Exception {
- Parallelize layer = new Parallelize();
- layer.configure(new ParallelizeConfig());
- Element el = serializer.dispatchLayerToXML(layer);
-
- assertEquals("element should have name dispatchLayer","dispatchLayer",el.getName());
- Element classChild = el.getChild("class",T2_WORKFLOW_NAMESPACE);
-
- assertNotNull("There should be a child called class",classChild);
- assertEquals("Incorrect class name for Parellalize","net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize",classChild.getText());
-
- Element bean = el.getChild("configBean",T2_WORKFLOW_NAMESPACE);
- assertNotNull("there should be a child called configBean",bean);
- assertEquals("the type should be xstream","xstream",bean.getAttribute("encoding").getValue());
- assertEquals("there should be 1 child that describes the class",1,bean.getChildren().size());
-
- classChild=(Element)bean.getChildren().get(0);
- assertEquals("the element name should describe the Parallelize child","net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig",classChild.getName());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializerTest.java
deleted file mode 100644
index c638495..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLDeserializerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-public class DispatchStackXMLDeserializerTest extends DeserializerTestsHelper {
- DispatchStackXMLDeserializer deserializer = DispatchStackXMLDeserializer.getInstance();
-
- @Test
- public void testDispatchStack() throws Exception {
- Element el = loadXMLFragment("dispatchStack.xml");
- Processor p = edits.createProcessor("p");
- deserializer.deserializeDispatchStack(p, el);
- assertEquals("there should be 5 layers",5,p.getDispatchStack().getLayers().size());
- assertTrue("first layer should be parallelize, but was "+p.getDispatchStack().getLayers().get(0),p.getDispatchStack().getLayers().get(0) instanceof Parallelize);
- assertTrue("2nd layer should be ErrorBounce, but was "+p.getDispatchStack().getLayers().get(1),p.getDispatchStack().getLayers().get(1) instanceof ErrorBounce);
- assertTrue("3rd layer should be Failover, but was "+p.getDispatchStack().getLayers().get(2),p.getDispatchStack().getLayers().get(2) instanceof Failover);
- assertTrue("4th layer should be Retry, but was "+p.getDispatchStack().getLayers().get(3),p.getDispatchStack().getLayers().get(3) instanceof Retry);
- assertTrue("5th layer should be Invoke, but was "+p.getDispatchStack().getLayers().get(4),p.getDispatchStack().getLayers().get(4) instanceof Invoke);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializerTest.java
deleted file mode 100644
index 4eec8fa..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DispatchStackXMLSerializerTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-
-public class DispatchStackXMLSerializerTest implements XMLSerializationConstants {
- DispatchStackXMLSerializer serializer = DispatchStackXMLSerializer.getInstance();
- Edits edits = new EditsImpl();
-
- @Test
- public void testDispatchStackSerialization() throws Exception {
- Processor p = edits.createProcessor("test");
- edits.getAddDispatchLayerEdit(p.getDispatchStack(), new Invoke(), 0).doEdit();
- edits.getAddDispatchLayerEdit(p.getDispatchStack(), new Failover(), 1).doEdit();
- Element el = serializer.dispatchStackToXML(p.getDispatchStack());
-
-
- assertEquals("root name should be dispatchStack","dispatchStack",el.getName());
- assertEquals("there should be 2 inner layer elements",2,el.getChildren("dispatchLayer",T2_WORKFLOW_NAMESPACE).size());
-
- Element firstLayer = (Element)el.getChildren("dispatchLayer",T2_WORKFLOW_NAMESPACE).get(0);
- assertEquals("child for layer define the class for the Invoke layer","net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke",firstLayer.getChild("class",T2_WORKFLOW_NAMESPACE).getText());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DummyDataflowActivity.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DummyDataflowActivity.java
deleted file mode 100644
index b8bc2f3..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/DummyDataflowActivity.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import java.util.Map;
-
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractAsynchronousActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AsynchronousActivityCallback;
-
-public class DummyDataflowActivity extends AbstractAsynchronousActivity<Dataflow> {
- Dataflow df;
- @Override
- public void configure(Dataflow conf) throws ActivityConfigurationException {
- this.df=conf;
-
- }
-
- @Override
- public void executeAsynch(Map<String, T2Reference> data,
- AsynchronousActivityCallback callback) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Dataflow getConfiguration() {
- return df;
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStragegyStackXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStragegyStackXMLDeserializerTest.java
deleted file mode 100644
index 896e949..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStragegyStackXMLDeserializerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategy;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-public class IterationStragegyStackXMLDeserializerTest extends DeserializerTestsHelper {
- private IterationStrategyStackXMLDeserializer deserializer = IterationStrategyStackXMLDeserializer.getInstance();
-
- @Test
- public void testCrossProducts() throws Exception {
- Element el = loadXMLFragment("2_port_cross_product.xml");
- Processor p =edits.createProcessor("test");
-
- deserializer.deserializeIterationStrategyStack(el, p.getIterationStrategy());
- assertEquals("There should be 1 strategy",1,p.getIterationStrategy().getStrategies().size());
-
- IterationStrategy strat = p.getIterationStrategy().getStrategies().get(0);
-
- assertNotNull(strat.getDesiredCardinalities());
- assertNotNull(strat.getDesiredCardinalities().get("nested_beanshell_in"));
- assertNotNull(strat.getDesiredCardinalities().get("nested_beanshell_in2"));
-
- assertEquals("cardinality should be 0",Integer.valueOf(0),strat.getDesiredCardinalities().get("nested_beanshell_in"));
- assertEquals("cardinality should be 1",Integer.valueOf(1),strat.getDesiredCardinalities().get("nested_beanshell_in2"));
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializerTest.java
deleted file mode 100644
index a32801b..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/IterationStrategyStackXMLSerializerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.DotProduct;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.NamedInputPortNode;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyImpl;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.impl.IterationStrategyStackImpl;
-
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-
-
-public class IterationStrategyStackXMLSerializerTest implements XMLSerializationConstants {
- IterationStrategyStackXMLSerializer serializer = IterationStrategyStackXMLSerializer.getInstance();
-
- @Test
- public void testIterationStrategyStack() throws Exception {
- NamedInputPortNode nipn1 = new NamedInputPortNode("a", 0);
- NamedInputPortNode nipn2 = new NamedInputPortNode("b", 0);
- IterationStrategyImpl strat = new IterationStrategyImpl();
-
- DotProduct dp = new DotProduct();
- nipn1.setParent(dp);
- nipn2.setParent(dp);
- dp.setParent(strat.getTerminalNode());
- IterationStrategyImpl is = new IterationStrategyImpl();
- is.addInput(nipn1);
- is.addInput(nipn2);
-
- IterationStrategyStackImpl stack = new IterationStrategyStackImpl();
- stack.addStrategy(strat);
-
- Element el = serializer.iterationStrategyStackToXML(stack);
-
- assertEquals("root name should be iterationStrategyStack","iterationStrategyStack",el.getName());
- assertEquals("child name should be iteration","iteration",el.getChild("iteration",T2_WORKFLOW_NAMESPACE).getName());
- Element iteration=el.getChild("iteration",T2_WORKFLOW_NAMESPACE);
- assertEquals("there should be 1 child named strategy",1,iteration.getChildren("strategy",T2_WORKFLOW_NAMESPACE).size());
- Element strategy=iteration.getChild("strategy",T2_WORKFLOW_NAMESPACE);
- assertEquals("there should be 1 child named dot",1,strategy.getChildren("dot",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be no child named cross",0,strategy.getChildren("cross",T2_WORKFLOW_NAMESPACE).size());
- Element dot=strategy.getChild("dot",T2_WORKFLOW_NAMESPACE);
- dot.setNamespace(null);
- for (Object child : dot.getChildren()) {
- ((Element)child).setNamespace(null);
- }
- assertEquals("wrong xml for dot","<dot><port name=\"a\" depth=\"0\" /><port name=\"b\" depth=\"0\" /></dot>",elementToString(dot));
-
- }
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
-
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializerTest.java
deleted file mode 100644
index 7b04585..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLDeserializerTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import java.util.HashMap;
-
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.processor.iteration.IterationStrategyStack;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-public class ProcessorXMLDeserializerTest extends DeserializerTestsHelper {
- ProcessorXMLDeserializer deserializer = ProcessorXMLDeserializer.getInstance();
-
- @Test
- public void testProcessor() throws Exception {
- Element el = loadXMLFragment("processor.xml");
- Processor p = deserializer.deserializeProcessor(el,new HashMap<String, Element>());
-
- assertEquals("Local name should be george","george",p.getLocalName());
- assertEquals("there should be 1 input port",1,p.getInputPorts().size());
- assertEquals("there should be 0 activities",0,p.getActivityList().size());
- assertEquals("there should be 1 output port",1,p.getOutputPorts().size());
- assertNotNull("there should be an iteration strategy",p.getIterationStrategy());
- assertEquals("there should be no dispatch stack layers",0,p.getDispatchStack().getLayers().size());
-
- ProcessorInputPort processorInputPort = p.getInputPorts().get(0);
- assertEquals("name should be input","input",processorInputPort.getName());
- assertEquals("depth should be 0",0,processorInputPort.getDepth());
-
- ProcessorOutputPort processorOutputPort = p.getOutputPorts().get(0);
- assertEquals("name should be output","output",processorOutputPort.getName());
- assertEquals("depth should be 1",1,processorOutputPort.getDepth());
- assertEquals("granular depth should be 0",0,processorOutputPort.getGranularDepth());
-
- IterationStrategyStack stack=p.getIterationStrategy();
- assertEquals("There should be 1 iteration strategy defined",1,stack.getStrategies().size());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializerTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializerTest.java
deleted file mode 100644
index b1606ae..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/ProcessorXMLSerializerTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorInputPort;
-import net.sf.taverna.t2.workflowmodel.ProcessorOutputPort;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.jdom.Element;
-import org.junit.Test;
-
-
-
-public class ProcessorXMLSerializerTest implements XMLSerializationConstants {
- Edits edits = new EditsImpl();
-
- ProcessorXMLSerializer serializer = ProcessorXMLSerializer.getInstance();
-
- @Test
- public void testProcessorSerialization() throws Exception {
- Processor p = edits.createProcessor("fred");
- ProcessorInputPort iPort = edits.createProcessorInputPort(p, "input", 0);
- ProcessorOutputPort oPort = edits.createProcessorOutputPort(p, "output", 1, 0);
- edits.getAddProcessorInputPortEdit(p, iPort).doEdit();
- edits.getAddProcessorOutputPortEdit(p, oPort).doEdit();
-
- Element el = serializer.processorToXML(p);
-
-
- assertNotNull("Element should not be null",el);
-
- assertEquals("root element should be processor","processor",el.getName());
- Element name=el.getChild("name",T2_WORKFLOW_NAMESPACE);
- assertNotNull("There should be a child called name",name);
- assertEquals("name should be fred","fred",name.getText());
-
- assertEquals("there should be an annotations child (even if its empty)",1,el.getChildren("annotations",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be an activities child (even if its empty)",1,el.getChildren("activities",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be an dispatch statck child (even if its empty)",1,el.getChildren("dispatchStack",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be an iteration strategy stack child (even if its empty)",1,el.getChildren("iterationStrategyStack",T2_WORKFLOW_NAMESPACE).size());
- assertEquals("there should be an input ports child (even if its empty)",1,el.getChildren("inputPorts",T2_WORKFLOW_NAMESPACE).size());
- Element inputPorts = el.getChild("inputPorts",T2_WORKFLOW_NAMESPACE);
- assertEquals("there should be 1 port element",1,inputPorts.getChildren("port",T2_WORKFLOW_NAMESPACE).size());
- Element port = inputPorts.getChild("port",T2_WORKFLOW_NAMESPACE);
- assertEquals("name should be input","input",port.getChild("name",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("depth should be 0","0",port.getChild("depth",T2_WORKFLOW_NAMESPACE).getText());
- Element outputPorts = el.getChild("outputPorts",T2_WORKFLOW_NAMESPACE);
- assertEquals("there should be an output ports child (even if its empty)",1,el.getChildren("outputPorts",T2_WORKFLOW_NAMESPACE).size());
- port = outputPorts.getChild("port",T2_WORKFLOW_NAMESPACE);
- assertEquals("name should be output","output",port.getChild("name",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("depth should be 1","1",port.getChild("depth",T2_WORKFLOW_NAMESPACE).getText());
- assertEquals("granularDepth should be 0","0",port.getChild("granularDepth",T2_WORKFLOW_NAMESPACE).getText());
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerImplTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerImplTest.java
deleted file mode 100644
index f0639ee..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerImplTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.*;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.impl.DataflowImpl;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-
-import org.apache.log4j.Logger;
-import org.jdom.Element;
-import org.jdom.output.XMLOutputter;
-import org.junit.Test;
-
-public class SerializerImplTest implements XMLSerializationConstants{
-
- private static Logger logger = Logger.getLogger(SerializerImplTest.class);
-
- private XMLSerializerImpl serializer=new XMLSerializerImpl();
- private EditsImpl edits = new EditsImpl();
-
- @Test
- public void testDataflowSerialization() throws Exception {
- //FIXME: Update to include name - a Dataflow has a LocalName
- Dataflow df = edits.createDataflow();
- Element el = serializer.serializeDataflow(df);
-
- logger.info("workflow serialization xml = "+elementToString(el));
-
- assertEquals("root should be workflow","workflow",el.getName());
- assertEquals("there should be 1 child 'dataflow'",1,el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).size());
- Element dfElement = el.getChild("dataflow",T2_WORKFLOW_NAMESPACE);
- assertEquals("the inner dataflow should have a role as 'top'","top",dfElement.getAttribute("role").getValue());
- }
-
-
- private String elementToString(Element element) {
- return new XMLOutputter().outputString(element);
- }
-
- @Test
- public void testWithNested() throws Exception {
- DataflowImpl df = (DataflowImpl)edits.createDataflow();
- df.setLocalName("main_dataflow");
- DataflowImpl innerDf = (DataflowImpl)edits.createDataflow();
- innerDf.setLocalName("inner_dataflow");
- DummyDataflowActivity a = new DummyDataflowActivity();
- a.configure(innerDf);
- Processor p = edits.createProcessor("proc");
- edits.getAddActivityEdit(p, a).doEdit();
- edits.getAddProcessorEdit(df, p).doEdit();
-
- Element el = serializer.serializeDataflow(df);
- assertEquals("root should be workflow","workflow",el.getName());
- assertEquals("there should be 2 child 'dataflow'",2,el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).size());
-
- Element elOuterDf = (Element)el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).get(0);
- Element elInnerDf = (Element)el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).get(1);
-
- assertEquals("first df should be role=top","top",elOuterDf.getAttribute("role").getValue());
- assertEquals("inner df should be role=nested","nested",elInnerDf.getAttribute("role").getValue());
- assertNotNull("inner df should have attribute id=inner_dataflow",elInnerDf.getAttributeValue("id"));
- }
-
- @Test
- //test for df that has a df activity that itself contains a df activity
- public void testWithNestedNested() throws Exception
- {
- DataflowImpl df = (DataflowImpl)edits.createDataflow();
- df.setLocalName("main_dataflow");
- DataflowImpl innerDf = (DataflowImpl)edits.createDataflow();
- innerDf.setLocalName("inner_dataflow");
- DummyDataflowActivity a = new DummyDataflowActivity();
- a.configure(innerDf);
- Processor p = edits.createProcessor("proc");
- edits.getAddActivityEdit(p, a).doEdit();
- edits.getAddProcessorEdit(df, p).doEdit();
-
- DataflowImpl innerInnerDf = (DataflowImpl)edits.createDataflow();
- innerInnerDf.setLocalName("inner_inner_dataflow");
- DummyDataflowActivity a2 = new DummyDataflowActivity();
- a2.configure(innerInnerDf);
- Processor p2 = edits.createProcessor("proc2");
- edits.getAddActivityEdit(p2, a2).doEdit();
- edits.getAddProcessorEdit(innerDf, p2).doEdit();
-
- Element el = serializer.serializeDataflow(df);
- assertEquals("root should be workflow","workflow",el.getName());
- assertEquals("there should be 3 child 'dataflow'",3,el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).size());
-
- Element elOuterDf = (Element)el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).get(0);
- Element elInnerDf = (Element)el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).get(1);
- Element elInnerInnerDf = (Element)el.getChildren("dataflow",T2_WORKFLOW_NAMESPACE).get(2);
-
- assertEquals("first df should be role=top","top",elOuterDf.getAttribute("role").getValue());
- assertEquals("inner df should be role=nested","nested",elInnerDf.getAttribute("role").getValue());
- assertNotNull("inner df should have attribute id=inner_dataflow",elInnerDf.getAttributeValue("id"));
-
- assertEquals("inner inner df should be role=nested","nested",elInnerInnerDf.getAttribute("role").getValue());
- assertNotNull("inner inner df should have attribute id=inner_dataflow",elInnerInnerDf.getAttributeValue("id"));
-
- }
-}
diff --git a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerRegistryTest.java b/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerRegistryTest.java
deleted file mode 100755
index d1d78ae..0000000
--- a/trunk/workflowmodel-impl/src/test/java/net/sf/taverna/t2/workflowmodel/serialization/xml/SerializerRegistryTest.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package net.sf.taverna.t2.workflowmodel.serialization.xml;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class SerializerRegistryTest {
-
- @Test
- public void getSerializer() {
- XMLSerializer serializer = XMLSerializerRegistry.getInstance().getSerializer();
- assertNotNull(serializer);
- }
-
- @Test
- public void getDeserializer() {
- XMLDeserializer deserializer = XMLDeserializerRegistry.getInstance().getDeserializer();
- assertNotNull(deserializer);
- }
-
-}
diff --git a/trunk/workflowmodel-impl/src/test/resources/log4j.properties b/trunk/workflowmodel-impl/src/test/resources/log4j.properties
deleted file mode 100644
index 2fba8c6..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/log4j.properties
+++ /dev/null
@@ -1,10 +0,0 @@
-log4j.rootLogger=WARN, CONSOLE
-log4j.logger.net.sf.taverna.t2=DEBUG
-#log4j.logger.net.sf.taverna.t2.ui=DEBUG
-
-#log4j.logger.org.apache.commons.httpclient=ERROR
-
-# Default output to console
-log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
-log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-5p %d{ISO8601} (%c:%L) - %m%n
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/2_port_cross_product.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/2_port_cross_product.xml
deleted file mode 100644
index 603685e..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/2_port_cross_product.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<iterationStrategyStack xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <iteration>
- <strategy>
- <cross>
- <port name="nested_beanshell_in" depth="0" />
- <port name="nested_beanshell_in2" depth="1" />
- </cross>
- </strategy>
- </iteration>
-</iterationStrategyStack>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/activity.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/activity.xml
deleted file mode 100644
index 3d0d426..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/activity.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<activity xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <class>
- net.sf.taverna.t2.workflowmodel.serialization.DummyActivity
- </class>
- <inputMap>
- <map from="in" to="in" />
- </inputMap>
- <outputMap>
- <map from="out" to="out" />
- </outputMap>
- <configBean encoding="xstream">
- <int xmlns="">5</int>
- </configBean>
-</activity>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_datalinks.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_datalinks.xml
deleted file mode 100644
index b7b7d58..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_datalinks.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<dataflow role="top" xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <inputPorts/>
- <outputPorts>
- <port>
- <name>df_output</name>
- </port>
- </outputPorts>
- <processors>
- <processor>
- <name>a_processor</name>
- <inputPorts />
- <outputPorts>
- <port>
- <name>a_output</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- <processor>
- <name>b_processor</name>
- <inputPorts>
- <port>
- <name>b_input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>b_output</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- </processors>
- <conditions />
- <datalinks xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <datalink>
- <sink type="processor">
- <processor>b_processor</processor>
- <port>b_input</port>
- </sink>
- <source type="processor">
- <processor>a_processor</processor>
- <port>a_output</port>
- </source>
- </datalink>
- <datalink>
- <sink type="dataflow">
- <port>df_output</port>
- </sink>
- <source type="processor">
- <processor>b_processor</processor>
- <port>b_output</port>
- </source>
- </datalink>
- </datalinks>
-</dataflow>
-
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_condition.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_condition.xml
deleted file mode 100644
index 608d1ec..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_condition.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<dataflow role="top" xmlns="http://taverna.sf.net/2008/xml/t2flow" id="123">
- <inputPorts />
- <outputPorts />
- <processors>
- <processor>
- <name>a_processor</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- <depth>1</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- <processor>
- <name>b_processor</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- <depth>1</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- </processors>
- <conditions>
- <condition control="a_processor" target="b_processor"/>
- </conditions>
- <datalinks />
-</dataflow>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_merge.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_merge.xml
deleted file mode 100644
index be0cca4..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_merge.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<dataflow xmlns="http://taverna.sf.net/2008/xml/t2flow" id="123">
- <inputPorts />
- <outputPorts />
- <processors>
- <processor>
- <name>top</name>
- <inputPorts />
- <outputPorts>
- <port>
- <name>output</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy />
- </iteration>
- </iterationStrategyStack>
- </processor>
- <processor>
- <name>bottom</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts />
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- </processors>
- <conditions />
- <datalinks>
- <datalink>
- <sink type="merge">
- <processor>bottom</processor>
- <port>input</port>
- </sink>
- <source type="processor">
- <processor>top</processor>
- <port>output</port>
- </source>
- </datalink>
- </datalinks>
-</dataflow>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_unlinked_processor.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_unlinked_processor.xml
deleted file mode 100644
index 2abafe7..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dataflow_with_unlinked_processor.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<dataflow role="top" xmlns="http://taverna.sf.net/2008/xml/t2flow" id="123">
- <inputPorts />
- <outputPorts />
- <processors>
- <processor>
- <name>a_processor</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- <depth>1</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
- </processor>
- </processors>
- <conditions />
- <datalinks />
-</dataflow>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchLayer.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchLayer.xml
deleted file mode 100644
index 572f3f4..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchLayer.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<dispatchLayer xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize
- </class>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig
- xmlns="">
- <maxJobs>7</maxJobs>
- </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig>
- </configBean>
-</dispatchLayer>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchStack.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchStack.xml
deleted file mode 100644
index 20184dc..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/dispatchStack.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<dispatchStack xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize
- </class>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig
- xmlns="">
- <maxJobs>1</maxJobs>
- </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ParallelizeConfig>
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Failover
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Retry
- </class>
- <configBean encoding="xstream">
- <net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig
- xmlns="">
- <backoffFactor>1.0</backoffFactor>
- <initialDelay>0</initialDelay>
- <maxDelay>0</maxDelay>
- <maxRetries>0</maxRetries>
- </net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.RetryConfig>
- </configBean>
- </dispatchLayer>
- <dispatchLayer>
- <class>
- net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Invoke
- </class>
- <configBean encoding="xstream">
- <null xmlns="" />
- </configBean>
- </dispatchLayer>
-</dispatchStack>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/empty_dataflow_with_ports.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/empty_dataflow_with_ports.xml
deleted file mode 100644
index 33a9746..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/empty_dataflow_with_ports.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<dataflow role="top" xmlns="http://taverna.sf.net/2008/xml/t2flow" id="123">
- <name>george</name>
- <inputPorts>
- <port>
- <name>input1</name>
- <depth>0</depth>
- <granularDepth>0</granularDepth>
- </port>
- <port>
- <name>input2</name>
- <depth>1</depth>
- <granularDepth>1</granularDepth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- </port>
- </outputPorts>
- <processors />
- <conditions />
- <datalinks />
-</dataflow>
\ No newline at end of file
diff --git a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/processor.xml b/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/processor.xml
deleted file mode 100644
index 30d541b..0000000
--- a/trunk/workflowmodel-impl/src/test/resources/serialized-fragments/processor.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<processor xmlns="http://taverna.sf.net/2008/xml/t2flow">
- <name>george</name>
- <inputPorts>
- <port>
- <name>input</name>
- <depth>0</depth>
- </port>
- </inputPorts>
- <outputPorts>
- <port>
- <name>output</name>
- <depth>1</depth>
- <granularDepth>0</granularDepth>
- </port>
- </outputPorts>
- <annotations />
- <activities />
- <dispatchStack />
- <iterationStrategyStack>
- <iteration>
- <strategy>
- <cross>
- <port name="input" depth="0" />
- </cross>
- </strategy>
- </iteration>
- </iterationStrategyStack>
-</processor>
\ No newline at end of file