jenkins.model.Jenkins._getFingerprint()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(268)

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

Jenkins._getFingerprint介绍

[英]Gets a Fingerprint object if it exists. Otherwise null.
[中]获取指纹对象(如果存在)。否则为空。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Map from file names of the fingerprinted file to its fingerprint record.
  3. */
  4. public synchronized Map<String,Fingerprint> getFingerprints() {
  5. if(ref!=null) {
  6. Map<String,Fingerprint> m = ref.get();
  7. if(m!=null)
  8. return m;
  9. }
  10. Jenkins h = Jenkins.getInstance();
  11. Map<String,Fingerprint> m = new TreeMap<String,Fingerprint>();
  12. for (Entry<String, String> r : record.entrySet()) {
  13. try {
  14. Fingerprint fp = h._getFingerprint(r.getValue());
  15. if(fp!=null)
  16. m.put(r.getKey(), fp);
  17. } catch (IOException e) {
  18. logger.log(Level.WARNING,e.getMessage(),e);
  19. }
  20. }
  21. m = ImmutableMap.copyOf(m);
  22. ref = new WeakReference<Map<String,Fingerprint>>(m);
  23. return m;
  24. }

代码示例来源:origin: jenkinsci/jenkins

  1. protected Fingerprint getFingerprint(Fingerprint fp) throws IOException {
  2. return Jenkins.get()._getFingerprint(fp.getHashString());
  3. }

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

  1. /**
  2. * Map from file names of the fingerprinted file to its fingerprint record.
  3. */
  4. public synchronized Map<String,Fingerprint> getFingerprints() {
  5. if(ref!=null) {
  6. Map<String,Fingerprint> m = ref.get();
  7. if(m!=null)
  8. return m;
  9. }
  10. Jenkins h = Jenkins.getInstance();
  11. Map<String,Fingerprint> m = new TreeMap<String,Fingerprint>();
  12. for (Entry<String, String> r : record.entrySet()) {
  13. try {
  14. Fingerprint fp = h._getFingerprint(r.getValue());
  15. if(fp!=null)
  16. m.put(r.getKey(), fp);
  17. } catch (IOException e) {
  18. logger.log(Level.WARNING,e.getMessage(),e);
  19. }
  20. }
  21. m = ImmutableMap.copyOf(m);
  22. ref = new WeakReference<Map<String,Fingerprint>>(m);
  23. return m;
  24. }

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

  1. /**
  2. * Examines the file and returns true if a file was deleted.
  3. */
  4. private boolean check(File fingerprintFile, TaskListener listener) {
  5. try {
  6. Fingerprint fp = Fingerprint.load(fingerprintFile);
  7. if (fp == null || !fp.isAlive()) {
  8. listener.getLogger().println("deleting obsolete " + fingerprintFile);
  9. fingerprintFile.delete();
  10. return true;
  11. } else {
  12. // get the fingerprint in the official map so have the changes visible to Jenkins
  13. // otherwise the mutation made in FingerprintMap can override our trimming.
  14. listener.getLogger().println("possibly trimming " + fingerprintFile);
  15. fp = Jenkins.getInstance()._getFingerprint(fp.getHashString());
  16. return fp.trim();
  17. }
  18. } catch (IOException e) {
  19. Functions.printStackTrace(e, listener.error("Failed to process " + fingerprintFile));
  20. return false;
  21. }
  22. }

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

  1. /**
  2. * Method accessed by the Stapler framework when the following url is accessed:
  3. * <i>JENKINS_ROOT_URL/exws/browse/workspaceId/</i>
  4. *
  5. * @param workspaceId the workspace's unique id
  6. * @return the workspace whose id matches the given input id, or {@link NoFingerprintMatch} if fingerprint is not found
  7. * @throws IOException if fingerprint load operation fails
  8. * @throws IllegalArgumentException if {@link WorkspaceBrowserFacet} is not registered for the matching fingerprint
  9. */
  10. @Restricted(NoExternalUse.class)
  11. @SuppressWarnings("unused")
  12. @Nonnull
  13. public Object getBrowse(String workspaceId) throws IOException {
  14. Fingerprint fingerprint = Jenkins.getActiveInstance()._getFingerprint(workspaceId);
  15. if (fingerprint == null) {
  16. return new NoFingerprintMatch(workspaceId);
  17. }
  18. WorkspaceBrowserFacet facet = fingerprint.getFacet(WorkspaceBrowserFacet.class);
  19. if (facet == null) {
  20. throw new IllegalArgumentException("Couldn't find the Fingerprint Facet that holds the Workspace metadata");
  21. }
  22. return facet.getWorkspace();
  23. }
  24. }

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

  1. /**
  2. * Adds the current run to the fingerprint's usages.
  3. *
  4. * @param workspaceId the workspace's id
  5. * @throws IOException if fingerprint load operation fails,
  6. * or if no fingerprint is found for the given workspace id
  7. */
  8. private void updateFingerprint(String workspaceId) throws IOException {
  9. Fingerprint f = Jenkins.getActiveInstance()._getFingerprint(workspaceId);
  10. if (f == null) {
  11. throw new AbortException("Couldn't find any Fingerprint for: " + workspaceId);
  12. }
  13. Fingerprint.RangeSet set = f.getUsages().get(run.getParent().getFullName());
  14. if (set == null || !set.includes(run.getNumber())) {
  15. f.addFor(run);
  16. f.save();
  17. }
  18. }

相关文章

Jenkins类方法