本文整理了Java中hudson.model.Node.getLabelString()
方法的一些代码示例,展示了Node.getLabelString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLabelString()
方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getLabelString
[英]Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available via #getAssignedLabels() and includes all labels that have been manually configured. Mainly for form binding.
[中]返回节点的手动配置标签。通过#getAssignedLabels()可以获得分配的和动态确定的标签列表,其中包括所有手动配置的标签。主要用于表格装订。
代码示例来源:origin: jenkinsci/jenkins
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a agent
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: jenkinsci/swarm-plugin
/**
* Gets list of labels for slave
*/
public void doGetSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
@QueryParameter String secret) throws IOException {
if (!getSwarmSecret().equals(secret)) {
rsp.setStatus(SC_FORBIDDEN);
return;
}
Node nn = getNodeByName(name, rsp);
if (nn == null) {
return;
}
normalResponse(req, rsp, nn.getLabelString());
}
代码示例来源:origin: jenkinsci/swarm-plugin
/**
* Remove labels from a slave
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void doRemoveSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
@QueryParameter String secret, @QueryParameter String labels) throws IOException {
if (!getSwarmSecret().equals(secret)) {
rsp.setStatus(SC_FORBIDDEN);
return;
}
Node nn = getNodeByName(name, rsp);
if (nn == null) {
return;
}
String sCurrentLabels = nn.getLabelString();
List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
HashSet<String> hs = new HashSet<>(lCurrentLabels);
List<String> lBadLabels = Arrays.asList(labels.split("\\s+"));
hs.removeAll(lBadLabels);
nn.setLabelString(hashSetToString(hs));
nn.getAssignedLabels();
normalResponse(req, rsp, nn.getLabelString());
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a slave
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a slave
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: jenkinsci/swarm-plugin
/**
* Adds labels to a slave.
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public void doAddSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
@QueryParameter String secret, @QueryParameter String labels) throws IOException{
if (!getSwarmSecret().equals(secret)) {
rsp.setStatus(SC_FORBIDDEN);
return;
}
Node nn = getNodeByName(name, rsp);
if (nn == null) {
return;
}
String sCurrentLabels = nn.getLabelString();
List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
HashSet<String> hs = new HashSet<>(lCurrentLabels);
List<String> lNewLabels = Arrays.asList(labels.split("\\s+"));
hs.addAll(lNewLabels);
nn.setLabelString(hashSetToString(hs));
nn.getAssignedLabels();
normalResponse(req, rsp, nn.getLabelString());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a agent
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a slave
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Returns the possibly empty set of labels that are assigned to this node,
* including the automatic {@link #getSelfLabel() self label}, manually
* assigned labels and dynamically assigned labels via the
* {@link LabelFinder} extension point.
*
* This method has a side effect of updating the hudson-wide set of labels
* and should be called after events that will change that - e.g. a slave
* connecting.
*/
@Exported
public Set<LabelAtom> getAssignedLabels() {
Set<LabelAtom> r = Label.parse(getLabelString());
r.add(getSelfLabel());
r.addAll(getDynamicLabels());
return Collections.unmodifiableSet(r);
}
代码示例来源:origin: awslabs/ec2-spot-jenkins-plugin
continue;
if (!this.labelString.equals(node.getLabelString())) {
try {
LOGGER.log(Level.INFO, "Updating label on node " + instId + " to \"" + this.labelString + "\".");
代码示例来源:origin: jenkinsci/selenium-plugin
/**
* Returns a list of auto completion candidates.
*
* @return candidates
*/
public AutoCompletionCandidates doAutoCompleteLabel() {
AutoCompletionCandidates candidates = new AutoCompletionCandidates();
List<Node> masterNodeList = Jenkins.getInstance().getNodes();
for (Node node : masterNodeList) {
try {
for (LabelAtom atom : Label.parseExpression(node.getLabelString()).listAtoms()) {
candidates.add(atom.getName());
}
} catch (ANTLRException e) {
// invalid expression, skipped
}
}
return candidates;
}
代码示例来源:origin: jenkinsci/external-workspace-manager-plugin
Template template = findTemplate(node.getLabelString(), step.getDescriptor().getTemplates());
内容来源于网络,如有侵权,请联系作者删除!