[ 
https://issues.apache.org/jira/browse/OAK-6917?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Sedding updated OAK-6917:
--------------------------------
    Attachment: OAK-6917-alternative-approach.patch

[~mreutegg] I attached a patch with a sketch for an alternative approach, YMMV. 
It is limited to the OSGi aspect, but lacks merging the "preset" (or default) 
configuration with the config for {{DocumentNodeStoreService}}. Check it out, 
maybe you find it useful.

Basically, I register an additional service, that references the same 
{{Configuration}} annotation. That way, it gets all the defaults set in the 
annotation, but these can be overridden by config admin (config policy is 
optional though). I created the (mostly empty) inner class {{Defaults}} to 
achieve this. The {{DocumentNodeStoreService}} then references the 
{{DNSS.Defaults}} service, but instead of having the service instance injected, 
we ask to get the {{Configuration}} annotation injected (not 100% sure this 
works, if not, try with {{Map<String, Object>}}, which I have done before).

I didn't test the patch, but quickly looked at the generated XML files, and 
they look as intended (at first glance at least). Note that I deliberately 
didn't get metatype information generated for the {{DNSS.Defaults}} service, as 
I understood that it should be a "private" config that should only be set by 
product vendors/distributors.



> Configuration presets for DocumentNodeStoreService
> --------------------------------------------------
>
>                 Key: OAK-6917
>                 URL: https://issues.apache.org/jira/browse/OAK-6917
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: documentmk
>            Reporter: Marcel Reutegger
>            Assignee: Marcel Reutegger
>            Priority: Minor
>             Fix For: 1.8
>
>         Attachments: OAK-6917-alternative-approach.patch, OAK-6917.patch
>
>
> When Oak is deployed in an OSGi container, applications usually want to ship 
> a default configuration which is different from the defaults present in Oak. 
> E.g. an application may want to use a default cache size of 1G for the 
> DocumentNodeStoreService instead of the default 256M. Now if a user of the 
> application provides a custom configuration and does not specify the cache 
> size, the value for this configuration will flip back to the Oak default of 
> 256M.
> There should be a way to configure presets for the application that are 
> different from the Oak defaults and then allow a user to customize the 
> configuration while still respecting the presets.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to