hudson.model
Class Fingerprint

java.lang.Object
  extended by hudson.model.Fingerprint
All Implemented Interfaces:
ModelObject, Saveable

@ExportedBean
public class Fingerprint
extends Object
implements ModelObject, Saveable

A file being tracked by Jenkins.

Lifecycle is managed by FingerprintMap.

Author:
Kohsuke Kawaguchi
See Also:
FingerprintMap

Nested Class Summary
static class Fingerprint.BuildPtr
          Pointer to a Build.
static class Fingerprint.ProjectRenameListener
           
static class Fingerprint.Range
          Range of build numbers [start,end).
static class Fingerprint.RangeItem
           
static class Fingerprint.RangeSet
          Set of Fingerprint.Ranges.
 
Field Summary
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
Fingerprint(Run build, String fileName, byte[] md5sum)
           
 
Method Summary
 List<Fingerprint.RangeItem> _getUsages()
           
 void add(AbstractBuild b)
           
 void add(String jobFullName, int n)
          Records that a build of a job has used this file.
 List<Action> getActions()
          Returns the actions contributed from getFacets()
 Api getApi()
           
 String getDisplayName()
           
 Collection<FingerprintFacet> getFacets()
          Gets the associated FingerprintFacets.
 String getFileName()
          The file name (like "foo.jar" without path).
 String getHashString()
          Gets the MD5 hash string.
 List<String> getJobs()
          Gets the sorted list of job names where this jar is used.
 Fingerprint.BuildPtr getOriginal()
          The first build in which this file showed up, if the file looked like it's created there.
 Fingerprint.RangeSet getRangeSet(Job job)
           
 Fingerprint.RangeSet getRangeSet(String jobFullName)
          Gets the build range set for the given job name.
 Collection<FingerprintFacet> getSortedFacets()
           
 Date getTimestamp()
          Gets the timestamp when this record is created.
 String getTimestampString()
          Gets the string that says how long since this build has scheduled.
 Hashtable<String,Fingerprint.RangeSet> getUsages()
           
 boolean isAlive()
          Returns true if any of the builds recorded in this fingerprint is still retained.
 void rename(String oldName, String newName)
          Update references to a renamed job in the fingerprint
 void save()
          Save the settings to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Fingerprint

public Fingerprint(Run build,
                   String fileName,
                   byte[] md5sum)
            throws IOException
Throws:
IOException
Method Detail

getOriginal

@Exported
public Fingerprint.BuildPtr getOriginal()
The first build in which this file showed up, if the file looked like it's created there.

This is considered as the "source" of this file, or the owner, in the sense that this project "owns" this file.

Returns:
null if the file is apparently created outside Hudson.

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface ModelObject

getFileName

@Exported
public String getFileName()
The file name (like "foo.jar" without path).


getHashString

@Exported(name="hash")
public String getHashString()
Gets the MD5 hash string.


getTimestamp

@Exported
public Date getTimestamp()
Gets the timestamp when this record is created.


getTimestampString

public String getTimestampString()
Gets the string that says how long since this build has scheduled.

Returns:
string like "3 minutes" "1 day" etc.

getRangeSet

public Fingerprint.RangeSet getRangeSet(String jobFullName)
Gets the build range set for the given job name.

These builds of this job has used this file.


getRangeSet

public Fingerprint.RangeSet getRangeSet(Job job)

getJobs

public List<String> getJobs()
Gets the sorted list of job names where this jar is used.


getUsages

public Hashtable<String,Fingerprint.RangeSet> getUsages()

_getUsages

@Exported(name="usage")
public List<Fingerprint.RangeItem> _getUsages()

add

public void add(AbstractBuild b)
         throws IOException
Throws:
IOException

add

public void add(String jobFullName,
                int n)
         throws IOException
Records that a build of a job has used this file.

Throws:
IOException

isAlive

public boolean isAlive()
Returns true if any of the builds recorded in this fingerprint is still retained.

This is used to find out old fingerprint records that can be removed without losing too much information.


getFacets

public Collection<FingerprintFacet> getFacets()
Gets the associated FingerprintFacets.

This method always return a non-empty collection, which is a synthetic collection. It contains persisted FingerprintFacets (those that are added explicitly, like fingerprint.getFacets().add(x)), as well those that are transient.

Mutation to this collection will manipulate persisted set of FingerprintFacets, and therefore regardless of what you do, this collection will always contain a set of FingerprintFacets that are added by TransientFingerprintFacetFactorys.

Since:
1.421

getSortedFacets

public Collection<FingerprintFacet> getSortedFacets()

getActions

public List<Action> getActions()
Returns the actions contributed from getFacets()


save

public void save()
          throws IOException
Save the settings to a file.

Specified by:
save in interface Saveable
Throws:
IOException - if the persistence failed.

rename

public void rename(String oldName,
                   String newName)
            throws IOException
Update references to a renamed job in the fingerprint

Throws:
IOException

getApi

public Api getApi()


Copyright © 2004-2013. All Rights Reserved.