Class JetbrainsRuntimeUtil

java.lang.Object
com.vaadin.copilot.JetbrainsRuntimeUtil

public final class JetbrainsRuntimeUtil extends Object
Utility class for downloading and referencing a JetBrains Runtime.
  • Constructor Details

    • JetbrainsRuntimeUtil

      public JetbrainsRuntimeUtil(ProjectManager projectManager)
      Creates a new instance of JetbrainsRuntimeUtil.
      Parameters:
      projectManager - the project manager to use
  • Method Details

    • unpackJbr

      public File unpackJbr(File jbrArchive, Consumer<String> statusUpdater) throws IOException, ArchiveExtractionException
      Unpacks the given JetBrains Runtime archive into a folder.
      Parameters:
      jbrArchive - the archive to unpack
      statusUpdater - the consumer to pass status information to
      Returns:
      the folder where the archive was unpacked
      Throws:
      IOException - if an I/O error occurs
      ArchiveExtractionException - if the archive cannot be extracted
    • getHotswapAgentLocation

      public File getHotswapAgentLocation(File jdkFolder)
      Returns the location inside the JDK where HotswapAgent should be placed.
      Parameters:
      jdkFolder - the JDK folder
      Returns:
      the location inside the JDK where HotswapAgent should be placed
    • getJavaExecutable

      public File getJavaExecutable(File jdkFolder)
      Returns the location of the Java executable inside the JDK.
      Parameters:
      jdkFolder - the JDK folder
      Returns:
      the location of the Java executable inside the JDK
    • downloadLatestJBR

      public Optional<File> downloadLatestJBR(Consumer<String> statusUpdater) throws IOException, URISyntaxException, DownloadException
      Downloads the latest JetBrains Runtime and returns the downloaded file.

      The downloaded file will be placed in the Vaadin home directory under the "jdk" folder. If the file already exists, it will not be downloaded again.

      If no suitable download is found, an empty optional is returned.

      Parameters:
      statusUpdater - the consumer to pass status information to
      Returns:
      the downloaded file, if any
      Throws:
      IOException - if an I/O error occurs
      URISyntaxException - if there is an internal error with url handling
      DownloadException - if the download fails
    • getDownloadKey

      public String getDownloadKey()
      Returns the key to use for downloading the correct JBR SDK for the current architecture.
      Returns:
      the key to use for downloading