public class ConsoleUpdateManager extends Object implements UpdateManager, RouterApp
APP_NAME| Constructor and Description |
|---|
ConsoleUpdateManager(RouterContext ctx,
ClientAppManager listener,
String[] args) |
| Modifier and Type | Method and Description |
|---|---|
String |
_t(String s)
translate a string
|
String |
_t(String s,
Object o)
translate a string with a parameter
|
String |
_t(String s,
Object o,
Object o2)
translate a string with parameters
|
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)
Is an update available?
Blocking.
|
String |
checkAvailable(UpdateType type,
long maxWait)
Is an update available?
Blocking.
|
String |
checkAvailable(UpdateType type,
String id,
long maxWait)
Is an update available?
Blocking.
|
String |
getDisplayName()
The display name of the ClientApp, used in user interfaces.
|
static ConsoleUpdateManager |
getInstance() |
String |
getName()
The generic name of the ClientApp, used for registration,
e.g.
|
ClientAppState |
getState()
The current state of the ClientApp.
|
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 |
getUpdateConstraint(UpdateType type,
String id)
Is there a reason we can't download the update?
|
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 |
isExternalRestartPending()
A router update had been downloaded and handled by an UpdatePostProcessor.
|
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 |
notifyInstalled(UpdateType type,
String id,
String version)
Adds to installed, removes from downloaded and available
|
void |
notifyProgress(UpdateTask task,
String status)
Notify of progress update.
|
void |
notifyProgress(UpdateTask task,
String status,
long downloaded,
long totalSize)
Notify of progress update with size information.
|
void |
notifyTaskFailed(UpdateTask task,
String reason,
Throwable t)
The task has finished and failed.
|
boolean |
notifyVersionAvailable(UpdateTask task,
URI newsSource,
UpdateType type,
String id,
Map<UpdateMethod,List<URI>> sourceMap,
String newVersion,
String minVersion)
Called by the Checker, either after check() was called, or it found out on its own.
|
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 |
notifyVersionConstraint(UpdateTask task,
URI newsSource,
UpdateType type,
String id,
String newVersion,
String message)
A new version is available but cannot be downloaded or installed due to some constraint.
|
void |
register(Checker updater,
UpdateType type,
UpdateMethod method,
int priority)
Register a checker for updates.
|
void |
register(UpdatePostProcessor upp,
UpdateType type,
int fileType)
Register a post-processor for this UpdateType and SU3File file type.
|
void |
register(Updater updater,
UpdateType type,
UpdateMethod method,
int priority)
Call once for each type/method pair.
|
void |
renderStatusHTML(Writer out)
debug
|
(package private) boolean |
shouldInstall()
from NewsFetcher
|
void |
shutdown()
UpdateManager interface
|
void |
shutdown(String[] args)
ClientApp interface
|
void |
start()
UpdateManager interface
|
void |
startup()
ClientApp interface
|
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)
Unregister a checker.
|
void |
unregister(Updater updater,
UpdateType type,
UpdateMethod method)
Unregister an updater.
|
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.
|
public ConsoleUpdateManager(RouterContext ctx, ClientAppManager listener, String[] args)
args - ignoredpublic void check(UpdateType type)
public void check(UpdateType type, String id)
public String checkAvailable(UpdateType type)
checkAvailable in interface UpdateManagertype - the UpdateType of this requestpublic String checkAvailable(UpdateType type, long maxWait)
checkAvailable in interface UpdateManagertype - the UpdateType of this requestmaxWait - max time to blockpublic String checkAvailable(UpdateType type, String id, long maxWait)
checkAvailable in interface UpdateManagertype - the UpdateType of this requestid - id of this requestmaxWait - max time to blockpublic String getDisplayName()
ClientAppgetDisplayName in interface ClientApppublic static ConsoleUpdateManager getInstance()
public String getName()
ClientApppublic ClientAppState getState()
ClientApppublic String getStatus()
getStatus in interface UpdateManagerpublic String getUpdateAvailable(UpdateType type)
public String getUpdateAvailable(UpdateType type, String id)
public String getUpdateConstraint(UpdateType type, String id)
public String getUpdateDownloaded(UpdateType type)
public String getUpdateDownloaded(UpdateType type, String id)
public List<URI> getUpdateURLs(UpdateType type, String id, UpdateMethod method)
public boolean installPlugin(String name, URI uri)
name - if null, a new installpublic boolean isCheckInProgress()
public boolean isCheckInProgress(UpdateType type)
public boolean isCheckInProgress(UpdateType type, String id)
public boolean isExternalRestartPending()
public boolean isUpdateInProgress()
isUpdateInProgress in interface UpdateManagerpublic boolean isUpdateInProgress(UpdateType type)
isUpdateInProgress in interface UpdateManagertype - the UpdateType of this requestpublic boolean isUpdateInProgress(UpdateType type, String id)
isUpdateInProgress in interface UpdateManagertype - the UpdateType of this requestid - of this requestpublic void notifyAttemptFailed(UpdateTask task, String reason, Throwable t)
notifyAttemptFailed in interface UpdateManagertask - checker or updatert - may be nullreason - failure reasonpublic void notifyCheckComplete(UpdateTask task, boolean newer, boolean success)
notifyCheckComplete in interface UpdateManagertask - update tasknewer - notifyVersionAvailable was calledsuccess - check succeeded (newer or not)public void notifyComplete(UpdateTask task, String status)
task - may be nullpublic boolean notifyComplete(UpdateTask task, String actualVersion, File file)
notifyComplete in interface UpdateManagertask - 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 itselfpublic void notifyInstalled(UpdateType type, String id, String version)
notifyInstalled in interface UpdateManagerid - subtype for plugins, or ""version - null to remove from installedtype - update typepublic void notifyProgress(UpdateTask task, String status)
UpdateManagernotifyProgress in interface UpdateManagertask - may be nullstatus - status messagepublic void notifyProgress(UpdateTask task, String status, long downloaded, long totalSize)
UpdateManagernotifyProgress in interface UpdateManagertask - update taskstatus - status messagedownloaded - bytes downloadedtotalSize - total sizepublic void notifyTaskFailed(UpdateTask task, String reason, Throwable t)
notifyTaskFailed in interface UpdateManagertask - checker or updatert - may be nullreason - failure reasonpublic boolean notifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, Map<UpdateMethod,List<URI>> sourceMap, String newVersion, String minVersion)
notifyVersionAvailable in interface UpdateManagernewsSource - who told usid - plugin name for plugins, ignored otherwisesourceMap - Mapping of methods to sourcesnewVersion - The new version availableminVersion - The minimum installed version to be able to update to newVersiontask - update tasktype - update typepublic boolean notifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, UpdateMethod method, List<URI> updateSources, String newVersion, String minVersion)
notifyVersionAvailable in interface UpdateManagernewsSource - 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 newVersiontask - update tasktype - update typemethod - How to get the new versionpublic void notifyVersionConstraint(UpdateTask task, URI newsSource, UpdateType type, String id, String newVersion, String message)
notifyVersionConstraint in interface UpdateManagernewsSource - who told usid - plugin name for plugins, ignored otherwisenewVersion - The new version availablemessage - A translated message to be displayed to the user, non-nulltask - update tasktype - update typepublic void register(Checker updater, UpdateType type, UpdateMethod method, int priority)
UpdateManagerregister in interface UpdateManagerupdater - the checker implementationtype - the update typemethod - the update methodpriority - the prioritypublic void register(UpdatePostProcessor upp, UpdateType type, int fileType)
register in interface UpdateManagertype - only ROUTER_SIGNED_SU3 and ROUTER_DEV_SU3 are currently supportedfileType - a SU3File TYPE_xxx constant, 1-255, TYPE_ZIP not supported.upp - update post processorpublic void register(Updater updater, UpdateType type, UpdateMethod method, int priority)
register in interface UpdateManagerupdater - the updater implementationtype - the update typemethod - the update methodpriority - the prioritypublic void renderStatusHTML(Writer out) throws IOException
renderStatusHTML in interface UpdateManagerout - writer to output toIOException - if writing failsboolean shouldInstall()
public void shutdown()
shutdown in interface UpdateManagerpublic void shutdown(String[] args)
public void start()
start in interface UpdateManagerpublic void stopCheck(UpdateType type)
public void stopCheck(UpdateType type, String id)
public void stopChecks()
public void stopUpdate(UpdateType type)
public void stopUpdate(UpdateType type, String id)
public void stopUpdates()
public void unregister(Checker updater, UpdateType type, UpdateMethod method)
UpdateManagerunregister in interface UpdateManagerupdater - the checker implementationtype - the update typemethod - the update methodpublic void unregister(Updater updater, UpdateType type, UpdateMethod method)
UpdateManagerunregister in interface UpdateManagerupdater - the updater implementationtype - the update typemethod - the update methodpublic boolean update(UpdateType type)
update in interface UpdateManagertype - the UpdateType of this requestpublic boolean update(UpdateType type, long maxTime)
update in interface UpdateManagermaxTime - not honored by all Updaterstype - the UpdateType of this requestpublic boolean update(UpdateType type, String id)
update in interface UpdateManagertype - the UpdateType of this requestid - id of this requestpublic boolean update(UpdateType type, String id, long maxTime)
update in interface UpdateManagermaxTime - not honored by all Updaterstype - the UpdateType of this requestid - id of this request