Package net.i2p.update
Interface UpdateManager
- 
- All Known Implementing Classes:
- ConsoleUpdateManager
 
 public interface UpdateManagerThe central resource coordinating updates. This must be registered with the context. The UpdateManager starts and stops all updates, and controls notification to the user.- Since:
- 0.9.4
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description StringcheckAvailable(UpdateType type)Is an update available? Blocking.StringcheckAvailable(UpdateType type, long maxWait)Is an update available? Blocking.StringcheckAvailable(UpdateType type, String id, long maxWait)Is an update available? Blocking.StringgetStatus()The status on any update current or last finished.booleanisUpdateInProgress()Is a router update being downloaded?booleanisUpdateInProgress(UpdateType type)Is a router update being downloaded?booleanisUpdateInProgress(UpdateType type, String id)Is a router update being downloaded?voidnotifyAttemptFailed(UpdateTask task, String reason, Throwable t)Not necessarily the end if there are more URIs to try.voidnotifyCheckComplete(UpdateTask task, boolean newer, boolean success)Called by the Checker after check() was called and all notifyVersionAvailable() callbacks are finishedbooleannotifyComplete(UpdateTask task, String actualVersion, File file)An update has been downloaded but not verified.voidnotifyInstalled(UpdateType type, String id, String version)Tell the UpdateManager that a version is already installed.voidnotifyProgress(UpdateTask task, String status)voidnotifyProgress(UpdateTask task, String status, long downloaded, long totalSize)voidnotifyTaskFailed(UpdateTask task, String reason, Throwable t)The task has finished and failed.booleannotifyVersionAvailable(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.booleannotifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, UpdateMethod method, List<URI> updateSources, String newVersion, String minVersion)Called by the Checker, either after check() was called, or it found out on its own.voidnotifyVersionConstraint(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.voidregister(Checker checker, UpdateType type, UpdateMethod method, int priority)voidregister(UpdatePostProcessor upp, UpdateType type, int fileType)Register a post-processor for this UpdateType and SU3File file type.voidregister(Updater updater, UpdateType type, UpdateMethod method, int priority)Call once for each type/method pair.voidrenderStatusHTML(Writer out)For debuggingvoidshutdown()voidstart()voidunregister(Checker checker, UpdateType type, UpdateMethod method)voidunregister(Updater updater, UpdateType type, UpdateMethod method)booleanupdate(UpdateType type)Non-blocking.booleanupdate(UpdateType type, long maxTime)Non-blocking.booleanupdate(UpdateType type, String id)Non-blocking.booleanupdate(UpdateType type, String id, long maxTime)Non-blocking.
 
- 
- 
- 
Field Detail- 
APP_NAMEstatic final String APP_NAME The name we register with the ClientAppManager- Since:
- 0.9.12
- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
registervoid register(Updater updater, UpdateType type, UpdateMethod method, int priority) Call once for each type/method pair.
 - 
registervoid register(Checker checker, UpdateType type, UpdateMethod method, int priority) 
 - 
unregistervoid unregister(Updater updater, UpdateType type, UpdateMethod method) 
 - 
unregistervoid unregister(Checker checker, UpdateType type, UpdateMethod method) 
 - 
registervoid register(UpdatePostProcessor upp, UpdateType type, int fileType) Register a post-processor for this UpdateType and SU3File file type.- Parameters:
- type- only ROUTER_SIGNED_SU3 and ROUTER_DEV_SU3 are currently supported
- fileType- a SU3File TYPE_xxx constant, 1-255, TYPE_ZIP not supported.
- Since:
- 0.9.51
 
 - 
startvoid start() 
 - 
shutdownvoid shutdown() 
 - 
notifyVersionAvailableboolean notifyVersionAvailable(UpdateTask task, URI newsSource, UpdateType type, String id, UpdateMethod method, List<URI> updateSources, String newVersion, String minVersion) Called by the Checker, either after check() was called, or it found out on its own. Use this if there is only one UpdateMethod; otherwise use the Map method below.- Parameters:
- newsSource- who told us
- id- plugin name for plugins, ignored otherwise
- method- How to get the new version
- updateSources- Where to get the new version
- newVersion- The new version available
- minVersion- The minimum installed version to be able to update to newVersion
- Returns:
- true if we didn't know already
 
 - 
notifyVersionAvailableboolean 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. Checkers must use this method if there are multiple UpdateMethods discoverd simultaneously.- Parameters:
- newsSource- who told us
- id- plugin name for plugins, ignored otherwise
- sourceMap- Mapping of methods to sources
- newVersion- The new version available
- minVersion- The minimum installed version to be able to update to newVersion
- Returns:
- true if we didn't know already
- Since:
- 0.9.6
 
 - 
notifyVersionConstraintvoid 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. The manager should notify the user. Called by the Checker, either after check() was called, or it found out on its own.- Parameters:
- newsSource- who told us
- id- plugin name for plugins, ignored otherwise
- newVersion- The new version available
- message- A translated message to be displayed to the user, non-null
- Since:
- 0.9.9
 
 - 
notifyCheckCompletevoid notifyCheckComplete(UpdateTask task, boolean newer, boolean success) Called by the Checker after check() was called and all notifyVersionAvailable() callbacks are finished- Parameters:
- newer- notifyVersionAvailable was called
- success- check succeeded (newer or not)
 
 - 
notifyProgressvoid notifyProgress(UpdateTask task, String status) 
 - 
notifyProgressvoid notifyProgress(UpdateTask task, String status, long downloaded, long totalSize) 
 - 
notifyAttemptFailedvoid notifyAttemptFailed(UpdateTask task, String reason, Throwable t) Not necessarily the end if there are more URIs to try.- Parameters:
- t- may be null
 
 - 
notifyTaskFailedvoid notifyTaskFailed(UpdateTask task, String reason, Throwable t) The task has finished and failed.- Parameters:
- t- may be null
 
 - 
notifyCompleteboolean notifyComplete(UpdateTask task, String actualVersion, File file) An update has been downloaded but not verified. The manager will verify it. Caller should delete the file upon return, unless it will share it with others, e.g. on a torrent.- Parameters:
- actualVersion- may be higher (or lower?) than the version requested
- file- a valid format for the task's UpdateType
- Returns:
- true if valid, false if corrupt
 
 - 
checkAvailableString checkAvailable(UpdateType type) Is an update available? Blocking. An available update may still have a constraint or lack sources.- Parameters:
- type- the UpdateType of this request
- Returns:
- new version or null if nothing newer is available
- Since:
- 0.9.21
 
 - 
checkAvailableString checkAvailable(UpdateType type, long maxWait) Is an update available? Blocking. An available update may still have a constraint or lack sources.- Parameters:
- type- the UpdateType of this request
- maxWait- max time to block
- Returns:
- new version or null if nothing newer is available
- Since:
- 0.9.21
 
 - 
checkAvailableString checkAvailable(UpdateType type, String id, long maxWait) Is an update available? Blocking. An available update may still have a constraint or lack sources.- Parameters:
- type- the UpdateType of this request
- maxWait- max time to block
- id- id of this request
- Returns:
- new version or null if nothing newer is available
- Since:
- 0.9.21
 
 - 
isUpdateInProgressboolean isUpdateInProgress() Is a router update being downloaded?- Returns:
- true iff router update is being downloaded
- Since:
- 0.9.21
 
 - 
isUpdateInProgressboolean isUpdateInProgress(UpdateType type) Is a router update being downloaded?- Parameters:
- type- the UpdateType of this request
- Returns:
- true iff router update is being downloaded
- Since:
- 0.9.21
 
 - 
isUpdateInProgressboolean isUpdateInProgress(UpdateType type, String id) Is a router update being downloaded?- Parameters:
- type- the UpdateType of this request
- id- of this request
- Returns:
- true iff router update is being downloaded
- Since:
- 0.9.21
 
 - 
updateboolean update(UpdateType type) Non-blocking. Does not check. Fails if check or update already in progress. If returns true, then call isUpdateInProgress() in a loop- Parameters:
- type- the UpdateType of this request
- Returns:
- true if task started
- Since:
- 0.9.21
 
 - 
updateboolean update(UpdateType type, String id) Non-blocking. Does not check. Fails if check or update already in progress. If returns true, then call isUpdateInProgress() in a loop- Parameters:
- type- the UpdateType of this request
- id- id of this request
- Returns:
- true if task started
- Since:
- 0.9.21
 
 - 
updateboolean update(UpdateType type, long maxTime) Non-blocking. Does not check. Fails if check or update already in progress. If returns true, then call isUpdateInProgress() in a loop- Parameters:
- type- the UpdateType of this request
- maxTime- not honored by all Updaters
- Returns:
- true if task started
- Since:
- 0.9.21
 
 - 
updateboolean update(UpdateType type, String id, long maxTime) Non-blocking. Does not check. Fails if check or update already in progress. If returns true, then call isUpdateInProgress() in a loop- Parameters:
- type- the UpdateType of this request
- maxTime- not honored by all Updaters
- id- id of this request
- Returns:
- true if task started
- Since:
- 0.9.21
 
 - 
getStatusString getStatus() The status on any update current or last finished.- Returns:
- status or ""
- Since:
- 0.9.21
 
 - 
notifyInstalledvoid notifyInstalled(UpdateType type, String id, String version) Tell the UpdateManager that a version is already installed.- Parameters:
- id- subtype for plugins, or ""
- version- null to remove from installed
- Since:
- 0.9.45
 
 - 
renderStatusHTMLvoid renderStatusHTML(Writer out) throws IOException For debugging- Throws:
- IOException
 
 
- 
 
-