本文整理了Java中hudson.model.Node.getNodeName()
方法的一些代码示例,展示了Node.getNodeName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getNodeName()
方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getNodeName
[英]Name of this node.
[中]此节点的名称。
代码示例来源:origin: jenkinsci/jenkins
/**
* Node name.
*/
public String getName() {
return node.getNodeName();
}
代码示例来源:origin: jenkinsci/jenkins
public String hash(Node node) {
return node.getNodeName();
}
};
代码示例来源:origin: jenkinsci/jenkins
public String getDisplayName() {
return getNodeName(); // default implementation
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public int compare(Node o1, Node o2) {
if (o1 == o2) {
return 0;
}
return o1 instanceof Jenkins ? -1 : (o2 instanceof Jenkins ? 1 : o1.getNodeName().compareTo(o2.getNodeName()));
}
}
代码示例来源:origin: jenkinsci/jenkins
public NodeList(Collection<? extends Node> c) {
super(c);
for (Node node: c) {
if (map.put(node.getNodeName(), node) != null) {
// make sure that all names are unique
throw new IllegalArgumentException(node.getNodeName()+" is defined more than once");
}
}
}
代码示例来源:origin: jenkinsci/jenkins
public String get(int index) {
return nodes.get(index).getNodeName();
}
代码示例来源:origin: jenkinsci/jenkins
public void run() {
Nodes.this.nodes.remove(oldOne.getNodeName());
Nodes.this.nodes.put(newOne.getNodeName(), newOne);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
代码示例来源:origin: jenkinsci/jenkins
@Override
public Boolean call() throws Exception {
if (node == nodes.get(node.getNodeName())) {
jenkins.trimLabels();
return true;
}
return false;
}
});
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
Set<String> toRemove = new HashSet<String>(Nodes.this.nodes.keySet());
for (Node n : nodes) {
final String name = n.getNodeName();
toRemove.remove(name);
Nodes.this.nodes.put(name, n);
}
Nodes.this.nodes.keySet().removeAll(toRemove); // directory clean up will be handled by save
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
nodes.put(node.getNodeName(), node);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the special label that represents this node itself.
*/
@Nonnull
@WithBridgeMethods(Label.class)
public LabelAtom getSelfLabel() {
return LabelAtom.get(getNodeName());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Auto-completion for the "copy from" field in the new job page.
*/
public AutoCompletionCandidates doAutoCompleteCopyNewItemFrom(@QueryParameter final String value) {
final AutoCompletionCandidates r = new AutoCompletionCandidates();
for (Node n : Jenkins.getInstance().getNodes()) {
if (n.getNodeName().startsWith(value))
r.add(n.getNodeName());
}
return r;
}
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Estimates the clock difference with this agent.
*
* @return
* always non-null.
* @throws InterruptedException
* if the operation is aborted.
*/
public ClockDifference getClockDifference() throws IOException, InterruptedException {
VirtualChannel channel = getChannel();
if(channel==null)
throw new IOException(getNodeName()+" is offline");
return channel.call(getClockDifferenceCallable());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Actually persists a node on disk.
*
* @param node the node to be persisted.
* @throws IOException if the node could not be persisted.
*/
private void persistNode(final @Nonnull Node node) throws IOException {
// no need for a full save() so we just do the minimum
if (node instanceof EphemeralNode) {
Util.deleteRecursive(new File(getNodesDir(), node.getNodeName()));
} else {
XmlFile xmlFile = new XmlFile(Jenkins.XSTREAM,
new File(new File(getNodesDir(), node.getNodeName()), "config.xml"));
xmlFile.write(node);
SaveableListener.fireOnChange(this, xmlFile);
}
jenkins.getQueue().scheduleMaintenance();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
nodes.compute(node.getNodeName(), (ignoredNodeName, ignoredNode) -> oldNode);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
代码示例来源:origin: jenkinsci/jenkins
public String getSearchUrl() {
Computer c = toComputer();
if (c != null) {
return c.getUrl();
}
return "computer/" + Util.rawEncode(getNodeName());
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Called to notify {@link Computer} that its corresponding {@link Node}
* configuration is updated.
*/
protected void setNode(Node node) {
assert node!=null;
if(node instanceof Slave)
this.nodeName = node.getNodeName();
else
this.nodeName = null;
setNumExecutors(node.getNumExecutors());
if (this.temporarilyOffline) {
// When we get a new node, push our current temp offline
// status to it (as the status is not carried across
// configuration changes that recreate the node).
// Since this is also called the very first time this
// Computer is created, avoid pushing an empty status
// as that could overwrite any status that the Node
// brought along from its persisted config data.
node.setTemporaryOfflineCause(this.offlineCause);
}
}
代码示例来源:origin: jenkinsci/jenkins
@Override
protected int run() throws Exception {
final Jenkins jenkins = Jenkins.getActiveInstance();
jenkins.checkPermission(Computer.CREATE);
final Node newNode = (Node) Jenkins.XSTREAM2.fromXML(stdin);
if (nodeName != null) {
// Using deprecated method but it's contract is preserved
newNode.setNodeName(nodeName);
}
if(newNode instanceof Slave) { //change userId too
User user = User.current();
((Slave) newNode).setUserId(user==null ? "anonymous" : user.getId());
}
if (jenkins.getNode(newNode.getNodeName()) != null) {
throw new IllegalStateException("Node '" + newNode.getNodeName() + "' already exists");
}
jenkins.addNode(newNode);
return 0;
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public void run() {
Computer c = node.toComputer();
if (c != null) {
c.recordTermination();
c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved()));
}
if (node == nodes.remove(node.getNodeName())) {
jenkins.updateComputerList();
jenkins.trimLabels();
}
}
});
代码示例来源:origin: jenkinsci/jenkins
public static String encodeTo(Node node) {
Computer c = node.toComputer();
if (c != null) {
return encodeTo("/" + c.getUrl(), node.getDisplayName());
}
String nodePath = node == Jenkins.getInstance() ? "(master)" : node.getNodeName();
return encodeTo("/computer/" + nodePath, node.getDisplayName());
}
内容来源于网络,如有侵权,请联系作者删除!