Skip to content

Commit

Permalink
FileSystemLike (#149)
Browse files Browse the repository at this point in the history
* AssayDataHandler and AssayUpload conversion File->FileObject
checkpoint

* FileLike
  • Loading branch information
labkey-matthewb authored Oct 10, 2024
1 parent f36c82b commit b0e1605
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 5 additions & 5 deletions genotyping/src/org/labkey/genotyping/HaplotypeDataCollector.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -71,7 +71,7 @@ public String getDescription(ContextType context)

@NotNull
@Override
public Map<String, File> createData(ContextType context) throws IOException, ExperimentException
public Map<String, FileLike> createData(ContextType context) throws IOException, ExperimentException
{
ExpProtocol protocol = context.getProtocol();
String data = context.getRequest().getParameter(HaplotypeAssayProvider.DATA_PROPERTY_NAME);
Expand All @@ -95,11 +95,11 @@ public Map<String, File> 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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())
{
Expand Down

0 comments on commit b0e1605

Please sign in to comment.