File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\LauncherDecorator.java.html

1 package hudson;
2
3 import jenkins.model.Jenkins;
4 import hudson.model.Node;
5 import hudson.model.Executor;
6 import hudson.tasks.BuildWrapper;
7
8 /**
9 * Decorates {@link Launcher} so that one can intercept executions of commands
10 * and alters the command being executed, such as doing this in fakeroot, sudo, pfexec, etc.
11 *
12 * @author Kohsuke Kawaguchi
13 * @since 1.299
14 * @see BuildWrapper#decorateLauncher(AbstractBuild, Launcher, BuildListener)
15 */
16 public abstract class LauncherDecorator implements ExtensionPoint {
17 /**
18 * Called from {@link Node#createLauncher(TaskListener)} to decorate the launchers.
19 *
20 * <p>
21 * This method should perform node-specific decoration. For job-specific decoration,
22 * {@link BuildWrapper#decorateLauncher(AbstractBuild, Launcher, BuildListener)} might
23 * fit your needs better.
24 *
25 * <p>
26 * If the implementation wants to do something differently if the launcher is
27 * for a build, call {@link Executor#currentExecutor()}. If it returns non-null
28 * you can figure out the current build in progress from there. Note that
29 * {@link Launcher}s are also created for doing things other than builds,
30 * so {@link Executor#currentExecutor()} may return null. Also, for job-specific
31 * decoration, see {@link BuildWrapper#decorateLauncher(AbstractBuild, Launcher, BuildListener)} as well.
32 *
33 * @param launcher
34 * The base launcher that you can decorate. Never null.
35 * @param node
36 * Node for which this launcher is created. Never null.
37 * @return
38 * Never null. Return the 'launcher' parameter to do no-op.
39 * @see Launcher#decorateFor(Node)
40 * @see Launcher#decorateByPrefix(String[])
41 */
42 public abstract Launcher decorate(Launcher launcher, Node node);
43
44 /**
45 * Returns all the registered {@link LauncherDecorator}s.
46 */
47 public static ExtensionList<LauncherDecorator> all() {
48 return Jenkins.getInstance().getExtensionList(LauncherDecorator.class);
49 }
50 }
51