[
https://issues.apache.org/jira/browse/OAK-2828?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693051#comment-14693051
]
Alex Parvulescu commented on OAK-2828:
--------------------------------------
I applied the patch with a few tweaks in http://svn.apache.org/r1695434
* conflict hook needs to keep the old setup. it is a composite that will accept
any new component, so it doesn't make sense to be able to overwrite the main
instance
* there was a bigger issue I noticed with the lazy init: tests were failing 2
different parts: _RemoteServerIT.java_ in _oak-remote_ and _HttpServer_ in
_oak-run_ because of the expectation that you'd be able to only create a
_ContentRepository_ without its jcr counterpart, which was not possible with
the patch. I changed the code a bit to allow this too, hopefully everything is
covered now :)
thanks [~rombert] for the contribution!
> Jcr builder class does not allow overriding most of its dependencies
> --------------------------------------------------------------------
>
> Key: OAK-2828
> URL: https://issues.apache.org/jira/browse/OAK-2828
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: jcr
> Affects Versions: 1.2.2
> Reporter: Robert Munteanu
> Assignee: Francesco Mari
> Labels: modularization, technical_debt
> Fix For: 1.3.5
>
> Attachments:
> 0001-OAK-2828-Jcr-builder-class-does-not-allow-overriding.patch,
> OAK-2828.patch
>
>
> The {{Jcr}} class is the entry point for configuring a JCR repository using
> an Oak backend. However, it always use a hardcoded set of dependencies (
> IndexEditorProvider, SecurityProvider, etc ) which cannot be reset, as they
> are defined in the constructor and the builder {{with}} methods eagerly
> configure the backing {{Oak}} instance with those dependencies.
> As an example
> {code:java|title=Jcr.java}
> @Nonnull
> public final Jcr with(@Nonnull SecurityProvider securityProvider) {
> oak.with(checkNotNull(securityProvider));
> this.securityProvider = securityProvider;
> return this;
> }
> {code}
> injects the security provider which in turn starts configuring the Oak
> repository provider
> {code:java|title=Oak.java}
> @Nonnull
> public Oak with(@Nonnull SecurityProvider securityProvider) {
> this.securityProvider = checkNotNull(securityProvider);
> if (securityProvider instanceof WhiteboardAware) {
> ((WhiteboardAware) securityProvider).setWhiteboard(whiteboard);
> }
> for (SecurityConfiguration sc : securityProvider.getConfigurations())
> {
> RepositoryInitializer ri = sc.getRepositoryInitializer();
> if (ri != RepositoryInitializer.DEFAULT) {
> initializers.add(ri);
> }
> }
> return this;
> }
> {code}
> Instead, the {{Jcr}} class should store the configured dependencies and only
> configure the {{Oak}} instance when {{createRepository}} is invoked.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)