提交 b012ea95 编写于 作者: S Stephen Connolly

[JENKINS-37032] Add display names and optional descriptions

上级 17894bc1
...@@ -265,7 +265,7 @@ public final class TcpSlaveAgentListener extends Thread { ...@@ -265,7 +265,7 @@ public final class TcpSlaveAgentListener extends Thread {
* Allow essential {@link AgentProtocol} implementations (basically {@link PingAgentProtocol}) * Allow essential {@link AgentProtocol} implementations (basically {@link PingAgentProtocol})
* to be always enabled. * to be always enabled.
* *
* @return {@code true} if the protocol can never be disbaled. * @return {@code true} if the protocol can never be disabled.
* @since FIXME * @since FIXME
*/ */
@Override @Override
...@@ -278,6 +278,14 @@ public final class TcpSlaveAgentListener extends Thread { ...@@ -278,6 +278,14 @@ public final class TcpSlaveAgentListener extends Thread {
return "Ping"; return "Ping";
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return Messages.TcpSlaveAgentListener_PingAgentProtocol_displayName();
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
try { try {
......
...@@ -36,6 +36,14 @@ public class CliProtocol extends AgentProtocol { ...@@ -36,6 +36,14 @@ public class CliProtocol extends AgentProtocol {
return "CLI-connect"; return "CLI-connect";
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return "Jenkins CLI Protocol/1";
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
new Handler(nio.getHub(),socket).run(); new Handler(nio.getHub(),socket).run();
......
...@@ -28,6 +28,14 @@ public class CliProtocol2 extends CliProtocol { ...@@ -28,6 +28,14 @@ public class CliProtocol2 extends CliProtocol {
return "CLI2-connect"; return "CLI2-connect";
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return "Jenkins CLI Protocol/2";
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
new Handler2(nio.getHub(), socket).run(); new Handler2(nio.getHub(), socket).run();
......
...@@ -33,7 +33,7 @@ public abstract class AgentProtocol implements ExtensionPoint { ...@@ -33,7 +33,7 @@ public abstract class AgentProtocol implements ExtensionPoint {
* Allow essential {@link AgentProtocol} implementations (basically {@link TcpSlaveAgentListener.PingAgentProtocol}) * Allow essential {@link AgentProtocol} implementations (basically {@link TcpSlaveAgentListener.PingAgentProtocol})
* to be always enabled. * to be always enabled.
* *
* @return {@code true} if the protocol can never be disbaled. * @return {@code true} if the protocol can never be disabled.
* @since FIXME * @since FIXME
*/ */
public boolean isRequired() { public boolean isRequired() {
...@@ -50,6 +50,16 @@ public abstract class AgentProtocol implements ExtensionPoint { ...@@ -50,6 +50,16 @@ public abstract class AgentProtocol implements ExtensionPoint {
*/ */
public abstract String getName(); public abstract String getName();
/**
* Returns the human readable protocol display name.
*
* @return the human readable protocol display name.
* @since FIXME
*/
public String getDisplayName() {
return getName();
}
/** /**
* Called by the connection handling thread to execute the protocol. * Called by the connection handling thread to execute the protocol.
*/ */
......
...@@ -65,6 +65,14 @@ public class JnlpSlaveAgentProtocol extends AgentProtocol { ...@@ -65,6 +65,14 @@ public class JnlpSlaveAgentProtocol extends AgentProtocol {
return "JNLP-connect"; return "JNLP-connect";
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return Messages.JnlpSlaveAgentProtocol_displayName();
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
new Handler(hub.getHub(),socket).run(); new Handler(hub.getHub(),socket).run();
......
...@@ -27,6 +27,14 @@ public class JnlpSlaveAgentProtocol2 extends JnlpSlaveAgentProtocol { ...@@ -27,6 +27,14 @@ public class JnlpSlaveAgentProtocol2 extends JnlpSlaveAgentProtocol {
return "JNLP2-connect"; return "JNLP2-connect";
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return Messages.JnlpSlaveAgentProtocol2_displayName();
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
new Handler2(hub.getHub(),socket).run(); new Handler2(hub.getHub(),socket).run();
......
...@@ -42,6 +42,14 @@ public class JnlpSlaveAgentProtocol3 extends AgentProtocol { ...@@ -42,6 +42,14 @@ public class JnlpSlaveAgentProtocol3 extends AgentProtocol {
return ENABLED ? "JNLP3-connect" : null; return ENABLED ? "JNLP3-connect" : null;
} }
/**
* {@inheritDoc}
*/
@Override
public String getDisplayName() {
return Messages.JnlpSlaveAgentProtocol3_displayName();
}
@Override @Override
public void handle(Socket socket) throws IOException, InterruptedException { public void handle(Socket socket) throws IOException, InterruptedException {
new Handler(hub.getHub(), socket).run(); new Handler(hub.getHub(), socket).run();
......
...@@ -72,3 +72,5 @@ ProxyConfiguration.FailedToConnect=Failed to connect to {0} (code {1}). ...@@ -72,3 +72,5 @@ ProxyConfiguration.FailedToConnect=Failed to connect to {0} (code {1}).
ProxyConfiguration.Success=Success ProxyConfiguration.Success=Success
Functions.NoExceptionDetails=No Exception details Functions.NoExceptionDetails=No Exception details
TcpSlaveAgentListener.PingAgentProtocol.displayName=Ping protocol
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%Accepts connections from CLI clients}
</j:jelly>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%Extends the version 1 protocol by adding transport encryption}
</j:jelly>
...@@ -94,3 +94,5 @@ OfflineNodeCommand.ShortDescription=Stop using a node for performing builds temp ...@@ -94,3 +94,5 @@ OfflineNodeCommand.ShortDescription=Stop using a node for performing builds temp
WaitNodeOnlineCommand.ShortDescription=Wait for a node to become online. WaitNodeOnlineCommand.ShortDescription=Wait for a node to become online.
WaitNodeOfflineCommand.ShortDescription=Wait for a node to become offline. WaitNodeOfflineCommand.ShortDescription=Wait for a node to become offline.
CliProtocol.displayName=Jenkins CLI Protocol/1
CliProtocol2.displayName=Jenkins CLI Protocol/2
...@@ -32,13 +32,23 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla ...@@ -32,13 +32,23 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla
f.advanced(title: _("Agent protocols"), align:"left") { f.advanced(title: _("Agent protocols"), align:"left") {
f.entry(title: _("Agent protocols")) { f.entry(title: _("Agent protocols")) {
def agentProtocols = my.agentProtocols; def agentProtocols = my.agentProtocols;
for (AgentProtocol p: AgentProtocol.all()) { table(width:"100%") {
for (AgentProtocol p : AgentProtocol.all()) {
if (p.name != null && !p.required) { if (p.name != null && !p.required) {
f.block() {
f.checkbox(name: "agentProtocol", f.checkbox(name: "agentProtocol",
title: p.name, title: p.displayName,
checked:agentProtocols.contains(p.name), checked: agentProtocols.contains(p.name),
json: p.name); json: p.name);
br(); }
tr() {
td(colspan:"2");
td(class:"setting-description"){
st.include(from:p, page: "description", optional:true);
}
td();
}
}
} }
} }
} }
......
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%Accepts connections from remote clients so that they can be used as additional build agents}
</j:jelly>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%Extends the version 1 protocol by adding a per-client cookie, so that we can detect a reconnection from the agent and take appropriate action}
</j:jelly>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%Extends the version 2 protocol by adding basic encryption but requires a thread per client}
</j:jelly>
# The MIT License
#
# Copyright 2016 Stephen Connolly
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
JnlpSlaveAgentProtocol.displayName=Java Web Start Agent Protocol/1
JnlpSlaveAgentProtocol2.displayName=Java Web Start Agent Protocol/2
JnlpSlaveAgentProtocol3.displayName=Java Web Start Agent Protocol/3
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册