Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
3e842b69
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3e842b69
编写于
12月 21, 2015
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More symbol assignments and constructor diet
to move more properties off to setters.
上级
16c4b50f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
61 addition
and
7 deletion
+61
-7
core/src/main/java/hudson/model/Slave.java
core/src/main/java/hudson/model/Slave.java
+31
-2
core/src/main/java/hudson/slaves/CommandLauncher.java
core/src/main/java/hudson/slaves/CommandLauncher.java
+2
-1
core/src/main/java/hudson/slaves/DumbSlave.java
core/src/main/java/hudson/slaves/DumbSlave.java
+14
-2
core/src/main/java/hudson/slaves/JNLPLauncher.java
core/src/main/java/hudson/slaves/JNLPLauncher.java
+14
-2
未找到文件。
core/src/main/java/hudson/model/Slave.java
浏览文件 @
3e842b69
...
@@ -67,6 +67,7 @@ import jenkins.slaves.WorkspaceLocator;
...
@@ -67,6 +67,7 @@ import jenkins.slaves.WorkspaceLocator;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.kohsuke.stapler.DataBoundSetter
;
import
org.kohsuke.stapler.HttpResponse
;
import
org.kohsuke.stapler.HttpResponse
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.StaplerRequest
;
import
org.kohsuke.stapler.StaplerRequest
;
...
@@ -98,7 +99,7 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -98,7 +99,7 @@ public abstract class Slave extends Node implements Serializable {
/**
/**
* Description of this node.
* Description of this node.
*/
*/
private
final
String
description
;
private
String
description
;
/**
/**
* Path to the root of the workspace from the view point of this node, such as "/hudson", this need not
* Path to the root of the workspace from the view point of this node, such as "/hudson", this need not
...
@@ -118,7 +119,7 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -118,7 +119,7 @@ public abstract class Slave extends Node implements Serializable {
/**
/**
* Job allocation strategy.
* Job allocation strategy.
*/
*/
private
Mode
mode
;
private
Mode
mode
=
Mode
.
NORMAL
;
/**
/**
* Agent availablility strategy.
* Agent availablility strategy.
...
@@ -162,6 +163,16 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -162,6 +163,16 @@ public abstract class Slave extends Node implements Serializable {
this
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
new
ArrayList
());
this
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
new
ArrayList
());
}
}
public
Slave
(
@Nonnull
String
name
,
String
remoteFS
,
ComputerLauncher
launcher
)
throws
FormException
,
IOException
{
this
.
name
=
name
;
this
.
remoteFS
=
remoteFS
;
this
.
launcher
=
launcher
;
}
/**
* @deprecated as of 1.XXX
* Use {@link #Slave(String, String, ComputerLauncher)} and set the rest through setters.
*/
public
Slave
(
@Nonnull
String
name
,
String
nodeDescription
,
String
remoteFS
,
int
numExecutors
,
public
Slave
(
@Nonnull
String
name
,
String
nodeDescription
,
String
remoteFS
,
int
numExecutors
,
Mode
mode
,
String
labelString
,
ComputerLauncher
launcher
,
RetentionStrategy
retentionStrategy
,
List
<?
extends
NodeProperty
<?>>
nodeProperties
)
throws
FormException
,
IOException
{
Mode
mode
,
String
labelString
,
ComputerLauncher
launcher
,
RetentionStrategy
retentionStrategy
,
List
<?
extends
NodeProperty
<?>>
nodeProperties
)
throws
FormException
,
IOException
{
this
.
name
=
name
;
this
.
name
=
name
;
...
@@ -231,6 +242,11 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -231,6 +242,11 @@ public abstract class Slave extends Node implements Serializable {
this
.
name
=
name
;
this
.
name
=
name
;
}
}
@DataBoundSetter
public
void
setNodeDescription
(
String
value
)
{
this
.
description
=
value
;
}
public
String
getNodeDescription
()
{
public
String
getNodeDescription
()
{
return
description
;
return
description
;
}
}
...
@@ -239,10 +255,16 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -239,10 +255,16 @@ public abstract class Slave extends Node implements Serializable {
return
numExecutors
;
return
numExecutors
;
}
}
@DataBoundSetter
public
void
setNumExecutors
(
int
n
)
{
this
.
numExecutors
=
n
;
}
public
Mode
getMode
()
{
public
Mode
getMode
()
{
return
mode
;
return
mode
;
}
}
@DataBoundSetter
public
void
setMode
(
Mode
mode
)
{
public
void
setMode
(
Mode
mode
)
{
this
.
mode
=
mode
;
this
.
mode
=
mode
;
}
}
...
@@ -252,10 +274,16 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -252,10 +274,16 @@ public abstract class Slave extends Node implements Serializable {
return
nodeProperties
;
return
nodeProperties
;
}
}
@DataBoundSetter
public
void
setNodeProperties
(
List
<?
extends
NodeProperty
<?>>
properties
)
throws
IOException
{
nodeProperties
.
replaceBy
(
properties
);
}
public
RetentionStrategy
getRetentionStrategy
()
{
public
RetentionStrategy
getRetentionStrategy
()
{
return
retentionStrategy
==
null
?
RetentionStrategy
.
Always
.
INSTANCE
:
retentionStrategy
;
return
retentionStrategy
==
null
?
RetentionStrategy
.
Always
.
INSTANCE
:
retentionStrategy
;
}
}
@DataBoundSetter
public
void
setRetentionStrategy
(
RetentionStrategy
availabilityStrategy
)
{
public
void
setRetentionStrategy
(
RetentionStrategy
availabilityStrategy
)
{
this
.
retentionStrategy
=
availabilityStrategy
;
this
.
retentionStrategy
=
availabilityStrategy
;
}
}
...
@@ -265,6 +293,7 @@ public abstract class Slave extends Node implements Serializable {
...
@@ -265,6 +293,7 @@ public abstract class Slave extends Node implements Serializable {
}
}
@Override
@Override
@DataBoundSetter
public
void
setLabelString
(
String
labelString
)
throws
IOException
{
public
void
setLabelString
(
String
labelString
)
throws
IOException
{
this
.
label
=
Util
.
fixNull
(
labelString
).
trim
();
this
.
label
=
Util
.
fixNull
(
labelString
).
trim
();
// Compute labels now.
// Compute labels now.
...
...
core/src/main/java/hudson/slaves/CommandLauncher.java
浏览文件 @
3e842b69
...
@@ -42,6 +42,7 @@ import java.util.logging.Level;
...
@@ -42,6 +42,7 @@ import java.util.logging.Level;
import
java.util.logging.Logger
;
import
java.util.logging.Logger
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.jenkinsci.Symbol
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.QueryParameter
;
import
org.kohsuke.stapler.QueryParameter
;
...
@@ -182,7 +183,7 @@ public class CommandLauncher extends ComputerLauncher {
...
@@ -182,7 +183,7 @@ public class CommandLauncher extends ComputerLauncher {
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
CommandLauncher
.
class
.
getName
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
CommandLauncher
.
class
.
getName
());
@Extension
@Extension
@Symbol
(
"command"
)
public
static
class
DescriptorImpl
extends
Descriptor
<
ComputerLauncher
>
{
public
static
class
DescriptorImpl
extends
Descriptor
<
ComputerLauncher
>
{
public
String
getDisplayName
()
{
public
String
getDisplayName
()
{
return
Messages
.
CommandLauncher_displayName
();
return
Messages
.
CommandLauncher_displayName
();
...
...
core/src/main/java/hudson/slaves/DumbSlave.java
浏览文件 @
3e842b69
...
@@ -31,8 +31,11 @@ import java.io.IOException;
...
@@ -31,8 +31,11 @@ import java.io.IOException;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
org.jenkinsci.Symbol
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
javax.annotation.Nonnull
;
/**
/**
* Default {@link Slave} implementation for computers that do not belong to a higher level structure,
* Default {@link Slave} implementation for computers that do not belong to a higher level structure,
* like grid or cloud.
* like grid or cloud.
...
@@ -49,12 +52,21 @@ public final class DumbSlave extends Slave {
...
@@ -49,12 +52,21 @@ public final class DumbSlave extends Slave {
this
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
new
ArrayList
());
this
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
new
ArrayList
());
}
}
@DataBoundConstructor
/**
* @deprecated as of 1.XXX.
* Use {@link #DumbSlave(String, String, ComputerLauncher)} and configure the rest through setters.
*/
public
DumbSlave
(
String
name
,
String
nodeDescription
,
String
remoteFS
,
String
numExecutors
,
Mode
mode
,
String
labelString
,
ComputerLauncher
launcher
,
RetentionStrategy
retentionStrategy
,
List
<?
extends
NodeProperty
<?>>
nodeProperties
)
throws
IOException
,
FormException
{
public
DumbSlave
(
String
name
,
String
nodeDescription
,
String
remoteFS
,
String
numExecutors
,
Mode
mode
,
String
labelString
,
ComputerLauncher
launcher
,
RetentionStrategy
retentionStrategy
,
List
<?
extends
NodeProperty
<?>>
nodeProperties
)
throws
IOException
,
FormException
{
super
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
nodeProperties
);
super
(
name
,
nodeDescription
,
remoteFS
,
numExecutors
,
mode
,
labelString
,
launcher
,
retentionStrategy
,
nodeProperties
);
}
}
@Extension
@DataBoundConstructor
public
DumbSlave
(
@Nonnull
String
name
,
String
remoteFS
,
ComputerLauncher
launcher
)
throws
FormException
,
IOException
{
super
(
name
,
remoteFS
,
launcher
);
}
@Extension
@Symbol
({
"dumb"
,
"slave"
/*because this is in effect the canonical slave type*/
})
public
static
final
class
DescriptorImpl
extends
SlaveDescriptor
{
public
static
final
class
DescriptorImpl
extends
SlaveDescriptor
{
public
String
getDisplayName
()
{
public
String
getDisplayName
()
{
return
Messages
.
DumbSlave_displayName
();
return
Messages
.
DumbSlave_displayName
();
...
...
core/src/main/java/hudson/slaves/JNLPLauncher.java
浏览文件 @
3e842b69
...
@@ -27,6 +27,8 @@ import hudson.model.Descriptor;
...
@@ -27,6 +27,8 @@ import hudson.model.Descriptor;
import
hudson.model.TaskListener
;
import
hudson.model.TaskListener
;
import
hudson.Util
;
import
hudson.Util
;
import
hudson.Extension
;
import
hudson.Extension
;
import
jenkins.model.Jenkins
;
import
org.jenkinsci.Symbol
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
org.kohsuke.stapler.DataBoundConstructor
;
/**
/**
...
@@ -75,8 +77,18 @@ public class JNLPLauncher extends ComputerLauncher {
...
@@ -75,8 +77,18 @@ public class JNLPLauncher extends ComputerLauncher {
// do nothing as we cannot self start
// do nothing as we cannot self start
}
}
@Extension
/**
public
static
final
Descriptor
<
ComputerLauncher
>
DESCRIPTOR
=
new
Descriptor
<
ComputerLauncher
>()
{
* @deprecated as of 1.XXX
* Use {@link Jenkins#getDescriptor(Class)}
*/
public
static
/*almost final*/
Descriptor
<
ComputerLauncher
>
DESCRIPTOR
;
@Extension
@Symbol
(
"jnlp"
)
public
static
class
DescriptorImpl
extends
Descriptor
<
ComputerLauncher
>
{
public
DescriptorImpl
()
{
DESCRIPTOR
=
this
;
}
public
String
getDisplayName
()
{
public
String
getDisplayName
()
{
return
Messages
.
JNLPLauncher_displayName
();
return
Messages
.
JNLPLauncher_displayName
();
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录