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:14 UTC
[30/51] [partial] incubator-taverna-engine git commit:
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToStringConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToStringConverter.java b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToStringConverter.java
new file mode 100644
index 0000000..5b3ccac
--- /dev/null
+++ b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToStringConverter.java
@@ -0,0 +1,79 @@
+/*
+* 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.impl.external.object;
+
+import static org.apache.taverna.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 org.apache.taverna.reference.ReferencedDataNature;
+import org.apache.taverna.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/5f1ddb71/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToVMObjectReferenceConverter.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToVMObjectReferenceConverter.java b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToVMObjectReferenceConverter.java
new file mode 100644
index 0000000..3e96d08
--- /dev/null
+++ b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StreamToVMObjectReferenceConverter.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.impl.external.object;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+
+import org.apache.taverna.reference.ReferencedDataNature;
+import org.apache.taverna.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);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StringToStringReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StringToStringReference.java b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StringToStringReference.java
new file mode 100644
index 0000000..6c872a6
--- /dev/null
+++ b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/StringToStringReference.java
@@ -0,0 +1,51 @@
+/*
+* 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.impl.external.object;
+
+import org.apache.taverna.reference.ExternalReferenceSPI;
+import org.apache.taverna.reference.ReferenceContext;
+import org.apache.taverna.reference.ValueToReferenceConversionException;
+import org.apache.taverna.reference.ValueToReferenceConverterSPI;
+
+/**
+ * Convert a String to a StringReference
+ *
+ * @author Tom Oinn
+ */
+public class StringToStringReference implements ValueToReferenceConverterSPI {
+ /**
+ * Can convert if the object is an instance of java.lang.String
+ */
+ @Override
+ public boolean canConvert(Object o, ReferenceContext context) {
+ return o instanceof String;
+ }
+
+ /**
+ * Return a new InlineStringReference wrapping the supplied String
+ */
+ @Override
+ public ExternalReferenceSPI convert(Object o, ReferenceContext context)
+ throws ValueToReferenceConversionException {
+ InlineStringReference result = new InlineStringReference();
+ result.setContents((String) o);
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/VMObjectReference.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/VMObjectReference.java b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/VMObjectReference.java
new file mode 100644
index 0000000..51e6669
--- /dev/null
+++ b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/VMObjectReference.java
@@ -0,0 +1,110 @@
+/*
+* 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.impl.external.object;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.Serializable;
+import java.nio.charset.Charset;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.taverna.reference.AbstractExternalReference;
+import org.apache.taverna.reference.ExternalReferenceSPI;
+import org.apache.taverna.reference.ReferenceContext;
+
+/**
+ * Implementation of ExternalReferenceSPI used to refer to objects in the local
+ * virtual machine.
+ *
+ * @author Stian Soiland-Reyes
+ * @author Alex Nenadic
+ */
+public class VMObjectReference extends AbstractExternalReference implements
+ ExternalReferenceSPI, Serializable {
+ private static final long serialVersionUID = 6708284419760319684L;
+ private static final Charset UTF8 = Charset.forName("UTF-8");
+
+ /**
+ * Mapping from objects to their UUIDs.
+ */
+ private static Map<Object, UUID> objectToUUID = new HashMap<>();
+ /**
+ * Mapping from UUIDs to objects.
+ */
+ private static Map<UUID, Object> uuidToObject = new HashMap<>();
+
+ /**
+ * Unique reference to the object.
+ */
+ private String uuid;
+
+ @Override
+ public InputStream openStream(ReferenceContext context) {
+ return new ByteArrayInputStream(getObject().toString().getBytes(UTF8));
+ }
+
+ /**
+ * Getter used by hibernate to retrieve the object uuid property.
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Setter used by hibernate to set the object uuid property.
+ */
+ public void setUuid(String id) {
+ if (uuid != null)
+ throw new IllegalStateException("Can't set UUID of an object twice");
+ this.uuid = id;
+ }
+
+ public void setObject(Object object) {
+ if (uuid != null)
+ throw new IllegalStateException("Can't set UUID an object twice");
+ UUID knownUUID = objectToUUID.get(object);
+ if (knownUUID == null) {
+ // register object
+ knownUUID = UUID.randomUUID();
+ objectToUUID.put(object, knownUUID);
+ uuidToObject.put(knownUUID, object);
+ }
+ setUuid(knownUUID.toString());
+ }
+
+ public Object getObject() {
+ return uuidToObject.get(UUID.fromString(uuid));
+ }
+
+ @Override
+ public Long getApproximateSizeInBytes() {
+ // We do not know the object size
+ return new Long(-1);
+ }
+
+ @Override
+ public VMObjectReference clone() {
+ VMObjectReference result = new VMObjectReference();
+ result.setUuid(this.getUuid());
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/package.html b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/package.html
new file mode 100644
index 0000000..b5b3b72
--- /dev/null
+++ b/taverna-reference-types/src/main/java/org/apache/taverna/reference/impl/external/object/package.html
@@ -0,0 +1,4 @@
+<body>
+Support for representation of inlined objects as references. Replaces
+the old Literal support
+</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI b/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI
deleted file mode 100644
index b90bb55..0000000
--- a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceBuilderSPI
+++ /dev/null
@@ -1,3 +0,0 @@
-# Implementation classes of ExternalReferenceBuilderSPI go here, one per line
-net.sf.taverna.t2.reference.impl.external.object.InlineStringReferenceBuilder
-net.sf.taverna.t2.reference.impl.external.object.InlineByteArrayReferenceBuilder
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI b/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI
deleted file mode 100644
index d4ad547..0000000
--- a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceSPI
+++ /dev/null
@@ -1,6 +0,0 @@
-# Implementation classes of ExternalReferenceSPI go here, one per line
-net.sf.taverna.t2.reference.impl.external.file.FileReference
-net.sf.taverna.t2.reference.impl.external.http.HttpReference
-net.sf.taverna.t2.reference.impl.external.object.InlineStringReference
-net.sf.taverna.t2.reference.impl.external.object.InlineByteArrayReference
-net.sf.taverna.t2.reference.impl.external.object.VMObjectReference
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI b/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI
deleted file mode 100644
index a5547db..0000000
--- a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ExternalReferenceTranslatorSPI
+++ /dev/null
@@ -1,3 +0,0 @@
-# Implementation classes of ExternalReferenceTranslatorSPI go here, one per line
-net.sf.taverna.t2.reference.impl.external.object.InlineByteToInlineStringTranslator
-net.sf.taverna.t2.reference.impl.external.object.InlineStringToInlineByteTranslator
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.StreamToValueConverterSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.StreamToValueConverterSPI b/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.StreamToValueConverterSPI
deleted file mode 100644
index a433461..0000000
--- a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.StreamToValueConverterSPI
+++ /dev/null
@@ -1,7 +0,0 @@
-# Implementation classes of StreamToValueConverterSPI go here, one per line
-net.sf.taverna.t2.reference.impl.external.object.StreamToStringConverter
-net.sf.taverna.t2.reference.impl.external.object.StreamToByteArrayConverter
-net.sf.taverna.t2.reference.impl.external.object.StreamToVMObjectReferenceConverter
-net.sf.taverna.t2.reference.impl.external.object.StreamToDoubleConverter
-net.sf.taverna.t2.reference.impl.external.object.StreamToBooleanConverter
-net.sf.taverna.t2.reference.impl.external.object.StreamToIntegerConverter
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ValueToReferenceConverterSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ValueToReferenceConverterSPI b/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ValueToReferenceConverterSPI
deleted file mode 100644
index e1c3593..0000000
--- a/taverna-reference-types/src/main/resources/META-INF/services/net.sf.taverna.t2.reference.ValueToReferenceConverterSPI
+++ /dev/null
@@ -1,8 +0,0 @@
-# Implementation classes of ValueToReferenceConverterSPI go here, one per line
-net.sf.taverna.t2.reference.impl.external.file.FileToFileReference
-net.sf.taverna.t2.reference.impl.external.http.UrlToHttpReference
-net.sf.taverna.t2.reference.impl.external.object.StringToStringReference
-net.sf.taverna.t2.reference.impl.external.object.ByteArrayToByteArrayReference
-net.sf.taverna.t2.reference.impl.external.object.NumberToStringReference
-net.sf.taverna.t2.reference.impl.external.object.CharacterToStringReference
-net.sf.taverna.t2.reference.impl.external.object.BooleanToStringReference
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceBuilderSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceBuilderSPI b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceBuilderSPI
new file mode 100644
index 0000000..4f1b88e
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceBuilderSPI
@@ -0,0 +1,3 @@
+# Implementation classes of ExternalReferenceBuilderSPI go here, one per line
+org.apache.taverna.reference.impl.external.object.InlineStringReferenceBuilder
+org.apache.taverna.reference.impl.external.object.InlineByteArrayReferenceBuilder
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceSPI b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceSPI
new file mode 100644
index 0000000..f62c91d
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceSPI
@@ -0,0 +1,6 @@
+# Implementation classes of ExternalReferenceSPI go here, one per line
+org.apache.taverna.reference.impl.external.file.FileReference
+org.apache.taverna.reference.impl.external.http.HttpReference
+org.apache.taverna.reference.impl.external.object.InlineStringReference
+org.apache.taverna.reference.impl.external.object.InlineByteArrayReference
+org.apache.taverna.reference.impl.external.object.VMObjectReference
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceTranslatorSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceTranslatorSPI b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceTranslatorSPI
new file mode 100644
index 0000000..7306bc0
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ExternalReferenceTranslatorSPI
@@ -0,0 +1,3 @@
+# Implementation classes of ExternalReferenceTranslatorSPI go here, one per line
+org.apache.taverna.reference.impl.external.object.InlineByteToInlineStringTranslator
+org.apache.taverna.reference.impl.external.object.InlineStringToInlineByteTranslator
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.StreamToValueConverterSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.StreamToValueConverterSPI b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.StreamToValueConverterSPI
new file mode 100644
index 0000000..cb4abe6
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.StreamToValueConverterSPI
@@ -0,0 +1,7 @@
+# Implementation classes of StreamToValueConverterSPI go here, one per line
+org.apache.taverna.reference.impl.external.object.StreamToStringConverter
+org.apache.taverna.reference.impl.external.object.StreamToByteArrayConverter
+org.apache.taverna.reference.impl.external.object.StreamToVMObjectReferenceConverter
+org.apache.taverna.reference.impl.external.object.StreamToDoubleConverter
+org.apache.taverna.reference.impl.external.object.StreamToBooleanConverter
+org.apache.taverna.reference.impl.external.object.StreamToIntegerConverter
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ValueToReferenceConverterSPI
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ValueToReferenceConverterSPI b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ValueToReferenceConverterSPI
new file mode 100644
index 0000000..fcf18a0
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/META-INF/services/org.apache.taverna.reference.ValueToReferenceConverterSPI
@@ -0,0 +1,8 @@
+# Implementation classes of ValueToReferenceConverterSPI go here, one per line
+org.apache.taverna.reference.impl.external.file.FileToFileReference
+org.apache.taverna.reference.impl.external.http.UrlToHttpReference
+org.apache.taverna.reference.impl.external.object.StringToStringReference
+org.apache.taverna.reference.impl.external.object.ByteArrayToByteArrayReference
+org.apache.taverna.reference.impl.external.object.NumberToStringReference
+org.apache.taverna.reference.impl.external.object.CharacterToStringReference
+org.apache.taverna.reference.impl.external.object.BooleanToStringReference
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml b/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
index aeed47f..c18021e 100644
--- a/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
+++ b/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context-osgi.xml
@@ -6,28 +6,28 @@
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="inlineStringReferenceBuilder" interface="org.apache.taverna.reference.ExternalReferenceBuilderSPI" />
+ <service ref="inlineByteArrayReferenceBuilder" interface="org.apahce.taverna.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="fileReference" interface="org.apache.taverna.reference.ExternalReferenceSPI" />
+ <service ref="httpReference" interface="org.apache.taverna.reference.ExternalReferenceSPI" />
+ <service ref="inlineStringReference" interface="org.apache.taverna.reference.ExternalReferenceSPI" />
+ <service ref="inlineByteArrayReference" interface="org.apache.taverna.reference.ExternalReferenceSPI" />
+ <service ref="vmObjectReference" interface="org.apache.taverna.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="streamToStringConverter" interface="org.apache.taverna.reference.StreamToValueConverterSPI" />
+ <service ref="streamToByteArrayConverter" interface="org.apache.taverna.reference.StreamToValueConverterSPI" />
+ <service ref="streamToVMObjectReferenceConverter" interface="org.apache.taverna.reference.StreamToValueConverterSPI" />
+ <service ref="streamToDoubleConverter" interface="org.apache.taverna.reference.StreamToValueConverterSPI" />
+ <service ref="streamToBooleanConverter" interface="org.apache.taverna.reference.StreamToValueConverterSPI" />
+ <service ref="streamToIntegerConverter" interface="org.apache.taverna.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" />
+ <service ref="fileToFileReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="urlToHttpReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="stringToStringReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="byteArrayToByteArrayReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="numberToStringReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="characterToStringReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
+ <service ref="booleanToStringReference" interface="org.apache.taverna.reference.ValueToReferenceConverterSPI" />
</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context.xml b/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
index 6b7a4cb..ee8702a 100644
--- a/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
+++ b/taverna-reference-types/src/main/resources/META-INF/spring/reference-core-extensions-context.xml
@@ -4,28 +4,28 @@
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="inlineStringReferenceBuilder" class="org.apache.taverna.reference.impl.external.object.InlineStringReferenceBuilder" />
+ <bean id="inlineByteArrayReferenceBuilder" class="org.apache.taverna.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="fileReference" class="org.apache.taverna.reference.impl.external.file.FileReference" />
+ <bean id="httpReference" class="org.apache.taverna.reference.impl.external.http.HttpReference" />
+ <bean id="inlineStringReference" class="org.apache.taverna.reference.impl.external.object.InlineStringReference" />
+ <bean id="inlineByteArrayReference" class="org.apache.taverna.reference.impl.external.object.InlineByteArrayReference" />
+ <bean id="vmObjectReference" class="org.apache.taverna.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="streamToStringConverter" class="org.apache.taverna.reference.impl.external.object.StreamToStringConverter" />
+ <bean id="streamToByteArrayConverter" class="org.apache.taverna.reference.impl.external.object.StreamToByteArrayConverter" />
+ <bean id="streamToVMObjectReferenceConverter" class="org.apache.taverna.reference.impl.external.object.StreamToVMObjectReferenceConverter" />
+ <bean id="streamToDoubleConverter" class="org.apache.taverna.reference.impl.external.object.StreamToDoubleConverter" />
+ <bean id="streamToBooleanConverter" class="org.apache.taverna.reference.impl.external.object.StreamToBooleanConverter" />
+ <bean id="streamToIntegerConverter" class="org.apache.taverna.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" />
+ <bean id="fileToFileReference" class="org.apache.taverna.reference.impl.external.file.FileToFileReference" />
+ <bean id="urlToHttpReference" class="org.apache.taverna.reference.impl.external.http.UrlToHttpReference" />
+ <bean id="stringToStringReference" class="org.apache.taverna.reference.impl.external.object.StringToStringReference" />
+ <bean id="byteArrayToByteArrayReference" class="org.apache.taverna.reference.impl.external.object.ByteArrayToByteArrayReference" />
+ <bean id="numberToStringReference" class="org.apache.taverna.reference.impl.external.object.NumberToStringReference" />
+ <bean id="characterToStringReference" class="org.apache.taverna.reference.impl.external.object.CharacterToStringReference" />
+ <bean id="booleanToStringReference" class="org.apache.taverna.reference.impl.external.object.BooleanToStringReference" />
</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml b/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/file/FileReference.hbm.xml
deleted file mode 100644
index 9a8fc05..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml b/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/http/HttpReference.hbm.xml
deleted file mode 100644
index 99af97c..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml b/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineByteArrayReference.hbm.xml
deleted file mode 100644
index 8f9ff44..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml b/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/InlineStringReference.hbm.xml
deleted file mode 100644
index d81b227..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml b/taverna-reference-types/src/main/resources/net/sf/taverna/t2/reference/impl/external/object/VMObjectReference.hbm.xml
deleted file mode 100644
index 74c47a7..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/file/FileReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/file/FileReference.hbm.xml b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/file/FileReference.hbm.xml
new file mode 100644
index 0000000..3a2f3e6
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/file/FileReference.hbm.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 extends="org.apache.taverna.reference.AbstractExternalReference" name="org.apache.taverna.reference.impl.external.file.FileReference">
+ <!-- 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/5f1ddb71/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/http/HttpReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/http/HttpReference.hbm.xml b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/http/HttpReference.hbm.xml
new file mode 100644
index 0000000..52608a0
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/http/HttpReference.hbm.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 extends="org.apache.taverna.reference.AbstractExternalReference" name="org.apache.taverna.reference.impl.external.http.HttpReference">
+ <!-- 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/5f1ddb71/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineByteArrayReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineByteArrayReference.hbm.xml b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineByteArrayReference.hbm.xml
new file mode 100644
index 0000000..e8b9810
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineByteArrayReference.hbm.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 extends="org.apache.taverna.t2.reference.AbstractExternalReference" name="org.apache.taverna.reference.impl.external.object.InlineByteArrayReference">
+ <!-- Link to primary key from abstract superclass -->
+ <key column="bean_id"/>
+ <!-- Reference specific props -->
+ <property length="1000000000" name="contents" type="text"/>
+ </joined-subclass>
+</hibernate-mapping>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineStringReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineStringReference.hbm.xml b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineStringReference.hbm.xml
new file mode 100644
index 0000000..492acd6
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/InlineStringReference.hbm.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 extends="org.apache.taverna.reference.AbstractExternalReference" name="org.apache.taverna.reference.impl.external.object.InlineStringReference">
+ <!-- Link to primary key from abstract superclass -->
+ <key column="bean_id"/>
+ <!-- Reference specific props -->
+ <property length="1000000000" name="contents" type="text"/>
+ </joined-subclass>
+</hibernate-mapping>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/VMObjectReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/VMObjectReference.hbm.xml b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/VMObjectReference.hbm.xml
new file mode 100644
index 0000000..0343a33
--- /dev/null
+++ b/taverna-reference-types/src/main/resources/org/apache/taverna/reference/impl/external/object/VMObjectReference.hbm.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!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 extends="org.apache.taverna.reference.AbstractExternalReference" name="org.apache.taverna.reference.impl.external.object.VMObjectReference">
+ <!-- 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/5f1ddb71/taverna-reference-types/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java b/taverna-reference-types/src/test/java/net/sf/taverna/t2/reference/impl/external/object/ByteArrayToStringTest.java
deleted file mode 100644
index 5afa878..0000000
--- a/taverna-reference-types/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/5f1ddb71/taverna-reference-types/src/test/java/org/apache/taverna/reference/impl/external/object/ByteArrayToStringTest.java
----------------------------------------------------------------------
diff --git a/taverna-reference-types/src/test/java/org/apache/taverna/reference/impl/external/object/ByteArrayToStringTest.java b/taverna-reference-types/src/test/java/org/apache/taverna/reference/impl/external/object/ByteArrayToStringTest.java
new file mode 100644
index 0000000..6325156
--- /dev/null
+++ b/taverna-reference-types/src/test/java/org/apache/taverna/reference/impl/external/object/ByteArrayToStringTest.java
@@ -0,0 +1,110 @@
+/*
+* 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.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 org.apache.taverna.reference.ExternalReferenceSPI;
+import org.apache.taverna.reference.ReferenceContext;
+import org.apache.taverna.reference.ReferenceSet;
+import org.apache.taverna.reference.impl.EmptyReferenceContext;
+import org.apache.taverna.reference.impl.TranslationPath;
+import org.apache.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/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ActivityReport.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ActivityReport.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ActivityReport.java
new file mode 100644
index 0000000..e01669d
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ActivityReport.java
@@ -0,0 +1,48 @@
+/*
+* 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.platform.report;
+
+import org.apache.taverna.scufl2.api.activity.Activity;
+
+/**
+ * Report about the {@link State} of an {@link Activity} invocation.
+ *
+ * @author David Withers
+ */
+public class ActivityReport extends StatusReport<Activity, ProcessorReport> {
+ private WorkflowReport nestedWorkflowReport;
+
+ /**
+ * Constructs a new <code>ActivityReport</code>.
+ *
+ * @param activity
+ */
+ public ActivityReport(Activity activity) {
+ super(activity);
+ }
+
+ public WorkflowReport getNestedWorkflowReport() {
+ return nestedWorkflowReport;
+ }
+
+ public void setNestedWorkflowReport(WorkflowReport nestedWorkflowReport) {
+ this.nestedWorkflowReport = nestedWorkflowReport;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/Invocation.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/Invocation.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/Invocation.java
new file mode 100644
index 0000000..4bbef53
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/Invocation.java
@@ -0,0 +1,305 @@
+/*
+* 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.platform.report;
+
+import java.nio.file.Path;
+import java.util.Date;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.taverna.scufl2.api.port.Port;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+/**
+ * A single invocation of a workflow, processor or activity.
+ *
+ * @author David Withers
+ */
+@JsonPropertyOrder({"id","parent", "name", "index", "state", "startedDate", "completedDate", "inputs", "outputs"})
+public class Invocation implements Comparable<Invocation> {
+ private final String name;
+ private final int[] index;
+ private final Invocation parent;
+ private State state;
+ private Date startedDate, completedDate;
+ private final SortedSet<Invocation> invocations;
+ private final StatusReport<?, ?> report;
+ private SortedMap<String, Path> inputs, outputs;
+
+ /**
+ * Internal constructor for comparison use.
+ *
+ * Only use with {@link #compareTo(Invocation)} use when looking
+ * up from {@link StatusReport#getInvocation(String)}. All fields except
+ * {@link #getName()} are <code>null</code>.
+ *
+ * @param name The name of the invocation to compare with
+ **/
+ Invocation(String name) {
+ this.name = name;
+ this.report = null;
+ this.parent = null;
+ this.invocations = null;
+ this.index = null;
+ }
+
+ public Invocation(String name, Invocation parent, StatusReport<?, ?> report) {
+ this(name, new int[0], parent, report);
+ }
+
+ public Invocation(String name, int[] index, Invocation parent, StatusReport<?, ?> report) {
+ this.name = name;
+ this.index = index;
+ this.parent = parent;
+ this.report = report;
+
+ invocations = new TreeSet<>();
+
+ inputs = new TreeMap<>();
+ for (Port port : report.getSubject().getInputPorts())
+ inputs.put(port.getName(), null);
+
+ outputs = new TreeMap<>();
+ for (Port port : report.getSubject().getOutputPorts())
+ outputs.put(port.getName(), null);
+
+ setStartedDate(new Date());
+
+ if (parent != null)
+ parent.getInvocations().add(this);
+ report.addInvocation(this);
+ }
+
+ /**
+ * Returns the name for this invocation.
+ *
+ * @return the name for this invocation
+ */
+ @JsonProperty("name")
+ public String getName() {
+ return name;
+ }
+
+ public int[] getIndex() {
+ return index;
+ }
+
+ /**
+ * Returns the identifier for this invocation by prepending the identifier of the parent
+ * invocation.
+ *
+ * @return the identifier for this invocation
+ */
+ @JsonProperty("id")
+ public String getId() {
+ if (parent != null) {
+ String parentId = parent.getId();
+ if (parentId != null && !parentId.isEmpty())
+ return parent.getId() + "/" + name;
+ }
+ return name;
+ }
+
+ @JsonIgnore
+ public StatusReport<?, ?> getReport() {
+ return report;
+ }
+
+ /**
+ * Returns the parent invocation.
+ * <p>
+ * Returns <code>null</code> if there is no parent invocation.
+ *
+ * @return the parent invocation
+ */
+ @JsonIgnore
+ public Invocation getParent() {
+ return parent;
+ }
+
+ @JsonProperty("parent")
+ public String getParentId() {
+ if (parent == null)
+ return null;
+ return parent.getId();
+ }
+
+ /**
+ * Returns the child invocations.
+ * <p>
+ * Returns and empty set if there are no child invocations.
+ *
+ * @return the child invocations
+ */
+ @JsonIgnore
+ public SortedSet<Invocation> getInvocations() {
+ return invocations;
+ }
+
+ /**
+ * Returns a map of input port names to values.
+ * <p>
+ * Returns an empty map if there are no input ports. If there is no value for an input port the
+ * map will contain a <code>null</code> value.
+ *
+ * @return a map of input port names to values
+ */
+ public SortedMap<String, Path> getInputs() {
+ return inputs;
+ }
+
+ /**
+ * Sets the values of input ports.
+ *
+ * @param inputs
+ * the values of input ports
+ */
+ public void setInputs(Map<String, Path> inputs) {
+ this.inputs.putAll(inputs);
+ }
+
+ /**
+ * Sets the value of an input port.
+ *
+ * @param port the port name
+ * @param value the port value
+ */
+ public void setInput(String port, Path value) {
+ inputs.put(port, value);
+ }
+
+ /**
+ * Returns a map of output port names to values.
+ * <p>
+ * Returns an empty map if there are no output ports. If there is no value for an output port
+ * the map will contain a <code>null</code> value.
+ *
+ * @return a map of input port names to values
+ */
+ public SortedMap<String, Path> getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * Sets the values of input ports.
+ *
+ * @param inputs
+ * the values of input ports
+ */
+ public void setOutputs(Map<String, Path> outputs) {
+ this.outputs.putAll(outputs);
+ }
+
+ /**
+ * Sets the value of an output port.
+ *
+ * @param port the port name
+ * @param value the port value
+ */
+ public void setOutput(String port, Path value) {
+ outputs.put(port, value);
+ }
+
+ /**
+ * Returns the current {@link State} of the invocation.
+ * <p>
+ * An invocation state can be RUNNING or COMPLETED.
+ *
+ * @return the current <code>State</code>
+ */
+ public State getState() {
+ return state;
+ }
+
+ /**
+ * Returns the date that the status changed to RUNNING.
+ * <p>
+ * If the status has never been RUNNING <code>null</code> is returned.
+ *
+ * @return the date that the status changed to started
+ */
+ public Date getStartedDate() {
+ return startedDate;
+ }
+
+ /**
+ * Sets the date that the status changed to RUNNING.
+ *
+ * @param startedDate
+ * the date that the status changed to RUNNING
+ */
+ public void setStartedDate(Date startedDate) {
+ this.startedDate = startedDate;
+ state = State.RUNNING;
+ }
+
+ /**
+ * Returns the date that the status changed to COMPLETED.
+ * <p>
+ * If the status never been COMPLETED <code>null</code> is returned.
+ *
+ * @return the date that the status changed to COMPLETED
+ */
+ public Date getCompletedDate() {
+ return completedDate;
+ }
+
+ /**
+ * Sets the date that the status changed to COMPLETED.
+ *
+ * @param completedDate
+ * the date that the status changed to COMPLETED
+ */
+ public void setCompletedDate(Date completedDate) {
+ this.completedDate = completedDate;
+ state = State.COMPLETED;
+ }
+
+ @Override
+ public String toString() {
+ return "Invocation " + indexToString(index);
+ }
+
+ @Override
+ public int compareTo(Invocation o) {
+ String id = getId();
+ String otherId = o.getId();
+ if (id.length() == otherId.length())
+ return id.compareTo(otherId);
+ // Make "invoc5" be sorted before "invoc49"
+ return id.length() - otherId.length();
+ }
+
+ private String indexToString(int[] index) {
+ StringBuilder indexString = new StringBuilder();
+ String sep = "";
+ for (int idx : index) {
+ indexString.append(sep).append(idx + 1);
+ sep = ":";
+ }
+ return indexString.toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ProcessorReport.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ProcessorReport.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ProcessorReport.java
new file mode 100644
index 0000000..fe54774
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ProcessorReport.java
@@ -0,0 +1,163 @@
+/*
+* 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.platform.report;
+
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import org.apache.taverna.scufl2.api.core.Processor;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+/**
+ * Report about the {@link State} of a {@link Processor} invocation.
+ *
+ * @author David Withers
+ * @author Stian Soiland-Reyes
+ */
+@JsonPropertyOrder({ "subject", "parent", "state", "createdDate",
+ "startedDate", "pausedDate", "pausedDates", "resumedDate",
+ "resumedDates", "cancelledDate", "failedDate", "completedDate",
+ "jobsQueued", "jobsStarted", "jobsCompleted",
+ "jobsCompletedWithErrors", "invocations", "activityReports"})
+public class ProcessorReport extends StatusReport<Processor, WorkflowReport> {
+ private Set<ActivityReport> activityReports = new LinkedHashSet<>();
+ private int jobsCompleted;
+ private int jobsCompletedWithErrors;
+ private int jobsQueued;
+ private int jobsStarted;
+ private SortedMap<String, Object> properties = new TreeMap<>();
+
+ /**
+ * Constructs a new <code>ProcessorReport</code>.
+ *
+ * @param processor The processor to report on
+ */
+ public ProcessorReport(Processor processor) {
+ super(processor);
+ }
+
+ public void addActivityReport(ActivityReport activityReport) {
+ activityReports.add(activityReport);
+ }
+
+ public Set<ActivityReport> getActivityReports() {
+ return activityReports;
+ }
+
+ /**
+ * Returns the number of jobs that the processor has completed.
+ *
+ * @return the number of jobs that the processor has completed
+ */
+ public int getJobsCompleted() {
+ return jobsCompleted;
+ }
+
+ /**
+ * Returns the number of jobs that completed with an error.
+ *
+ * @return the number of jobs that completed with an error
+ */
+ public int getJobsCompletedWithErrors() {
+ return jobsCompletedWithErrors;
+ }
+
+ /**
+ * Returns the number of jobs queued by the processor.
+ *
+ * @return the number of jobs queued by the processor
+ */
+ public int getJobsQueued() {
+ return jobsQueued;
+ }
+
+ /**
+ * Returns the number of jobs that the processor has started processing.
+ *
+ * @return the number of jobs that the processor has started processing
+ */
+ public int getJobsStarted() {
+ return jobsStarted;
+ }
+
+ public Object getProperty(String key) {
+ return properties.get(key);
+ }
+
+ @JsonIgnore
+ public Set<String> getPropertyKeys() {
+ return new HashSet<>(properties.keySet());
+ }
+
+ /**
+ * Set the number of completed jobs.
+ *
+ * @param jobsCompleted the number of jobs that the processor has completed.
+ */
+ public void setJobsCompleted(int jobsCompleted) {
+ this.jobsCompleted = jobsCompleted;
+ }
+
+ /**
+ * Set the number of jobs that have completed, but with errors.
+ *
+ * @param jobsCompletedWithErrors the number of jobs that completed with errors
+ */
+ public void setJobsCompletedWithErrors(int jobsCompletedWithErrors) {
+ this.jobsCompletedWithErrors = jobsCompletedWithErrors;
+ }
+
+ /**
+ * Set the number of queued jobs.
+ *
+ * @param jobsQueued the number of jobs queued by the processor
+ */
+ public void setJobsQueued(int jobsQueued) {
+ this.jobsQueued = jobsQueued;
+ }
+
+ /**
+ * Set the number of started jobs.
+ *
+ * @param jobsStarted the number of jobs that the processor has started processing
+ */
+ public void setJobsStarted(int jobsStarted) {
+ this.jobsStarted = jobsStarted;
+ }
+
+ /**
+ * Set an additional property
+ *
+ * @param key
+ * @param value
+ */
+ public void setProperty(String key, Object value) {
+ synchronized (properties) {
+ // if (properties.containsKey(key)) {
+ properties.put(key, value);
+ // }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ReportListener.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ReportListener.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ReportListener.java
new file mode 100644
index 0000000..e3a0c6e
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/ReportListener.java
@@ -0,0 +1,31 @@
+/*
+* 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.platform.report;
+
+import java.nio.file.Path;
+
+/**
+ * @author David Withers
+ */
+public interface ReportListener {
+ void outputAdded(Path path, String portName, int[] index);
+
+ void stateChanged(State oldState, State newState);
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/State.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/State.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/State.java
new file mode 100755
index 0000000..b42b722
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/State.java
@@ -0,0 +1,29 @@
+/*
+* 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.platform.report;
+
+/**
+ * Valid states for status reports.
+ *
+ * @author David Withers
+ */
+public enum State {
+ CREATED, RUNNING, COMPLETED, PAUSED, CANCELLED, FAILED
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-report-api/src/main/java/org/apache/taverna/platform/report/StatusReport.java
----------------------------------------------------------------------
diff --git a/taverna-report-api/src/main/java/org/apache/taverna/platform/report/StatusReport.java b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/StatusReport.java
new file mode 100644
index 0000000..1ea47d5
--- /dev/null
+++ b/taverna-report-api/src/main/java/org/apache/taverna/platform/report/StatusReport.java
@@ -0,0 +1,372 @@
+/*
+* 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.platform.report;
+
+import java.net.URI;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.NavigableSet;
+import java.util.SortedSet;
+import java.util.TreeSet;
+
+import org.apache.taverna.scufl2.api.common.Ported;
+import org.apache.taverna.scufl2.api.common.URITools;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+/**
+ * Report about the {@link State} of a workflow component.
+ *
+ * @author David Withers
+ * @param <SUBJECT>
+ * the WorkflowBean that the report is about
+ * @param <PARENT>
+ * the parent report type
+ */
+
+@JsonPropertyOrder({ "subject", "parent", "state", "createdDate", "startedDate", "pausedDate",
+ "pausedDates", "resumedDate", "resumedDates", "cancelledDate", "failedDate", "completedDate"})
+public class StatusReport<SUBJECT extends Ported, PARENT extends StatusReport<?, ?>> {
+ private final SUBJECT subject;
+ private PARENT parentReport;
+ private State state;
+ private NavigableSet<Invocation> invocations = new TreeSet<>();
+ private Date createdDate, startedDate, pausedDate, resumedDate, cancelledDate, completedDate,
+ failedDate;
+ private final List<Date> pausedDates = new ArrayList<>(),
+ resumedDates = new ArrayList<>();
+ private List<ReportListener> reportListeners = new ArrayList<>();
+
+ /**
+ * Constructs a new <code>StatusReport</code> for the subject and sets the created date to the
+ * current date.
+ *
+ * @param subject
+ * the subject of the report
+ */
+ public StatusReport(SUBJECT subject) {
+ this.subject = subject;
+ setCreatedDate(new Date());
+ }
+
+ /**
+ * Returns the subject of this report.
+ *
+ * @return the subject of this report
+ */
+ @JsonIgnore
+ public SUBJECT getSubject() {
+ return subject;
+ }
+
+ @JsonProperty("subject")
+ public URI getSubjectURI() {
+ return new URITools().uriForBean(subject);
+ }
+
+ /**
+ * Returns the parent report.
+ * <p>
+ * Returns null if this report has no parent.
+ *
+ * @return the parent report
+ */
+ @JsonIgnore
+ public PARENT getParentReport() {
+ return parentReport;
+ }
+
+ /**
+ * Sets the parent report.
+ * <p>
+ * Can be null if this report has no parent.
+ *
+ * @param workflowReport
+ * the parent report
+ */
+ public void setParentReport(PARENT parentReport) {
+ this.parentReport = parentReport;
+ }
+
+ /**
+ * Returns the current {@link State}.
+ * <p>
+ * A state can be CREATED, RUNNING, COMPLETED, PAUSED, CANCELLED or FAILED.
+ *
+ * @return the current <code>State</code>
+ */
+ public State getState() {
+ return state;
+ }
+
+ public void setState(State state) {
+ synchronized (reportListeners) {
+ if (this.state != state) {
+ State oldState = this.state;
+ this.state = state;
+ for (ReportListener reportListener : reportListeners)
+ reportListener.stateChanged(oldState, state);
+ }
+ }
+ }
+
+ /**
+ * Returns the date that the status was set to CREATED.
+ *
+ * @return the the date that the status was set to CREATED
+ */
+ public Date getCreatedDate() {
+ return createdDate;
+ }
+
+ /**
+ * Sets the date that the status was set to CREATED.
+ *
+ * @param createdDate
+ * the date that the status was set to CREATED
+ */
+ public void setCreatedDate(Date createdDate) {
+ this.createdDate = createdDate;
+ setState(State.CREATED);
+ }
+
+ /**
+ * Returns the date that the status changed to RUNNING.
+ * <p>
+ * If the status has never been RUNNING <code>null</code> is returned.
+ *
+ * @return the date that the status changed to started
+ */
+ public Date getStartedDate() {
+ return startedDate;
+ }
+
+ /**
+ * Sets the date that the status changed to RUNNING.
+ *
+ * @param startedDate
+ * the date that the status changed to RUNNING
+ */
+ public void setStartedDate(Date startedDate) {
+ if (this.startedDate == null)
+ this.startedDate = startedDate;
+ setState(State.RUNNING);
+ }
+
+ /**
+ * Returns the date that the status last changed to PAUSED.
+ * <p>
+ * If the status has never been PAUSED <code>null</code> is returned.
+ *
+ * @return the date that the status last changed to PAUSED
+ */
+ public Date getPausedDate() {
+ return pausedDate;
+ }
+
+ /**
+ * Sets the date that the status last changed to PAUSED.
+ *
+ * @param pausedDate
+ * the date that the status last changed to PAUSED
+ */
+ public void setPausedDate(Date pausedDate) {
+ this.pausedDate = pausedDate;
+ pausedDates.add(pausedDate);
+ setState(State.PAUSED);
+ }
+
+ /**
+ * Returns the date that the status last changed form PAUSED to RUNNING.
+ * <p>
+ * If the status has never changed form PAUSED to RUNNING <code>null</code> is returned.
+ *
+ * @return the date that the status last changed form PAUSED to RUNNING
+ */
+ public Date getResumedDate() {
+ return resumedDate;
+ }
+
+ /**
+ * Sets the date that the status last changed form PAUSED to RUNNING.
+ *
+ * @param resumedDate
+ * the date that the status last changed form PAUSED to RUNNING
+ */
+ public void setResumedDate(Date resumedDate) {
+ this.resumedDate = resumedDate;
+ resumedDates.add(resumedDate);
+ setState(State.RUNNING);
+ }
+
+ /**
+ * Returns the date that the status changed to CANCELLED.
+ * <p>
+ * If the status has never been CANCELLED <code>null</code> is returned.
+ *
+ * @return the date that the status changed to canceled
+ */
+ public Date getCancelledDate() {
+ return cancelledDate;
+ }
+
+ /**
+ * Sets the date that the status changed to CANCELLED.
+ *
+ * @param cancelledDate
+ * the date that the status changed to CANCELLED
+ */
+ public void setCancelledDate(Date cancelledDate) {
+ this.cancelledDate = cancelledDate;
+ setState(State.CANCELLED);
+ }
+
+ /**
+ * Returns the date that the status changed to COMPLETED.
+ * <p>
+ * If the status never been COMPLETED <code>null</code> is returned.
+ *
+ * @return the date that the status changed to COMPLETED
+ */
+ public Date getCompletedDate() {
+ return completedDate;
+ }
+
+ /**
+ * Sets the date that the status changed to COMPLETED.
+ *
+ * @param completedDate
+ * the date that the status changed to COMPLETED
+ */
+ public void setCompletedDate(Date completedDate) {
+ this.completedDate = completedDate;
+ setState(State.COMPLETED);
+ }
+
+ /**
+ * Returns the date that the status changed to FAILED. If the status has never been FAILED
+ * <code>null</code> is returned.
+ *
+ * @return the date that the status changed to failed
+ */
+ public Date getFailedDate() {
+ return failedDate;
+ }
+
+ /**
+ * Sets the date that the status changed to FAILED.
+ *
+ * @param failedDate
+ * the date that the status changed to FAILED
+ */
+ public void setFailedDate(Date failedDate) {
+ this.failedDate = failedDate;
+ setState(State.FAILED);
+ }
+
+ /**
+ * Returns the dates that the status changed to PAUSED.
+ * <p>
+ * If the status has never been PAUSED an empty list is returned.
+ *
+ * @return the dates that the status was paused
+ */
+ public List<Date> getPausedDates() {
+ return pausedDates;
+ }
+
+ /**
+ * Returns the dates that the status changed from PAUSED to RUNNING.
+ * <p>
+ * If the status has never changed from PAUSED to RUNNING an empty list is returned.
+ *
+ * @return the dates that the status was resumed
+ */
+ public List<Date> getResumedDates() {
+ return resumedDates;
+ }
+
+ /**
+ * Returns the invocations.
+ *
+ * @return the invocations
+ */
+ public NavigableSet<Invocation> getInvocations() {
+ synchronized (invocations) {
+ return new TreeSet<>(invocations);
+ }
+ }
+
+ public void addInvocation(Invocation invocation) {
+ synchronized (invocations) {
+ invocations.add(invocation);
+ }
+ }
+
+ /**
+ * Informs the report that an output value has been added.
+ * <p>
+ * Any <code>ReportListener</code>s registered with this report will be notified that an output
+ * value has been added.
+ *
+ * @param path
+ * the path that the value was added to
+ * @param portName
+ * the port that the value belongs to
+ * @param index
+ * the position of the value
+ */
+ public void outputAdded(Path path, String portName, int[] index) {
+ synchronized (reportListeners) {
+ for (ReportListener reportListener : reportListeners)
+ reportListener.outputAdded(path, portName, index);
+ }
+ }
+
+ public void addReportListener(ReportListener reportListener) {
+ synchronized (reportListeners) {
+ reportListeners.add(reportListener);
+ }
+ }
+
+ public void removeReportListener(ReportListener reportListener) {
+ synchronized (reportListeners) {
+ reportListeners.remove(reportListener);
+ }
+ }
+
+ /**
+ * Get an invocation with a given name.
+ * @param invocationName
+ * @return
+ */
+ public Invocation getInvocation(String invocationName) {
+ NavigableSet<Invocation> invocs = getInvocations();
+ // A Comparable Invocation with the desired name
+ SortedSet<Invocation> tailSet = invocs.tailSet(new Invocation(invocationName));
+ if (!tailSet.isEmpty())
+ return tailSet.first();
+ return null;
+ }
+}
\ No newline at end of file