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

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.slaves;
25
26 import hudson.model.Descriptor;
27 import hudson.model.TaskListener;
28
29 import java.io.IOException;
30
31 /**
32 * {@link ComputerLauncher} filter that can be used as a base class for decorators.
33 *
34 * <p>
35 * Using this class also protects you from method additions in {@link ComputerLauncher},
36 * since these two classes are updated in sync.
37 *
38 * @author Kohsuke Kawaguchi
39 * @see SlaveComputer#grabLauncher(Node)
40 */
41 public abstract class ComputerLauncherFilter extends ComputerLauncher {
42 protected volatile ComputerLauncher core;
43
44 public ComputerLauncherFilter(ComputerLauncher core) {
45 this.core = core;
46 }
47
48 /**
49 * Returns the delegation target.
50 */
51 public ComputerLauncher getCore() {
52 return core;
53 }
54
55 @Override
56 public boolean isLaunchSupported() {
57 return core.isLaunchSupported();
58 }
59
60 @Override
61 public void launch(SlaveComputer computer, TaskListener listener) throws IOException, InterruptedException {
62 core.launch(computer, listener);
63 }
64
65 @Override
66 public void afterDisconnect(SlaveComputer computer, TaskListener listener) {
67 core.afterDisconnect(computer, listener);
68 }
69
70 @Override
71 public void beforeDisconnect(SlaveComputer computer, TaskListener listener) {
72 core.beforeDisconnect(computer, listener);
73 }
74
75 @Override
76 public Descriptor<ComputerLauncher> getDescriptor() {
77 throw new UnsupportedOperationException();
78 }
79 }
80