MigrationResult result = new MigrationResult();
HashMap<String, Object> inputData = new HashMap<String, Object>();
WorkflowDescription workflowDescription = MyExperimentRESTClient.getWorkflow(action.getDescriptor());
workflowDescription.readMetadata();
if (!workflowDescription.getProfile().equals("http://purl.org/DP/components#MigrationAction")) {
result.setSuccessful(false);
result.setReport("The workflow " + action.getUrl() + " is no MigrationAction.");
return result;
}
List<Port> inputPorts = workflowDescription.getInputPorts();
for (Port p : inputPorts) {
if (ComponentConstants.VALUE_SOURCE_OBJECT.equals(p.getValue())) {
inputData.put(p.getName(),
tavernaExecutor.new ByteArraySourceFile(FileUtils.makeFilename(digitalObject.getFullname()),
digitalObject.getData().getData()));
} else if (ComponentConstants.VALUE_PARAMETER.equals(p.getValue()) || p.getValue() == null) {
String value = action.getParamByName(p.getName());
if (value == null) {
value = "";
}
inputData.put(p.getName(), value);
} else {
result.setSuccessful(false);
result.setReport("The workflow " + action.getUrl() + " has unsupported port " + p.getName()
+ " that accepts " + p.getValue());
return result;
}
}
tavernaExecutor.setInputData(inputData);
// Workflow
tavernaExecutor.setWorkflow(action.getUrl());
// Output ports to receive
List<Port> outputPorts = workflowDescription.getOutputPorts();
Set<String> outputPortNames = new HashSet<String>(outputPorts.size());
String targetPathPort = null;
for (Port p : outputPorts) {
outputPortNames.add(p.getName());