net.i2p.router.update

## Class UpdateHandler

- java.lang.Object
- - net.i2p.router.update.UpdateHandler

- All Implemented Interfaces:
    Updater
  Direct Known Subclasses:
    NewsHandler

      class UpdateHandler
      extends Object
      implements Updater

  Handles the request to update the router by firing one or more `EepGet` calls to download the latest signed update file and displaying the status to anyone who asks.

  After the download completes the signed update file is verified with `TrustedUpdate`, and if it's authentic the payload of the signed update file is unpacked and the router is restarted to complete the update process.

  This does not do any checking, that is handled by the NewsFetcher.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `protected ConsoleUpdateManager` | `_mgr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UpdateTask` | `update(UpdateType type, UpdateMethod method, List<URI> updateSources, String id, String newVersion, long maxTime)` Start a download and return a handle to the download task.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _context

          protected final RouterContext _context

    - #### _mgr

          protected final ConsoleUpdateManager _mgr

  - ### Constructor Detail

    - #### UpdateHandler

          public UpdateHandler(RouterContext ctx,
                               ConsoleUpdateManager mgr)

  - ### Method Detail

    - #### update

          public UpdateTask update(UpdateType type,
                                   UpdateMethod method,
                                   List<URI> updateSources,
                                   String id,
                                   String newVersion,
                                   long maxTime)

      Start a download and return a handle to the download task. Should not block.
      Specified by:
        `update` in interface `Updater`
      Parameters:
        `id` - plugin name or ignored
        `maxTime` - how long you have
        `type` - update type
        `method` - update method
        `updateSources` - Where to get the new version from
        `newVersion` - new version to download
      Returns:
        active task or null if unable to download