In OSGi (Apache Felix 4.2.1), I want my bundles to check for updates automatically on startup.
I do this with the following code (in my "management agent"). How can I tell whether a bundle was updated?
Bundle[] bundles = context.getBundles();
for (int i = 0; i < bundles.length; i++) {
Bundle bundle = bundles[i];
bundle.update();
}
// which bundle was updated?
I want to refresh the bundles automatically (using FrameworkWiring
), but only if one of the .update()
calls actually resulted in a new deployment from my server.
As I'm deploying from Maven to my OBR, my SNAPSHOT version have all the same number. From gogo, I can see that the Bnd-LastModified
header changes, but how to automate this?
PS: If easy solutions exist which solve the whole update thing more nicely than rolling my own, I'm interested as well. It needs to be lean. (Apache Karaf?, Apache ACE? others?)