diff --git a/productMods/WEB-INF/web.xml b/productMods/WEB-INF/web.xml
index 042c4609..e25789da 100644
--- a/productMods/WEB-INF/web.xml
+++ b/productMods/WEB-INF/web.xml
@@ -1356,6 +1356,15 @@
/qrcode/about
+
+ FileHarvestController
+ edu.cornell.mannlib.vitro.webapp.controller.harvester.FileHarvestController
+
+
+ FileHarvestController
+ /harvester/harvest
+
+
diff --git a/productMods/templates/freemarker/body/harvester/testfile.ftl b/productMods/templates/freemarker/body/harvester/fileharvest.ftl
similarity index 98%
rename from productMods/templates/freemarker/body/harvester/testfile.ftl
rename to productMods/templates/freemarker/body/harvester/fileharvest.ftl
index 3516225c..ca5dbe98 100644
--- a/productMods/templates/freemarker/body/harvester/testfile.ftl
+++ b/productMods/templates/freemarker/body/harvester/fileharvest.ftl
@@ -77,7 +77,7 @@
} else {
var newLi = document.createElement("li");
- newLi.innerHTML = "" + json.newlyAddedUris[i] + "";
+ newLi.innerHTML = "${jobSpecificNoNewDataMessage}";
importedItems.appendChild(newLi);
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java
index 0fb6c5de..3418f4d0 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/CsvFileHarvestJob.java
@@ -163,8 +163,8 @@ class CsvFileHarvestJob implements FileHarvestJob {
* @return the path to the directory containing the template files
*/
private String getTemplateFileDirectory() {
- String harvesterPath = TestFileController.getHarvesterPath();
- String pathToTemplateFiles = harvesterPath + TestFileController.PATH_TO_TEMPLATE_FILES;
+ String harvesterPath = FileHarvestController.getHarvesterPath();
+ String pathToTemplateFiles = harvesterPath + FileHarvestController.PATH_TO_TEMPLATE_FILES;
return pathToTemplateFiles;
}
@@ -173,8 +173,8 @@ class CsvFileHarvestJob implements FileHarvestJob {
* @return the path to the directory containing the script files
*/
private String getScriptFileDirectory() {
- String harvesterPath = TestFileController.getHarvesterPath();
- String pathToScriptFiles = harvesterPath + TestFileController.PATH_TO_HARVESTER_SCRIPTS;
+ String harvesterPath = FileHarvestController.getHarvesterPath();
+ String pathToScriptFiles = harvesterPath + FileHarvestController.PATH_TO_HARVESTER_SCRIPTS;
return pathToScriptFiles;
}
@@ -286,13 +286,15 @@ class CsvFileHarvestJob implements FileHarvestJob {
private String performScriptTemplateReplacements(String scriptTemplateContents) {
String replacements = scriptTemplateContents;
- String workingDirectory = TestFileController.getHarvesterPath();
- String fileDirectory = TestFileController.getUploadPath(vreq);
+ String workingDirectory = FileHarvestController.getHarvesterPath();
+ String fileDirectory = FileHarvestController.getUploadPath(vreq);
String harvestedDataPath = getHarvestedDataPath();
+ String globalHarvestedDataRelativePath = FileHarvestController.PATH_TO_HARVESTED_DATA;
replacements = replacements.replace("${WORKING_DIRECTORY}", workingDirectory);
replacements = replacements.replace("${UPLOADS_FOLDER}", fileDirectory);
replacements = replacements.replace("${HARVESTED_DATA_PATH}", harvestedDataPath);
+ replacements = replacements.replace("${GLOBAL_HARVESTED_DATA_RELATIVE_PATH}", globalHarvestedDataRelativePath);
return replacements;
}
@@ -322,7 +324,7 @@ class CsvFileHarvestJob implements FileHarvestJob {
}
private String getHarvestedDataPath() {
- return TestFileController.getFileHarvestRootPath() + "harvested-data/csv/" + this.sessionId + "/";
+ return FileHarvestController.getHarvesterPath() + FileHarvestController.PATH_TO_HARVESTED_DATA + "csv/" + this.sessionId + "/";
}
@Override
diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/TestFileController.java b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java
similarity index 96%
rename from src/edu/cornell/mannlib/vitro/webapp/controller/harvester/TestFileController.java
rename to src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java
index 64b930d6..645dd14b 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/TestFileController.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/controller/harvester/FileHarvestController.java
@@ -45,11 +45,11 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
import edu.cornell.mannlib.vitro.webapp.filestorage.backend.FileStorageSetup;
import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest;
-public class TestFileController extends FreemarkerHttpServlet {
+public class FileHarvestController extends FreemarkerHttpServlet {
private static final long serialVersionUID = 1L;
- private static final Log log = LogFactory.getLog(TestFileController.class);
- private static final String TEMPLATE_DEFAULT = "testfile.ftl";
+ private static final Log log = LogFactory.getLog(FileHarvestController.class);
+ private static final String TEMPLATE_DEFAULT = "fileharvest.ftl";
private static final String PARAMETER_FIRST_UPLOAD = "firstUpload";
private static final String PARAMETER_UPLOADED_FILE = "uploadedFile";
@@ -84,7 +84,8 @@ public class TestFileController extends FreemarkerHttpServlet {
/**
* Absolute path on the server of the Harvester root directory. Include final slash.
*/
- private static final String PATH_TO_HARVESTER = "/home/mbarbieri/workspace/HarvesterDev/";
+ private static final String PATH_TO_HARVESTER = "/usr/share/vivo/harvester/";
+// private static final String PATH_TO_HARVESTER = "/home/mbarbieri/workspace/HarvesterDev/";
/**
* Relative path from the Harvester root directory to the main area reserved for the VIVO File Harvest feature. Include
@@ -102,6 +103,11 @@ public class TestFileController extends FreemarkerHttpServlet {
*/
public static final String PATH_TO_HARVESTER_SCRIPTS = PATH_TO_FILE_HARVEST_ROOT + "scripts/";
+ /**
+ * Relative path from the Harvester root directory to the directory containing the script templates. Include final slash.
+ */
+ public static final String PATH_TO_HARVESTED_DATA = PATH_TO_FILE_HARVEST_ROOT + "harvested-data/";
+
static {
fillKnownJobTypesList();
@@ -132,7 +138,7 @@ public class TestFileController extends FreemarkerHttpServlet {
String job = vreq.getParameter(PARAMETER_JOB);
String jobKnown = "false";
- if((job != null) && TestFileController.knownJobs.contains(job.toLowerCase()))
+ if((job != null) && FileHarvestController.knownJobs.contains(job.toLowerCase()))
jobKnown = "true";
FileHarvestJob jobObject = getJob(vreq, job);
@@ -514,9 +520,19 @@ public class TestFileController extends FreemarkerHttpServlet {
}
}
-
+ /**
+ * Returns the location in which the ready-to-run scripts, after having template replacements made on them, will be
+ * placed. Final slash included.
+ * @return the location in which the ready-to-run scripts will be placed
+ */
+ private static String getScriptFileLocation() {
+ return PATH_TO_HARVESTER + PATH_TO_HARVESTER_SCRIPTS + "temp/";
+ }
+
+
+
private File createScriptFile(String script) throws IOException {
- File scriptDirectory = new File(getHarvesterPath() + "scripts/temp");
+ File scriptDirectory = new File(getScriptFileLocation());
if(!scriptDirectory.exists()) {
scriptDirectory.mkdirs();
}
@@ -790,7 +806,7 @@ public class TestFileController extends FreemarkerHttpServlet {
File scriptFile = createScriptFile(this.script);
- String command = "/bin/bash " + getHarvesterPath() + "scripts/temp/" + scriptFile.getName();
+ String command = "/bin/bash " + getScriptFileLocation() + scriptFile.getName();
log.info("Running command: " + command);
Process pr = Runtime.getRuntime().exec(command);