--- a/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/provenance/ProvenanceAccessClient.java
+++ b/src/main/java/net/timbusproject/extractors/modules/tavernaextractor/provenance/ProvenanceAccessClient.java
@@ -44,8 +44,8 @@
import au.com.bytecode.opencsv.CSVReader;
import au.com.bytecode.opencsv.bean.ColumnPositionMappingStrategy;
import au.com.bytecode.opencsv.bean.CsvToBean;
-import uk.gov.nationalarchives.droid.command.DroidCommandLine;
-import uk.gov.nationalarchives.droid.command.action.CommandLineException;
+//import uk.gov.nationalarchives.droid.command.DroidCommandLine;
+//import uk.gov.nationalarchives.droid.command.action.CommandLineException;
/**
* Class for accessing provenance data generated by a Taverna Workflow Run, which is stored in the standard Derby
@@ -118,16 +118,16 @@
saved profile to process. "
*/
- public void processWorkflow(Integer id, final String droidOutputFilePath) throws ProvenanceAccessException,
+ public Path processWorkflow(Integer id, final String droidOutputFilePath) throws ProvenanceAccessException,
ReferenceServiceException, SQLException, IOException {
if (id == null) {
throw new IllegalArgumentException("ID must not be null");
}
- if (droidOutputFilePath == null || droidOutputFilePath.isEmpty()) {
- throw new IllegalArgumentException("Problems accessing the DROID output file at " + droidOutputFilePath);
- }
+// if (droidOutputFilePath == null || droidOutputFilePath.isEmpty()) {
+// throw new IllegalArgumentException("Problems accessing the DROID output file at " + droidOutputFilePath);
+// }
final File droidOutputFile = new File(droidOutputFilePath);
if (!droidOutputFile.exists()) {
@@ -159,7 +159,8 @@
String fileName = new String();
- final Path tempDir = Files.createTempDirectory("workflowRunID-" + workflowRunID + "-");
+ //final Path tempDir = Files.createTempDirectory("workflowRunID-" + workflowRunID + "-");
+ final Path tempDir = droidOutputFile.toPath();
// all processors
List<ProvenanceProcessor> provenanceProcesor = pa.getProcessorsForWorkflowID(workflowID);
@@ -253,25 +254,27 @@
}
}
- final String dir = tempDir.toString();
- Thread t = new Thread() {
- public void run() {
- String[] args = {"-a", dir, "-p", droidOutputFilePath};
- StringBuilder info = new StringBuilder();
- info.append("Running DROID identification with following arguments: ");
- for (String arg : args) {
- info.append(" " + arg + ",");
- }
- LOGGER.debug(info);
- try {
- DroidCommandLine.main(args);
- LOGGER.info("DROID profile successfully saved at "+droidOutputFilePath);
- } catch (CommandLineException e) {
- e.printStackTrace();
- }
- }
- };
- t.start();
+ return tempDir;
+
+// final String dir = tempDir.toString();
+// Thread t = new Thread() {
+// public void run() {
+// String[] args = {"-a", dir, "-p", droidOutputFilePath};
+// StringBuilder info = new StringBuilder();
+// info.append("Running DROID identification with following arguments: ");
+// for (String arg : args) {
+// info.append(" " + arg + ",");
+// }
+// LOGGER.debug(info);
+// try {
+// DroidCommandLine.main(args);
+// LOGGER.info("DROID profile successfully saved at "+droidOutputFilePath);
+// } catch (CommandLineException e) {
+// e.printStackTrace();
+// }
+// }
+// };
+// t.start();
}
/**
@@ -281,37 +284,37 @@
* @throws CommandLineException
*/
- public void generateReport(final File droidProfile) {
-
- final String dir = droidProfile.getParentFile().getAbsolutePath();
- final String fileName = droidProfile.getName();
-
- LOGGER.debug("Directory of the DROID profile file = " + dir);
-
- final File resultCSV = new File(dir + File.separator + fileName + ".csv");
-
- LOGGER.info("Generate CSV-report [" + resultCSV.getAbsolutePath() + "] out of profile ["
- + droidProfile.getAbsolutePath() + "].");
-
- Thread t = new Thread() {
- public void run() {
- String[] args = {"-p", droidProfile.getAbsolutePath(), "-e", resultCSV.getAbsolutePath()};
- StringBuilder info = new StringBuilder();
- info.append("Running DROID identification with following arguments: ");
- for (String arg : args) {
- info.append(" " + arg + ",");
- }
- LOGGER.debug(new String(info));
- try {
- DroidCommandLine.main(args);
- } catch (CommandLineException e) {
- e.printStackTrace();
- }
- }
- };
-
- t.start();
- }
+// public void generateReport(final File droidProfile) {
+//
+// final String dir = droidProfile.getParentFile().getAbsolutePath();
+// final String fileName = droidProfile.getName();
+//
+// LOGGER.debug("Directory of the DROID profile file = " + dir);
+//
+// final File resultCSV = new File(dir + File.separator + fileName + ".csv");
+//
+// LOGGER.info("Generate CSV-report [" + resultCSV.getAbsolutePath() + "] out of profile ["
+// + droidProfile.getAbsolutePath() + "].");
+//
+// Thread t = new Thread() {
+// public void run() {
+// String[] args = {"-p", droidProfile.getAbsolutePath(), "-e", resultCSV.getAbsolutePath()};
+// StringBuilder info = new StringBuilder();
+// info.append("Running DROID identification with following arguments: ");
+// for (String arg : args) {
+// info.append(" " + arg + ",");
+// }
+// LOGGER.debug(new String(info));
+// try {
+// DroidCommandLine.main(args);
+// } catch (CommandLineException e) {
+// e.printStackTrace();
+// }
+// }
+// };
+//
+// t.start();
+// }
/**
* Read a DROID generated CSV report and convert each row in the report to a CSVEntry.