Wednesday, May 03, 2006

Automatic Updates Using StableUpdate

StableUpdate is an open source java project that can be included in applications to add automatic update functionality (allowing the user to check for new versions of the program). It also includes an update generator, which works by comparing an two installations of the software and generates a jar containing the differences.

The documentation isn't all that easy to follow, and I had to change one method (Update.setUpdateFrom(url[] URLS) ) from private to public to get it to work. It also needs to work with a specific directory structure (one main application jar, which needs to be in the bin/ subdirectory along with autoupdate. jar). Once it worked though, it seemed to work really well.

5 Comments:

Anonymous Anonymous said...

Turned out to be a useful reference for me while googling, thanks :)

By the way, it's also actually relatively easy to get it to drop the dependency on having to be in the 'bin' directories. Not sure why he hardcoded that anyway.

11:56 AM  
Blogger melissa said...

Someone found something useful on my blog! yay :)

I'm an admin on this project now (as a result of emailing the guy who wrote it and telling him I had some changes). Haven't had a chance to work on it much lately, but if you post your changes to the code I'll update it on the project cvs.

4:47 PM  
Anonymous Daniel Stonier said...

lol, Ive done my good deed for the week and made someone happy. Great!

As for the code, just found myself reading your comment after making a swathe of changes. Don't know where to start, probably better to finish it off a bit before chatting to you about it, but will be happy to do so. So far:

1) Removed the bin dependency. An app just needs to send one call to the update library to pop up the update manager. The update library just has to be in the app's classpath. Example of the call is something like:

AutoUpdate.update(update_urls, update_target);

That also means xml configs and pointer to the update spot on the local system are defined outside the library as well.

2) In the middle of separating the updater and generator code. Dont really need to be in the same bundle and you dont want to be increasing an application's size by bundling the generator libraries with it.

Todo

1) In my app, I currently get the update manager to pop up through a menu option. So updates this way are manual. Would like to be able to set it up so I can have the option of getting the update manager to work invisibly and quietly in the background, automatically applying necessary updates on startup. I usually hate invisible processes that slyly dont tell you what they're doing, but the nice fallback with this thing, is that you could have a toggle for this in your app, so if the update screws it up, just turn it back to manual updates and backtrack the install process.

2) Haven't thought about this much yet, but would like to extend the update manager to provide an interface to collect and download extra resources for your application. Like mods or font sets etc etc. Not sure how to do this yet though.

Anyway, rambled enough! Wonder if this will fit into a blog comment!

8:23 PM  
Blogger melissa said...

Sounds great! If you'd like to work on StableUpdate, let me know your sourceforge username and i'll add you as an admin.

The app we're using it in is a pharmacy tool for antiretroviral drug dispensing in remote clinics (i'm South African, by the way). This means our users are mostly quite technically inexperienced pharmacists - so they'd be quite happy to have the update checker running in the background. So if you do implement that we'd definitely use it! Another thing I've been meaning to do is develop an alternative, simplified GUI - all the scrolling text and all the options might confuse our users.

It's be great if you could commit your changes - I'm also keen to write some more documentation, I think the project really fills a niche and could be useful to quite a wide range of projects.

9:17 PM  
Anonymous daniel said...

You're right, I was surprised there wasn't any fully developed code for an update manager (like what azureus and eclipse do) somewhere. I had initially thought this was due to the advance of Webstart. I didn't like the idea of webstart initially, though I think I'm coming around to it now. Still not sure that it would always be the right tool for the job though and that'd be where a generic update manager comes in.

Anyway, can send you what I've done with it to date and would like to discuss some ideas regarding how it works - drop me an email on d.stonier@snorriheim.com sometime.

Hooroo!
Daniel.

9:31 AM  

Post a Comment

<< Home