Re: Possible to get config on first component startup?

2020-09-21 Thread Francois Papon
Hi, May be you can try with: @Component(immediate = true, configurationPolicy = ConfigurationPolicy.REQUIRE) regards, François fpa...@apache.org Le 20/09/2020 à 19:00, Steinar Bang a écrit : > I've added config for an Declarative Services component in the > src/main/feature/feature.xml file: >

Re: Possible to get config on first component startup?

2020-09-21 Thread Łukasz Dywicki
Last resort is turning your configuration into ManagedConfigurationFactory and publishing services only when config admin receives an updated version of config. Best, Łukasz On 21.09.2020 09:22, Francois Papon wrote: > Hi, > > May be you can try with: > > @Component(immediate = true, configurat

How to uniquely configure multiple instances of a bundle, including an instance specific URL?

2020-09-21 Thread Paul Spencer
Karaf 4.2.9 I am migrating Tomcat based web applications to Karaf. As I have several instances of each application installed on one Tomcat Server, the application's web context defines the identity and URL of each instance. *** * conf/Catalina/localhost/productionLine1.xml ***

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> Jean-Baptiste Onofre : > To force config before the component, you need prerequisite=true. > Can you try: > > http://karaf.apache.org/xmlns/features/v1.4.0"; > name="oldalbum.roleadder.test"> > > name="no.priv.bang.oldalbum.roleadder.test.ShiroRoleAdderForOldalbumTestEnviron

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> Łukasz Dywicki : > Last resort is turning your configuration into > ManagedConfigurationFactory and publishing services only when config > admin receives an updated version of config. Hm... google can't find much on ManagedConfigurationFactory. Do you have a URL to some docs? Thanks!

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> Francois Papon : > Hi, > May be you can try with: > @Component(immediate = true, configurationPolicy = > ConfigurationPolicy.REQUIRE) With this annotation in place, the breakpoint in the @Activate method wasn't called on initial startup (all bundles still showed up as Active... is this exp

Re: Possible to get config on first component startup?

2020-09-21 Thread David Jencks
Bundle state and SCR component state are (mostly) independent. If I’ve understood your use case this is the solution you want (configurationPolicy = ConfigurationPolicy.REQUIRE results in requiring a configuration to be present for your component to activate). Generally immediate = true is not

Re: Possible to get config on first component startup?

2020-09-21 Thread Jean-Baptiste Onofre
Hi, For sure if the prerequisite feature contains the config, the config will be there before the features. So, by default, the features are installed async (its own provisioning thread), so, your SCR bundle can start while config is not populated yet. With required config, start method will be

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> Jean-Baptiste Onofre : > What Karaf version are you using ? If you tested 4.2.9, can you try > 4.2.8 (I did a fix in FileInstall affecting 4.2.9) ? I'm using 4.2.9 with openjdk 11 on debian 10.5 "buster" on amd64. I will try with 4.2.8.

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> David Jencks : > Bundle state and SCR component state are (mostly) independent. If > I’ve understood your use case this is the solution you want > (configurationPolicy = ConfigurationPolicy.REQUIRE results in > requiring a configuration to be present for your component to > activate). Yes,

Re: Possible to get config on first component startup?

2020-09-21 Thread Steinar Bang
> Steinar Bang : > Jean-Baptiste Onofre : >> What Karaf version are you using ? If you tested 4.2.9, can you try >> 4.2.8 (I did a fix in FileInstall affecting 4.2.9) ? > I'm using 4.2.9 with openjdk 11 on debian 10.5 "buster" on amd64. > I will try with 4.2.8. On 4.2.8 the config map c

Re: Possible to get config on first component startup?

2020-09-21 Thread Łukasz Dywicki
Yeah, my bad - I meant ManagedServiceFactory: https://docs.osgi.org/javadoc/r5/cmpn/org/osgi/service/cm/ManagedServiceFactory.html It works with "pid", however this pid becomes a factory one, meaning that your etc/ configuration files must have -something in the name. >From your example: etc/no.pr

Re: Possible to get config on first component startup?

2020-09-21 Thread Jean-Baptiste Onofre
Hi, It’s what I thought and it’s fixed on 4.2.10-SNAPSHOT. If you have the chance to test with 4.2.10-SNAPSHOT to double check, but I’m pretty sure it will work. I did the fix in FileInstall (regression introduced there and fixed). Regards JB > Le 21 sept. 2020 à 22:03, Steinar Bang a écrit