Hi,

If you want to add to a specific configuration, you have to use a
ManagedService (or ManagedServiceFactory if it's a configuration factory).

If you use scr with @Managed, it's a managed service listening change on
the org.apache.karaf.scheduler.quartz configuration (so
etc/org.apache.karaf.scheduler.quartz.cfg corresponding file). When you
want the configuration, the update() method is called.

If you want to listen for any config change, you can implement a
ConfigurationListener.

I will add a example showing this if you want.

Regards
JB

On 13/09/2018 11:06, Miroslav Beranič wrote:
> Hi all,
> 
> I would like to hook into configuration change made in etc/* file. I put
> configuration file there and when I change it, I see in Karaf's log the
> change was picked up and also file was rewritten.
> 
> But, how is this hooked in from the Java class ?
> 
> 
> I manual I've only found:
> Dynamic Configuration: Apache Karaf provides a set of commands focused
> on managing its own configuration. All configuration files are
> centralized in the etc folder. Any change in a configuration file is
> noticed and reloaded.
> 
> Back at the scheduler I've seen this:
> @Managed("org.apache.karaf.scheduler.quartz")
> and implements org.osgi.service.cm.ManagedService
> 
> That has method void updated(Dictionary<String, ?> var1) throws
> ConfigurationException;
> 
> this is great, but this method is not called.
> 
> Is there any example/code I can look at at take as an starting point?
> 
> 
> Kind Regards,
> Miroslav
> 
> 
> -- 
> Miroslav Beranič
> MIBESIS
> +386(0)40/814-843
> [email protected] <mailto:[email protected]>
> http://www.mibesis.si

-- 
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to