Class Fingerprint
- All Implemented Interfaces:
ModelObject
,Saveable
Lifecycle is managed by FingerprintMap
.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Pointer to aBuild
.static final class
static final class
Range of build numbers [start,end).static final class
static final class
Set ofFingerprint.Range
s. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(AbstractBuild b) Deprecated.void
Records that a build of a job has used this file.void
Adds a usage reference to the build.static void
Deletes theFingerprint
in the configured storage with the given unique id.Returns the actions contributed fromgetFacets()
getApi()
<T extends FingerprintFacet>
TFinds a facet of the specific type (including subtypes.)Returns a facet that blocks the deletion of the fingerprint.Gets the associatedFingerprintFacet
s.The file name (like "foo.jar" without path).Gets the MD5 hash string.getJobs()
Gets the sorted list of job names where this jar is used.The first build in which this file showed up, if the file looked like it's created there.final PersistedList<FingerprintFacet>
Returns the persisted facets.getRangeSet
(Job job) getRangeSet
(String jobFullName) Gets the build range set for the given job name.SortsFingerprintFacet
s by their timestamps.Gets the timestamp when this record is created.Gets the string that says how long since this build has scheduled.static XStream2
Provides the XStream instance this class is using for serialization.boolean
isAlive()
Returns true if any of the builds recorded in this fingerprint is still retained.static Fingerprint
Loads aFingerprint
from the Storage with the given unique id.protected Object
void
Update references to a renamed job in the fingerprintvoid
save()
Save the Fingerprint in the Fingerprint StoragetoString()
boolean
trim()
Trim off references to non-existent builds and jobs, thereby making the fingerprint smaller.
-
Constructor Details
-
Fingerprint
public Fingerprint(@CheckForNull Run build, @NonNull String fileName, @NonNull byte[] md5sum) throws IOException - Throws:
IOException
-
-
Method Details
-
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 or if the current user has no permission to discover the job.
-
getDisplayName
- Specified by:
getDisplayName
in interfaceModelObject
-
getFileName
The file name (like "foo.jar" without path). -
getHashString
Gets the MD5 hash string. -
getTimestamp
Gets the timestamp when this record is created. -
getTimestampString
Gets the string that says how long since this build has scheduled.- Returns:
- string like "3 minutes" "1 day" etc.
-
getRangeSet
Gets the build range set for the given job name.These builds of this job has used this file.
- Returns:
- may be empty but not null.
-
getRangeSet
-
getJobs
Gets the sorted list of job names where this jar is used. -
getUsages
-
_getUsages
-
add
Deprecated.- Throws:
IOException
-
addFor
Adds a usage reference to the build.- Parameters:
b
-Run
to be referenced inusages
- Throws:
IOException
- Since:
- 1.577
-
add
Records that a build of a job has used this file.- Throws:
IOException
-
readResolve
-
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.
-
trim
Trim off references to non-existent builds and jobs, thereby making the fingerprint smaller.- Returns:
- true if this record was modified.
- Throws:
IOException
- Save failure
-
getFacets
Gets the associatedFingerprintFacet
s.This method always return a non-empty collection, which is a synthetic collection. It contains persisted
FingerprintFacet
s (those that are added explicitly, likefingerprint.getFacets().add(x)
), as well those that are transient.Mutation to this collection will manipulate persisted set of
FingerprintFacet
s, and therefore regardless of what you do, this collection will always contain a set ofFingerprintFacet
s that are added byTransientFingerprintFacetFactory
s.- Since:
- 1.421
-
getPersistedFacets
Returns the persisted facets.- Since:
- 2.242
-
getSortedFacets
SortsFingerprintFacet
s by their timestamps.- Returns:
- Sorted list of
FingerprintFacet
s
-
getFacet
Finds a facet of the specific type (including subtypes.)- Type Parameters:
T
- Class of theFingerprintFacet
- Returns:
- First matching facet of the specified class
- Since:
- 1.556
-
getActions
Returns the actions contributed fromgetFacets()
-
save
Save the Fingerprint in the Fingerprint Storage- Specified by:
save
in interfaceSaveable
- Throws:
IOException
- Save error
-
getFacetBlockingDeletion
Returns a facet that blocks the deletion of the fingerprint. Returns null if no such facet.- Since:
- 2.223
-
rename
Update references to a renamed job in the fingerprint- Throws:
IOException
-
getApi
-
load
Loads aFingerprint
from the Storage with the given unique id.- Returns:
- Loaded
Fingerprint
.null
if the config file does not exist or malformed. In case an external storage is configured on top of a file system based storage: 1. External storage is polled to retrieve the fingerprint 2. If not found, then the local storage is polled to retrieve the fingerprint - Throws:
IOException
-
delete
Deletes theFingerprint
in the configured storage with the given unique id.- Throws:
IOException
- Since:
- 2.242
-
toString
-
getXStream
Provides the XStream instance this class is using for serialization.- Returns:
- the XStream instance
- Since:
- 1.655
-
addFor(hudson.model.Run)