hudson.model.Node.getLabelString()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(202)

本文整理了Java中hudson.model.Node.getLabelString()方法的一些代码示例,展示了Node.getLabelString()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLabelString()方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getLabelString

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

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a agent
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: jenkinsci/swarm-plugin

  1. /**
  2. * Gets list of labels for slave
  3. */
  4. public void doGetSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
  5. @QueryParameter String secret) throws IOException {
  6. if (!getSwarmSecret().equals(secret)) {
  7. rsp.setStatus(SC_FORBIDDEN);
  8. return;
  9. }
  10. Node nn = getNodeByName(name, rsp);
  11. if (nn == null) {
  12. return;
  13. }
  14. normalResponse(req, rsp, nn.getLabelString());
  15. }

代码示例来源:origin: jenkinsci/swarm-plugin

  1. /**
  2. * Remove labels from a slave
  3. */
  4. @SuppressWarnings({ "unchecked", "rawtypes" })
  5. public void doRemoveSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
  6. @QueryParameter String secret, @QueryParameter String labels) throws IOException {
  7. if (!getSwarmSecret().equals(secret)) {
  8. rsp.setStatus(SC_FORBIDDEN);
  9. return;
  10. }
  11. Node nn = getNodeByName(name, rsp);
  12. if (nn == null) {
  13. return;
  14. }
  15. String sCurrentLabels = nn.getLabelString();
  16. List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
  17. HashSet<String> hs = new HashSet<>(lCurrentLabels);
  18. List<String> lBadLabels = Arrays.asList(labels.split("\\s+"));
  19. hs.removeAll(lBadLabels);
  20. nn.setLabelString(hashSetToString(hs));
  21. nn.getAssignedLabels();
  22. normalResponse(req, rsp, nn.getLabelString());
  23. }

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a slave
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a slave
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: jenkinsci/swarm-plugin

  1. /**
  2. * Adds labels to a slave.
  3. */
  4. @SuppressWarnings({ "unchecked", "rawtypes" })
  5. public void doAddSlaveLabels(StaplerRequest req, StaplerResponse rsp, @QueryParameter String name,
  6. @QueryParameter String secret, @QueryParameter String labels) throws IOException{
  7. if (!getSwarmSecret().equals(secret)) {
  8. rsp.setStatus(SC_FORBIDDEN);
  9. return;
  10. }
  11. Node nn = getNodeByName(name, rsp);
  12. if (nn == null) {
  13. return;
  14. }
  15. String sCurrentLabels = nn.getLabelString();
  16. List<String> lCurrentLabels = Arrays.asList(sCurrentLabels.split("\\s+"));
  17. HashSet<String> hs = new HashSet<>(lCurrentLabels);
  18. List<String> lNewLabels = Arrays.asList(labels.split("\\s+"));
  19. hs.addAll(lNewLabels);
  20. nn.setLabelString(hashSetToString(hs));
  21. nn.getAssignedLabels();
  22. normalResponse(req, rsp, nn.getLabelString());
  23. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a agent
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a slave
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: hudson/hudson-2.x

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a slave
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: awslabs/ec2-spot-jenkins-plugin

  1. continue;
  2. if (!this.labelString.equals(node.getLabelString())) {
  3. try {
  4. LOGGER.log(Level.INFO, "Updating label on node " + instId + " to \"" + this.labelString + "\".");

代码示例来源:origin: jenkinsci/selenium-plugin

  1. /**
  2. * Returns a list of auto completion candidates.
  3. *
  4. * @return candidates
  5. */
  6. public AutoCompletionCandidates doAutoCompleteLabel() {
  7. AutoCompletionCandidates candidates = new AutoCompletionCandidates();
  8. List<Node> masterNodeList = Jenkins.getInstance().getNodes();
  9. for (Node node : masterNodeList) {
  10. try {
  11. for (LabelAtom atom : Label.parseExpression(node.getLabelString()).listAtoms()) {
  12. candidates.add(atom.getName());
  13. }
  14. } catch (ANTLRException e) {
  15. // invalid expression, skipped
  16. }
  17. }
  18. return candidates;
  19. }

代码示例来源:origin: jenkinsci/external-workspace-manager-plugin

  1. Template template = findTemplate(node.getLabelString(), step.getDescriptor().getTemplates());

相关文章