Skip to content

Commit 1101bcf

Browse files
Continue adopting FileLike instead of File or Path (#1136)
1 parent 3ba8d8c commit 1101bcf

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

src/org/labkey/targetedms/SkylineDocImporter.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
import org.labkey.targetedms.query.ReplicateManager;
7272
import org.labkey.targetedms.query.RepresentativeStateManager;
7373
import org.labkey.targetedms.query.SkylineListManager;
74+
import org.labkey.vfs.FileLike;
7475

7576
import javax.xml.stream.XMLStreamException;
7677
import java.io.ByteArrayInputStream;
@@ -239,17 +240,17 @@ public TargetedMSRun importRun(RunInfo runInfo, PipelineJob job) throws IOExcept
239240

240241
try
241242
{
242-
File inputFile = getInputFile();
243+
FileLike inputFile = getInputFile();
243244
if (null == inputFile)
244245
throw new FileNotFoundException();
245246

246247
// Set the size of the Skyline document (.sky.zip) file.
247-
run.setDocumentSize(Files.size(inputFile.toPath()));
248+
run.setDocumentSize(inputFile.getSize());
248249
saveRunDocumentSize(run);
249250

250251
updateRunStatus(IMPORT_STARTED);
251252
_log.info("Starting to import Skyline document from " + run.getFileName());
252-
importSkylineDoc(run, inputFile);
253+
importSkylineDoc(run, inputFile.toNioPathForRead().toFile());
253254
_log.info("Completed import of Skyline document from " + run.getFileName());
254255

255256
updateRunStatus(IMPORT_SUCCEEDED, STATUS_SUCCESS);
@@ -2725,10 +2726,10 @@ private RegressionFit getRegressionFit(QuantificationSettings quantificationSett
27252726
}
27262727

27272728
@Nullable
2728-
private File getInputFile()
2729+
private FileLike getInputFile()
27292730
{
27302731
if (_expData.hasFileScheme())
2731-
return _expData.getFile();
2732+
return _expData.getFileLike();
27322733

27332734
if (null == _pipeRoot || null == _localDirectory)
27342735
return null;

src/org/labkey/targetedms/chromlib/ChromatogramLibraryUtils.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.labkey.targetedms.TargetedMSManager;
3434
import org.labkey.targetedms.TargetedMSRun;
3535
import org.labkey.targetedms.query.ConflictResultsManager;
36+
import org.labkey.vfs.FileLike;
3637
import org.sqlite.SQLiteConfig;
3738

3839
import java.io.File;
@@ -182,14 +183,14 @@ public static Integer parseChromLibRevision(@NotNull String chromLibFileName)
182183
return null;
183184
}
184185

185-
public static Path getChromLibTempFile(Container container, LocalDirectory localDirectory, int revision) throws IOException
186+
public static FileLike getChromLibTempFile(Container container, LocalDirectory localDirectory, int revision) throws IOException
186187
{
187188
// Temp file in LocalDirectory (guaranteed to be local File dir)
188-
File localDir = localDirectory.getLocalDirectoryFile();
189-
Path chromLibDir = localDir.toPath().resolve(CHROM_LIB_FILE_DIR);
190-
if(!Files.exists(chromLibDir))
189+
FileLike localDir = localDirectory.getLocalDirectoryFile();
190+
FileLike chromLibDir = localDir.resolveChild(CHROM_LIB_FILE_DIR);
191+
if(!chromLibDir.exists())
191192
FileUtil.createDirectory(chromLibDir);
192-
return chromLibDir.resolve(
193+
return chromLibDir.resolveChild(
193194
FileUtil.makeFileNameWithTimestamp(CHROM_LIB_FILE_BASE_NAME+"_"+container.getRowId()+"_rev"+revision,
194195
CHROM_LIB_FILE_EXT));
195196
}

src/org/labkey/targetedms/chromlib/ContainerChromatogramLibraryWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public ContainerChromatogramLibraryWriter(String panoramaServer, Container conta
113113

114114
public String writeLibrary(LocalDirectory localDirectory, int libraryRevision) throws SQLException, IOException
115115
{
116-
Path tempChromLibFile = ChromatogramLibraryUtils.getChromLibTempFile(_container, localDirectory, libraryRevision);
116+
Path tempChromLibFile = ChromatogramLibraryUtils.getChromLibTempFile(_container, localDirectory, libraryRevision).toNioPathForWrite();
117117

118118
try
119119
{

src/org/labkey/targetedms/parser/speclib/LibSpectrumReader.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import org.labkey.api.util.Pair;
3030
import org.labkey.targetedms.parser.Peptide;
3131
import org.labkey.targetedms.view.spectrum.LibrarySpectrumMatchGetter;
32+
import org.labkey.vfs.FileLike;
33+
import org.labkey.vfs.FileSystemLike;
3234
import org.sqlite.SQLiteConfig;
3335

3436
import java.io.File;
@@ -161,9 +163,9 @@ private static String getLibCacheKey(@NotNull Container container, String pathSt
161163
Path remotePath = pair.second;
162164
if (null != container && null != remotePath)
163165
{
164-
File file = LocalDirectory.copyToContainerDirectory(container, remotePath, LOG);
166+
FileLike file = LocalDirectory.copyToContainerDirectory(container, FileSystemLike.wrapFile(remotePath), LOG);
165167
if (null != file)
166-
return file.getAbsolutePath();
168+
return file.toNioPathForRead().toFile().getAbsolutePath();
167169
}
168170
}
169171
return null;

src/org/labkey/targetedms/pipeline/TargetedMSImportPipelineJob.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public TargetedMSImportPipelineJob(ViewBackgroundInfo info, ExpData expData, Sky
6868
throw new RuntimeException("Cannot process ExpData when its schema does not match root URI scheme.");
6969

7070
LocalDirectory localDirectory = LocalDirectory.create(root, baseLogFileName,
71-
null != _expData.getFile() ? _expData.getFile().getParentFile().getPath() : FileUtil.getTempDirectory().getPath());
71+
null != _expData.getFile() ? _expData.getFileLike().getParent() : FileUtil.getTempDirectoryFileLike());
7272
setLocalDirectory(localDirectory);
7373
setLogFile(localDirectory.determineLogFile());
7474
}

0 commit comments

Comments
 (0)