Commit 5710ca31 authored by Matija Obreza's avatar Matija Obreza
Browse files

Validator data folder root is /data and requires write permissions

parent 0e74d4d6
......@@ -3,7 +3,7 @@ FROM jetty:9.4.5
LABEL maintainer "Matija Obreza <matija.obreza@croptrust.org>"
ENV USER=jetty \
APP_DATA=/data/grin \
APP_DATA=/data \
JETTY_BASE=/var/lib/jetty/ \
GENESYS_WAR='validator-web-*.war'
......@@ -17,4 +17,4 @@ RUN mkdir -p $APP_DATA \
COPY ${GENESYS_WAR} ${JETTY_BASE}/webapps/validator.war
VOLUME /data/grin
VOLUME /data
# Path to directory with extract GRIN-Taxonomy CAB
taxonomy.data.path=/data/grin
# Path to writable directory for downloads
data.folder.path=/data
......@@ -57,7 +57,7 @@ public class DownloaderData {
File downloadedFile = File.createTempFile("temp-", ".zip");
if (files.length == 0) {
LOG.warn("Data not provided in {}, starting download {}", dataFolder.getAbsoluteFile(), downloadUrl);
LOG.warn("No files {} found in {}, starting download {}", templateNameFileExist, dataFolder.getAbsoluteFile(), downloadUrl);
download(downloadedFile, downloadUrl);
if (unzip) {
......@@ -134,26 +134,29 @@ public class DownloaderData {
ZipInputStream zipIn = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry entry = zipIn.getNextEntry();
while (entry != null) {
File outputFile;
String filePath;
File target;
if (!saveArchiveStructure) {
String name = entry.getName();
filePath = outputFolder + File.separator + name.substring(name.lastIndexOf("/") + 1, name.length());
outputFile = new File(filePath);
target = new File(outputFolder, name.substring(name.lastIndexOf("/") + 1, name.length()));
} else {
filePath = outputFolder + File.separator + entry.getName();
outputFile = new File(filePath);
outputFile.getParentFile().mkdirs();
target = new File(outputFolder, entry.getName());
if (! target.getParentFile().exists()) {
LOG.warn("Making directories {}", target.getParentFile());
target.getParentFile().mkdirs();
}
}
outputFile.createNewFile();
if (!entry.isDirectory()) {
extractFile(zipIn, outputFile);
if (! entry.isDirectory()) {
if (! target.exists()) {
LOG.warn("Creating file {}", target);
target.createNewFile();
}
extractFile(zipIn, target);
} else {
if (saveArchiveStructure) {
File dir = new File(filePath);
LOG.warn("Creating directory {}", target);
File dir = target;
dir.mkdir();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment