From b0e1605e985456230b9fa5c62596132b00b26cf1 Mon Sep 17 00:00:00 2001 From: labkey-matthewb Date: Wed, 9 Oct 2024 22:47:21 -0700 Subject: [PATCH] FileSystemLike (#149) * AssayDataHandler and AssayUpload conversion File->FileObject checkpoint * FileLike --- .../org/labkey/genotyping/HaplotypeDataCollector.java | 10 +++++----- .../org/labkey/genotyping/HaplotypeDataHandler.java | 3 +-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/genotyping/src/org/labkey/genotyping/HaplotypeDataCollector.java b/genotyping/src/org/labkey/genotyping/HaplotypeDataCollector.java index 6b7352e9..df1b661c 100644 --- a/genotyping/src/org/labkey/genotyping/HaplotypeDataCollector.java +++ b/genotyping/src/org/labkey/genotyping/HaplotypeDataCollector.java @@ -24,9 +24,9 @@ import org.labkey.api.exp.api.ExpProtocol; import org.labkey.api.view.HttpView; import org.labkey.api.view.JspView; +import org.labkey.vfs.FileLike; import java.io.ByteArrayInputStream; -import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -71,7 +71,7 @@ public String getDescription(ContextType context) @NotNull @Override - public Map createData(ContextType context) throws IOException, ExperimentException + public Map createData(ContextType context) throws IOException, ExperimentException { ExpProtocol protocol = context.getProtocol(); String data = context.getRequest().getParameter(HaplotypeAssayProvider.DATA_PROPERTY_NAME); @@ -95,11 +95,11 @@ public Map createData(ContextType context) throws IOException, Exp } // NOTE: We use a 'tmp' file extension so that DataLoaderService will sniff the file type by parsing the file's header. - File dir = getFileTargetDir(context); - File file = createFile(protocol, dir, "tmp"); + FileLike dir = getFileTargetDir(context); + FileLike file = createFile(protocol, dir, "tmp"); ByteArrayInputStream bIn = new ByteArrayInputStream(data.getBytes(context.getRequest().getCharacterEncoding())); - writeFile(bIn, file); + writeFile(bIn, file.toNioPathForWrite().toFile()); return Collections.singletonMap(PRIMARY_FILE, file); } diff --git a/genotyping/src/org/labkey/genotyping/HaplotypeDataHandler.java b/genotyping/src/org/labkey/genotyping/HaplotypeDataHandler.java index 5b2e60fa..69b13836 100644 --- a/genotyping/src/org/labkey/genotyping/HaplotypeDataHandler.java +++ b/genotyping/src/org/labkey/genotyping/HaplotypeDataHandler.java @@ -16,7 +16,6 @@ package org.labkey.genotyping; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -70,7 +69,7 @@ public DataType getDataType() } @Override - public void importFile(ExpData data, File dataFile, ViewBackgroundInfo info, Logger log, XarContext context) throws ExperimentException + public void importFile(@NotNull ExpData data, File dataFile, @NotNull ViewBackgroundInfo info, @NotNull Logger log, @NotNull XarContext context) throws ExperimentException { if (!dataFile.exists()) {