本文整理了Java中jenkins.model.Jenkins._getFingerprint()
方法的一些代码示例,展示了Jenkins._getFingerprint()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins._getFingerprint()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:_getFingerprint
[英]Gets a Fingerprint object if it exists. Otherwise null.
[中]获取指纹对象(如果存在)。否则为空。
代码示例来源:origin: jenkinsci/jenkins
/**
* Map from file names of the fingerprinted file to its fingerprint record.
*/
public synchronized Map<String,Fingerprint> getFingerprints() {
if(ref!=null) {
Map<String,Fingerprint> m = ref.get();
if(m!=null)
return m;
}
Jenkins h = Jenkins.getInstance();
Map<String,Fingerprint> m = new TreeMap<String,Fingerprint>();
for (Entry<String, String> r : record.entrySet()) {
try {
Fingerprint fp = h._getFingerprint(r.getValue());
if(fp!=null)
m.put(r.getKey(), fp);
} catch (IOException e) {
logger.log(Level.WARNING,e.getMessage(),e);
}
}
m = ImmutableMap.copyOf(m);
ref = new WeakReference<Map<String,Fingerprint>>(m);
return m;
}
代码示例来源:origin: jenkinsci/jenkins
protected Fingerprint getFingerprint(Fingerprint fp) throws IOException {
return Jenkins.get()._getFingerprint(fp.getHashString());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Map from file names of the fingerprinted file to its fingerprint record.
*/
public synchronized Map<String,Fingerprint> getFingerprints() {
if(ref!=null) {
Map<String,Fingerprint> m = ref.get();
if(m!=null)
return m;
}
Jenkins h = Jenkins.getInstance();
Map<String,Fingerprint> m = new TreeMap<String,Fingerprint>();
for (Entry<String, String> r : record.entrySet()) {
try {
Fingerprint fp = h._getFingerprint(r.getValue());
if(fp!=null)
m.put(r.getKey(), fp);
} catch (IOException e) {
logger.log(Level.WARNING,e.getMessage(),e);
}
}
m = ImmutableMap.copyOf(m);
ref = new WeakReference<Map<String,Fingerprint>>(m);
return m;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Examines the file and returns true if a file was deleted.
*/
private boolean check(File fingerprintFile, TaskListener listener) {
try {
Fingerprint fp = Fingerprint.load(fingerprintFile);
if (fp == null || !fp.isAlive()) {
listener.getLogger().println("deleting obsolete " + fingerprintFile);
fingerprintFile.delete();
return true;
} else {
// get the fingerprint in the official map so have the changes visible to Jenkins
// otherwise the mutation made in FingerprintMap can override our trimming.
listener.getLogger().println("possibly trimming " + fingerprintFile);
fp = Jenkins.getInstance()._getFingerprint(fp.getHashString());
return fp.trim();
}
} catch (IOException e) {
Functions.printStackTrace(e, listener.error("Failed to process " + fingerprintFile));
return false;
}
}
代码示例来源:origin: jenkinsci/external-workspace-manager-plugin
/**
* Method accessed by the Stapler framework when the following url is accessed:
* <i>JENKINS_ROOT_URL/exws/browse/workspaceId/</i>
*
* @param workspaceId the workspace's unique id
* @return the workspace whose id matches the given input id, or {@link NoFingerprintMatch} if fingerprint is not found
* @throws IOException if fingerprint load operation fails
* @throws IllegalArgumentException if {@link WorkspaceBrowserFacet} is not registered for the matching fingerprint
*/
@Restricted(NoExternalUse.class)
@SuppressWarnings("unused")
@Nonnull
public Object getBrowse(String workspaceId) throws IOException {
Fingerprint fingerprint = Jenkins.getActiveInstance()._getFingerprint(workspaceId);
if (fingerprint == null) {
return new NoFingerprintMatch(workspaceId);
}
WorkspaceBrowserFacet facet = fingerprint.getFacet(WorkspaceBrowserFacet.class);
if (facet == null) {
throw new IllegalArgumentException("Couldn't find the Fingerprint Facet that holds the Workspace metadata");
}
return facet.getWorkspace();
}
}
代码示例来源:origin: jenkinsci/external-workspace-manager-plugin
/**
* Adds the current run to the fingerprint's usages.
*
* @param workspaceId the workspace's id
* @throws IOException if fingerprint load operation fails,
* or if no fingerprint is found for the given workspace id
*/
private void updateFingerprint(String workspaceId) throws IOException {
Fingerprint f = Jenkins.getActiveInstance()._getFingerprint(workspaceId);
if (f == null) {
throw new AbortException("Couldn't find any Fingerprint for: " + workspaceId);
}
Fingerprint.RangeSet set = f.getUsages().get(run.getParent().getFullName());
if (set == null || !set.includes(run.getNumber())) {
f.addFor(run);
f.save();
}
}
内容来源于网络,如有侵权,请联系作者删除!