-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
track zenodo/github query responses when using [elton track] in addit…
…ion to [elton ls]
- Loading branch information
Jorrit Poelen
committed
Jan 2, 2025
1 parent
fa30156
commit f2bb29e
Showing
6 changed files
with
126 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
src/main/java/org/globalbioticinteractions/elton/util/ResourceServiceRemote.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package org.globalbioticinteractions.elton.util; | ||
|
||
import org.eol.globi.service.ResourceService; | ||
import org.eol.globi.util.InputStreamFactory; | ||
import org.eol.globi.util.ResourceServiceFactoryRemote; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URI; | ||
|
||
public class ResourceServiceRemote implements ResourceService { | ||
|
||
private final InputStreamFactory factory; | ||
private final File cacheDir; | ||
|
||
public ResourceServiceRemote(InputStreamFactory factory, File tmpDir) { | ||
this.factory = factory; | ||
this.cacheDir = tmpDir; | ||
} | ||
|
||
@Override | ||
public InputStream retrieve(URI resourceName) throws IOException { | ||
InputStream is = null; | ||
|
||
if (resourceName != null) { | ||
ResourceService resourceService = new ResourceServiceFactoryRemote(factory, cacheDir) | ||
.serviceForResource(resourceName); | ||
if (resourceService == null) { | ||
throw new IOException("cannot retrieve content of unsupported resource identifier [" + resourceName.toString() + "]"); | ||
} else { | ||
is = resourceService.retrieve(resourceName); | ||
} | ||
} | ||
|
||
return is; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters