public class DownloadHelper
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
downloadIfRequired(java.lang.String toolName,
java.net.URL url)
Download tool if required.
|
java.util.concurrent.CompletableFuture<java.lang.String> |
downloadIfRequiredAsync(java.lang.String toolName,
java.net.URL url) |
static DownloadHelper |
getInstance() |
public static DownloadHelper getInstance()
public java.lang.String downloadIfRequired(java.lang.String toolName,
java.net.URL url)
throws java.io.IOException
{
"tools": {
"tool": {
"version": "1.0.0",
"versionCmd": "version", //the argument(s) to add to cmdFileName to get the version
"versionExtractRegExp": "", //the regular expression to extract the version string from the version command
"versionMatchRegExpr": "", //the regular expression use to match the extracted version to decide if download if required
"baseDir": "" //the basedir to install to, a sub folder named after version will be created, can use $HOME
"platforms": {
"win": {
"url": "https://tool.com/tool/v1.0.0/odo-windows-amd64.exe.tar.gz",
"cmdFileName": "tool.exe",
"dlFileName": "tool-windows-amd64.exe.gz"
},
"osx": {
"url": "https://tool.com/tool/v1.0.0/odo-darwin-amd64.tar.gz",
"cmdFileName": "tool",
"dlFileName": "tool-darwin-amd64.gz"
},
"lnx": {
"url": "https://tool.com/tool/v1.0.0/odo-linux-amd64.tar.gz",
"cmdFileName": "odo",
"dlFileName": "odo-linux-amd64.gz"
}
}
}
}
}
toolName - the name of the tool to downloadurl - the URL to the tool description filejava.io.IOExceptionpublic java.util.concurrent.CompletableFuture<java.lang.String> downloadIfRequiredAsync(java.lang.String toolName,
java.net.URL url)