net.i2p.router.web
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.
Modifier and Type | Class and Description |
---|---|
class |
UpdateHandler.UpdateRunner |
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 and Description |
---|
UpdateHandler() |
UpdateHandler(RouterContext ctx) |
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) |
protected static UpdateHandler.UpdateRunner _updateRunner
protected RouterContext _context
protected Log _log
protected String _updateFile
protected static final String SIGNED_UPDATE_FILE
static final String PROP_UPDATE_IN_PROGRESS
protected static final String PROP_LAST_UPDATE_TIME
public UpdateHandler()
public UpdateHandler(RouterContext ctx)
public void setContextId(String contextId)
contextId
- beginning few characters of the routerHash, or null to pick
the first one we come across.public void setUpdateAction(String val)
public void setUpdateNonce(String nonce)
public void update()
public static String getStatus()
public boolean isDone()
protected void restart()
protected void updateStatus(String s)
protected String _(String s, Object o)
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.