TAVERNA-1011 Use DataBundles.resolve()
...and remove T2ReferenceConverter.convertPathToObject
diff --git a/pom.xml b/pom.xml
index bbba0c1..ca745e6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@
<name>Apache Taverna Engine and Platform</name>
<properties>
- <taverna.language.version>0.15.1-incubating</taverna.language.version>
+ <taverna.language.version>0.16.0-incubating-SNAPSHOT</taverna.language.version>
<taverna.osgi.version>0.2.1-incubating</taverna.osgi.version>
<servicemix.derby.version>10.12.1.1_1</servicemix.derby.version>
</properties>
diff --git a/taverna-execution-local/pom.xml b/taverna-execution-local/pom.xml
index 68ff222..6470e94 100644
--- a/taverna-execution-local/pom.xml
+++ b/taverna-execution-local/pom.xml
@@ -97,7 +97,7 @@
<dependency>
<groupId>org.apache.taverna.language</groupId>
<artifactId>taverna-databundle</artifactId>
- <version>${taverna.language.version}</version>
+ <version>${taverna.language.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/LocalExecution.java b/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/LocalExecution.java
index 3fea278..51d2f51 100644
--- a/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/LocalExecution.java
+++ b/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/LocalExecution.java
@@ -20,9 +20,9 @@
package org.apache.taverna.platform.execution.impl.local;
import static java.util.logging.Level.SEVERE;
-import static org.apache.taverna.platform.execution.impl.local.T2ReferenceConverter.convertPathToObject;
-
+i
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
@@ -49,6 +49,7 @@
import org.apache.taverna.robundle.Bundle;
import org.apache.taverna.databundle.DataBundles;
+import org.apache.taverna.databundle.DataBundles.ResolveOptions;
import org.apache.taverna.platform.capability.api.ActivityService;
import org.apache.taverna.platform.capability.api.DispatchLayerService;
import org.apache.taverna.platform.execution.api.AbstractExecution;
@@ -145,10 +146,11 @@
for (Entry<String, DataflowInputPort> inputPort : inputPorts
.entrySet()) {
String portName = inputPort.getKey();
- Path path = DataBundles.getPort(inputs, portName);
- if (!DataBundles.isMissing(path)) {
+ Path port = DataBundles.getPort(inputs, portName);
+ if (!DataBundles.isMissing(port)) {
T2Reference identifier = referenceService.register(
- convertPathToObject(path), inputPort.getValue()
+ DataBundles.resolve(port, ResolveOptions.BYTES),
+ inputPort.getValue()
.getDepth(), true, null);
int[] index = new int[] {};
WorkflowDataToken token = new WorkflowDataToken("",
@@ -162,7 +164,7 @@
}
}
}
- } catch (IOException e) {
+ } catch (IOException|UncheckedIOException e) {
logger.log(SEVERE, "Error getting input data", e);
}
}
diff --git a/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/T2ReferenceConverter.java b/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/T2ReferenceConverter.java
deleted file mode 100644
index 69c40b2..0000000
--- a/taverna-execution-local/src/main/java/org/apache/taverna/platform/execution/impl/local/T2ReferenceConverter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-* 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.execution.impl.local;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.nio.file.Path;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.taverna.databundle.DataBundles;
-
-/**
- * @author David Withers
- */
-public class T2ReferenceConverter {
- public static Object convertPathToObject(Path path) throws IOException {
- Object object = null;
- if (DataBundles.isValue(path)) {
- object = DataBundles.getStringValue(path);
- } else if (DataBundles.isReference(path)) {
- URI reference = DataBundles.getReference(path);
- String scheme = reference.getScheme();
- if ("file".equals(scheme)) {
- object = new File(reference);
- } else {
- object = reference.toURL();
- }
- } else if (DataBundles.isList(path)) {
- List<Path> list = DataBundles.getList(path);
- List<Object> objectList = new ArrayList<Object>(list.size());
- for (Path pathElement : list) {
- objectList.add(convertPathToObject(pathElement));
- }
- object = objectList;
- }
- return object;
- }
-}