cziegeler commented on a change in pull request #12: SLING-8421: Allow artifact
providers that work with URLs instead of F…
URL:
https://github.com/apache/sling-org-apache-sling-feature-io/pull/12#discussion_r284984009
##########
File path:
src/main/java/org/apache/sling/feature/io/file/spi/ArtifactProvider.java
##########
@@ -52,4 +56,14 @@
* @return A file if the artifact exists or {@code null}
*/
File getArtifact(String url, String relativeCachePath);
+
+ default ArtifactHandler getArtifactHandler(String url, String
relativeCachePath) {
+ File result = getArtifact(url, relativeCachePath);
+ if (result != null && result.exists()) {
+ return new ArtifactHandler(url, result);
+ }
+ else {
+ return null;
+ }
+ }
}
Review comment:
This adds a dependency to the io.file package which so far has been avoided
(for circular dependencies between those packages). I think we should avoid this
As this adds new api, the package version needs to be updated
If such a new method (in whatever form) is added, could we maybe deprecate
getArtifact() ? This might also need adjustments to the javadoc, as getArtifact
might return null while getArtifactHandler might not (if I understand
everything correctly)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services