forked from I2P_Developers/i2p.i2p
- Split up Updater and Checker interfaces
- Update router after check
This commit is contained in:
26
core/java/src/net/i2p/update/Checker.java
Normal file
26
core/java/src/net/i2p/update/Checker.java
Normal file
@@ -0,0 +1,26 @@
|
||||
package net.i2p.update;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Controls one or more types of updates.
|
||||
* This must be registered with the UpdateManager.
|
||||
*
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public interface Checker {
|
||||
|
||||
/**
|
||||
* Check for updates.
|
||||
* Should not block.
|
||||
* If any are found, call back to UpdateManager.notifyUpdateAvailable().
|
||||
*
|
||||
* @param id plugin name or ignored
|
||||
* @param maxTime how long you have
|
||||
* @return active task or null if unable to check
|
||||
*/
|
||||
public UpdateTask check(UpdateType type, UpdateMethod method,
|
||||
String id, String currentVersion, long maxTime);
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@ package net.i2p.update;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The central resource coordinating updates.
|
||||
@@ -11,17 +11,20 @@ import java.util.List;;
|
||||
* The UpdateManager starts and stops all updates,
|
||||
* and controls notification to the user.
|
||||
*
|
||||
* @since 0.9.2
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public interface UpdateManager {
|
||||
|
||||
/**
|
||||
* Call multiple times for each type/method pair.
|
||||
* The UpdateManager will then call start()
|
||||
* Call once for each type/method pair.
|
||||
*/
|
||||
public void register(Updater updater, UpdateType type, UpdateMethod method, int priority);
|
||||
|
||||
public void register(Checker checker, UpdateType type, UpdateMethod method, int priority);
|
||||
|
||||
public void unregister(Updater updater, UpdateType type, UpdateMethod method);
|
||||
|
||||
public void unregister(Checker checker, UpdateType type, UpdateMethod method);
|
||||
|
||||
public void start();
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package net.i2p.update;
|
||||
/**
|
||||
* Transport mechanism for getting something.
|
||||
*
|
||||
* @since 0.9.2
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public enum UpdateMethod {
|
||||
METHOD_DUMMY,
|
||||
|
@@ -5,7 +5,7 @@ import java.net.URI;
|
||||
/**
|
||||
* A running check or download. Cannot be restarted.
|
||||
*
|
||||
* @since 0.9.2
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public interface UpdateTask {
|
||||
|
||||
|
@@ -3,7 +3,7 @@ package net.i2p.update;
|
||||
/**
|
||||
* What to update
|
||||
*
|
||||
* @since 0.9.2
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public enum UpdateType {
|
||||
TYPE_DUMMY,
|
||||
|
@@ -7,22 +7,10 @@ import java.util.List;
|
||||
* Controls one or more types of updates.
|
||||
* This must be registered with the UpdateManager.
|
||||
*
|
||||
* @since 0.9.2
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public interface Updater {
|
||||
|
||||
/**
|
||||
* Check for updates.
|
||||
* Should not block.
|
||||
* If any are found, call back to UpdateManager.notifyUpdateAvailable().
|
||||
*
|
||||
* @param id plugin name or ignored
|
||||
* @param maxTime how long you have
|
||||
* @return active task or null if unable to check
|
||||
*/
|
||||
public UpdateTask check(UpdateType type, UpdateMethod method,
|
||||
String id, String currentVersion, long maxTime);
|
||||
|
||||
/**
|
||||
* Start a download and return a handle to the download task.
|
||||
* Should not block.
|
||||
|
Reference in New Issue
Block a user