Class AutomaticUpdater


  • public class AutomaticUpdater
    extends java.lang.Object
    Checks for updates to plug-ins and the application at regular intervals and displays feedback to the user when updates are available.
    Since:
    2.1
    Author:
    Chris Jennings
    • Method Detail

      • markUpdate

        public static void markUpdate()
        Called when any kind of plug-in check occurs; updates the setting that tracks when the last update took place.
      • getMillisecondsBetweenChecks

        public static long getMillisecondsBetweenChecks()
        Returns the number of milliseconds that elapse between automatic checks, depending on the update frequency setting.
        Returns:
        the ideal number of milliseconds between update checks
      • isUpdateOverdue

        public static boolean isUpdateOverdue()
        Returns true if, according to current settings, an automatic update check is overdue.
        Returns:
        true if the time since the last check is greater than the update check frequency set by the user
      • getMillisecondsUntilNextCheck

        public static long getMillisecondsUntilNextCheck()
        Returns the number of milliseconds before the next update check should be performed, or Long.MAX_VALUE if no update check will be performed. Note that this may be less than 0 if an update is overdue.
        Returns:
        the number of milliseconds before an update is pending, or Long.MAX_VALUE
      • performAutomaticUpdate

        public static void performAutomaticUpdate()
        Checks if an update is overdue, and if so checks if updates are available in a separate thread. If they are, displays feedback to the user.
      • isApplicationUpdateAvailable

        public static boolean isApplicationUpdateAvailable()
        Returns true if it can determine with certainty that an application update is available. If no update is available, or if any error occurs, it will return false. This call bypasses the usual update infrastructure; for example, it does not reset the time until the next update check.
        Returns:
        true if an application update is available
      • performUpdate

        public static int performUpdate​(int updateAction,
                                        boolean allCatalogs)
        Performs an update check immediately, even if an update is not overdue. The value of updateAction must be one of: ACTION_TELL_USER, ACTION_OPEN_CATALOG, ACTION_INSTALL_IMMEDIATELY. If allCatalogs is true, then all catalogs in the user's catalog URL history will be checked. Otherwise, only the default catalog is checked. Returns a bitwise combination of true if any updates were found, or false otherwise.
        Parameters:
        updateAction - the action to take when updates are found
        allCatalogs - update from all catalogs in the catalog URL history, not just the primary catalog
        Returns:
        true if any updates were found
        Throws:
        java.lang.IllegalArgumentException - if the updateAction is not valid
      • writePendingUpdateInformation

        public static void writePendingUpdateInformation()
        This is called during shutdown to write required information into user settings. It is public only to cross a package boundary and should not be called by plug-ins.
      • getUpdateAllCatalogs

        public static boolean getUpdateAllCatalogs()
      • setUpdateAllCatalogs

        public static void setUpdateAllCatalogs​(boolean updateAll)
      • getUpdateFrequency

        public static int getUpdateFrequency()
      • setUpdateFrequency

        public static void setUpdateFrequency​(int freq)
      • getUpdateAction

        public static int getUpdateAction()
      • setUpdateAction

        public static void setUpdateAction​(int action)
      • isShowingAppUpdates

        public static boolean isShowingAppUpdates()
      • setShowingAppUpdates

        public static void setShowingAppUpdates​(boolean show)
      • isShowingNewPlugins

        public static boolean isShowingNewPlugins()
      • setShowingNewPlugins

        public static void setShowingNewPlugins​(boolean show)
      • startAutomaticUpdateTimer

        public static void startAutomaticUpdateTimer()
        Starts a timer that counts down until the next automatic update is due. If the timer is already running, it will be reset to match the current update frequency. The timer is normally started during application startup.