Details
-
Feature Request
-
Resolution: Done
-
Critical
-
3.3.0.Final
-
None
Description
We would like to store Binary properties in BinaryStores with different configurations based on e.g. property values on the node containing the binary value or ancestor nodes of that node. For example, a binary created by user X should be stored in a FileSystemBinaryStore, but a binary created by user Y should be stored in a replicated InfinispanBinaryStore.
An approach was suggested in the linked forum reference that we believe will satisfy our use case. In the (to be) attached pull request, we're offering a "StrategyBinaryStore" that:
- allows an implementor to define a set of binary stores
- extends the org.modeshape.jcr.JcrValueFactory (and components down to the BinaryStore) to support a "hinted" storeValue method that may store the InputStream in one of the defined binary stores (we've left the contract wide open for now, and are naively passing through a key to the child BinaryStore.)
- on retrieval, looks through all of the BinaryStores for the requested BinaryKey and returns it.
We envision writing content to the BinaryStore at our application level doing something like:
Binary b = (Binary)valueFactory.createBinary(inputStream, generateStorageHint(contentNode))
Property dataProperty = contentNode.setProperty(JCR_DATA, (Binary)b);
The current pull request is fairly naïve, and we anticipate making iterative improvements on it after we get validation of the approach from this community and attempting to work with this store in our own environment. Some tasks we've identified include:
- improving retrieval efficiency (parallelism, via an index, via a specially constructed BinaryKey or otherwise), or making retrieval order explicit.
- adding test coverage of new high level APIs
- revisiting some initial arbitrary decisions (e.g. storing data in only one store)