net.i2p.router.web
Class UpdateHandler

java.lang.Object
  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()
           
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

_updateRunner

protected static UpdateHandler.UpdateRunner _updateRunner

_context

protected RouterContext _context

_log

protected Log _log

_updateFile

protected java.lang.String _updateFile

SIGNED_UPDATE_FILE

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

PROP_UPDATE_IN_PROGRESS

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

PROP_LAST_UPDATE_TIME

protected static final java.lang.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(java.lang.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(java.lang.String val)
these two can be set in either order, so call checkUpdateAction() twice


setUpdateNonce

public void setUpdateNonce(java.lang.String nonce)

update

public void update()

getStatus

public static java.lang.String getStatus()

isDone

public boolean isDone()

restart

protected void restart()

updateStatus

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.

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.