You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/23 17:38:25 UTC

[41/51] [partial] incubator-taverna-engine git commit:

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.java
deleted file mode 100644
index b60333c..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/T2ReferenceType.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;
-
-/**
- * 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;
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.java
deleted file mode 100644
index a1ecc7d..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueCarryingExternalReference.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;
-
-/**
- * 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
-	 */
-	Class<T> getValueType();
-
-	/**
-	 * Returns the value
-	 */
-	T getValue();
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.java
deleted file mode 100644
index 3187184..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConversionException.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;
-
-/**
- * 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);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.java
deleted file mode 100644
index 04a4cfd..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/ValueToReferenceConverterSPI.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;
-
-/**
- * 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
-	 */
-	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
-	 */
-	ExternalReferenceSPI convert(Object o, ReferenceContext context)
-			throws ValueToReferenceConversionException;
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/WorkflowRunIdEntity.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/WorkflowRunIdEntity.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/WorkflowRunIdEntity.java
deleted file mode 100644
index e60bed9..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/WorkflowRunIdEntity.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;
-
-/**
- * Entity that wraps workflow run id and can be passed through (
- * {@link ReferenceContext} to be used by {@link T2ReferenceGenerator} to
- * generate references that are specific for a workflow run.
- * 
- * @author Alex Nenadic
- */
-public class WorkflowRunIdEntity {
-	private String workflowRunId;
-
-	public WorkflowRunIdEntity(String workflowRunId) {
-		this.setWorkflowRunId(workflowRunId);
-	}
-
-	public void setWorkflowRunId(String workflowRunId) {
-		this.workflowRunId = workflowRunId;
-	}
-
-	public String getWorkflowRunId() {
-		return workflowRunId;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java
deleted file mode 100644
index 863a193..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/DeleteIdentifiedOperation.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package net.sf.taverna.t2.reference.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Applied to methods in Dao implementations which delete data in the backing
- * store.
- * 
- * @author Stuart Owen
- */
-@Retention(RUNTIME)
-@Target(METHOD)
-public @interface DeleteIdentifiedOperation {
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.java
deleted file mode 100644
index bc23b20..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/GetIdentifiedOperation.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.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Applied to methods in Dao implementations which fetch data from the backing
- * store by ID
- * 
- * @author Tom Oinn
- */
-@Retention(RUNTIME)
-@Target(METHOD)
-public @interface GetIdentifiedOperation {
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.java
deleted file mode 100644
index d05febe..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/PutIdentifiedOperation.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.annotations;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Applied to methods in Dao implementations which store or update data in the
- * backing store.
- * 
- * @author Tom Oinn
- */
-@Retention(RUNTIME)
-@Target(METHOD)
-public @interface PutIdentifiedOperation {
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/annotations/package.html
deleted file mode 100644
index 0d38e1e..0000000
--- a/taverna-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

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.java
deleted file mode 100644
index f8f2076..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateComponentClass.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 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 {
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.java
deleted file mode 100644
index ae77e1d..0000000
--- a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/HibernateMappedEntity.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.h3;
-
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceSet;
-
-/**
- * A marker interface used to denote that the component should be registered
- * with the Hibernate ORM system prior to any {@link ExternalReferenceSPI}
- * implementations. This is here to allow implementations of e.g.
- * {@link 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 {
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/h3/package.html
deleted file mode 100644
index 4ffba14..0000000
--- a/taverna-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

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/package.html b/taverna-reference-api/src/main/java/net/sf/taverna/t2/reference/package.html
deleted file mode 100644
index 503dc3b..0000000
--- a/taverna-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:
-</p>
-<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>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

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/AbstractExternalReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/AbstractExternalReference.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/AbstractExternalReference.java
new file mode 100644
index 0000000..084844a
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/AbstractExternalReference.java
@@ -0,0 +1,88 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+import static org.apache.taverna.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
+	 */
+	@Override
+	public ReferencedDataNature getDataNature() {
+		return UNKNOWN;
+	}
+
+	/**
+	 * Default to returning null for charset
+	 */
+	@Override
+	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!
+	 */
+	@Override
+	public float getResolutionCost() {
+		return 0.0f;
+	}
+
+	@Override
+	public abstract ExternalReferenceSPI clone()
+			throws CloneNotSupportedException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ContextualizedT2Reference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ContextualizedT2Reference.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ContextualizedT2Reference.java
new file mode 100644
index 0000000..c0249e7
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ContextualizedT2Reference.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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.
+	 */
+	T2Reference getReference();
+
+	/**
+	 * @return the index of this T2Reference
+	 */
+	int[] getIndex();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/DaoException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/DaoException.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/DaoException.java
new file mode 100644
index 0000000..62d67cd
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/DaoException.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/DereferenceException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/DereferenceException.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/DereferenceException.java
new file mode 100644
index 0000000..572d150
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/DereferenceException.java
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocument.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocument.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocument.java
new file mode 100644
index 0000000..fbc5f1c
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocument.java
@@ -0,0 +1,55 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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 {@link Throwable} it will have a
+	 * stack trace, in this case the stack trace is represented as a list of
+	 * {@link StackTraceElement} beans
+	 */
+	List<StackTraceElementBean> getStackTraceStrings();
+
+	/**
+	 * If the error document is created from a {@link Throwable}, this contains
+	 * the message part of the {@link Throwable}.
+	 */
+	String getExceptionMessage();
+
+	/**
+	 * Error documents can carry an arbitrary string message, this returns it.
+	 */
+	String getMessage();
+
+	/**
+	 * If the error document is created from set of references that contain
+	 * error documents, this method returns them.
+	 */
+	Set<T2Reference> getErrorReferences();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentDao.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentDao.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentDao.java
new file mode 100644
index 0000000..a6adea2
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentDao.java
@@ -0,0 +1,63 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+import static org.springframework.transaction.annotation.Propagation.REQUIRED;
+import static org.springframework.transaction.annotation.Propagation.SUPPORTS;
+
+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 = REQUIRED, readOnly = false)
+	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 = SUPPORTS, readOnly = true)
+	ErrorDocument get(T2Reference reference) throws DaoException;
+
+	@Transactional(propagation = SUPPORTS, readOnly = false)
+	boolean delete(ErrorDocument errorDoc) throws DaoException;
+
+	@Transactional(propagation = SUPPORTS, readOnly = false)
+	void deleteErrorDocumentsForWFRun(String workflowRunId) throws DaoException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentService.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentService.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentService.java
new file mode 100644
index 0000000..1c8b5d4
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentService.java
@@ -0,0 +1,151 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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.
+	 * <p>
+	 * The created reference will be related with a workflow run id passed
+	 * through ReferenceContext so we can track all data referenced by a
+	 * specific run.
+	 * 
+	 * @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)
+	ErrorDocument registerError(String message, Throwable t, int depth,
+			ReferenceContext context) throws ErrorDocumentServiceException;
+
+	/**
+	 * Equivalent to <code>registerError(message, null, depth, context)</code>.
+	 */
+	@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
+	ErrorDocument registerError(String message, int depth,
+			ReferenceContext context) throws ErrorDocumentServiceException;
+
+	/**
+	 * Equivalent to <code>registerError("", t, depth, context)</code>.
+	 */
+	@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
+	ErrorDocument registerError(Throwable t, int depth, ReferenceContext context)
+			throws ErrorDocumentServiceException;
+
+	/**
+	 * Register a new error document.
+	 * <p>
+	 * The created reference will be related with a workflow run id passed
+	 * through ReferenceContext so we can track all data referenced by a
+	 * specific run.
+	 * 
+	 * @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)
+	ErrorDocument registerError(String message, Set<T2Reference> errors,
+			int depth, ReferenceContext context)
+			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).
+	 */
+	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.
+	 */
+	void getErrorAsynch(T2Reference id, ErrorDocumentServiceCallback callback)
+			throws ErrorDocumentServiceException;
+
+	/**
+	 * Return the T2Reference for the sole child of an error document
+	 * identifier.
+	 */
+	T2Reference getChild(T2Reference errorId)
+			throws ErrorDocumentServiceException;
+
+	@Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
+	boolean delete(T2Reference reference) throws ReferenceServiceException;
+
+	/**
+	 * Delete all {@link ErrorDocument}S used by the specific workflow run.
+	 */
+	@Transactional(propagation = Propagation.SUPPORTS, readOnly = false)
+	void deleteErrorDocumentsForWorkflowRun(String workflowRunId)
+			throws ReferenceServiceException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceCallback.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceCallback.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceCallback.java
new file mode 100644
index 0000000..245faa2
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceCallback.java
@@ -0,0 +1,46 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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
+	 */
+	void errorRetrieved(ErrorDocument errorDoc);
+
+	/**
+	 * Called if the retrieval failed for some reason
+	 * 
+	 * @param cause
+	 *            an ErrorDocumentServiceException explaining the retrieval
+	 *            failure
+	 */
+	void errorRetrievalFailed(ErrorDocumentServiceException cause);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceException.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceException.java
new file mode 100644
index 0000000..f10189b
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ErrorDocumentServiceException.java
@@ -0,0 +1,47 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceBuilderSPI.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceBuilderSPI.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceBuilderSPI.java
new file mode 100644
index 0000000..a22d1f2
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceBuilderSPI.java
@@ -0,0 +1,89 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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 byteStream
+	 *            the bytestream to read target from.
+	 * @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.
+	 */
+	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.
+	 */
+	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
+	 */
+	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.
+	 */
+	float getConstructionCost();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceConstructionException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceConstructionException.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceConstructionException.java
new file mode 100644
index 0000000..715d53d
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceConstructionException.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceSPI.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceSPI.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceSPI.java
new file mode 100644
index 0000000..43f00b7
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceSPI.java
@@ -0,0 +1,131 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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 extends Cloneable {
+	/**
+	 * 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
+	 */
+	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.
+	 */
+	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).
+	 */
+	InputStream openStream(ReferenceContext context)
+			throws DereferenceException;
+
+	/**
+	 * Approximate size of the stored data or -1 if we do not know.
+	 */
+	Long getApproximateSizeInBytes();
+
+	/**
+	 * 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.
+	 */
+	float getResolutionCost();
+
+	ExternalReferenceSPI clone() throws CloneNotSupportedException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceTranslatorSPI.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceTranslatorSPI.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceTranslatorSPI.java
new file mode 100644
index 0000000..30047e7
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceTranslatorSPI.java
@@ -0,0 +1,95 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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.
+	 */
+	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.
+	 */
+	Class<SourceType> getSourceReferenceType();
+
+	/**
+	 * Return the type of external reference this translator constructs.
+	 * 
+	 * @return ExternalReferenceSPI class corresponding to the reference type
+	 *         emitted by this translator.
+	 */
+	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
+	 */
+	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.
+	 */
+	float getTranslationCost();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceValidationException.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceValidationException.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceValidationException.java
new file mode 100644
index 0000000..aa084ca
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ExternalReferenceValidationException.java
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/Identified.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/Identified.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/Identified.java
new file mode 100644
index 0000000..9da23ca
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/Identified.java
@@ -0,0 +1,35 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+/**
+ * Interface for any object that has an associated {@link 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
+	 */
+	T2Reference getId();
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/IdentifiedList.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/IdentifiedList.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/IdentifiedList.java
new file mode 100644
index 0000000..747ff84
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/IdentifiedList.java
@@ -0,0 +1,45 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.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 {@link 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 {@link 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 {@link IllegalStateException}. Lists in T2, once named, are
+ * immutable.
+ * 
+ * @author Tom Oinn
+ * 
+ * @param <T>
+ */
+public interface IdentifiedList<T> extends List<T>, Identified {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ListDao.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ListDao.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ListDao.java
new file mode 100644
index 0000000..7be8c5e
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ListDao.java
@@ -0,0 +1,66 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+import static org.springframework.transaction.annotation.Propagation.REQUIRED;
+import static org.springframework.transaction.annotation.Propagation.SUPPORTS;
+
+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 = REQUIRED, readOnly = false)
+	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 = SUPPORTS, readOnly = true)
+	IdentifiedList<T2Reference> get(T2Reference reference) throws DaoException;
+
+	@Transactional(propagation = SUPPORTS, readOnly = false)
+	boolean delete(IdentifiedList<T2Reference> theList) throws DaoException;
+
+	@Transactional(propagation = SUPPORTS, readOnly = false)
+	void deleteIdentifiedListsForWFRun(String workflowRunId)
+			throws DaoException;
+}