Class Upgrader

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Runnable, Accessible, RootPaneContainer, WindowConstants

public class Upgrader extends JFrame implements Runnable
This class implements an upgrader that replaces the current executing copy of YAAC with a newer version freshly downloaded from the distribution website. It assumes it will run in a different JVM instance than YAAC was (launched by Runtime.exec()) so that all files used by YAAC will be closed and therefore deleteable and replaceable by the upgrader (for example, Microsoft Windows does not allow deleting or overwriting a file that is currently in use by another program). As such, the upgrader must be delivered in a JAR file separate from YAAC.jar and all other JAR files used by YAAC. Furthermore, the upgrader cannot install the upgrader file itself; YAAC needs to install the upgrader.jar on an initial install and leave it alone for all future upgrades, or upgraded upgraders have to be installed under a different path name, and moved into their correct place after the upgraded YAAC is started the first time.

Note that this Upgrader is a Java Swing application, and therefore can only be used on Java Standard Edition platforms with a graphical UI (not on Android, for example). Currently, the only code that runs this program is in the Java Swing GUI code of YAAC proper, which guarantees that Swing support will be available.

Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Details

    • Upgrader

      public Upgrader(ResourceBundle rb, File baseDir, String[] startupOptions) throws HeadlessException
      Creates a new, initially invisible Frame with the specified title. This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.
      Parameters:
      rb - ResourceBundle for localizing displayed messages
      baseDir - File pointing at directory where YAAC is installed
      startupOptions - String array of startup command-line options, or null if no options passed
      Throws:
      HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
  • Method Details

    • main

      public static void main(String[] args)
      Start the upgrade sequence with the distribution zip file.
      Parameters:
      args - ignored
    • run

      public void run()
      Execute the background upgrade operation, reporting progress to the foreground GUI thread,
      Specified by:
      run in interface Runnable