I would more recommend a ManagedService or inject the ConfigAdmin service.

Regards
JB

On 12/03/2017 09:41 AM, Steinar Bang wrote:
What's the recommended way for an OSGi bundle running inside karaf to
access its configuration?

Get an OSGi service of type ConfigMBean[1]?
Get an OSGi servie of type ConfigRepository[2]?

Or maybe avoid karaf dependencies, and get an OSGi service of type
ConfigurationAdmin[3]...?

Does anyone know of code examples of any of the three approaches?
Preferrably DS w/annotation based code examples?


Thanks!


- Steinar

References:
[1] 
<https://github.com/apache/karaf/blob/master/config/src/main/java/org/apache/karaf/config/core/ConfigMBean.java>
[2] 
<https://github.com/apache/karaf/blob/master/config/src/main/java/org/apache/karaf/config/core/ConfigRepository.java>
[3] <https://osgi.org/javadoc/r4v42/org/osgi/service/cm/ConfigurationAdmin.html>


--
Jean-Baptiste Onofré
jbono...@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to