Class BootstrapRuntime

java.lang.Object
lu.kbra.modelizer_next.bootstrap.BootstrapRuntime
All Implemented Interfaces:
UpdateRuntime

public class BootstrapRuntime extends Object implements UpdateRuntime
Runtime coordinator that checks updates, prepares the installed application, and launches it.
  • Method Details

    • bootstrap

      public static BootstrapRuntime bootstrap() throws IOException
      Starts the bootstrap sequence.
      Returns:
      the bootstrap result
      Throws:
      IOException - if the operation cannot be completed
    • getInstance

      public static BootstrapRuntime getInstance()
      Returns the instance during bootstrap/update processing.
      Returns:
      the instance
    • isActive

      public static boolean isActive()
      Checks whether active is enabled or applies during bootstrap/update processing.
      Returns:
      true if active is enabled or applies; otherwise false
    • checkForUpdates

      public AvailableUpdate checkForUpdates() throws IOException
      Checks the for updates.
      Specified by:
      checkForUpdates in interface UpdateRuntime
      Returns:
      the check for updates result
      Throws:
      IOException - if the operation cannot be completed
    • getInstalledUpdatesDiskUsageBytes

      public long getInstalledUpdatesDiskUsageBytes() throws IOException
      Returns the installed updates disk usage bytes.
      Specified by:
      getInstalledUpdatesDiskUsageBytes in interface UpdateRuntime
      Returns:
      the installed updates disk usage bytes
      Throws:
      IOException - if the operation cannot be completed
    • getInstalledUpdatesFileCount

      public int getInstalledUpdatesFileCount() throws IOException
      Returns the installed updates file count.
      Specified by:
      getInstalledUpdatesFileCount in interface UpdateRuntime
      Returns:
      the installed updates file count
      Throws:
      IOException - if the operation cannot be completed
    • getInstalledUpdatesDirectory

      public Path getInstalledUpdatesDirectory()
      Returns the installed updates directory.
      Specified by:
      getInstalledUpdatesDirectory in interface UpdateRuntime
      Returns:
      the installed updates directory
    • freeUnusedInstalledUpdates

      public long freeUnusedInstalledUpdates() throws IOException
      Deletes installed update folders that are no longer needed.
      Specified by:
      freeUnusedInstalledUpdates in interface UpdateRuntime
      Returns:
      the free unused installed updates result
      Throws:
      IOException - if the operation cannot be completed
    • getBootstrapConfig

      public BootstrapConfig getBootstrapConfig()
      Returns the bootstrap config.
      Specified by:
      getBootstrapConfig in interface UpdateRuntime
      Returns:
      the bootstrap config
    • getBootstrapJson

      public com.fasterxml.jackson.databind.JsonNode getBootstrapJson()
      Returns the bootstrap JSON.
      Specified by:
      getBootstrapJson in interface UpdateRuntime
      Returns:
      the bootstrap JSON
    • getCurrentApplicationVersion

      public VersionComparator.ParsedVersion getCurrentApplicationVersion()
      Returns the current application version.
      Specified by:
      getCurrentApplicationVersion in interface UpdateRuntime
      Returns:
      the current application version
    • getSelectedChannel

      public UpdateChannel getSelectedChannel()
      Returns the selected channel during bootstrap/update processing.
      Specified by:
      getSelectedChannel in interface UpdateRuntime
      Returns:
      the selected channel
    • installUpdateAndRestart

      public boolean installUpdateAndRestart(Component parentComponent, AvailableUpdate update, UpdateRuntime.UpdatePreparation preparation) throws IOException
      Installs the update and restart.
      Specified by:
      installUpdateAndRestart in interface UpdateRuntime
      Parameters:
      parentComponent - parent component value used by the operation
      update - update metadata to download or install
      preparation - preparation value used by the operation
      Returns:
      true when the condition is met; otherwise false
      Throws:
      IOException - if the operation cannot be completed
    • isAutoCheckUpdates

      public boolean isAutoCheckUpdates()
      Checks whether auto check updates is enabled or applies.
      Specified by:
      isAutoCheckUpdates in interface UpdateRuntime
      Returns:
      true if auto check updates is enabled or applies; otherwise false
    • isAutomaticUpdateChecksEnabledByProperty

      public boolean isAutomaticUpdateChecksEnabledByProperty()
      Checks whether automatic update checks enabled by property is enabled or applies.
      Specified by:
      isAutomaticUpdateChecksEnabledByProperty in interface UpdateRuntime
      Returns:
      true if automatic update checks enabled by property is enabled or applies; otherwise false
    • isAvailable

      public boolean isAvailable()
      Checks whether available is enabled or applies during bootstrap/update processing.
      Specified by:
      isAvailable in interface UpdateRuntime
      Returns:
      true if available is enabled or applies; otherwise false
    • getForceJarName

      public String getForceJarName()
      Returns the force jar name during bootstrap/update processing.
      Returns:
      the force jar name
    • launch

      public void launch(String[] args, Queue<File> toBeOpened) throws Exception
      Launches the installed application.
      Parameters:
      args - command-line arguments supplied by the launcher
      toBeOpened - to be opened value used by the operation
      Throws:
      Exception - if the operation cannot be completed
    • setAutoCheckUpdates

      public void setAutoCheckUpdates(boolean enabled)
      Sets the auto check updates.
      Specified by:
      setAutoCheckUpdates in interface UpdateRuntime
      Parameters:
      enabled - whether enabled is enabled
    • setSelectedChannel

      public void setSelectedChannel(UpdateChannel updateChannel)
      Sets the selected channel during bootstrap/update processing.
      Specified by:
      setSelectedChannel in interface UpdateRuntime
      Parameters:
      updateChannel - update channel value used by the operation