diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/plugins/DefaultFileStoragePlugin.java b/dicoogle/src/main/java/pt/ua/dicoogle/plugins/DefaultFileStoragePlugin.java index f9564461a..e2ceec73e 100644 --- a/dicoogle/src/main/java/pt/ua/dicoogle/plugins/DefaultFileStoragePlugin.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/plugins/DefaultFileStoragePlugin.java @@ -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 createIterator(URI location) { if (!handles(location)) { logger.error("Cannot Handle: " + location.toString()); @@ -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; } @@ -135,7 +128,7 @@ public void remove(URI location) { @Override public Stream list(URI location) throws IOException { - if (!location.getScheme().equals(defaultScheme)) { + if (!handles(location)) { return Stream.empty(); } diff --git a/sdk/src/main/java/pt/ua/dicoogle/sdk/StorageInterface.java b/sdk/src/main/java/pt/ua/dicoogle/sdk/StorageInterface.java index fe26d0369..36b9c0735 100644 --- a/sdk/src/main/java/pt/ua/dicoogle/sdk/StorageInterface.java +++ b/sdk/src/main/java/pt/ua/dicoogle/sdk/StorageInterface.java @@ -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()); }