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

class DevSU3UpdateHandlerextends Object implements Checker, Updater

Handles the request to update the router by firing off an EepGet call to download the latest su3 file and display the status.

After the download completes the su3 is verified, and the zip is extracted and copied to the router directory, and if configured the router is restarted to complete the update process.

  • 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.
  • Constructor Details

    • DevSU3UpdateHandler

      public DevSU3UpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr)
      DevSU3UpdateHandler.
      Parameters:
      ctx - the router context supplying the dev SU3 URL property and the log
      mgr - the update manager that runs the checker and reports its progress
  • Method Details

    • getUpdateSources

      public List<URI> getUpdateSources()
      Returns the dev SU3 download location as a single-element list. The URL comes from the console property set by the user, so it is null when that property is unset and also when its value does not parse as a URI, leaving the checker with nothing to fetch.
      Returns:
      null if none
    • check

      public UpdateTask check(UpdateType type, UpdateMethod method, String id, String currentVersion, long maxTime)
      Look for a dev SU3 update.
      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
      id - plugin name or ignored
      currentVersion - ignored, we use current router 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 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:
      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
      id - plugin name or ignored
      newVersion - new version to download
      maxTime - how long you have
      Returns:
      active task or null if unable to download