Hi Christian,

Am 17.09.2012 um 11:47 schrieb Christian Schneider:

> Hi all,
> 
> felix config admin behaves differently if the config originated from a 
> file or was directly created in config admin. For most cases this is good.

I think there is a misconception here: Configuration can always only be created 
through the Configuration Admin service API. Internally, the implementation 
persist in an implementation dependent (and thus not usable outside of the 
implementation) location.

What you are seeing is probably something else, maybe the use of FileInstall 
which supports injecting .cfg files as configurations into the Configuration 
Admin Service.

Therefore:

> 
> Sometimes I would like the behaviour to create a config by hand (shell 
> or mbean) or programatically but make sure it is also created in etc in 
> Karaf. So I would like to have a way to tell felix config admin to 
> persist the config to etc.
> 
> I see two possible solutions:
> 
> 1. Have a special config property like 
> felix.configadmin.persistToFile=true. When this property is set to true 
> the config admin service would create a file pid.cfg in a configurable 
> default config directory.

No, the Configuration Admin Service only persists internally. I will not add 
such functionality. There are so many ways and ideas on how this could be done 
and one solution might always be wrong for someone else. Therefore I prefer to 
not start implementing such stuff.

Apart from that: This would tie you into the Felix Configuration Admin impl. 
and cause your application to probably fail with the Equinox/Eclipse 
implementation.


> 2. Have a special API in form of an OSGi service that allows to 
> initially persist a config like configAdminExt.persist(String pid)

Equally not (see above).

But you can do this yourselves rather easily: You may implement a 
ConfigurationListener which is notified on configuration creation, update, 
deletion (and location change) and which you can then use to persist the 
configuration in other places.

This is what we for example do in the Apache Sling JCR Installer: A 
Configuration Listener writes back the configuration to files (actually JCR 
nodes) upon modification.

Regards
Felix


> 
> We are also discussing this feature on the karaf list but I think it 
> would be more suitable to solve this in felix config admin service. What 
> do you think?
> 
> Christian
> 
> -- 
> Christian Schneider
> http://www.liquid-reality.de
> 
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
> 

Reply via email to