Skip to content

Commit

Permalink
[sdk] Undeprecate StorageInterface#handles (#695)
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed Aug 27, 2024
1 parent 169d3eb commit 27848cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ public String getScheme() {
return defaultScheme;
}

@Override
public boolean handles(URI location) {
if (location.getScheme() == null)
return true;
return location.getScheme().equals(defaultScheme);
}

private Iterator<StorageInputStream> createIterator(URI location) {
if (!handles(location)) {
logger.error("Cannot Handle: " + location.toString());
Expand Down Expand Up @@ -122,7 +115,7 @@ public URI store(DicomInputStream inputStream, Object... args) throws IOExceptio

@Override
public void remove(URI location) {
if (!location.getScheme().equals(defaultScheme)) {
if (!handles(location)) {
return;
}

Expand All @@ -135,7 +128,7 @@ public void remove(URI location) {

@Override
public Stream<URI> list(URI location) throws IOException {
if (!location.getScheme().equals(defaultScheme)) {
if (!handles(location)) {
return Stream.empty();
}

Expand Down
4 changes: 3 additions & 1 deletion sdk/src/main/java/pt/ua/dicoogle/sdk/StorageInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ public interface StorageInterface extends DicooglePlugin {
/**
* Checks whether the file in the given path can be handled by this storage plugin.
*
* The default implementation checks that the given location URI
* has the exact same scheme as the scheme returned by {@link #getScheme()}.
*
* @param location a URI containing a scheme to be verified
* @return true if this storage plugin is in charge of URIs in the given form
*/
@Deprecated
public default boolean handles(URI location) {
return Objects.equals(this.getScheme(), location.getScheme());
}
Expand Down

0 comments on commit 27848cc

Please sign in to comment.