Hi JB,

Thanks for the insights.

I think what is not yet clear to me is how the ConfigRepository and the Felix 
ConfigurationAdmin interoperate.
If I am not mistaken, Karaf uses the Felix ConfigurationAdmin implementation. 
From the docs of Felix CM, I see that it persists the configurations (i.e. does 
NOT only hold it in memory) and its location can be configured by the 
felix.cm.dir property. Is this whole mechanism disabled in Karaf and the 
ConfigRepository actually intercepts those calls?

> I propose to introduce a user property to let you define the storage location 
> or disable it. 


I think this would solve my issue - it would enable users to use different 
folders for reading configs through fileinstall and managing the overall 
ConfigAdmin settings in a different place.

Probably it would suffice to not hardcode System.getProperty("karaf.etc“) in 
ConfigRepository, but come up with a new property here, right?

Cheers,
Kai

> On 5 Nov 2016, at 10:30, jbonofre [via Karaf] 
> <[email protected]> wrote:
> 
> Hi, 
> 
> let me explain a bit. 
> 
> When you create a config using ConfigAdmin (using the ConfigAdmin 
> service), it doesn't create a file (it's in "memory"). In that 
> situation, if any change is not persisted to a cfg file. 
> On the other hand, if you create a cfg file in Karaf etc folder, then 
> the corresponding ConfigAdmin configuration is created and implicitely 
> add a felix.fileinstall.filename property. Then, any change to the 
> configuration is flush back to the cfg file. 
> 
> So, in Karaf, you have a feature that automatically create the 
> corresponding cfg file when you create a configuration. And after that, 
> we are on the "normal" behavior. 
> 
> The Karaf documentation is correct: when you have the 
> felix.fileinstall.filename property in a ConfigAdmin configuration, if 
> the enableConfigSave is true, it's flush back to cfg file, false doesn't. 
> 
> The difference is when the configuration is create and without the 
> fileinstall.file property. 
> In the case, you may want to disable the "auto-create" cfg file done by 
> Karaf (ConfigRepository). 
> The ConfigRepository is create (in the config feature) like this: 
> 
> ConfigRepository configRepository = new 
> ConfigRepositoryImpl(configurationAdmin, new 
> File(System.getProperty("karaf.etc"))); 
> 
> The File is the storage, if null, Karaf doesn't do any storage. 
> 
> I propose to introduce a user property to let you define the storage 
> location or disable it. 
> 
> Regards 
> JB 
> 
> 
> On 11/04/2016 08:29 PM, Kai Kreuzer wrote:
> 
> > Hi, 
> > 
> > I just came across the same issue. I would like to treat the etc folder as 
> > read-only and thus prevent Karaf from doing changes to it. Nonetheless, I 
> > want to keep fileinstall to read configs from etc and push them to 
> > ConfigAdmin. 
> > 
> > I would have expected this to work by merely setting 
> > "felix.fileinstall.enableConfigSave = false" - this is what the  Karaf (not 
> > fileinstall!) documentation <https://karaf.apache.org/manual/latest/#_files 
> > <https://karaf.apache.org/manual/latest/#_files>> 
> > suggests. 
> > 
> > So what can I do to achieve my goal? What does it mean to "use a null 
> > Storage"? What consequences does that have? 
> > 
> > I hope you can help! 
> > 
> > Thanks, 
> > Kai 
> > 
> > 
> > 
> > -- 
> > View this message in context: 
> > http://karaf.922171.n3.nabble.com/felix-fileinstall-enableConfigSave-false-ignored-tp4047867p4048570.html
> >  
> > <http://karaf.922171.n3.nabble.com/felix-fileinstall-enableConfigSave-false-ignored-tp4047867p4048570.html>
> > Sent from the Karaf - User mailing list archive at Nabble.com. 
> >
> 
> -- 
> Jean-Baptiste Onofré 
> [hidden email] <x-msg://58/user/SendEmail.jtp?type=node&node=4048573&i=0> 
> http://blog.nanthrax.net <http://blog.nanthrax.net/>
> Talend - http://www.talend.com <http://www.talend.com/>
> 
> 
> If you reply to this email, your message will be added to the discussion 
> below:
> http://karaf.922171.n3.nabble.com/felix-fileinstall-enableConfigSave-false-ignored-tp4047867p4048573.html
>  
> <http://karaf.922171.n3.nabble.com/felix-fileinstall-enableConfigSave-false-ignored-tp4047867p4048573.html>
> To unsubscribe from felix.fileinstall.enableConfigSave = false ignored?, 
> click here 
> <http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4047867&code=a2FpQG9wZW5oYWIub3JnfDQwNDc4Njd8MTExNjQ1MjI3Ng==>.
> NAML 
> <http://karaf.922171.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://karaf.922171.n3.nabble.com/felix-fileinstall-enableConfigSave-false-ignored-tp4047867p4048574.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to