java.lang.Object
net.i2p.router.update.PluginUpdateHandler
All Implemented Interfaces:
Checker, Updater

class PluginUpdateHandlerextends 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.

  • Field Details

    • _context

      private final RouterContext _context
      The router context the handler runs in.
    • _mgr

      private final ConsoleUpdateManager _mgr
      The manager that installs the update.
    • _log

      private final Log _log
      Logger for this class.
  • Constructor Details

    • PluginUpdateHandler

      public PluginUpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr)
      Create a plugin update handler.
      Parameters:
      ctx - the router context
      mgr - the console update manager
  • Method Details

    • 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 - the kind of update to look for, e.g. UpdateType.ROUTER_SIGNED
      method - the transport to fetch it over, e.g. UpdateMethod.HTTP
      appName - plugin name or ignored
      currentVersion - the running version, compared against the remote one so an equal or older release is not offered
      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 - selects what is being fetched, e.g. UpdateType.ROUTER_SIGNED
      method - how it is fetched, e.g. UpdateMethod.HTTP over I2P
      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