[
https://issues.apache.org/jira/browse/OAK-2919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15335960#comment-15335960
]
Robert Munteanu commented on OAK-2919:
--------------------------------------
I've taken a quick look at the DocumentMK.Builder and what is needed to make it
more extensible. Along the lines of what [~mreutegg] mentioned, I believe the
best way is to create a generic builder and move the specific checks to
subclasses.
A strawman API would be
{code:java}
public enum DocumentNodeStoreType {
MEMORY, MONGO, RDB;
}
public abstract class DocumentNodeStoreBuilder {
public static DocumentNodeStoreBuilder getFor(DocumentNodeStoreType type) {
... };
// contains common methods and hooks
public DocumentNodeStore getNodeStore() { ... };
}
public class MemoryNodeStoreBuilder extends DocumentNodeStoreBuilder {
// specific concerns for the memory-based persistence
}
{code}
A couple of design notes:
* DocumentMK and DocumentMK.Builder will be deleted. Most of DocumentMK.Builder
will be moved to the DocumentNodeStoreBuilder and its subclasses, but right now
I think it's a good time to make the API clearer
** This will cause a large number of changes in the oak project, but at least
the {{org.apache.jackrabbit.oak.plugins.document}} package is not exported so
this is mostly an internal change
* This is still going to be a 'closed' builder, in the sense that the builder
needs to know beforehand of all the types of persistence to instantiate them.
But I think this is fine, it's not by far the only remaining roadblock to
creating a new DocumentStore-based persistence option outside of {{oak-core}}.
* To keep the changes to the DocumentNodeStore minimal, it will still allow all
the built objects to be accessed through getters ( DocumentStore, BlobStore,
etc )
Opinions?
> Refactor DocumentNodeStoreService and dependencies
> --------------------------------------------------
>
> Key: OAK-2919
> URL: https://issues.apache.org/jira/browse/OAK-2919
> Project: Jackrabbit Oak
> Issue Type: Improvement
> Components: blob, mongomk
> Reporter: Philipp Suter
> Labels: technical_debt
>
> Change how DocumentNodeStoreService, DocumentNodeStore, DocumentStore,
> BlobStore, DocumentMK.Builder are wired. It is unclear why
> registerNodeStoreIfPossible and registerNodeStore need additional logic to
> load the right BlobStore and DocumentStore.
> - Ideally (Document)NodeStore references one DocumentStore and one BlobStore.
> Configuration for them are loaded over respective OSGi configurations.
> - Cache should be handled in (Document)NodeStore and be independent from
> DocumentStore, BlobStore.
> - DocumentMK.Builder and DocumentNodeStoreService should be obsolete.
> - DocumentNodeStore is too long and could ideally be split in smaller files.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)