You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cs...@apache.org on 2020/07/23 10:05:52 UTC
[sling-org-apache-sling-distribution-journal-messages] branch
master updated: SLING-9593: Abstract out binary handling to allow plugging
of different stores (#4)
This is an automated email from the ASF dual-hosted git repository.
cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-distribution-journal-messages.git
The following commit(s) were added to refs/heads/master by this push:
new 7c132b0 SLING-9593: Abstract out binary handling to allow plugging of different stores (#4)
7c132b0 is described below
commit 7c132b0645d34fcbcd9c4f9911dfe1a0ae80470e
Author: Amit Jain <am...@apache.org>
AuthorDate: Thu Jul 23 15:35:43 2020 +0530
SLING-9593: Abstract out binary handling to allow plugging of different stores (#4)
* SLING-9593: Abstract out binary handling to allow plugging of different stores
- Introduced an interface BinaryStore and JcrBinaryStore as the default implementation storing the binaries in JCR with no change in the existing strategy of storing based on size.
* SLING-9593: Abstract out binary handling to allow plugging of different stores
- Simplifying the interface as dependent implementations can also be simplified
---
.../sling/distribution/journal/BinaryStore.java | 47 ++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java b/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java
new file mode 100644
index 0000000..3739e82
--- /dev/null
+++ b/src/main/java/org/apache/sling/distribution/journal/BinaryStore.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.distribution.journal;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * Abstraction for storing binaries
+ */
+public interface BinaryStore {
+
+ /**
+ * Return an input stream for the identifier
+ *
+ * @param reference binary reference
+ * @return
+ * @throws IOException
+ */
+ InputStream get(String reference) throws IOException;
+
+ /**
+ * Return the reference for the
+ * @param id binary identifier
+ * @param stream stream to store
+ * @param length length of the stream
+ * @return
+ * @throws IOException
+ */
+ String put(String id, InputStream stream, long length) throws IOException;
+}