public class CheckForUpdates extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
CheckForUpdates.UpdateResult
Returns the result of an update check.
|
Modifier and Type | Field and Description |
---|---|
static long |
ONE_DAY |
static long |
ONE_MINUTE |
protected static String |
PROPERTY_DEBUG_HTTP_GET |
protected static String |
PROPERTY_FORCE_NONNATIVE |
protected static String |
PROPERTY_PREFS_NAME |
protected static String |
PROPERTY_QUERY_URL |
Constructor and Description |
---|
CheckForUpdates(TreeLogger logger,
String entryPoint)
Create an update checker which will poll a server URL and log a message
about an update if available.
|
Modifier and Type | Method and Description |
---|---|
CheckForUpdates.UpdateResult |
check()
Check for updates and log to the logger if they are available.
|
CheckForUpdates.UpdateResult |
check(long minCheckMillis)
Check for updates and log to the logger if they are available.
|
static FutureTask<CheckForUpdates.UpdateResult> |
checkForUpdatesInBackgroundThread(TreeLogger logger,
long minCheckMillis) |
static String |
computeEntryPoint()
Find the first method named "main" on the call stack and use its class as
the entry point.
|
static CheckForUpdates |
createUpdateChecker(TreeLogger logger) |
static CheckForUpdates |
createUpdateChecker(TreeLogger logger,
String entryPoint) |
protected byte[] |
doHttpGet(TreeLogger branch,
String userAgent,
String url)
Default implementation just uses the platform-independent method.
|
protected byte[] |
httpGetNonNative(TreeLogger branch,
String userAgent,
String url)
This default implementation uses regular Java HTTP, which doesn't deal with
proxies automagically.
|
static void |
logUpdateAvailable(TreeLogger logger,
CheckForUpdates.UpdateResult result) |
static void |
logUpdateAvailable(TreeLogger logger,
FutureTask<CheckForUpdates.UpdateResult> updater) |
public static final long ONE_DAY
public static final long ONE_MINUTE
protected static final String PROPERTY_DEBUG_HTTP_GET
protected static final String PROPERTY_FORCE_NONNATIVE
protected static final String PROPERTY_PREFS_NAME
protected static final String PROPERTY_QUERY_URL
public CheckForUpdates(TreeLogger logger, String entryPoint)
logger
- TreeLogger to useentryPoint
- the name of the main entry point used for this executionpublic static FutureTask<CheckForUpdates.UpdateResult> checkForUpdatesInBackgroundThread(TreeLogger logger, long minCheckMillis)
public static String computeEntryPoint()
public static CheckForUpdates createUpdateChecker(TreeLogger logger)
public static CheckForUpdates createUpdateChecker(TreeLogger logger, String entryPoint)
public static void logUpdateAvailable(TreeLogger logger, FutureTask<CheckForUpdates.UpdateResult> updater)
public static void logUpdateAvailable(TreeLogger logger, CheckForUpdates.UpdateResult result)
public CheckForUpdates.UpdateResult check()
public CheckForUpdates.UpdateResult check(long minCheckMillis)
protected byte[] doHttpGet(TreeLogger branch, String userAgent, String url)
branch
- TreeLogger to useuserAgent
- user agent string to send in requesturl
- URL to fetchprotected byte[] httpGetNonNative(TreeLogger branch, String userAgent, String url)
branch
- TreeLogger to useuserAgent
- user agent string to send in requesturl
- URL to fetchCopyright © 2018. All rights reserved.