Skip to content

Commit 4a30259

Browse files
More cleanup
1 parent f8d587e commit 4a30259

File tree

2 files changed

+28
-31
lines changed

2 files changed

+28
-31
lines changed

SequenceAnalysis/src/org/labkey/sequenceanalysis/SequenceAnalysisController.java

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,27 +2145,24 @@ protected void setContentType(HttpServletResponse response)
21452145
}
21462146

21472147
@Override
2148-
protected File getTargetFile(String filename) throws IOException
2148+
protected FileLike getTargetFile(String filename) throws IOException
21492149
{
21502150
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
21512151
throw new UploadException("Pipeline root must be configured before uploading FASTA files", HttpServletResponse.SC_NOT_FOUND);
21522152

21532153
PipeRoot root = PipelineService.get().getPipelineRootSetting(getContainer());
2154-
2155-
File targetDirectory = root.getRootPath();
2156-
2157-
return FileUtil.findUniqueFileName(filename, targetDirectory);
2154+
return FileUtil.findUniqueFileName(filename, root.getRootFileLike());
21582155
}
21592156

21602157
@Override
2161-
public String getResponse(ImportFastaSequencesForm form, Map<String, Pair<File, String>> files)
2158+
public String getResponse(ImportFastaSequencesForm form, Map<String, Pair<FileLike, String>> files)
21622159
{
21632160
JSONObject resp = new JSONObject();
21642161
try
21652162
{
2166-
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
2163+
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
21672164
{
2168-
File file = entry.getValue().getKey();
2165+
File file = entry.getValue().getKey().toNioPathForRead().toFile();
21692166

21702167
Map<String, String> params = form.getNtParams();
21712168
Map<String, Object> libraryParams = form.getLibraryParams();
@@ -2444,15 +2441,15 @@ protected void setContentType(HttpServletResponse response)
24442441
}
24452442

24462443
@Override
2447-
protected File getTargetFile(String filename) throws IOException
2444+
protected FileLike getTargetFile(String filename) throws IOException
24482445
{
24492446
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
24502447
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);
24512448

24522449
try
24532450
{
24542451
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer(), "sequenceOutputs");
2455-
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
2452+
return FileUtil.findUniqueFileName(filename, targetDirectory);
24562453
}
24572454
catch (ExperimentException e)
24582455
{
@@ -2461,14 +2458,14 @@ protected File getTargetFile(String filename) throws IOException
24612458
}
24622459

24632460
@Override
2464-
public String getResponse(ImportOutputFileForm form, Map<String, Pair<File, String>> files)
2461+
public String getResponse(ImportOutputFileForm form, Map<String, Pair<FileLike, String>> files)
24652462
{
24662463
JSONObject resp = new JSONObject();
24672464
try
24682465
{
2469-
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
2466+
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
24702467
{
2471-
File file = entry.getValue().getKey();
2468+
FileLike file = entry.getValue().getKey();
24722469

24732470
Map<String, Object> params = new CaseInsensitiveHashMap<>();
24742471
params.put("name", form.getName());
@@ -2577,15 +2574,15 @@ protected void setContentType(HttpServletResponse response)
25772574
}
25782575

25792576
@Override
2580-
protected File getTargetFile(String filename) throws IOException
2577+
protected FileLike getTargetFile(String filename) throws IOException
25812578
{
25822579
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
25832580
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);
25842581

25852582
try
25862583
{
25872584
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer());
2588-
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
2585+
return FileUtil.findUniqueFileName(filename, targetDirectory);
25892586
}
25902587
catch (ExperimentException e)
25912588
{
@@ -2610,7 +2607,7 @@ public void validateCommand(ImportTrackForm form, Errors errors)
26102607
}
26112608

26122609
@Override
2613-
public String getResponse(ImportTrackForm form, Map<String, Pair<File, String>> files) throws UploadException
2610+
public String getResponse(ImportTrackForm form, Map<String, Pair<FileLike, String>> files) throws UploadException
26142611
{
26152612
JSONObject resp = new JSONObject();
26162613
if (form.getTrackName() == null || form.getLibraryId() == null)
@@ -2620,9 +2617,9 @@ public String getResponse(ImportTrackForm form, Map<String, Pair<File, String>>
26202617

26212618
try
26222619
{
2623-
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
2620+
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
26242621
{
2625-
File file = entry.getValue().getKey();
2622+
File file = entry.getValue().getKey().toNioPathForRead().toFile();
26262623

26272624
try
26282625
{
@@ -2742,15 +2739,15 @@ protected void setContentType(HttpServletResponse response)
27422739
}
27432740

27442741
@Override
2745-
protected File getTargetFile(String filename) throws IOException
2742+
protected FileLike getTargetFile(String filename) throws IOException
27462743
{
27472744
if (!PipelineService.get().hasValidPipelineRoot(getContainer()))
27482745
throw new UploadException("Pipeline root must be configured before uploading files", HttpServletResponse.SC_NOT_FOUND);
27492746

27502747
try
27512748
{
27522749
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer());
2753-
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
2750+
return FileUtil.findUniqueFileName(filename, targetDirectory);
27542751
}
27552752
catch (ExperimentException e)
27562753
{
@@ -2759,14 +2756,14 @@ protected File getTargetFile(String filename) throws IOException
27592756
}
27602757

27612758
@Override
2762-
public String getResponse(ImportChainFileForm form, Map<String, Pair<File, String>> files)
2759+
public String getResponse(ImportChainFileForm form, Map<String, Pair<FileLike, String>> files)
27632760
{
27642761
JSONObject resp = new JSONObject();
27652762
try
27662763
{
2767-
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
2764+
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
27682765
{
2769-
File file = entry.getValue().getKey();
2766+
File file = entry.getValue().getKey().toNioPathForRead().toFile();
27702767

27712768
if (form.getGenomeId1() == null || form.getGenomeId2() == null)
27722769
{

blast/src/org/labkey/blast/BLASTController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -212,13 +212,13 @@ public void validateCommand(RunBlastForm form, Errors errors)
212212
}
213213

214214
@Override
215-
protected File getTargetFile(String filename) throws IOException
215+
protected FileLike getTargetFile(String filename) throws IOException
216216
{
217217
AssayFileWriter writer = new AssayFileWriter();
218218
try
219219
{
220220
FileLike targetDirectory = AssayFileWriter.ensureUploadDirectory(getContainer());
221-
return FileUtil.findUniqueFileName(filename, targetDirectory).toNioPathForWrite().toFile();
221+
return FileUtil.findUniqueFileName(filename, targetDirectory);
222222
}
223223
catch (ExperimentException e)
224224
{
@@ -227,7 +227,7 @@ protected File getTargetFile(String filename) throws IOException
227227
}
228228

229229
@Override
230-
public String getResponse(RunBlastForm form, Map<String, Pair<File, String>> files)
230+
public String getResponse(RunBlastForm form, Map<String, Pair<FileLike, String>> files)
231231
{
232232
JSONObject resp = new JSONObject();
233233
Map<String, String> params = new HashMap<>();
@@ -251,10 +251,10 @@ public String getResponse(RunBlastForm form, Map<String, Pair<File, String>> fil
251251
params.put("perc_identity", form.getPctIdentity());
252252
}
253253

254-
List<File> inputFiles = new ArrayList<>();
254+
List<FileLike> inputFiles = new ArrayList<>();
255255
try
256256
{
257-
for (Map.Entry<String, Pair<File, String>> entry : files.entrySet())
257+
for (Map.Entry<String, Pair<FileLike, String>> entry : files.entrySet())
258258
{
259259
inputFiles.add(entry.getValue().getKey());
260260
}
@@ -272,7 +272,7 @@ public String getResponse(RunBlastForm form, Map<String, Pair<File, String>> fil
272272
{
273273
fw.write(form.getQuery());
274274
}
275-
inputFiles.add(input.toNioPathForRead().toFile());
275+
inputFiles.add(input);
276276
}
277277
catch (ExperimentException e)
278278
{
@@ -282,9 +282,9 @@ public String getResponse(RunBlastForm form, Map<String, Pair<File, String>> fil
282282

283283
if (!inputFiles.isEmpty())
284284
{
285-
for (File input : inputFiles)
285+
for (FileLike input : inputFiles)
286286
{
287-
String jobId = BLASTManager.get().runBLASTN(getContainer(), getUser(), form.getDatabase(), input, form.getTask(), form.getTitle(), form.getSaveResults(), params, true);
287+
String jobId = BLASTManager.get().runBLASTN(getContainer(), getUser(), form.getDatabase(), input.toNioPathForRead().toFile(), form.getTask(), form.getTitle(), form.getSaveResults(), params, true);
288288
resp.put("jobId", jobId);
289289
}
290290
}

0 commit comments

Comments
 (0)