Did you add the requirement to your configuration bundle?

Require-Capability: osgi.extender; \
     filter:="(&(osgi.extender=osgi.configurator) \
             (version>=1.0
<https://osgi.org/specification/osgi.cmpn/7.0.0/service.configurator.html#org.osgi.service.configurator>)(!(version>=2.0)))"

That or on some bit of code in the configuration bundle add the annotation:

@org.osgi.service.configurator.annotations.RequireConfigurator

- Ray


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

> Hallo David,
>
> thanks for the explanation.
> So, the configurator is just a "wrapper" for the ConfigAdminService to
> read json and transfer it into a key value format, right?
>
> I still have problems to use the
> I put a test.json file in the OSGI-INF/configurator folder of a bundle
> with the following content:
> {
>   // Resource Format Version
>   ":configurator:resource-version" : 1,
>
>   // First Configuration
>   "my.config":
>   {
>     "test.securityEnabled": false,
>     "test.test": false
>   }
> }
>
> In addition, I have an annotation for holding the values:
> public @interface MyConfig
> {
>     boolean test_securityEnabled () default true;
>     boolean test_test() default true;
> }
>
> Besides that, I've a custom GoGo command for configuration. But I am not
> sure, if this is really needed for loading the json?
>
> Unfortunately, the json is obviously not loaded.
> Both values are set to true, according to the default value.
>
> Do I have to do something in addition to load the json file?
>
> Thanks,
> Philipp
>
> -----Ursprüngliche Nachricht-----
> Von: David Bosschaert <david.bosscha...@gmail.com>
> Gesendet: Donnerstag, 12. Juli 2018 11:15
> An: users@felix.apache.org
> Betreff: Re: Configurator R7 example
>
> 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.ht
> > ml
> >
> > 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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
>



-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Reply via email to