java.lang.Object
net.i2p.router.update.PluginUpdateHandler
Check for or download an updated version of a plugin. A plugin is a standard .sud file with a 40-byte signature, a 16-byte version, and a .zip file.
So we get the current version and update URL for the installed plugin, then fetch the first 56 bytes of the URL, extract the version, and compare.
Moved from web/ and turned into an Updater.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RouterContextThe router context the handler runs in.private final LogLogger for this class.private final ConsoleUpdateManagerThe manager that installs the update.Constructor Summary
ConstructorsConstructorDescriptionCreate a plugin update handler.Method Summary
All MethodsModifier and TypeMethodDescriptioncheck(UpdateType type, UpdateMethod method, String appName, String currentVersion, long maxTime) Check a single plugin.update(UpdateType type, UpdateMethod method, List<URI> updateSources, String appName, String newVersion, long maxTime) Download a single plugin.
Field Details
_context
The router context the handler runs in._mgr
The manager that installs the update._log
Logger for this class.
Constructor Details
PluginUpdateHandler
Create a plugin update handler.- Parameters:
ctx- the router contextmgr- the console update manager
Method Details
check
public UpdateTask check(UpdateType type, UpdateMethod method, String appName, String currentVersion, long maxTime) Check a single plugin.- Specified by:
checkin interfaceChecker- Parameters:
type- the kind of update to look for, e.g.UpdateType.ROUTER_SIGNEDmethod- the transport to fetch it over, e.g.UpdateMethod.HTTPappName- plugin name or ignoredcurrentVersion- the running version, compared against the remote one so an equal or older release is not offeredmaxTime- how long you have- Returns:
- active task or null if unable to check
update
public UpdateTask update(UpdateType type, UpdateMethod method, List<URI> updateSources, String appName, String newVersion, long maxTime) Download a single plugin.- Specified by:
updatein interfaceUpdater- Parameters:
type- selects what is being fetched, e.g.UpdateType.ROUTER_SIGNEDmethod- how it is fetched, e.g.UpdateMethod.HTTPover I2PupdateSources- Where to get the new version fromappName- plugin name or ignorednewVersion- new version to downloadmaxTime- how long you have- Returns:
- active task or null if unable to download