提交 930ffc07 编写于 作者: K kohsuke

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
上级 5450534d
......@@ -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<Descriptor<ComputerStartMethod>> getSlaveStartMethodDescriptors() {
return ComputerStartMethod.LIST;
public static List<Descriptor<ComputerLauncher>> getSlaveStartMethodDescriptors() {
return ComputerLauncher.LIST;
}
public static List<Descriptor<RetentionStrategy<?>>> getSlaveAvailabilityStrategyDescriptors() {
......
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
......
......@@ -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<TopLevelItem>, 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;
}
......
......@@ -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);
// }
}
......@@ -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<ComputerStartMethod> getDescriptor() {
public Descriptor<ComputerLauncher> getDescriptor() {
return DESCRIPTOR;
}
public static final Descriptor<ComputerStartMethod> DESCRIPTOR = new Descriptor<ComputerStartMethod>(CommandStartMethod.class) {
public static final Descriptor<ComputerLauncher> DESCRIPTOR = new Descriptor<ComputerLauncher>(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);
......
......@@ -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.
*
* <p>
* <b>EXPERIMENTAL: SIGNATURE MAY CHANGE IN FUTURE RELEASES</b>
......@@ -19,9 +20,9 @@ import java.io.OutputStream;
* @author Stephen Connolly
* @since 24-Apr-2008 22:12:35
*/
public abstract class ComputerStartMethod implements Describable<ComputerStartMethod>, ExtensionPoint {
public abstract class ComputerLauncher implements Describable<ComputerLauncher>, 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<ComputerStartMe
public abstract void launch(SlaveComputer computer, StreamTaskListener listener);
/**
* All registered {@link ComputerStartMethod} implementations.
* All registered {@link ComputerLauncher} implementations.
*/
public static final DescriptorList<ComputerStartMethod> LIST = new DescriptorList<ComputerStartMethod>();
public static final DescriptorList<ComputerLauncher> LIST = new DescriptorList<ComputerLauncher>();
static {
LIST.load(JNLPStartMethod.class);
LIST.load(CommandStartMethod.class);
LIST.load(JNLPLauncher.class);
LIST.load(CommandLauncher.class);
}
}
......@@ -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<ComputerStartMethod> getDescriptor() {
public Descriptor<ComputerLauncher> getDescriptor() {
return DESCRIPTOR;
}
public static final Descriptor<ComputerStartMethod> DESCRIPTOR = new Descriptor<ComputerStartMethod>(JNLPStartMethod.class) {
public static final Descriptor<ComputerLauncher> DESCRIPTOR = new Descriptor<ComputerLauncher>(JNLPLauncher.class) {
public String getDisplayName() {
return "Launch slave agents via JNLP";
}
......
......@@ -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();
......
......@@ -19,7 +19,7 @@
${it.caption}
</h1>
<st:include from="${it.startMethod}" page="main.jelly" optional="true"/>
<st:include from="${it.launcher}" page="main.jelly" optional="true"/>
<j:if test="${it.node.assignedLabels.size() gt 1}">
<div>
......
......@@ -63,18 +63,18 @@
</s:entry>
<s:dropdownList name="slave.startMethodClass" title="${%Start method}"
help="/help/system-config/master-slave/startMethod.html">
help="/help/system-config/master-slave/launcher.html">
<j:forEach var="d" items="${h.getSlaveStartMethodDescriptors()}" varStatus="loop">
<s:dropdownListBlock value="${d.class.name}" name="${d.displayName}"
selected="${s.startMethod.descriptor==d}"
selected="${s.launcher.descriptor==d}"
title="${d.displayName}">
<s:nested>
<j:if test='${d.configPage != ""}'>
<div name="startMethod">
<div name="launcher">
<table width="100%">
<j:set var="descriptor" value="${d}"/>
<j:set var="instance"
value="${h.ifThenElse(s.startMethod.descriptor==d,s.startMethod,null)}"/>
value="${h.ifThenElse(s.launcher.descriptor==d,s.launcher,null)}"/>
<st:include from="${d}" page="${d.configPage}" optional="true"/>
</table>
</div>
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="${%launch command}" help="/help/system-config/master-slave/command.html">
<f:textbox name="startMethod.command" value="${instance.command}"/>
<f:textbox name="launcher.command" value="${instance.command}"/>
</f:entry>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册