Hi Philipp,

In the end the configuration specified with the Configurator will end up in
OSGi Configuration Admin, so the Configurator is limited to the same types
as ConfigAdmin. The Configurator allows complex JSON values to be
specified, they will end up as JSON text in Configuration Admin if they go
beyond what ConfigAdmin supports natively.

So to use the Configurator you need the Configurator bundle plus the
ConfigAdmin bundle.

The Configurator handles configuration resources in OSGI-INF/configurator
inside bundles but can also be provided with external configuration via
the configurator.initial framework/system property. This is described in
sections 150.4 and 150.5 in [1]. To provide Configurator configuration into
the system you don't need to write any classes, but depending on how you
use the configuration you may have to add classes that consume it. But
again, the consumption can be done by anything that understands ConfigAdmin
configs, so there are a lot of options for this.

I'm not aware of a complete tutorial on this topic yet. I agree it would be
nice to have that.

Hope this helps,

David

[1] https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html

On Thu, 12 Jul 2018 at 10:55, Philipp Höfler <philipp.hoef...@pernexas.com>
wrote:

> Hi,
>
> I am searching for a possibility to load complex configurations.
> I tried the ConfigurationAdminService, but key value pairs are not
> sufficient as I need complex types.
>
> Raymond pointed out that I should have a look at the Configurator
> Specification.
> https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html
>
> I read the specification and it sounds promising.
> But I am stuck how to use the Configuration in my project.
> I understand that I've to add the following dependency.
> org.apache.felix.configurator
>
> But I don't understand if I've to add some classes, where the json file
> has to be placed and if it's possible to place it outside of the bundle?
>
> Is there any tutorial or sample project out there?
>
> Thanks,
> Philipp
>

Reply via email to