|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.AbstractDescribableImpl<ToolInstallation>
hudson.tools.ToolInstallation
public abstract class ToolInstallation
Formalization of a tool installed in nodes used for builds. (Examples include things like JDKs, Ants, Mavens, and Groovys.)
You can define such a concept in your plugin entirely on your own, without extending from this class, but choosing this class as a base class has several benefits:
Implementations of this class are strongly encouraged to also implement NodeSpecific
(by using translateFor(Node, TaskListener)
) and
EnvironmentSpecific
(by using EnvVars.expand(String)
.)
Callers such as build steps can then use translate(AbstractBuild,TaskListener)
and cast to the desired ToolInstallation
subtype, or just call
NodeSpecific.forNode(hudson.model.Node, hudson.model.TaskListener)
and EnvironmentSpecific.forEnvironment(hudson.EnvVars)
directly.
To contribute an extension point, put Extension
on your ToolDescriptor
class.
Nested Class Summary | |
---|---|
protected static class |
ToolInstallation.ToolConverter
Subclasses can extend this for data migration from old field storing home directory. |
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Constructor Summary | |
---|---|
ToolInstallation(String name,
String home)
Deprecated. as of 1.302. Use ToolInstallation(String, String, List) |
|
ToolInstallation(String name,
String home,
List<? extends ToolProperty<?>> properties)
|
Method Summary | |
---|---|
static DescriptorExtensionList<ToolInstallation,ToolDescriptor<?>> |
all()
Returns all the registered ToolDescriptor s. |
void |
buildEnvVars(EnvVars env)
Expose any environment variables that this tool installation wants the build to see. |
String |
getHome()
Gets the home directory of this tool. |
String |
getName()
Gets the human readable name that identifies this tool among other ToolInstallation s of the same kind. |
DescribableList<ToolProperty<?>,ToolPropertyDescriptor> |
getProperties()
|
protected Object |
readResolve()
Invoked by XStream when this object is read into memory. |
ToolInstallation |
translate(AbstractBuild<?,?> buildInProgress,
TaskListener listener)
Convenient version of translate(Node, EnvVars, TaskListener) that just takes a build object in progress. |
ToolInstallation |
translate(Node node,
EnvVars envs,
TaskListener listener)
Performs a necessary variable/environment/context expansion. |
protected String |
translateFor(Node node,
TaskListener log)
Finds a tool on a node. |
Methods inherited from class hudson.model.AbstractDescribableImpl |
---|
getDescriptor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolInstallation(String name, String home)
ToolInstallation(String, String, List)
public ToolInstallation(String name, String home, List<? extends ToolProperty<?>> properties)
Method Detail |
---|
public String getName()
ToolInstallation
s of the same kind.
public String getHome()
public void buildEnvVars(EnvVars env)
To add entry to PATH, do envVars.put("PATH+XYZ",path)
where 'XYZ' is something unique.
Variable names of the form 'A+B' is interpreted as adding the value to the existing PATH.
public DescribableList<ToolProperty<?>,ToolPropertyDescriptor> getProperties()
public ToolInstallation translate(Node node, EnvVars envs, TaskListener listener) throws IOException, InterruptedException
node
- Node that this tool is used in.envs
- Set of environment variables to expand any references.listener
- Any lengthy operation (such as auto-installation) will report its progress here.
ToolInstallation
object that is fully specialized.
IOException
InterruptedException
NodeSpecific
,
EnvironmentSpecific
public ToolInstallation translate(AbstractBuild<?,?> buildInProgress, TaskListener listener) throws IOException, InterruptedException
translate(Node, EnvVars, TaskListener)
that just takes a build object in progress.
IOException
InterruptedException
protected String translateFor(Node node, TaskListener log) throws IOException, InterruptedException
ToolLocationTranslator
s.
Otherwise returns installation.getHome()
.
This is the core logic behind NodeSpecific.forNode(Node, TaskListener)
for ToolInstallation
,
and meant to be used by the forNode
implementations.
IOException
InterruptedException
protected Object readResolve()
public static DescriptorExtensionList<ToolInstallation,ToolDescriptor<?>> all()
ToolDescriptor
s.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |