Package com.biglybt.update
Class CoreUpdateChecker
- java.lang.Object
-
- com.biglybt.update.CoreUpdateChecker
-
- All Implemented Interfaces:
Plugin
,UpdatableComponent
public class CoreUpdateChecker extends java.lang.Object implements Plugin, UpdatableComponent
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
first_check
static java.lang.String
LATEST_VERSION_PROPERTY
protected LoggerChannel
log
static java.lang.String
MESSAGE_PROPERTY
protected PluginInterface
plugin_interface
static int
RD_GET_DETAILS_RETRIES
static int
RD_GET_MIRRORS_RETRIES
protected ResourceDownloaderListener
rd_logger
static int
RD_SIZE_RETRIES
static int
RD_SIZE_TIMEOUT
protected ResourceDownloaderFactory
rdf
static java.lang.String
RES_EXPLICIT_FILE
protected static CoreUpdateChecker
singleton
-
Constructor Summary
Constructors Constructor Description CoreUpdateChecker()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkForUpdate(UpdateChecker checker)
private void
displayUserMessage(java.util.Map reply)
Log and display a user message if contained within reply.static void
doUsageStats()
protected void
doUsageStatsSupport()
private static java.lang.String
findCommand(java.lang.String name)
int
getMaximumCheckTime()
estimated maximum time to check whether an update is required or not in SECONDSjava.lang.String
getName()
Name of the updatable componentstatic CoreUpdateChecker
getSingleton()
protected void
handleZIPUpdate(UpdateChecker checker, java.io.InputStream data)
void
initialize(PluginInterface _plugin_interface)
This method is called when the Plugin is loaded by the clientprotected void
installUpdate(UpdateChecker checker, Update update, ResourceDownloader rd, java.lang.String filename, java.lang.String version, java.io.InputStream data)
protected void
launchUpdate(java.io.File file, java.lang.String[] args)
static void
main(java.lang.String[] args)
private static void
runCommand(java.lang.String[] command, boolean wait)
protected static boolean
shouldUpdate(java.lang.String current_version, java.lang.String latest_version)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.biglybt.pif.Plugin
getInitialProperties
-
-
-
-
Field Detail
-
LATEST_VERSION_PROPERTY
public static final java.lang.String LATEST_VERSION_PROPERTY
- See Also:
- Constant Field Values
-
MESSAGE_PROPERTY
public static final java.lang.String MESSAGE_PROPERTY
- See Also:
- Constant Field Values
-
RD_GET_DETAILS_RETRIES
public static final int RD_GET_DETAILS_RETRIES
- See Also:
- Constant Field Values
-
RD_GET_MIRRORS_RETRIES
public static final int RD_GET_MIRRORS_RETRIES
- See Also:
- Constant Field Values
-
RD_SIZE_RETRIES
public static final int RD_SIZE_RETRIES
- See Also:
- Constant Field Values
-
RD_SIZE_TIMEOUT
public static final int RD_SIZE_TIMEOUT
- See Also:
- Constant Field Values
-
RES_EXPLICIT_FILE
public static final java.lang.String RES_EXPLICIT_FILE
- See Also:
- Constant Field Values
-
singleton
protected static volatile CoreUpdateChecker singleton
-
plugin_interface
protected PluginInterface plugin_interface
-
rdf
protected ResourceDownloaderFactory rdf
-
log
protected LoggerChannel log
-
rd_logger
protected ResourceDownloaderListener rd_logger
-
first_check
protected boolean first_check
-
-
Method Detail
-
getSingleton
public static CoreUpdateChecker getSingleton()
-
doUsageStats
public static void doUsageStats()
-
doUsageStatsSupport
protected void doUsageStatsSupport()
-
initialize
public void initialize(PluginInterface _plugin_interface)
Description copied from interface:Plugin
This method is called when the Plugin is loaded by the client- Specified by:
initialize
in interfacePlugin
- Parameters:
_plugin_interface
- the interface that the plugin must use to communicate with the client
-
getName
public java.lang.String getName()
Description copied from interface:UpdatableComponent
Name of the updatable component- Specified by:
getName
in interfaceUpdatableComponent
- Returns:
-
getMaximumCheckTime
public int getMaximumCheckTime()
Description copied from interface:UpdatableComponent
estimated maximum time to check whether an update is required or not in SECONDS- Specified by:
getMaximumCheckTime
in interfaceUpdatableComponent
- Returns:
-
checkForUpdate
public void checkForUpdate(UpdateChecker checker)
- Specified by:
checkForUpdate
in interfaceUpdatableComponent
-
displayUserMessage
private void displayUserMessage(java.util.Map reply)
Log and display a user message if contained within reply.- Parameters:
reply
- from server
-
installUpdate
protected void installUpdate(UpdateChecker checker, Update update, ResourceDownloader rd, java.lang.String filename, java.lang.String version, java.io.InputStream data)
-
handleZIPUpdate
protected void handleZIPUpdate(UpdateChecker checker, java.io.InputStream data) throws java.lang.Exception
- Throws:
java.lang.Exception
-
launchUpdate
protected void launchUpdate(java.io.File file, java.lang.String[] args)
-
findCommand
private static java.lang.String findCommand(java.lang.String name)
-
runCommand
private static void runCommand(java.lang.String[] command, boolean wait) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
shouldUpdate
protected static boolean shouldUpdate(java.lang.String current_version, java.lang.String latest_version)
-
main
public static void main(java.lang.String[] args)
-
-