Package hudson.tools
Class DownloadFromUrlInstaller
- java.lang.Object
-
- hudson.tools.ToolInstaller
-
- hudson.tools.DownloadFromUrlInstaller
-
- All Implemented Interfaces:
ExtensionPoint,Describable<ToolInstaller>
- Direct Known Subclasses:
Maven.MavenInstaller
public abstract class DownloadFromUrlInstaller extends ToolInstaller
Partial convenience implementation ofToolInstallerthat just downloads an archive from the URL and extracts it.Each instance of this is configured to download from a specific URL identified by an ID.
- Since:
- 1.308
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDownloadFromUrlInstaller.DescriptorImpl<T extends DownloadFromUrlInstaller>static classDownloadFromUrlInstaller.InstallableDownloadable and installable tool.static classDownloadFromUrlInstaller.InstallableListUsed for JSON databinding to parse the obtained list.classDownloadFromUrlInstaller.NodeSpecificInstallableConvenient abstract class to implement a NodeSpecificInstallable based on an existing Installable-
Nested classes/interfaces inherited from class hudson.tools.ToolInstaller
ToolInstaller.ToolInstallerEntry, ToolInstaller.ToolInstallerList
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description Stringid-
Fields inherited from class hudson.tools.ToolInstaller
tool
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDownloadFromUrlInstaller(String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected FilePathfindPullUpDirectory(FilePath root)Often an archive contains an extra top-level directory that's unnecessary when extracted on the disk into the expected location.DownloadFromUrlInstaller.InstallablegetInstallable()Gets theDownloadFromUrlInstaller.Installableidentified byid.protected booleanisUpToDate(FilePath expectedLocation, DownloadFromUrlInstaller.Installable i)Checks if the specified expected location already contains the installed version of the tool.FilePathperformInstallation(ToolInstallation tool, Node node, TaskListener log)Ensure that the configured tool is really installed.-
Methods inherited from class hudson.tools.ToolInstaller
appliesTo, getDescriptor, getLabel, preferredLocation, setTool
-
-
-
-
Field Detail
-
id
public final String id
-
-
Constructor Detail
-
DownloadFromUrlInstaller
protected DownloadFromUrlInstaller(String id)
-
-
Method Detail
-
isUpToDate
protected boolean isUpToDate(FilePath expectedLocation, DownloadFromUrlInstaller.Installable i) throws IOException, InterruptedException
Checks if the specified expected location already contains the installed version of the tool. This check needs to run fairly efficiently. The current implementation uses the source URL ofDownloadFromUrlInstaller.Installable, based on the assumption that released bits do not change its content.- Throws:
IOExceptionInterruptedException
-
getInstallable
public DownloadFromUrlInstaller.Installable getInstallable() throws IOException
Gets theDownloadFromUrlInstaller.Installableidentified byid.- Returns:
- null if no such ID is found.
- Throws:
IOException
-
performInstallation
public FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException
Description copied from class:ToolInstallerEnsure that the configured tool is really installed. If it is already installed, do nothing. Called only ifToolInstaller.appliesTo(Node)are true.- Specified by:
performInstallationin classToolInstaller- Parameters:
tool- the tool being installednode- the computer on which to install the toollog- any status messages produced by the installation go here- Returns:
- the (directory) path at which the tool can be found,
typically coming from
ToolInstaller.preferredLocation(hudson.tools.ToolInstallation, hudson.model.Node) - Throws:
IOException- if installation failsInterruptedException- if communication with a agent is interrupted
-
findPullUpDirectory
protected FilePath findPullUpDirectory(FilePath root) throws IOException, InterruptedException
Often an archive contains an extra top-level directory that's unnecessary when extracted on the disk into the expected location. If your installation sources provide that kind of archives, override this method to find the real root location.The caller will "pull up" the discovered real root by throw away the intermediate directory, so that the user-configured "tool home" directory contains the right files.
The default implementation applies some heuristics to auto-determine if the pull up is necessary. This should work for typical archive files.
- Parameters:
root- The directory that contains the extracted archive. This directory contains nothing but the extracted archive. For example, if the user installed jakarta-ant-1.1.zip , this directory would contain a single directory "jakarta-ant".- Returns:
- Return the real top directory inside
rootthat contains the meat. In the above example,root.child("jakarta-ant")should be returned. If there's no directory to pull up, return null. - Throws:
IOExceptionInterruptedException
-
-