net.i2p.update
Interface UpdateManager

All Known Implementing Classes:
ConsoleUpdateManager

public interface UpdateManager

The central resource coordinating updates. This must be registered with the context. The UpdateManager starts and stops all updates, and controls notification to the user.

Since:
0.9.4

Method Summary
 void notifyAttemptFailed(UpdateTask task, String reason, Throwable t)
          Not necessarily the end if there are more URIs to try.
 void notifyCheckComplete(UpdateTask task, boolean newer, boolean success)
          Called by the Updater after check() was called and all notifyVersionAvailable() callbacks are finished
 boolean notifyComplete(UpdateTask task, String actualVersion, File file)
          An update has been downloaded but not verified.
 void notifyProgress(UpdateTask task, String status)
           
 void notifyProgress(UpdateTask task, String status, long downloaded, long totalSize)
           
 void notifyTaskFailed(UpdateTask task, String reason, Throwable t)
          The task has finished and failed.
 boolean notifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, UpdateMethod method, List<URI> updateSources, String newVersion, String minVersion)
          Called by the Updater, either after check() was called, or it found out on its own.
 void register(Checker checker, UpdateType type, UpdateMethod method, int priority)
           
 void register(Updater updater, UpdateType type, UpdateMethod method, int priority)
          Call once for each type/method pair.
 void renderStatusHTML(Writer out)
          For debugging
 void shutdown()
           
 void start()
           
 void unregister(Checker checker, UpdateType type, UpdateMethod method)
           
 void unregister(Updater updater, UpdateType type, UpdateMethod method)
           
 

Method Detail

register

void register(Updater updater,
              UpdateType type,
              UpdateMethod method,
              int priority)
Call once for each type/method pair.


register

void register(Checker checker,
              UpdateType type,
              UpdateMethod method,
              int priority)

unregister

void unregister(Updater updater,
                UpdateType type,
                UpdateMethod method)

unregister

void unregister(Checker checker,
                UpdateType type,
                UpdateMethod method)

start

void start()

shutdown

void shutdown()

notifyVersionAvailable

boolean notifyVersionAvailable(UpdateTask task,
                               URI newsSource,
                               UpdateType type,
                               String id,
                               UpdateMethod method,
                               List<URI> updateSources,
                               String newVersion,
                               String minVersion)
Called by the Updater, either after check() was called, or it found out on its own.

Parameters:
newsSource - who told us
id - plugin name for plugins, ignored otherwise
method - How to get the new version
updateSources - Where to get the new version
newVersion - The new version available
minVersion - The minimum installed version to be able to update to newVersion
Returns:
true if we didn't know already

notifyCheckComplete

void notifyCheckComplete(UpdateTask task,
                         boolean newer,
                         boolean success)
Called by the Updater after check() was called and all notifyVersionAvailable() callbacks are finished

Parameters:
newer - notifyVersionAvailable was called
success - check succeeded (newer or not)

notifyProgress

void notifyProgress(UpdateTask task,
                    String status)

notifyProgress

void notifyProgress(UpdateTask task,
                    String status,
                    long downloaded,
                    long totalSize)

notifyAttemptFailed

void notifyAttemptFailed(UpdateTask task,
                         String reason,
                         Throwable t)
Not necessarily the end if there are more URIs to try.

Parameters:
t - may be null

notifyTaskFailed

void notifyTaskFailed(UpdateTask task,
                      String reason,
                      Throwable t)
The task has finished and failed.

Parameters:
t - may be null

notifyComplete

boolean notifyComplete(UpdateTask task,
                       String actualVersion,
                       File file)
An update has been downloaded but not verified. The manager will verify it. Caller should delete the file upon return, unless it will share it with others, e.g. on a torrent.

Parameters:
actualVersion - may be higher (or lower?) than the version requested
file - a valid format for the task's UpdateType
Returns:
true if valid, false if corrupt

renderStatusHTML

void renderStatusHTML(Writer out)
                      throws IOException
For debugging

Throws:
IOException