Hi Pat,
it's a ManagedService right (not a ManagedServiceFactory) ?
Can you see the config with config:list "(service.pid=MyConfig)" ?
Regards
JB
On 03/21/2015 12:01 PM, Pat Warren wrote:
Hi,
Problem: I have a notification listener that implements ManagedService and
provides implementation for the updated method. The updated method does not
get called when the corresponding *.cfg file is updated.
.......
package test;
import java.util.Dictionary;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
class CNListener implements ManagedService {
public void updated(Dictionary config) throws ConfigurationException {
System.out.println("updated called");
}
}
-----
In the Activator.java file, I register CNListener with the BundleContext as
follows:
------
Activator.java
package test;
public class Activator implements BundleActivator {
/*
* (non-Javadoc)
* @see
org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
Dictionary<String, Object> dict = new Hashtable<String,
Object>();
dict.put(Constants.SERVICE_PID, "MyConfig");
context.registerService(CNListener.class.getName(), new
CNListener(),
dict);
System.out.println("Done registering Service");
}
/*
* (non-Javadoc)
* @see
org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
// Unregister code
}
}
---------
context.registerService seems to work fine. I see no exceptions there. I
also checked by returned ServiceRegistration and am able to setProperties
using that reference. (That code is not shown above).
The issue is that when I update a property, say property1, in MyConfig.cfg
in the etc directory of Karaf, I don't see the updated method getting
called. I tried the update from Karaf Console (using config:edit ...,
config:set-property and then config:update) as well as editing the .cfg file
directly.
I am on Karaf 3.0.3. Not sure what I am missing. Thanks for any info.
--
View this message in context:
http://karaf.922171.n3.nabble.com/Karaf-3-0-3-ManagedService-updated-method-not-getting-called-tp4039197.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.
--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com