KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > hudson > model > Node


1 package hudson.model;
2
3 import hudson.Launcher;
4 import hudson.FilePath;
5 import hudson.util.EnumConverter;
6 import org.apache.commons.beanutils.ConvertUtils;
7
8 /**
9  * Commonality between {@link Slave} and master {@link Hudson}.
10  *
11  * @author Kohsuke Kawaguchi
12  */

13 public interface Node {
14     /**
15      * PluginName of this node.
16      *
17      * @return
18      * "" if this is master
19      */

20     String JavaDoc getNodeName();
21
22     /**
23      * Human-readable description of this node.
24      */

25     String JavaDoc getNodeDescription();
26
27     /**
28      * Returns a {@link Launcher} for executing programs on this node.
29      */

30     Launcher createLauncher(TaskListener listener);
31
32     /**
33      * Returns the number of {@link Executor}s.
34      *
35      * This may be different from <code>getExecutors().size()</code>
36      * because it takes time to adjust the number of executors.
37      */

38     int getNumExecutors();
39
40     /**
41      * Returns true if this node is only available
42      * for those jobs that exclusively specifies this node
43      * as the assigned node.
44      */

45     Mode getMode();
46
47     Computer createComputer();
48
49     /**
50      * Returns a "workspace" directory for the given {@link TopLevelItem}.
51      *
52      * <p>
53      * Workspace directory is usually used for keeping out the checked out
54      * source code, but it can be used for anything.
55      */

56     FilePath getWorkspaceFor(TopLevelItem item);
57
58     public enum Mode {
59         NORMAL("Utilize this slave as much as possible"),
60         EXCLUSIVE("Leave this machine for tied jobs only");
61
62         private final String JavaDoc description;
63
64         public String JavaDoc getDescription() {
65             return description;
66         }
67
68         public String JavaDoc getName() {
69             return name();
70         }
71
72         Mode(String JavaDoc description) {
73             this.description = description;
74         }
75
76         static {
77             ConvertUtils.register(new EnumConverter(),Mode.class);
78         }
79     }
80 }
81
Popular Tags