Skip to content

Commit

Permalink
Merge pull request #34 from bioinformatics-ua/change/undeprecate-stor…
Browse files Browse the repository at this point in the history
…age-handles

Undeprecate StorageInterface#handles
  • Loading branch information
bastiao authored Aug 28, 2024
2 parents 1b98e15 + dec12e1 commit 9a9bdb5
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions _docs/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,27 @@ children.
scheme like this:

```java
@Override
public String getScheme() {
return "file";
}
```

Dicoogle will identify whether a particular item in storage (existent or not yet existent)
should be handled by this plugin through the URI scheme.
By default, this check is done through an exact match.
That is, `file://CT/I0001.dcm` is handled by the plugin with `getScheme()` above,
but `file+ssl://CT/I0001.dcm` is not.
If you need to change this behavior, you can override the `handles(URI)` method.

```java
@Override
public boolean handles(URI location) {
String scheme = location.getScheme();
return scheme.equals("file") || scheme.equals("file+ssl");
}
```

`list()` was introduced in Dicoogle 3,
enabling storage interfaces to provide a list of entries
at a particular position in the storage tree.
Expand All @@ -161,13 +177,3 @@ Implementers may ignore this method,
but implemeting it may grant additional features to end applications.
Consumers of this method should catch `UnsupportedOperationException`
to handle situations in which the method is not implemented.

`handles(URI)` is a deprecated method,
which was made to verify whether the given URI can relate to an item (existent or inexistent) in this storage.
Since this was meant to be based uniquely on the scheme of the URI,
implementers should ignore it,
and consumers should instead check for equality of the scheme:

```java
boolean handles = Objects.equals(storageInterface.getScheme(), uri.getScheme());
```

0 comments on commit 9a9bdb5

Please sign in to comment.