Package hudson.tools
Class ToolInstaller
java.lang.Object
hudson.tools.ToolInstaller
- All Implemented Interfaces:
ExtensionPoint
,Describable<ToolInstaller>
- Direct Known Subclasses:
AbstractCommandInstaller
,DownloadFromUrlInstaller
,ZipExtractionInstaller
public abstract class ToolInstaller
extends Object
implements Describable<ToolInstaller>, ExtensionPoint
An object which can ensure that a generic
ToolInstallation
in fact exists on a node.
The properties can be added to ToolInstallation
using the InstallSourceProperty
.
The subclass should have a ToolInstallerDescriptor
.
A config.jelly
should be provided to customize specific fields;
<t:label xmlns:t="/hudson/tools"/>
to customize label
.- Since:
- 1.305
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
static final class
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
ToolInstaller
(String label) Subclasses should pass these parameters in usingDataBoundConstructor
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether this installer can be applied to a given node.Gets the descriptor for this instance.final String
getLabel()
Label to limit which nodes this installation can be performed on.abstract FilePath
performInstallation
(ToolInstallation tool, Node node, TaskListener log) Ensure that the configured tool is really installed.protected final FilePath
preferredLocation
(ToolInstallation tool, Node node) Convenience method to find a location to install a tool.protected void
Called during the initialization to tellToolInstaller
whatToolInstallation
it is configured against.
-
Field Details
-
tool
-
-
Constructor Details
-
ToolInstaller
Subclasses should pass these parameters in usingDataBoundConstructor
.
-
-
Method Details
-
setTool
Called during the initialization to tellToolInstaller
whatToolInstallation
it is configured against. -
getLabel
Label to limit which nodes this installation can be performed on. Can be null to not impose a limit. -
appliesTo
Checks whether this installer can be applied to a given node. (By default, just checks the label.) -
performInstallation
public abstract FilePath performInstallation(ToolInstallation tool, Node node, TaskListener log) throws IOException, InterruptedException Ensure that the configured tool is really installed. If it is already installed, do nothing. Called only ifappliesTo(Node)
are true.- 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
preferredLocation(hudson.tools.ToolInstallation, hudson.model.Node)
- Throws:
IOException
- if installation failsInterruptedException
- if communication with a agent is interrupted
-
preferredLocation
Convenience method to find a location to install a tool.- Parameters:
tool
- the tool being installednode
- the computer on which to install the tool- Returns:
ToolInstallation.getHome()
if specified, else a path within the local Jenkins work area named according toToolInstallation.getName()
- Since:
- 1.310
-
getDescriptor
Description copied from interface:Describable
Gets the descriptor for this instance.Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<ToolInstaller>
-