0

I am trying to use configuration file to persist OSGi configuration in Karaf 3.0.0 and having some issue when using property with array of values. My configuration file is placed in /etc folder and looks something like this:

property = ["value1","value2"]

The problem is that array does not get interpreted properly, so in Web Console I see one string value instead of array of values. I figure out that if I use .config as extension for the configuration file, the array gets interpreted properly, but I experience another issue then, like for example that my config file gets overwritten. Is there any way to use .cfg extension and somehow indicate that the property is array?

  • That is quite interesting. I was not aware that .config files are interpreted in karaf and that it supports arrays then. I think it would be a good improvement to also support arrays in cfg files. Can you create an issue for it? – Christian Schneider Feb 15 '16 at 22:40
  • Hi Christian, thanks for prompt reply. Here is the link I found that explains how to use .config for configuration files http://dywicki.pl/2015/02/apache-felix-configuration-admin-with-array-values/. I have not created karaf related issues before, can you provide some guidance? – Boban Petkovic Feb 16 '16 at 14:13
  • You need to create the issue here https://issues.apache.org/jira/browse/KARAF . You will have to register in jira first though. – Christian Schneider Feb 17 '16 at 15:52
  • Thanks a lot. I've created an improvement ticket – Boban Petkovic Feb 17 '16 at 21:59

1 Answers1

0

You might want to take a look at the OSGi Configurer RFP and the OSGi Configurer RFC. OSGi enRoute, which inspired this upcoming spec, has a bundle and some documentation for it.

The Configurer maps JSON to (the spec will be likely YAML) to configuration admin. That said, we generally then use interfaces that define the properties so we can convert the actual configuration type to the type that the code needs automatically. This model is used in DS for configuration and (annotation interfaces in that case). OSGi enRoute has special support for this model with the DTOs service. (Which is also being specified.)

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55