Class UpdateHandler

  extended by net.i2p.router.web.UpdateHandler
Direct Known Subclasses:
PluginUpdateChecker, PluginUpdateHandler, UnsignedUpdateHandler

public class UpdateHandler
extends java.lang.Object

Handles the request to update the router by firing off an EepGet call 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
 class UpdateHandler.UpdateRunner
Field Summary
protected  RouterContext _context
protected  Log _log
protected  java.lang.String _updateFile
protected static UpdateHandler.UpdateRunner _updateRunner
protected static java.lang.String PROP_LAST_UPDATE_TIME
(package private) static java.lang.String PROP_UPDATE_IN_PROGRESS
protected static java.lang.String SIGNED_UPDATE_FILE
Constructor Summary
UpdateHandler(RouterContext ctx)
Method Summary
protected  java.lang.String _(java.lang.String s)
          translate a string
protected  java.lang.String _(java.lang.String s, java.lang.Object o)
          translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.
static java.lang.String getStatus()
 boolean isDone()
protected  void restart()
 void setContextId(java.lang.String contextId)
          Configure this bean to query a particular router context
 void setUpdateAction(java.lang.String val)
          these two can be set in either order, so call checkUpdateAction() twice
 void setUpdateNonce(java.lang.String nonce)
 void update()
protected  void updateStatus(java.lang.String s)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected static UpdateHandler.UpdateRunner _updateRunner


protected RouterContext _context


protected Log _log


protected java.lang.String _updateFile


protected static final java.lang.String SIGNED_UPDATE_FILE
See Also:
Constant Field Values


static final java.lang.String PROP_UPDATE_IN_PROGRESS
See Also:
Constant Field Values


protected static final java.lang.String PROP_LAST_UPDATE_TIME
See Also:
Constant Field Values
Constructor Detail


public UpdateHandler()


public UpdateHandler(RouterContext ctx)
Method Detail


public void setContextId(java.lang.String contextId)
Configure this bean to query a particular router context

contextId - beginning few characters of the routerHash, or null to pick the first one we come across.


public void setUpdateAction(java.lang.String val)
these two can be set in either order, so call checkUpdateAction() twice


public void setUpdateNonce(java.lang.String nonce)


public void update()


public static java.lang.String getStatus()


public boolean isDone()


protected void restart()


protected void updateStatus(java.lang.String s)


protected java.lang.String _(java.lang.String s)
translate a string


protected java.lang.String _(java.lang.String s,
                             java.lang.Object o)
translate a string with a parameter This is a lot more expensive than _(s), so use sparingly.

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.