I have a Felix setup like this:
ID|State |Level|Name
0|Active | 0|System Bundle (5.0.1)
1|Active | 1|Apache Felix Bundle Repository (2.0.4)
2|Active | 1|Apache Felix Configuration Admin Service (1.8.8)
3|Resolved | 1|Apache Felix File Install (3.5.0)
4|Active | 1|Apache Felix Gogo Command (0.14.0)
5|Active | 1|Apache Felix Gogo Runtime (0.16.2)
6|Active | 1|Apache Felix Gogo Shell (0.10.0)
7|Active | 1|g.db OSGi Bundle (1.0.0)
The g.db
bundle does basically this:
public class Activator implements BundleActivator, ManagedService {
ServiceRegistration sr;
public void updated(Dictionary dict) throws ConfigurationException {
System.err.println("\nupdated " + this);
}
public void start(BundleContext context) throws Exception {
System.err.println("\nstart " + this);
Dictionary props = new Hashtable();
props.put(Constants.SERVICE_PID, "db");
sr = context.registerService(ManagedService.class.getName(), this, props);
}
}
And I'm awaiting that updated()
get called if I modify db.cfg
in ./load
. But it won't.
g! inspect cap service 7
g.db [7] provides:
------------------------------------
service; org.osgi.service.cm.ManagedService with properties:
service.bundleid = 7
service.id = 28
service.pid = db
service.scope = singleton
File Install is watching the right file. I get the log message when modifying db.cfg
:
Updating configuration from db.cfg
I raised the log level of the Configuration Admin Service and get this:
*DEBUG* Scheduling task Update: pid=db
*DEBUG* Running task Update: pid=db
*DEBUG* UpdateConfiguration(db) scheduled
*DEBUG* Updating configuration db to revision #3
*DEBUG* No ManagedService[Factory] registered for updates to configuration db
Seems something is wrong with my service registration (?)
Finally it was an error in the POM of the NB project: I was using the org.osgi.compendium
artifact in compile
scope. Changing to provided
scope and it works.