|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.update.ConsoleUpdateManager
public class ConsoleUpdateManager
The central resource coordinating updates. This must be registered with the context. The UpdateManager starts and stops all updates, prevents multiple updates as appropriate, and controls notification to the user. Version notes: For news and unsigned updates, use Long.toString(modtime).
Constructor Summary | |
---|---|
ConsoleUpdateManager(RouterContext ctx)
|
Method Summary | |
---|---|
String |
_(String s)
translate a string |
String |
_(String s,
Object o)
translate a string with a parameter |
void |
check(UpdateType type)
Fire off a checker task Non-blocking. |
void |
check(UpdateType type,
String id)
Fire off a checker task Non-blocking. |
String |
checkAvailable(UpdateType type,
long maxWait)
|
String |
checkAvailable(UpdateType type,
String id,
long maxWait)
Is an update available? Blocking. |
static ConsoleUpdateManager |
getInstance()
|
String |
getStatus()
The status on any update current or last finished. |
String |
getUpdateAvailable(UpdateType type)
Is an update available? Non-blocking, returns result of last check or notification from an Updater |
String |
getUpdateAvailable(UpdateType type,
String id)
Is an update available? Non-blocking, returns result of last check or notification from an Updater |
String |
getUpdateDownloaded(UpdateType type)
Is an update downloaded? Non-blocking, returns result of last download |
String |
getUpdateDownloaded(UpdateType type,
String id)
Is an update downloaded? Non-blocking, returns result of last download |
List<URI> |
getUpdateURLs(UpdateType type,
String id,
UpdateMethod method)
Where to find various resources |
boolean |
installPlugin(String name,
URI uri)
Install a plugin. |
boolean |
isCheckInProgress()
Is any check in progress? Does not include updates. |
boolean |
isCheckInProgress(UpdateType type)
Is a check in progress? |
boolean |
isCheckInProgress(UpdateType type,
String id)
Is a check in progress? |
boolean |
isUpdateInProgress()
Is any download in progress? Does not include checks. |
boolean |
isUpdateInProgress(UpdateType type)
Is a download in progress? |
boolean |
isUpdateInProgress(UpdateType type,
String id)
Is a download in progress? |
(package private) static String |
linkify(String url)
|
void |
notifyAttemptFailed(UpdateTask task,
String reason,
Throwable t)
Not necessarily the end if there are more URIs to try. |
void |
notifyCheckComplete(UpdateTask task,
boolean newer,
boolean success)
Called by the Updater after check() was called and all notifyVersionAvailable() callbacks are finished |
void |
notifyComplete(UpdateTask task,
String status)
An expiring status |
boolean |
notifyComplete(UpdateTask task,
String actualVersion,
File file)
An update has been downloaded but not verified. |
void |
notifyProgress(UpdateTask task,
String status)
|
void |
notifyProgress(UpdateTask task,
String status,
long downloaded,
long totalSize)
|
void |
notifyTaskFailed(UpdateTask task,
String reason,
Throwable t)
The task has finished and failed. |
boolean |
notifyVersionAvailable(UpdateTask task,
URI newsSource,
UpdateType type,
String id,
UpdateMethod method,
List<URI> updateSources,
String newVersion,
String minVersion)
Called by the Updater, either after check() was called, or it found out on its own. |
void |
register(Checker updater,
UpdateType type,
UpdateMethod method,
int priority)
|
void |
register(Updater updater,
UpdateType type,
UpdateMethod method,
int priority)
Call once for each type/method pair. |
void |
renderStatusHTML(Writer out)
debug |
void |
shutdown()
|
void |
start()
|
void |
stopCheck(UpdateType type)
Stop this check |
void |
stopCheck(UpdateType type,
String id)
Stop this check |
void |
stopChecks()
Stop all checks in progress |
void |
stopUpdate(UpdateType type)
Stop this download |
void |
stopUpdate(UpdateType type,
String id)
Stop this download |
void |
stopUpdates()
Stop all downloads in progress |
void |
unregister(Checker updater,
UpdateType type,
UpdateMethod method)
|
void |
unregister(Updater updater,
UpdateType type,
UpdateMethod method)
|
boolean |
update(UpdateType type)
Non-blocking. |
boolean |
update(UpdateType type,
long maxTime)
Non-blocking. |
boolean |
update(UpdateType type,
String id)
Non-blocking. |
boolean |
update(UpdateType type,
String id,
long maxTime)
Non-blocking. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConsoleUpdateManager(RouterContext ctx)
Method Detail |
---|
public static ConsoleUpdateManager getInstance()
public void start()
start
in interface UpdateManager
public void shutdown()
shutdown
in interface UpdateManager
public String getStatus()
public String checkAvailable(UpdateType type, long maxWait)
public String checkAvailable(UpdateType type, String id, long maxWait)
maxWait
- max time to block
public void check(UpdateType type)
public void check(UpdateType type, String id)
public String getUpdateAvailable(UpdateType type)
public String getUpdateAvailable(UpdateType type, String id)
public String getUpdateDownloaded(UpdateType type)
public String getUpdateDownloaded(UpdateType type, String id)
public boolean isUpdateInProgress()
public boolean isUpdateInProgress(UpdateType type)
public boolean isUpdateInProgress(UpdateType type, String id)
public void stopUpdates()
public void stopUpdate(UpdateType type)
public void stopUpdate(UpdateType type, String id)
public boolean isCheckInProgress()
public boolean isCheckInProgress(UpdateType type)
public boolean isCheckInProgress(UpdateType type, String id)
public void stopChecks()
public void stopCheck(UpdateType type)
public void stopCheck(UpdateType type, String id)
public boolean installPlugin(String name, URI uri)
name
- if null, a new install
public boolean update(UpdateType type)
public boolean update(UpdateType type, String id)
public boolean update(UpdateType type, long maxTime)
maxTime
- not honored by all Updaters
public boolean update(UpdateType type, String id, long maxTime)
maxTime
- not honored by all Updaters
public void register(Updater updater, UpdateType type, UpdateMethod method, int priority)
register
in interface UpdateManager
public void unregister(Updater updater, UpdateType type, UpdateMethod method)
unregister
in interface UpdateManager
public void register(Checker updater, UpdateType type, UpdateMethod method, int priority)
register
in interface UpdateManager
public void unregister(Checker updater, UpdateType type, UpdateMethod method)
unregister
in interface UpdateManager
public boolean notifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, UpdateMethod method, List<URI> updateSources, String newVersion, String minVersion)
notifyVersionAvailable
in interface UpdateManager
newsSource
- who told usid
- plugin name for plugins, ignored otherwiseupdateSources
- Where to get the new versionnewVersion
- The new version availableminVersion
- The minimum installed version to be able to update to newVersionmethod
- How to get the new version
public void notifyCheckComplete(UpdateTask task, boolean newer, boolean success)
notifyCheckComplete
in interface UpdateManager
newer
- notifyVersionAvailable was calledsuccess
- check succeeded (newer or not)public void notifyProgress(UpdateTask task, String status, long downloaded, long totalSize)
notifyProgress
in interface UpdateManager
public void notifyProgress(UpdateTask task, String status)
notifyProgress
in interface UpdateManager
task
- may be nullpublic void notifyComplete(UpdateTask task, String status)
task
- may be nullpublic void notifyAttemptFailed(UpdateTask task, String reason, Throwable t)
notifyAttemptFailed
in interface UpdateManager
task
- checker or updatert
- may be nullpublic void notifyTaskFailed(UpdateTask task, String reason, Throwable t)
notifyTaskFailed
in interface UpdateManager
task
- checker or updatert
- may be nullpublic boolean notifyComplete(UpdateTask task, String actualVersion, File file)
notifyComplete
in interface UpdateManager
task
- must be an Updater, not a CheckeractualVersion
- may be higher (or lower?) than the version requestedfile
- a valid format for the task's UpdateType, or null if it did the installation itself
public List<URI> getUpdateURLs(UpdateType type, String id, UpdateMethod method)
static String linkify(String url)
public String _(String s)
public String _(String s, Object o)
public void renderStatusHTML(Writer out) throws IOException
renderStatusHTML
in interface UpdateManager
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |