net.i2p.router.update

## Class PluginUpdateHandler

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

- All Implemented Interfaces:
    Checker, Updater

      class PluginUpdateHandler
      extends Object
      implements Checker, Updater

  Check for or download an updated version of a plugin. A plugin is a standard .sud file with a 40-byte signature, a 16-byte version, and a .zip file. So we get the current version and update URL for the installed plugin, then fetch the first 56 bytes of the URL, extract the version, and compare. Moved from web/ and turned into an Updater.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UpdateTask` | `check(UpdateType type, UpdateMethod method, String appName, String currentVersion, long maxTime)` check a single plugin
    `UpdateTask` | `update(UpdateType type, UpdateMethod method, List<URI> updateSources, String appName, String newVersion, long maxTime)` download a single plugin

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

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

- - ### Constructor Detail

    - #### PluginUpdateHandler

          public PluginUpdateHandler(RouterContext ctx,
                                     ConsoleUpdateManager mgr)

  - ### Method Detail

    - #### check

          public UpdateTask check(UpdateType type,
                                  UpdateMethod method,
                                  String appName,
                                  String currentVersion,
                                  long maxTime)

      check a single plugin
      Specified by:
        `check` in interface `Checker`
      Parameters:
        `type` - update type
        `method` - update method
        `appName` - plugin name or ignored
        `currentVersion` - current version
        `maxTime` - how long you have
      Returns:
        active task or null if unable to check

    - #### update

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

      download a single plugin
      Specified by:
        `update` in interface `Updater`
      Parameters:
        `type` - update type
        `method` - update method
        `updateSources` - Where to get the new version from
        `appName` - plugin name or ignored
        `newVersion` - new version to download
        `maxTime` - how long you have
      Returns:
        active task or null if unable to download