This is an automated email from the ASF dual-hosted git repository. tmaret pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal-messages.git
commit a2c0d7c3d4885cd0ea9e29e26f39b416a21f2e2d Author: Dirk Rudolph <[email protected]> AuthorDate: Thu May 15 12:44:30 2025 +0200 SLING-12780: allow metadata for binaries put into the BinaryStore (#25) * feat: allow to pass content type and metadata to binaries * feat: add verify method --- .../sling/distribution/journal/BinaryStore.java | 29 +++++++++++++++++++++- .../sling/distribution/journal/package-info.java | 2 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java b/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java index 3739e82..4c88d22 100644 --- a/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java +++ b/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java @@ -18,12 +18,16 @@ */ package org.apache.sling.distribution.journal; +import org.osgi.annotation.versioning.ProviderType; + import java.io.IOException; import java.io.InputStream; +import java.util.Map; /** * Abstraction for storing binaries */ +@ProviderType public interface BinaryStore { /** @@ -36,7 +40,8 @@ public interface BinaryStore { InputStream get(String reference) throws IOException; /** - * Return the reference for the + * Return the reference for the binary in the binary store + * * @param id binary identifier * @param stream stream to store * @param length length of the stream @@ -44,4 +49,26 @@ public interface BinaryStore { * @throws IOException */ String put(String id, InputStream stream, long length) throws IOException; + + /** + * Verifies that the given reference belongs to this BinaryStore. + * + * @param reference + * @return + */ + boolean verify(String reference); + + /** + * Return the reference for the binary in the binary store. + * + * @param id binary identifier + * @param stream stream to store + * @param length length of the stream + * @param contentType the content type of the stream + * @param metadata a map of metadata to assign to the blog + * @return + * @throws IOException + */ + String put(String id, InputStream stream, long length, String contentType, Map<String, String> metadata) throws IOException; + } diff --git a/src/main/java/org/apache/sling/distribution/journal/package-info.java b/src/main/java/org/apache/sling/distribution/journal/package-info.java index 6d73476..f4876d9 100644 --- a/src/main/java/org/apache/sling/distribution/journal/package-info.java +++ b/src/main/java/org/apache/sling/distribution/journal/package-info.java @@ -16,6 +16,6 @@ * specific language governing permissions and limitations * under the License. */ [email protected]("1.6.0") [email protected]("1.7.0") package org.apache.sling.distribution.journal;
