From 930ffc076885f31aa27524ac9b758894c8b6f70f Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 18 May 2008 23:36:04 +0000 Subject: [PATCH] Renamed to reflect what it really does. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9415 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Functions.java | 6 ++--- core/src/main/java/hudson/model/Computer.java | 4 +-- core/src/main/java/hudson/model/Hudson.java | 6 ++--- core/src/main/java/hudson/model/Slave.java | 26 +++++++++---------- ...dStartMethod.java => CommandLauncher.java} | 12 ++++----- ...StartMethod.java => ComputerLauncher.java} | 15 ++++++----- ...JNLPStartMethod.java => JNLPLauncher.java} | 10 +++---- .../java/hudson/slaves/SlaveComputer.java | 14 +++++----- .../hudson/model/Computer/index.jelly | 2 +- .../model/Hudson/configureExecutors.jelly | 8 +++--- .../config.jelly | 2 +- .../config_ja.properties | 0 .../main.jelly | 0 .../config.jelly | 0 .../main.jelly | 0 15 files changed, 53 insertions(+), 52 deletions(-) rename core/src/main/java/hudson/slaves/{CommandStartMethod.java => CommandLauncher.java} (88%) rename core/src/main/java/hudson/slaves/{ComputerStartMethod.java => ComputerLauncher.java} (69%) rename core/src/main/java/hudson/slaves/{JNLPStartMethod.java => JNLPLauncher.java} (67%) rename core/src/main/resources/hudson/slaves/{CommandStartMethod => CommandLauncher}/config.jelly (73%) rename core/src/main/resources/hudson/slaves/{CommandStartMethod => CommandLauncher}/config_ja.properties (100%) rename core/src/main/resources/hudson/slaves/{CommandStartMethod => CommandLauncher}/main.jelly (100%) rename core/src/main/resources/hudson/slaves/{JNLPStartMethod => JNLPLauncher}/config.jelly (100%) rename core/src/main/resources/hudson/slaves/{JNLPStartMethod => JNLPLauncher}/main.jelly (100%) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index c7fbd4aed8..c81339aa81 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -13,7 +13,7 @@ import hudson.security.SecurityRealm; import hudson.security.AuthorizationStrategy; import hudson.security.Permission; import hudson.util.Area; -import hudson.slaves.ComputerStartMethod; +import hudson.slaves.ComputerLauncher; import hudson.slaves.RetentionStrategy; import org.apache.commons.jexl.parser.ASTSizeFunction; import org.apache.commons.jexl.util.Introspector; @@ -494,8 +494,8 @@ public class Functions { return BuildStepDescriptor.filter(BuildStep.PUBLISHERS, project.getClass()); } - public static List> getSlaveStartMethodDescriptors() { - return ComputerStartMethod.LIST; + public static List> getSlaveStartMethodDescriptors() { + return ComputerLauncher.LIST; } public static List>> getSlaveAvailabilityStrategyDescriptors() { diff --git a/core/src/main/java/hudson/model/Computer.java b/core/src/main/java/hudson/model/Computer.java index d295a90cc6..4ec5d87ff4 100644 --- a/core/src/main/java/hudson/model/Computer.java +++ b/core/src/main/java/hudson/model/Computer.java @@ -1,7 +1,7 @@ package hudson.model; import hudson.EnvVars; -import hudson.slaves.ComputerStartMethod; +import hudson.slaves.ComputerLauncher; import hudson.slaves.RetentionStrategy; import hudson.node_monitors.NodeMonitor; import hudson.remoting.Channel; @@ -127,7 +127,7 @@ public abstract class Computer extends AbstractModelObject { /** * Returns true if this computer is supposed to be launched via JNLP. - * @deprecated see {@linkplain #isLaunchSupported()} and {@linkplain ComputerStartMethod} + * @deprecated see {@linkplain #isLaunchSupported()} and {@linkplain ComputerLauncher} */ @Exported @Deprecated diff --git a/core/src/main/java/hudson/model/Hudson.java b/core/src/main/java/hudson/model/Hudson.java index 2f7f5faae5..f9540f96c4 100644 --- a/core/src/main/java/hudson/model/Hudson.java +++ b/core/src/main/java/hudson/model/Hudson.java @@ -14,7 +14,7 @@ import hudson.TcpSlaveAgentListener; import hudson.Util; import static hudson.Util.fixEmpty; import hudson.XmlFile; -import hudson.slaves.ComputerStartMethod; +import hudson.slaves.ComputerLauncher; import hudson.slaves.RetentionStrategy; import hudson.model.Descriptor.FormException; import hudson.model.listeners.ItemListener; @@ -1523,10 +1523,10 @@ public final class Hudson extends View implements ItemGroup, Node, } private Slave newSlave(StaplerRequest req, JSONObject j) throws FormException { - final ComputerStartMethod startMethod = newDescribedChild(req, j, "startMethod", ComputerStartMethod.LIST); + final ComputerLauncher launcher = newDescribedChild(req, j, "launcher", ComputerLauncher.LIST); final RetentionStrategy retentionStrategy = newDescribedChild(req, j, "availabilityStrategy", RetentionStrategy.LIST); final Slave slave = req.bindJSON(Slave.class, j); - slave.setStartMethod(startMethod); + slave.setStartMethod(launcher); slave.setRetentionStrategy(retentionStrategy); return slave; } diff --git a/core/src/main/java/hudson/model/Slave.java b/core/src/main/java/hudson/model/Slave.java index 2e119ad215..9f476dfbc8 100644 --- a/core/src/main/java/hudson/model/Slave.java +++ b/core/src/main/java/hudson/model/Slave.java @@ -4,10 +4,10 @@ import hudson.FilePath; import hudson.Launcher; import hudson.Launcher.RemoteLauncher; import hudson.Util; -import hudson.slaves.ComputerStartMethod; +import hudson.slaves.ComputerLauncher; import hudson.slaves.RetentionStrategy; -import hudson.slaves.CommandStartMethod; -import hudson.slaves.JNLPStartMethod; +import hudson.slaves.CommandLauncher; +import hudson.slaves.JNLPLauncher; import hudson.slaves.SlaveComputer; import hudson.model.Descriptor.FormException; import hudson.remoting.Callable; @@ -71,7 +71,7 @@ public final class Slave implements Node, Serializable { /** * The starter that will startup this slave. */ - private ComputerStartMethod startMethod; + private ComputerLauncher launcher; /** * Whitespace-separated labels. @@ -114,12 +114,12 @@ public final class Slave implements Node, Serializable { throw new FormException(Messages.Slave_InvalidConfig_Executors(name), null); } - public ComputerStartMethod getStartMethod() { - return startMethod == null ? new JNLPStartMethod() : startMethod; + public ComputerLauncher getStartMethod() { + return launcher == null ? new JNLPLauncher() : launcher; } - public void setStartMethod(ComputerStartMethod startMethod) { - this.startMethod = startMethod; + public void setStartMethod(ComputerLauncher launcher) { + this.launcher = launcher; } public String getRemoteFS() { @@ -340,10 +340,10 @@ public final class Slave implements Node, Serializable { if(command.length()>0) command += ' '; agentCommand = command+"java -jar ~/bin/slave.jar"; } - if (startMethod == null) { - startMethod = (agentCommand == null || agentCommand.trim().length() == 0) - ? new JNLPStartMethod() - : new CommandStartMethod(agentCommand); + if (launcher == null) { + launcher = (agentCommand == null || agentCommand.trim().length() == 0) + ? new JNLPLauncher() + : new CommandLauncher(agentCommand); } return this; } @@ -384,6 +384,6 @@ public final class Slave implements Node, Serializable { // } // return null; //To change body of implemented methods use File | Settings | File Templates. // } -// }, ComputerStartMethod.class); +// }, ComputerLauncher.class); // } } diff --git a/core/src/main/java/hudson/slaves/CommandStartMethod.java b/core/src/main/java/hudson/slaves/CommandLauncher.java similarity index 88% rename from core/src/main/java/hudson/slaves/CommandStartMethod.java rename to core/src/main/java/hudson/slaves/CommandLauncher.java index a4144e3acf..05aba7aa14 100644 --- a/core/src/main/java/hudson/slaves/CommandStartMethod.java +++ b/core/src/main/java/hudson/slaves/CommandLauncher.java @@ -16,12 +16,12 @@ import java.util.logging.Logger; import java.io.IOException; /** - * {@link ComputerStartMethod} through a remote login mechanism like ssh/rsh. + * {@link ComputerLauncher} through a remote login mechanism like ssh/rsh. * * @author Stephen Connolly * @author Kohsuke Kawaguchi */ -public class CommandStartMethod extends ComputerStartMethod { +public class CommandLauncher extends ComputerLauncher { /** * Command line to launch the agent, like @@ -30,7 +30,7 @@ public class CommandStartMethod extends ComputerStartMethod { private String agentCommand; @DataBoundConstructor - public CommandStartMethod(String command) { + public CommandLauncher(String command) { this.agentCommand = command; } @@ -38,11 +38,11 @@ public class CommandStartMethod extends ComputerStartMethod { return agentCommand; } - public Descriptor getDescriptor() { + public Descriptor getDescriptor() { return DESCRIPTOR; } - public static final Descriptor DESCRIPTOR = new Descriptor(CommandStartMethod.class) { + public static final Descriptor DESCRIPTOR = new Descriptor(CommandLauncher.class) { public String getDisplayName() { return "Launch slave via execution of command on the Master"; } @@ -98,7 +98,7 @@ public class CommandStartMethod extends ComputerStartMethod { } } - private static final Logger LOGGER = Logger.getLogger(CommandStartMethod.class.getName()); + private static final Logger LOGGER = Logger.getLogger(CommandLauncher.class.getName()); static { LIST.add(DESCRIPTOR); diff --git a/core/src/main/java/hudson/slaves/ComputerStartMethod.java b/core/src/main/java/hudson/slaves/ComputerLauncher.java similarity index 69% rename from core/src/main/java/hudson/slaves/ComputerStartMethod.java rename to core/src/main/java/hudson/slaves/ComputerLauncher.java index 67467bd368..22a8cdf486 100644 --- a/core/src/main/java/hudson/slaves/ComputerStartMethod.java +++ b/core/src/main/java/hudson/slaves/ComputerLauncher.java @@ -11,7 +11,8 @@ import java.io.InputStream; import java.io.OutputStream; /** - * Extension point to allow control over how Slaves are started. + * Extension point to allow control over how {@link Computer}s are "launched", + * meaning how they get connected to their slave agent program. * *

* EXPERIMENTAL: SIGNATURE MAY CHANGE IN FUTURE RELEASES @@ -19,9 +20,9 @@ import java.io.OutputStream; * @author Stephen Connolly * @since 24-Apr-2008 22:12:35 */ -public abstract class ComputerStartMethod implements Describable, ExtensionPoint { +public abstract class ComputerLauncher implements Describable, ExtensionPoint { /** - * Returns true if this {@link ComputerStartMethod} supports + * Returns true if this {@link ComputerLauncher} supports * programatic launch of the slave agent in the target {@link Computer}. */ public boolean isLaunchSupported() { @@ -43,12 +44,12 @@ public abstract class ComputerStartMethod implements Describable LIST = new DescriptorList(); + public static final DescriptorList LIST = new DescriptorList(); static { - LIST.load(JNLPStartMethod.class); - LIST.load(CommandStartMethod.class); + LIST.load(JNLPLauncher.class); + LIST.load(CommandLauncher.class); } } diff --git a/core/src/main/java/hudson/slaves/JNLPStartMethod.java b/core/src/main/java/hudson/slaves/JNLPLauncher.java similarity index 67% rename from core/src/main/java/hudson/slaves/JNLPStartMethod.java rename to core/src/main/java/hudson/slaves/JNLPLauncher.java index 54114746e2..3c22fcd94e 100644 --- a/core/src/main/java/hudson/slaves/JNLPStartMethod.java +++ b/core/src/main/java/hudson/slaves/JNLPLauncher.java @@ -5,14 +5,14 @@ import hudson.util.StreamTaskListener; import org.kohsuke.stapler.DataBoundConstructor; /** - * {@link ComputerStartMethod} via JNLP. + * {@link ComputerLauncher} via JNLP. * * @author Stephen Connolly * @author Kohsuke Kawaguchi */ -public class JNLPStartMethod extends ComputerStartMethod { +public class JNLPLauncher extends ComputerLauncher { @DataBoundConstructor - public JNLPStartMethod() { + public JNLPLauncher() { } @Override @@ -24,11 +24,11 @@ public class JNLPStartMethod extends ComputerStartMethod { // do nothing as we cannot self start } - public Descriptor getDescriptor() { + public Descriptor getDescriptor() { return DESCRIPTOR; } - public static final Descriptor DESCRIPTOR = new Descriptor(JNLPStartMethod.class) { + public static final Descriptor DESCRIPTOR = new Descriptor(JNLPLauncher.class) { public String getDisplayName() { return "Launch slave agents via JNLP"; } diff --git a/core/src/main/java/hudson/slaves/SlaveComputer.java b/core/src/main/java/hudson/slaves/SlaveComputer.java index bfce7e5ecf..74c82f1cbf 100644 --- a/core/src/main/java/hudson/slaves/SlaveComputer.java +++ b/core/src/main/java/hudson/slaves/SlaveComputer.java @@ -46,7 +46,7 @@ import javax.servlet.http.HttpServletResponse; public final class SlaveComputer extends Computer { private volatile Channel channel; private Boolean isUnix; - private ComputerStartMethod startMethod; + private ComputerLauncher launcher; /** * Number of failed attempts to reconnect to this node @@ -83,16 +83,16 @@ public final class SlaveComputer extends Computer { @Override @Deprecated public boolean isJnlpAgent() { - return startMethod instanceof JNLPStartMethod; + return launcher instanceof JNLPLauncher; } @Override public boolean isLaunchSupported() { - return startMethod.isLaunchSupported(); + return launcher.isLaunchSupported(); } - public ComputerStartMethod getStartMethod() { - return startMethod; + public ComputerLauncher getLauncher() { + return launcher; } public void launch() { @@ -103,7 +103,7 @@ public final class SlaveComputer extends Computer { public void run() { // do this on another thread so that the lengthy launch operation // (which is typical) won't block UI thread. - startMethod.launch(SlaveComputer.this, new StreamTaskListener(openLogFile())); + launcher.launch(SlaveComputer.this, new StreamTaskListener(openLogFile())); } }); } @@ -256,7 +256,7 @@ public final class SlaveComputer extends Computer { @Override protected void setNode(Node node) { super.setNode(node); - startMethod = ((Slave)node).getStartMethod(); + launcher = ((Slave)node).getStartMethod(); // maybe the configuration was changed to relaunch the slave, so try to re-launch now. launch(); diff --git a/core/src/main/resources/hudson/model/Computer/index.jelly b/core/src/main/resources/hudson/model/Computer/index.jelly index 90a1c6edcf..b35c596994 100644 --- a/core/src/main/resources/hudson/model/Computer/index.jelly +++ b/core/src/main/resources/hudson/model/Computer/index.jelly @@ -19,7 +19,7 @@ ${it.caption} - +

diff --git a/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly b/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly index e9b59e5459..d1a0e82b3e 100644 --- a/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly +++ b/core/src/main/resources/hudson/model/Hudson/configureExecutors.jelly @@ -63,18 +63,18 @@ + help="/help/system-config/master-slave/launcher.html"> -
+
+ value="${h.ifThenElse(s.launcher.descriptor==d,s.launcher,null)}"/>
diff --git a/core/src/main/resources/hudson/slaves/CommandStartMethod/config.jelly b/core/src/main/resources/hudson/slaves/CommandLauncher/config.jelly similarity index 73% rename from core/src/main/resources/hudson/slaves/CommandStartMethod/config.jelly rename to core/src/main/resources/hudson/slaves/CommandLauncher/config.jelly index 96ac592652..ce8004699e 100644 --- a/core/src/main/resources/hudson/slaves/CommandStartMethod/config.jelly +++ b/core/src/main/resources/hudson/slaves/CommandLauncher/config.jelly @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/core/src/main/resources/hudson/slaves/CommandStartMethod/config_ja.properties b/core/src/main/resources/hudson/slaves/CommandLauncher/config_ja.properties similarity index 100% rename from core/src/main/resources/hudson/slaves/CommandStartMethod/config_ja.properties rename to core/src/main/resources/hudson/slaves/CommandLauncher/config_ja.properties diff --git a/core/src/main/resources/hudson/slaves/CommandStartMethod/main.jelly b/core/src/main/resources/hudson/slaves/CommandLauncher/main.jelly similarity index 100% rename from core/src/main/resources/hudson/slaves/CommandStartMethod/main.jelly rename to core/src/main/resources/hudson/slaves/CommandLauncher/main.jelly diff --git a/core/src/main/resources/hudson/slaves/JNLPStartMethod/config.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly similarity index 100% rename from core/src/main/resources/hudson/slaves/JNLPStartMethod/config.jelly rename to core/src/main/resources/hudson/slaves/JNLPLauncher/config.jelly diff --git a/core/src/main/resources/hudson/slaves/JNLPStartMethod/main.jelly b/core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly similarity index 100% rename from core/src/main/resources/hudson/slaves/JNLPStartMethod/main.jelly rename to core/src/main/resources/hudson/slaves/JNLPLauncher/main.jelly -- GitLab