Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using OSGi to implement auto-update

What I'd like to do is create a "launcher" framework for my code that, given a URL and a predefined versioning scheme: 1) go check if an update exists 2) download the updates 3) "install" the update 4) "re-run" the application

I want to a) do all of this inside of the existing JVM and b) be platform independent. Tall order right? Based on my (limited) knowledge of OSGi and Apache Felix I'm pretty sure this is possible, but I'm really getting lost in the details.

Checking for an update and downloading it is trivial. Causing the "old" bundle to unload and the "new" bundle to load is where I'm getting stuck. I've done OSGi work in the past but it was a lot less dynamic than this. A good starting place or a hard shove in the right direction would be most appreciated.

If I'm seriously over-baking something that's already been solved with a free library then tell me this too, but I haven't found anything so far. :-)

like image 330
user453385 Avatar asked Aug 17 '11 17:08

user453385


2 Answers

you can check well-known provisioning solutions that can do all your steps instead of you (check for a new version, download, install/update, restart etc.)

  1. For Equinox framework: p2 http://www.eclipse.org/equinox/p2/
  2. For any OSGi R4 framework: Apache ACE http://incubator.apache.org/ace/a-brief-introduction.html

best regards, Dmytro

like image 33
Dmytro Pishchukhin Avatar answered Oct 25 '22 00:10

Dmytro Pishchukhin


You don't even need to download it, just check if an update is available and then call Bundle.update(InputStream) on the bundle that needs to be updated, generally followed by a call to PackageAdmin.refreshPackages() afterward.

like image 111
Richard S. Hall Avatar answered Oct 25 '22 00:10

Richard S. Hall