updater
Class Updater

java.lang.Object
  extended by updater.Updater

public class Updater
extends Object

Implements a self-updater. The updater checks if a new version of a program is available, asks the user if the new version should be installed, and performs the download and installation.


Constructor Summary
Updater()
           
 
Method Summary
 void update(IDownloader downloader, IDecider decider, File root)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Updater

public Updater()
Method Detail

update

public void update(IDownloader downloader,
                   IDecider decider,
                   File root)
Requires:
  • All arguments are non-null.
  • root is a directory that points to the directory containing the application. It has the following contents:
    • The launcher program: root/launcher.jar
    • A subdirectory root/app/.
    • The application: root/app/app.jar.
    • The version number file: root/app/latest-version-local.txt.
Effects:
Uses downloader to determine if a newer version of the application is available.

If no new version is available, calls decider.tell with the message no update available.

If a newer version is available, calls decider.ask with an appropriate message, and if the call returns true, performs the update. When performing an update:

  • Files are installed under appropriate directories under root.
  • Progress messages and any failures are reported to the user using decider.tell.