You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 12:32:20 UTC

[14/50] [abbrv] incubator-taverna-engine git commit: taverna-reference-types

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml b/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
deleted file mode 100644
index aeed47f..0000000
--- a/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:beans="http://www.springframework.org/schema/beans"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                                 http://www.springframework.org/schema/beans/spring-beans.xsd
-                                 http://www.springframework.org/schema/osgi 
-                                 http://www.springframework.org/schema/osgi/spring-osgi.xsd" >
-
-	<service ref="inlineStringReferenceBuilder" interface="net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI" />
-	<service ref="inlineByteArrayReferenceBuilder" interface="net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI" />
-
-	<service ref="fileReference" interface="net.sf.taverna.t2.reference.ExternalReferenceSPI" />
-	<service ref="httpReference" interface="net.sf.taverna.t2.reference.ExternalReferenceSPI" />
-	<service ref="inlineStringReference" interface="net.sf.taverna.t2.reference.ExternalReferenceSPI" />
-	<service ref="inlineByteArrayReference" interface="net.sf.taverna.t2.reference.ExternalReferenceSPI" />
-	<service ref="vmObjectReference" interface="net.sf.taverna.t2.reference.ExternalReferenceSPI" />
-		
-	<service ref="streamToStringConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-	<service ref="streamToByteArrayConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-	<service ref="streamToVMObjectReferenceConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-	<service ref="streamToDoubleConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-	<service ref="streamToBooleanConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-	<service ref="streamToIntegerConverter" interface="net.sf.taverna.t2.reference.StreamToValueConverterSPI" />
-
-	<service ref="fileToFileReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="urlToHttpReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="stringToStringReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="byteArrayToByteArrayReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="numberToStringReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="characterToStringReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-	<service ref="booleanToStringReference" interface="net.sf.taverna.t2.reference.ValueToReferenceConverterSPI" />
-
-</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/reference-core-extensions-context.xml b/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
deleted file mode 100644
index 6b7a4cb..0000000
--- a/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans 
-                           http://www.springframework.org/schema/beans/spring-beans.xsd">
-                           
-	<bean id="inlineStringReferenceBuilder" class="net.sf.taverna.t2.reference.impl.external.object.InlineStringReferenceBuilder" />
-	<bean id="inlineByteArrayReferenceBuilder" class="net.sf.taverna.t2.reference.impl.external.object.InlineByteArrayReferenceBuilder" />
-
-	<bean id="fileReference" class="net.sf.taverna.t2.reference.impl.external.file.FileReference" />
-	<bean id="httpReference" class="net.sf.taverna.t2.reference.impl.external.http.HttpReference" />
-	<bean id="inlineStringReference" class="net.sf.taverna.t2.reference.impl.external.object.InlineStringReference" />
-	<bean id="inlineByteArrayReference" class="net.sf.taverna.t2.reference.impl.external.object.InlineByteArrayReference" />
-	<bean id="vmObjectReference" class="net.sf.taverna.t2.reference.impl.external.object.VMObjectReference" />
-
-	<bean id="streamToStringConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToStringConverter" />
-	<bean id="streamToByteArrayConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToByteArrayConverter" />
-	<bean id="streamToVMObjectReferenceConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToVMObjectReferenceConverter" />
-	<bean id="streamToDoubleConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToDoubleConverter" />
-	<bean id="streamToBooleanConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToBooleanConverter" />
-	<bean id="streamToIntegerConverter" class="net.sf.taverna.t2.reference.impl.external.object.StreamToIntegerConverter" />
-	
-	<bean id="fileToFileReference" class="net.sf.taverna.t2.reference.impl.external.file.FileToFileReference" />
-	<bean id="urlToHttpReference" class="net.sf.taverna.t2.reference.impl.external.http.UrlToHttpReference" />
-	<bean id="stringToStringReference" class="net.sf.taverna.t2.reference.impl.external.object.StringToStringReference" />
-	<bean id="byteArrayToByteArrayReference" class="net.sf.taverna.t2.reference.impl.external.object.ByteArrayToByteArrayReference" />
-	<bean id="numberToStringReference" class="net.sf.taverna.t2.reference.impl.external.object.NumberToStringReference" />
-	<bean id="characterToStringReference" class="net.sf.taverna.t2.reference.impl.external.object.CharacterToStringReference" />
-	<bean id="booleanToStringReference" class="net.sf.taverna.t2.reference.impl.external.object.BooleanToStringReference" />
-
-</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml b/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml
deleted file mode 100644
index 9a8fc05..0000000
--- a/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml
+++ /dev/null
@@ -1,18 +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 file reference bean -->
-<hibernate-mapping>
-	<joined-subclass
-		name="net.sf.taverna.t2.reference.impl.external.file.FileReference"
-		extends="net.sf.taverna.t2.reference.AbstractExternalReference">
-		<!-- Link to primary key from abstract superclass -->
-		<key column="bean_id" />
-		<!-- FileReference specific properties below here -->
-		<property name="filePath" type="string" />
-		<property name="dataNatureName" type="string"/>
-		<property name="charset" type="string" />
-	</joined-subclass>
-</hibernate-mapping>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml b/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml
deleted file mode 100644
index 99af97c..0000000
--- a/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.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 http and https reference bean -->
-<hibernate-mapping>
-	<joined-subclass
-		name="net.sf.taverna.t2.reference.impl.external.http.HttpReference"
-		extends="net.sf.taverna.t2.reference.AbstractExternalReference">
-		<!-- Link to primary key from abstract superclass -->
-		<key column="bean_id" />
-		<!-- HttpReference specific properties below here -->
-		<property name="httpUrlString" type="string" />
-	</joined-subclass>
-</hibernate-mapping>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml b/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml
deleted file mode 100644
index 8f9ff44..0000000
--- a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.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 inline byte array reference bean -->
-<hibernate-mapping>
-	<joined-subclass
-		name="net.sf.taverna.t2.reference.impl.external.object.InlineByteArrayReference"
-		extends="net.sf.taverna.t2.reference.AbstractExternalReference">
-		<!-- Link to primary key from abstract superclass -->
-		<key column="bean_id" />
-		<!-- Reference specific props -->
-		<property name="contents" type="text" length="1000000000" />
-	</joined-subclass>
-</hibernate-mapping>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml b/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml
deleted file mode 100644
index d81b227..0000000
--- a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.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 inline string reference bean -->
-<hibernate-mapping>
-	<joined-subclass
-		name="net.sf.taverna.t2.reference.impl.external.object.InlineStringReference"
-		extends="net.sf.taverna.t2.reference.AbstractExternalReference">
-		<!-- Link to primary key from abstract superclass -->
-		<key column="bean_id" />
-		<!-- Reference specific props -->
-		<property name="contents" type="text" length="1000000000"/>
-	</joined-subclass>
-</hibernate-mapping>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml b/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml
deleted file mode 100644
index 74c47a7..0000000
--- a/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.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 VM object reference bean -->
-<hibernate-mapping>
-	<joined-subclass
-		name="net.sf.taverna.t2.reference.impl.external.object.VMObjectReference"
-		extends="net.sf.taverna.t2.reference.AbstractExternalReference">
-		<!-- Link to primary key from abstract superclass -->
-		<key column="bean_id" />
-		<!-- VMObjectReference specific properties below here -->
-		<property name="uuid" type="string" />
-	</joined-subclass>
-</hibernate-mapping>
-

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java b/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java
deleted file mode 100644
index 5afa878..0000000
--- a/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package net.sf.taverna.t2.reference.impl.external.object;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.charset.Charset;
-import java.util.Set;
-
-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.impl.EmptyReferenceContext;
-import net.sf.taverna.t2.reference.impl.TranslationPath;
-import net.sf.taverna.t2referencetest.DummyReferenceSet;
-
-import org.junit.Test;
-
-public class ByteArrayToStringTest {
-
-	protected TranslationPath path  = new TranslationPath();
-	private final Charset UTF8 = Charset.forName("UTF-8");
-	// cleverly including the supplementary character U+10400
-	// which in UTF8 should be \xf0\x90\x90\x80
-	private final String string = "Ferronni\u00e8re \ud801\udc00";	
-	
-	
-	@Test
-	public void translateStringToByteTranslator() throws Exception {
-		ReferenceContext context = new EmptyReferenceContext();
-		InlineStringReference inlineString = new InlineStringReference();
-		inlineString.setContents(string);
-		path.setSourceReference(inlineString);
-		ReferenceSet rs = new DummyReferenceSet(inlineString);		
-		path.getTranslators().add(new InlineStringToInlineByteTranslator());
-		
-		Set<ExternalReferenceSPI> set = path.doTranslation(rs, context);		
-		assertEquals(1, set.size());
-		InlineByteArrayReference byteRef = (InlineByteArrayReference) set.iterator().next();
-		
-		assertEquals(string, new String(byteRef.getValue(), UTF8));		
-	}
-
-	@Test
-	public void translateByteToStringTranslator() throws Exception {
-		ReferenceContext context = new EmptyReferenceContext();
-		InlineByteArrayReference inlineByte = new InlineByteArrayReference();
-		inlineByte.setValue(string.getBytes(UTF8));
-		path.setSourceReference(inlineByte);
-		ReferenceSet rs = new DummyReferenceSet(inlineByte);		
-		path.getTranslators().add(new InlineByteToInlineStringTranslator());		
-		
-		Set<ExternalReferenceSPI> set = path.doTranslation(rs, context);		
-		assertEquals(1, set.size());
-		InlineStringReference inlineString = (InlineStringReference) set.iterator().next();
-		assertEquals(string,  inlineString.getContents());	
-	}
-
-	
-	@Test
-	public void translateStringToByteArrayBuilder() throws Exception {
-		ReferenceContext context = new EmptyReferenceContext();
-		InlineStringReference inlineString = new InlineStringReference();
-		inlineString.setContents(string);
-		path.setSourceReference(inlineString);
-		ReferenceSet rs = new DummyReferenceSet(inlineString);
-		path.setInitialBuilder(new InlineByteArrayReferenceBuilder());
-		Set<ExternalReferenceSPI> set = path.doTranslation(rs, context);		
-		assertEquals(1, set.size());
-		InlineByteArrayReference byteRef = (InlineByteArrayReference) set.iterator().next();
-		
-		assertEquals(string, new String(byteRef.getValue(), UTF8));		
-	}
-
-	@Test
-	public void translateByteArrayToStringBuilder() throws Exception {
-		ReferenceContext context = new EmptyReferenceContext();
-		InlineByteArrayReference inlineByte = new InlineByteArrayReference();
-		inlineByte.setValue(string.getBytes(UTF8));
-		path.setSourceReference(inlineByte);
-		ReferenceSet rs = new DummyReferenceSet(inlineByte);
-		path.setInitialBuilder(new InlineStringReferenceBuilder());
-		Set<ExternalReferenceSPI> set = path.doTranslation(rs, context);		
-		assertEquals(1, set.size());
-		assertTrue(set.iterator().next() instanceof InlineStringReference);
-		InlineStringReference inlineString = (InlineStringReference) set.iterator().next();
-		assertEquals(string,  inlineString.getContents());
-		//System.out.println(string);
-	}
-	
-	
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/README.md
----------------------------------------------------------------------
diff --git a/taverna-reference-types/README.md b/taverna-reference-types/README.md
new file mode 100644
index 0000000..faaf57d
--- /dev/null
+++ b/taverna-reference-types/README.md
@@ -0,0 +1,5 @@
+Taverna Workflow system Execution Engine data reference management implementation
+
+Implementations of certain SPIs to provide a core set of functionality for the reference management framework. This includes ExternalReference implementations to reference data held in local files and URLs along with the appropriate translate / publish logic. Implementations in this package are tied only to the API, although certain metadata files such as hibernate mappings are also included where appropriate (these will be silently ignored if using a backing store that is not hibernate based)
+
+This code was previously hosted at http://taverna.googlecode.com/svn/taverna/engine/net.sf.taverna.t2.core.reference-core-extensions

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/pom.xml b/taverna-reference-types/pom.xml
new file mode 100644
index 0000000..8539b9d
--- /dev/null
+++ b/taverna-reference-types/pom.xml
@@ -0,0 +1,100 @@
+<?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</groupId>
+		<artifactId>taverna-parent</artifactId>
+	    <version>3.0.1-SNAPSHOT</version>
+	</parent>
+	<groupId>net.sf.taverna.t2.core</groupId>
+	<artifactId>reference-core-extensions</artifactId>
+	<version>2.0.1-SNAPSHOT</version>
+	<packaging>bundle</packaging>
+	<name>Taverna engine referencetypes</name>
+	<description>
+		Implementations of certain SPIs to provide a core set of
+		functionality for the reference management framework. This
+		includes ExternalReference implementations to reference data
+		held in local files and URLs along with the appropriate
+		translate / publish logic.
+		Implementations in this package are tied only to the API, although
+		certain metadata files such as hibernate mappings are also included
+		where appropriate (these will be silently ignored if using a backing
+		store that is not hibernate based)
+	</description>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<extensions>true</extensions>
+				<configuration>
+					<instructions>
+						<Export-Package>net.sf.taverna.t2.reference.impl.external.*</Export-Package>
+					</instructions>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<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>
+		<repository>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+			<snapshots />
+			<id>mygrid-snapshot-repository</id>
+			<name>myGrid Snapshot Repository</name>
+			<url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>net.sf.taverna.t2.core</groupId>
+			<artifactId>reference-api</artifactId>
+			<version>${t2.core.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+			<version>${commons.codec.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>com.springsource.org.apache.commons.httpclient</artifactId>
+			<version>${commons.httpclient.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.core</groupId>
+			<artifactId>reference-testhelpers</artifactId>
+			<version>${t2.core.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.taverna.t2.core</groupId>
+			<artifactId>reference-impl</artifactId>
+			<version>${t2.core.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.log4j</groupId>
+			<artifactId>com.springsource.org.apache.log4j</artifactId>
+			<version>${log4j.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileReference.java
new file mode 100644
index 0000000..eeca752
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileReference.java
@@ -0,0 +1,210 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import net.sf.taverna.t2.reference.AbstractExternalReference;
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+
+/**
+ * Implementation of ExternalReference used to refer to data held in a locally
+ * accessible file. Inherits from
+ * {@link net.sf.taverna.t2.reference.AbstractExternalReference
+ * AbstractExternalReference} to enable hibernate based persistence.
+ * 
+ * @author Tom Oinn
+ */
+public class FileReference extends AbstractExternalReference implements
+		ExternalReferenceSPI {
+	private String filePathString = null;
+	private String charset = null;
+	private File file = null;
+	private String dataNatureName = ReferencedDataNature.UNKNOWN.name();
+
+	/**
+	 * Explicitly declare default constructor, will be used by hibernate when
+	 * constructing instances of this bean from the database.
+	 */
+	public FileReference() {
+		super();
+	}
+
+	/**
+	 * Construct a file reference pointed at the specified file and with no
+	 * character set defined.
+	 */
+	public FileReference(File theFile) {
+		super();
+		this.file = theFile.getAbsoluteFile();
+		this.filePathString = this.file.getPath();
+		this.charset = Charset.defaultCharset().name();
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public InputStream openStream(ReferenceContext context) {
+		try {
+			return new FileInputStream(file);
+		} catch (FileNotFoundException e) {
+			throw new RuntimeException(e);
+		}
+	}
+
+	/**
+	 * Setter used by hibernate to set the charset property of the file
+	 * reference
+	 */
+	public void setCharset(String charset) {
+		this.charset = charset;
+	}
+
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public String getCharset() {
+		return this.charset;
+	}
+
+	/**
+	 * Setter used by hibernate to set the file path property of the file
+	 * reference
+	 */
+	public void setFilePath(String filePathString) {
+		this.filePathString = filePathString;
+		this.file = new File(filePathString).getAbsoluteFile();
+	}
+
+	/**
+	 * Getter used by hibernate to retrieve the file path string property
+	 */
+	public String getFilePath() {
+		return this.filePathString;
+	}
+
+	/**
+	 * Human readable string form for debugging, should not be regarded as
+	 * stable.
+	 */
+	@Override
+	public String toString() {
+		return "file{" + file.getAbsolutePath() + "}";
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + ((file == null) ? 0 : file.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		final FileReference other = (FileReference) obj;
+		if (file == null) {
+			if (other.file != null)
+				return false;
+		} else if (!file.equals(other.file))
+			return false;
+		return true;
+	}
+
+	@Override
+	public Long getApproximateSizeInBytes() {
+		return new Long(file.length());
+	}
+
+	/**
+	 * @return the dataNature
+	 */
+	@Override
+	public ReferencedDataNature getDataNature() {
+		return Enum.valueOf(ReferencedDataNature.class, getDataNatureName());
+	}
+
+	/**
+	 * @param dataNature
+	 *            the dataNature to set
+	 */
+	public void setDataNature(ReferencedDataNature dataNature) {
+		setDataNatureName(dataNature.name());
+	}
+
+	/**
+	 * @return the file
+	 */
+	public final File getFile() {
+		return file;
+	}
+
+	@Override
+	public float getResolutionCost() {
+		return (float) 100.0;
+	}
+
+	/**
+	 * @return the dataNatureName
+	 */
+	public String getDataNatureName() {
+		return dataNatureName;
+	}
+
+	/**
+	 * @param dataNatureName
+	 *            the dataNatureName to set
+	 */
+	public void setDataNatureName(String dataNatureName) {
+		this.dataNatureName = dataNatureName;
+	}
+
+	public void deleteData() {
+		try {
+			getFile().delete();
+		} catch (SecurityException e) {
+			// TODO
+		}
+	}
+
+	@Override
+	public FileReference clone() {
+		FileReference result = new FileReference();
+		result.setFilePath(this.getFilePath());
+		result.setCharset(this.getCharset());
+		result.setDataNature(this.getDataNature());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileToFileReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileToFileReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileToFileReference.java
new file mode 100644
index 0000000..cde79a5
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/FileToFileReference.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.file;
+
+import java.io.File;
+import java.io.IOException;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Converts java.lang.File instances to FileReference reference type
+ * 
+ * @author Tom Oinn
+ */
+public class FileToFileReference implements ValueToReferenceConverterSPI {
+	/*
+	 * TODO - should probably do more sophisticated checks such as whether the
+	 * file is a file or directory etc etc, for now just checks whether the
+	 * specified object is a java.io.File
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		return (o instanceof File);
+	}
+
+	/**
+	 * Return a FileReference
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		FileReference result = new FileReference();
+		try {
+			result.setFilePath(((File) o).getCanonicalPath());
+		} catch (IOException ioe) {
+			throw new ValueToReferenceConversionException(ioe);
+		}
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/package.html b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/package.html
new file mode 100644
index 0000000..8be59b3
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/file/package.html
@@ -0,0 +1,4 @@
+<body>
+Support for references to a file on a local (or otherwise mounted)
+filesystem
+</body>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/HttpReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/HttpReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/HttpReference.java
new file mode 100644
index 0000000..d72eed6
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/HttpReference.java
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.http;
+
+import static java.lang.System.currentTimeMillis;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Date;
+
+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.ExternalReferenceValidationException;
+import net.sf.taverna.t2.reference.ReferenceContext;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.HeadMethod;
+
+/**
+ * Implementation of ExternalReference used to refer to data held in a locally
+ * accessible file. Inherits from
+ * {@link net.sf.taverna.t2.reference.AbstractExternalReference
+ * AbstractExternalReference} to enable hibernate based persistence.
+ * 
+ * @author Tom Oinn
+ */
+public class HttpReference extends AbstractExternalReference implements
+		ExternalReferenceSPI {
+	private String httpUrlString = null;
+	private URL httpUrl = null;
+	private String charsetName = null;
+	private boolean charsetFetched = false;
+	private transient Long cachedLength;
+	private transient Date cacheTime;
+
+	/**
+	 * Explicitly declare default constructor, will be used by hibernate when
+	 * constructing instances of this bean from the database.
+	 */
+	public HttpReference() {
+		super();
+	}
+
+	/**
+	 * Return the data at the {@link URL} represented by this external reference
+	 */
+	@Override
+	public InputStream openStream(ReferenceContext context)
+			throws DereferenceException {
+		try {
+			return httpUrl.openStream();
+		} catch (IOException e) {
+			throw new DereferenceException(e);
+		}
+	}
+
+	@Override
+	public String getCharset() throws DereferenceException {
+		if (charsetFetched)
+			return charsetName;
+		charsetFetched = true;
+		if (!httpUrl.getProtocol().equals("http")
+				&& !httpUrl.getProtocol().equals("https")) {
+			charsetName = null;
+			return null;
+		}
+		HeadMethod method = new HeadMethod(httpUrl.toExternalForm());
+		HttpClient httpClient = new HttpClient();
+		try {
+			httpClient.executeMethod(method);
+			charsetName = method.getResponseCharSet();
+			return charsetName;
+		} catch (HttpException e) {
+			// throw new DereferenceException(e);
+		} catch (IOException e) {
+			// throw new DereferenceException(e);
+		} finally {
+			method.releaseConnection();
+		}
+		charsetName = null;
+		return null;
+	}
+
+	/**
+	 * Setter used by hibernate to set the file path property of the file
+	 * reference
+	 * 
+	 * @throws ExternalReferenceValidationException
+	 *             if there is some problem parsing the supplied string as a URL
+	 */
+	public void setHttpUrlString(String httpUrlString) {
+		try {
+			this.httpUrlString = httpUrlString;
+			this.httpUrl = new URL(httpUrlString);
+		} catch (MalformedURLException e) {
+			throw new ExternalReferenceValidationException(e);
+		}
+	}
+
+	/**
+	 * Getter used by hibernate to retrieve the file path string property
+	 */
+	public String getHttpUrlString() {
+		return this.httpUrlString;
+	}
+
+	/**
+	 * Human readable string form for debugging, should not be regarded as
+	 * stable.
+	 */
+	@Override
+	public String toString() {
+		return "http{" + httpUrl.toExternalForm() + "}";
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((httpUrl == null) ? 0 : httpUrl.toExternalForm().hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (!(obj instanceof HttpReference))
+			return false;
+		final HttpReference other = (HttpReference) obj;
+		if (httpUrl == null) {
+			if (other.httpUrl != null)
+				return false;
+		} else if (!httpUrl.toExternalForm().equals(
+				other.httpUrl.toExternalForm()))
+			return false;
+		return true;
+	}
+
+	// One minute
+	private static final int CACHE_TIMEOUT = 60000;
+
+	@Override
+	public Long getApproximateSizeInBytes() {
+		long now = currentTimeMillis();
+		if (cachedLength != null && cacheTime != null
+				&& cacheTime.getTime() + CACHE_TIMEOUT > now)
+			return cachedLength;
+		try {
+			HttpURLConnection c = (HttpURLConnection) httpUrl.openConnection();
+			c.setRequestMethod("HEAD");
+			c.connect();
+			String lenString = c.getHeaderField("Content-Length");
+			if (lenString != null && !lenString.isEmpty()) {
+				cachedLength = new Long(lenString);
+				cacheTime = new Date(now);
+				return cachedLength;
+			}
+			// there is no Content-Length field so we cannot know the size
+		} catch (Exception e) {
+			// something went wrong, but we don't care what
+		}
+		cachedLength = null;
+		cacheTime = null;
+		return new Long(-1);
+	}
+
+	/**
+	 * @return the httpUrl
+	 */
+	public final URL getHttpUrl() {
+		return httpUrl;
+	}
+
+	@Override
+	public float getResolutionCost() {
+		return (float) 200.0;
+	}
+
+	public void deleteData() {
+		throw new UnsupportedOperationException(
+				"Cannot delete data referenced by a URL");
+	}
+
+	@Override
+	public HttpReference clone() {
+		HttpReference result = new HttpReference();
+		result.setHttpUrlString(this.getHttpUrlString());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/UrlToHttpReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/UrlToHttpReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/UrlToHttpReference.java
new file mode 100644
index 0000000..67c3fc8
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/UrlToHttpReference.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.http;
+
+import java.net.URL;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a URL with http protocol to a HttpReference reference type
+ * 
+ * @author Tom Oinn
+ * 
+ */
+public class UrlToHttpReference implements ValueToReferenceConverterSPI {
+	/**
+	 * Can convert if the object is an instance of java.net.URL and the protocol
+	 * is HTTP
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		if (o instanceof URL) {
+			String protocol = ((URL) o).getProtocol();
+			if (protocol.equalsIgnoreCase("http") || protocol.equals("https"))
+				return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Return a new HttpReference constructed from
+	 * <code>((URL)o).toExternalForm()</code>
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		HttpReference result = new HttpReference();
+		result.setHttpUrlString(((URL) o).toExternalForm());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/package.html b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/package.html
new file mode 100644
index 0000000..49d1d32
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/http/package.html
@@ -0,0 +1,3 @@
+<body>
+Support for references to a URL with the HTTP protocol
+</body>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/BooleanToStringReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/BooleanToStringReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/BooleanToStringReference.java
new file mode 100644
index 0000000..77d54fb
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/BooleanToStringReference.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a java.lang.Boolean to a StringReference.
+ * 
+ * @author Alan R Williams
+ */
+public class BooleanToStringReference implements ValueToReferenceConverterSPI {
+	/**
+	 * Can convert if the object is an instance of java.lang.Boolean
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		return o instanceof Boolean;
+	}
+
+	/**
+	 * Return a new InlineStringReference wrapping the supplied String
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		InlineStringReference result = new InlineStringReference();
+		String stringValue = ((Boolean) o).toString();
+		result.setContents(stringValue);
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToByteArrayReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToByteArrayReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToByteArrayReference.java
new file mode 100644
index 0000000..41e60ea
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToByteArrayReference.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a byte[] to a ByteArrayReference
+ * 
+ * @author Tom Oinn
+ */
+public class ByteArrayToByteArrayReference implements
+		ValueToReferenceConverterSPI {
+	/**
+	 * Can convert if the object is an instance of byte[]
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		return (o instanceof byte[]);
+	}
+
+	/**
+	 * Return a new InlineByteArrayReference wrapping the supplied byte[]
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		InlineByteArrayReference result = new InlineByteArrayReference();
+		result.setValue((byte[]) o);
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/CharacterToStringReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/CharacterToStringReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/CharacterToStringReference.java
new file mode 100644
index 0000000..c5d6c66
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/CharacterToStringReference.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a {@link Character} to a StringReference.
+ * 
+ * @author Alan R Williams
+ */
+public class CharacterToStringReference implements ValueToReferenceConverterSPI {
+	/**
+	 * Can convert if the object is an instance of java.lang.Character
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		return (o instanceof Character);
+	}
+
+	/**
+	 * Return a new {@link InlineStringReference} wrapping the supplied String
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		InlineStringReference result = new InlineStringReference();
+		String stringValue = ((Character) o).toString();
+		result.setContents(stringValue);
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.java
new file mode 100644
index 0000000..fac9f02
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import static org.apache.commons.codec.binary.Base64.decodeBase64;
+import static org.apache.commons.codec.binary.Base64.encodeBase64;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+
+import net.sf.taverna.t2.reference.AbstractExternalReference;
+import net.sf.taverna.t2.reference.DereferenceException;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueCarryingExternalReference;
+
+/**
+ * A reference implementation that inlines an array of bytes. Rather
+ * unpleasantly this currently exposes the byte array to Hibernate through a
+ * textual value, as Derby allows long textual values but not long binary ones
+ * (yuck). As it uses a fixed character set (UTF-8) to store and load I believe
+ * this doesn't break things.
+ * <p>
+ * Unfortunately this does break things (binaries get corrupted) so I've added
+ * base64 encoding of the value as a workaround.
+ * 
+ * @author Tom Oinn
+ * @author David Withers
+ */
+public class InlineByteArrayReference extends AbstractExternalReference
+		implements ValueCarryingExternalReference<byte[]> {
+	private byte[] bytes = new byte[0];
+
+	public void setValue(byte[] newBytes) {
+		this.bytes = newBytes;
+	}
+
+	@Override
+	public byte[] getValue() {
+		return bytes;
+	}
+
+	@Override
+	public Class<byte[]> getValueType() {
+		return byte[].class;
+	}
+
+	@Override
+	public InputStream openStream(ReferenceContext context)
+			throws DereferenceException {
+		return new ByteArrayInputStream(bytes);
+	}
+
+	private static final Charset charset = Charset.forName("UTF-8");
+
+	public String getContents() {
+		return new String(encodeBase64(bytes), charset);
+	}
+
+	public void setContents(String contentsAsString) {
+		this.bytes = decodeBase64(contentsAsString.getBytes(charset));
+	}
+
+	@Override
+	public Long getApproximateSizeInBytes() {
+		return new Long(bytes.length);
+	}
+
+	@Override
+	public InlineByteArrayReference clone() {
+		InlineByteArrayReference result = new InlineByteArrayReference();
+		result.setValue(this.getValue().clone());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReferenceBuilder.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReferenceBuilder.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReferenceBuilder.java
new file mode 100644
index 0000000..f58f77b
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReferenceBuilder.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import static net.sf.taverna.t2.reference.impl.external.object.StreamToByteArrayConverter.readFile;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI;
+import net.sf.taverna.t2.reference.ExternalReferenceConstructionException;
+import net.sf.taverna.t2.reference.ReferenceContext;
+
+/**
+ * Build an InlineByteArrayReference from an InputStream
+ * 
+ * @author Tom Oinn
+ * 
+ */
+public class InlineByteArrayReferenceBuilder implements
+		ExternalReferenceBuilderSPI<InlineByteArrayReference> {
+	@Override
+	public InlineByteArrayReference createReference(InputStream byteStream,
+			ReferenceContext context) {
+		try {
+			byte[] contents = readFile(byteStream);
+			InlineByteArrayReference ref = new InlineByteArrayReference();
+			ref.setValue(contents);
+			return ref;
+		} catch (IOException e) {
+			throw new ExternalReferenceConstructionException(e);
+		}
+	}
+
+	@Override
+	public float getConstructionCost() {
+		return 0.1f;
+	}
+
+	@Override
+	public Class<InlineByteArrayReference> getReferenceType() {
+		return InlineByteArrayReference.class;
+	}
+
+	@Override
+	public boolean isEnabled(ReferenceContext context) {
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteToInlineStringTranslator.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteToInlineStringTranslator.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteToInlineStringTranslator.java
new file mode 100644
index 0000000..b9aa66c
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineByteToInlineStringTranslator.java
@@ -0,0 +1,51 @@
+package net.sf.taverna.t2.reference.impl.external.object;
+
+import java.io.UnsupportedEncodingException;
+
+import net.sf.taverna.t2.reference.ExternalReferenceConstructionException;
+import net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+
+public class InlineByteToInlineStringTranslator
+		implements
+		ExternalReferenceTranslatorSPI<InlineByteArrayReference, InlineStringReference> {
+	@Override
+	public InlineStringReference createReference(
+			InlineByteArrayReference sourceReference, ReferenceContext context) {
+		String contents;
+		try {
+			String charset = sourceReference.getCharset();
+			if (charset == null)
+				// usual fallback:
+				charset = "UTF-8";
+			contents = new String(sourceReference.getValue(), charset);
+		} catch (UnsupportedEncodingException e) {
+			String msg = "Unknown character set "
+					+ sourceReference.getCharset();
+			throw new ExternalReferenceConstructionException(msg, e);
+		}
+		InlineStringReference ref = new InlineStringReference();
+		ref.setContents(contents);
+		return ref;
+	}
+
+	@Override
+	public Class<InlineByteArrayReference> getSourceReferenceType() {
+		return InlineByteArrayReference.class;
+	}
+
+	@Override
+	public Class<InlineStringReference> getTargetReferenceType() {
+		return InlineStringReference.class;
+	}
+
+	@Override
+	public boolean isEnabled(ReferenceContext context) {
+		return true;
+	}
+
+	@Override
+	public float getTranslationCost() {
+		return 0.001f;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.java
new file mode 100644
index 0000000..cf3de46
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+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.ReferenceContext;
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.ValueCarryingExternalReference;
+
+/**
+ * Contains and references a String value
+ * 
+ * @author Tom Oinn
+ */
+public class InlineStringReference extends AbstractExternalReference implements
+		ValueCarryingExternalReference<String> {
+	/**
+	 * Hold the 'value' of this reference, probably the simplest backing store
+	 * possible for an ExternalReferenceSPI implementation :)
+	 */
+	private String contents;
+	private transient Long length;
+
+	/**
+	 * 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.
+	 */
+	@Override
+	public InputStream openStream(ReferenceContext arg0) {
+		try {
+			return new ByteArrayInputStream(contents.getBytes(getCharset()));
+		} catch (UnsupportedEncodingException e) {
+			throw new DereferenceException(e);
+		}
+	}
+
+	/**
+	 * Default resolution cost of 0.0f whatever the contents
+	 */
+	@Override
+	public float getResolutionCost() {
+		return 0.0f;
+	}
+
+	/**
+	 * Data nature set to 'ReferencedDataNature.TEXT'
+	 */
+	@Override
+	public ReferencedDataNature getDataNature() {
+		return ReferencedDataNature.TEXT;
+	}
+
+	/**
+	 * Character encoding set to 'UTF-8' by default
+	 */
+	@Override
+	public String getCharset() {
+		return "UTF-8";
+	}
+
+	/**
+	 * String representation for testing, returns <code>string{CONTENTS}</code>
+	 */
+	@Override
+	public String toString() {
+		return "string{" + contents + "}";
+	}
+
+	@Override
+	public String getValue() {
+		return getContents();
+	}
+
+	@Override
+	public Class<String> getValueType() {
+		return String.class;
+	}
+
+	@Override
+	public Long getApproximateSizeInBytes() {
+		if (length == null)
+			length = new Long(contents.getBytes().length);
+		return length;
+	}
+
+	@Override
+	public InlineStringReference clone() {
+		InlineStringReference result = new InlineStringReference();
+		result.setContents(this.getContents());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReferenceBuilder.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReferenceBuilder.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReferenceBuilder.java
new file mode 100644
index 0000000..66c5512
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringReferenceBuilder.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import static net.sf.taverna.t2.reference.impl.external.object.StreamToStringConverter.readFile;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.nio.charset.Charset;
+
+import net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI;
+import net.sf.taverna.t2.reference.ExternalReferenceConstructionException;
+import net.sf.taverna.t2.reference.ReferenceContext;
+
+/**
+ * Build an InlineStringReference from an InputStream
+ * 
+ * @author Tom Oinn
+ */
+public class InlineStringReferenceBuilder implements
+		ExternalReferenceBuilderSPI<InlineStringReference> {
+	private static final Charset UTF8 = Charset.forName("UTF-8");
+	
+	@Override
+	public InlineStringReference createReference(InputStream byteStream,
+			ReferenceContext context) {
+		try {
+			/*
+			 * UTF8 is a slightly saner default than system default for most
+			 * bytestreams
+			 */
+			String contents = readFile(new BufferedReader(
+					new InputStreamReader(byteStream, UTF8)));
+			InlineStringReference ref = new InlineStringReference();
+			ref.setContents(contents);
+			return ref;
+		} catch (IOException e) {
+			throw new ExternalReferenceConstructionException(e);
+		}
+	}
+
+	@Override
+	public float getConstructionCost() {
+		return 0.1f;
+	}
+
+	@Override
+	public Class<InlineStringReference> getReferenceType() {
+		return InlineStringReference.class;
+	}
+
+	@Override
+	public boolean isEnabled(ReferenceContext context) {
+		return true;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringToInlineByteTranslator.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringToInlineByteTranslator.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringToInlineByteTranslator.java
new file mode 100644
index 0000000..e603a93
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/InlineStringToInlineByteTranslator.java
@@ -0,0 +1,40 @@
+package net.sf.taverna.t2.reference.impl.external.object;
+
+import java.nio.charset.Charset;
+
+import net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+
+public class InlineStringToInlineByteTranslator implements
+		ExternalReferenceTranslatorSPI<InlineStringReference, InlineByteArrayReference> {
+	private static final Charset UTF8 = Charset.forName("UTF-8");
+	
+	@Override
+	public InlineByteArrayReference createReference(
+			InlineStringReference sourceReference, ReferenceContext context) {
+		byte[] bytes = sourceReference.getValue().getBytes(UTF8);
+		InlineByteArrayReference ref = new InlineByteArrayReference();
+		ref.setValue(bytes);	
+		return ref;
+	}
+
+	@Override
+	public Class<InlineStringReference> getSourceReferenceType() {
+		return InlineStringReference.class;
+	}
+
+	@Override
+	public Class<InlineByteArrayReference> getTargetReferenceType() {
+		return InlineByteArrayReference.class;
+	}
+
+	@Override
+	public boolean isEnabled(ReferenceContext context) {
+		return true;
+	}
+
+	@Override
+	public float getTranslationCost() {
+		return 0.001f;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/NumberToStringReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/NumberToStringReference.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/NumberToStringReference.java
new file mode 100644
index 0000000..58fbc09
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/NumberToStringReference.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import net.sf.taverna.t2.reference.ExternalReferenceSPI;
+import net.sf.taverna.t2.reference.ReferenceContext;
+import net.sf.taverna.t2.reference.ValueToReferenceConversionException;
+import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a java.lang.Number to a StringReference.
+ * 
+ * @author Alex Nenadic
+ */
+public class NumberToStringReference implements ValueToReferenceConverterSPI {
+	/**
+	 * Can convert if the object is an instance of java.lang.Number
+	 */
+	@Override
+	public boolean canConvert(Object o, ReferenceContext context) {
+		return o instanceof Number;
+	}
+
+	/**
+	 * Return a new InlineStringReference wrapping the supplied String
+	 */
+	@Override
+	public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+			throws ValueToReferenceConversionException {
+		InlineStringReference result = new InlineStringReference();
+		result.setContents(o.toString());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToBooleanConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToBooleanConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToBooleanConverter.java
new file mode 100644
index 0000000..a26f4df
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToBooleanConverter.java
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package net.sf.taverna.t2.reference.impl.external.object;
+
+import java.io.InputStream;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * @author alanrw
+ */
+public class StreamToBooleanConverter implements
+		StreamToValueConverterSPI<Boolean> {
+	@Override
+	public Class<Boolean> getPojoClass() {
+		return Boolean.class;
+	}
+
+	@Override
+	public Boolean renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		StreamToStringConverter stringConverter = new StreamToStringConverter();
+		String s = stringConverter.renderFrom(stream, dataNature, charset);
+		Boolean result = Boolean.valueOf(s.trim());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToByteArrayConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToByteArrayConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToByteArrayConverter.java
new file mode 100644
index 0000000..e8c3a5a
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToByteArrayConverter.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * Build a byte[] from an InputStream
+ * 
+ * @author Tom Oinn
+ */
+public class StreamToByteArrayConverter implements
+		StreamToValueConverterSPI<byte[]> {
+	private static final int CHUNK_SIZE = 4096;
+
+	static byte[] readFile(InputStream reader) throws IOException {
+		ByteArrayOutputStream bos = new ByteArrayOutputStream();
+		byte[] buf = new byte[CHUNK_SIZE];
+		int len;
+		while ((len = reader.read(buf)) > 0)
+			bos.write(buf, 0, len);
+		return bos.toByteArray();
+	}
+
+	@Override
+	public Class<byte[]> getPojoClass() {
+		return byte[].class;
+	}
+
+	@Override
+	public byte[] renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		try {
+			return readFile(stream);
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToDoubleConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToDoubleConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToDoubleConverter.java
new file mode 100644
index 0000000..835c8cd
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToDoubleConverter.java
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package net.sf.taverna.t2.reference.impl.external.object;
+
+import java.io.InputStream;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * @author alanrw
+ */
+public class StreamToDoubleConverter implements
+		StreamToValueConverterSPI<Double> {
+	@Override
+	public Class<Double> getPojoClass() {
+		return Double.class;
+	}
+
+	@Override
+	public Double renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		StreamToStringConverter stringConverter = new StreamToStringConverter();
+		String s = stringConverter.renderFrom(stream, dataNature, charset);
+		Double result = Double.valueOf(s.trim());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToIntegerConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToIntegerConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToIntegerConverter.java
new file mode 100644
index 0000000..2a42a24
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToIntegerConverter.java
@@ -0,0 +1,29 @@
+/**
+ * 
+ */
+package net.sf.taverna.t2.reference.impl.external.object;
+
+import java.io.InputStream;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * @author alanrw
+ */
+public class StreamToIntegerConverter implements
+		StreamToValueConverterSPI<Integer> {
+	@Override
+	public Class<Integer> getPojoClass() {
+		return Integer.class;
+	}
+
+	@Override
+	public Integer renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		StreamToStringConverter stringConverter = new StreamToStringConverter();
+		String s = stringConverter.renderFrom(stream, dataNature, charset);
+		Integer result = Integer.valueOf(s.trim());
+		return result;
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToStringConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToStringConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToStringConverter.java
new file mode 100644
index 0000000..03edf56
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToStringConverter.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import static net.sf.taverna.t2.reference.ReferencedDataNature.TEXT;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.nio.charset.Charset;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * Build a String from an InputStream
+ * 
+ * @author Tom Oinn
+ */
+public class StreamToStringConverter implements
+		StreamToValueConverterSPI<String> {
+	private static final int END_OF_FILE = -1;
+	private static final int CHUNK_SIZE = 4096;
+	private static final Charset UTF8 = Charset.forName("UTF-8");
+
+	/**
+	 * Reads a text file and returns a string.
+	 */
+	static String readFile(Reader reader) throws IOException {
+		BufferedReader br = new BufferedReader(reader);
+		StringBuilder buffer = new StringBuilder();
+		char[] chunk = new char[CHUNK_SIZE];
+		int character;
+		while ((character = br.read(chunk)) != END_OF_FILE)
+			buffer.append(chunk, 0, character);
+		return buffer.toString();
+	}
+
+	@Override
+	public Class<String> getPojoClass() {
+		return String.class;
+	}
+
+	@Override
+	public String renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		try {
+			if (charset != null && dataNature.equals(TEXT))
+				try {
+					Charset c = Charset.forName(charset);
+					return readFile(new InputStreamReader(stream, c));
+				} catch (IllegalArgumentException e1) {
+					// Ignore; fallback below is good enough
+				}
+			return readFile(new InputStreamReader(stream, UTF8));
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		}
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/cb77125a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToVMObjectReferenceConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToVMObjectReferenceConverter.java b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToVMObjectReferenceConverter.java
new file mode 100644
index 0000000..45cbb5c
--- /dev/null
+++ b/taverna-reference-types/src/main/java/net/sf/taverna/t2/reference/impl/external/object/StreamToVMObjectReferenceConverter.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (C) 2007 The University of Manchester   
+ * 
+ *  Modifications to the initial code base are copyright of their
+ *  respective authors, or their employers as appropriate.
+ * 
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public License
+ *  as published by the Free Software Foundation; either version 2.1 of
+ *  the License, or (at your option) any later version.
+ *    
+ *  This program is distributed in the hope that it will be useful, but
+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *    
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this 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.external.object;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+
+import net.sf.taverna.t2.reference.ReferencedDataNature;
+import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
+
+/**
+ * Builds a VMObjectReference from an InputStream.
+ * 
+ * @author Alex Nenadic
+ */
+public class StreamToVMObjectReferenceConverter implements
+		StreamToValueConverterSPI<VMObjectReference> {
+	@Override
+	public Class<VMObjectReference> getPojoClass() {
+		return VMObjectReference.class;
+	}
+
+	@Override
+	public VMObjectReference renderFrom(InputStream stream,
+			ReferencedDataNature dataNature, String charset) {
+		VMObjectReference vmRef = new VMObjectReference();
+		try {
+			ObjectInputStream in = new ObjectInputStream(stream);
+			vmRef = (VMObjectReference) in.readObject();
+			return vmRef;
+		} catch (IOException e) {
+			throw new RuntimeException(e);
+		} catch (ClassNotFoundException e) {
+			throw new RuntimeException(e);
+		}
+	}
+}