com.vaadin.copilot.
Class JetbrainsRuntimeUtil
Utility class for downloading and referencing a JetBrains Runtime.
-
Constructor Summary
ConstructorsConstructorDescriptionJetbrainsRuntimeUtil
(ProjectManager projectManager) Creates a new instance of JetbrainsRuntimeUtil.
-
Method Summary
Modifier and TypeMethodDescriptiondownloadLatestJBR
(Consumer<String> statusUpdater) Downloads the latest JetBrains Runtime and returns the downloaded file.
Returns the key to use for downloading the correct JBR SDK for the current architecture.
getHotswapAgentLocation
(File jdkFolder) Returns the location inside the JDK where HotswapAgent should be placed.
getJavaExecutable
(File jdkFolder) Returns the location of the Java executable inside the JDK.
Unpacks the given JetBrains Runtime archive into a folder.
-
Constructor Details
-
JetbrainsRuntimeUtil
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 unpackstatusUpdater
- the consumer to pass status information toReturns:
the folder where the archive was unpacked
Throws:
IOException
- if an I/O error occursArchiveExtractionException
- if the archive cannot be extracted -
getHotswapAgentLocation
Returns the location inside the JDK where HotswapAgent should be placed.
Parameters:
jdkFolder
- the JDK folderReturns:
the location inside the JDK where HotswapAgent should be placed
-
getJavaExecutable
Returns the location of the Java executable inside the JDK.
Parameters:
jdkFolder
- the JDK folderReturns:
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 toReturns:
the downloaded file, if any
Throws:
IOException
- if an I/O error occursURISyntaxException
- if there is an internal error with url handlingDownloadException
- if the download fails -
getDownloadKey
Returns the key to use for downloading the correct JBR SDK for the current architecture.
Returns:
the key to use for downloading
-