net.i2p.router.web

## Class UpdateHandler

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

- Direct Known Subclasses:
    PluginUpdateChecker, PluginUpdateHandler, UnsignedUpdateHandler

      public class UpdateHandler
      extends Object

  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.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `UpdateHandler.UpdateRunner`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected RouterContext` | `_context`
    `protected Log` | `_log`
    `protected String` | `_updateFile`
    `protected static UpdateHandler.UpdateRunner` | `_updateRunner`
    `protected static String` | `PROP_LAST_UPDATE_TIME`
    `(package private) static String` | `PROP_UPDATE_IN_PROGRESS`
    `protected static String` | `SIGNED_UPDATE_FILE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UpdateHandler()`
    `UpdateHandler(RouterContext ctx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected String` | `_(String s)` translate a string
    `protected String` | `_(String s, Object o)` translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.
    `static String` | `getStatus()`
    `boolean` | `isDone()`
    `protected static String` | `linkify(String url)`
    `protected void` | `restart()`
    `void` | `setContextId(String contextId)` Configure this bean to query a particular router context
    `void` | `setUpdateAction(String val)` these two can be set in either order, so call checkUpdateAction() twice
    `void` | `setUpdateNonce(String nonce)`
    `void` | `update()`
    `protected void` | `updateStatus(String s)`

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

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

- - ### Field Detail

    - #### _updateRunner

          protected static UpdateHandler.UpdateRunner _updateRunner

    - #### _context

          protected RouterContext _context

    - #### _log

          protected Log _log

    - #### _updateFile

          protected String _updateFile

    - #### SIGNED_UPDATE_FILE

          protected static final String SIGNED_UPDATE_FILE

      See Also:
        Constant Field Values

    - #### PROP_UPDATE_IN_PROGRESS

          static final String PROP_UPDATE_IN_PROGRESS

      See Also:
        Constant Field Values

    - #### PROP_LAST_UPDATE_TIME

          protected static final String PROP_LAST_UPDATE_TIME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### UpdateHandler

          public UpdateHandler()

    - #### UpdateHandler

          public UpdateHandler(RouterContext ctx)

  - ### Method Detail

    - #### setContextId

          public void setContextId(String contextId)

      Configure this bean to query a particular router context
      Parameters:
        `contextId` - beginning few characters of the routerHash, or null to pick the first one we come across.

    - #### setUpdateAction

          public void setUpdateAction(String val)

      these two can be set in either order, so call checkUpdateAction() twice

    - #### setUpdateNonce

          public void setUpdateNonce(String nonce)

    - #### update

          public void update()

    - #### getStatus

          public static String getStatus()

    - #### isDone

          public boolean isDone()

    - #### restart

          protected void restart()

    - #### updateStatus

          protected void updateStatus(String s)

    - #### linkify

          protected static String linkify(String url)

    - #### _

          protected String _(String s)

      translate a string

    - #### _

          protected String _(String s,
                 Object o)

      translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.
      Parameters:
        `s` - string to be translated containing {0} The {0} will be replaced by the parameter. Single quotes must be doubled, i.e. ' -> '' in the string.
        `o` - parameter, not translated. To tranlslate parameter also, use _("foo {0} bar", _("baz")) Do not double the single quotes in the parameter. Use autoboxing to call with ints, longs, floats, etc.