@ExportedBean public class Fingerprint extends Object implements ModelObject, Saveable
Lifecycle is managed by FingerprintMap
.
FingerprintMap
Modifier and Type | Class and Description |
---|---|
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.Range s. |
Constructor and Description |
---|
Fingerprint(Run build,
String fileName,
byte[] md5sum) |
Modifier and Type | Method and Description |
---|---|
List<Fingerprint.RangeItem> |
_getUsages() |
void |
add(AbstractBuild b)
Deprecated.
|
void |
add(String jobFullName,
int n)
Records that a build of a job has used this file.
|
void |
addFor(Run b)
Adds a usage reference to the build.
|
static void |
delete(String id)
Deletes the
Fingerprint in the configured storage with the given unique id. |
List<Action> |
getActions()
Returns the actions contributed from
getFacets() |
Api |
getApi() |
String |
getDisplayName() |
<T extends FingerprintFacet> |
getFacet(Class<T> type)
Finds a facet of the specific type (including subtypes.)
|
FingerprintFacet |
getFacetBlockingDeletion()
Returns a facet that blocks the deletion of the fingerprint.
|
Collection<FingerprintFacet> |
getFacets()
Gets the associated
FingerprintFacet s. |
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.
|
PersistedList<FingerprintFacet> |
getPersistedFacets()
Returns the persisted facets.
|
Fingerprint.RangeSet |
getRangeSet(Job job) |
Fingerprint.RangeSet |
getRangeSet(String jobFullName)
Gets the build range set for the given job name.
|
Collection<FingerprintFacet> |
getSortedFacets()
Sorts
FingerprintFacet s by their timestamps. |
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() |
static XStream2 |
getXStream()
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 |
load(String id)
Loads a
Fingerprint from the Storage with the given unique id. |
protected Object |
readResolve() |
void |
rename(String oldName,
String newName)
Update references to a renamed job in the fingerprint
|
void |
save()
Save the Fingerprint in the Fingerprint Storage
|
String |
toString() |
boolean |
trim()
Trim off references to non-existent builds and jobs, thereby making the fingerprint smaller.
|
public Fingerprint(@CheckForNull Run build, @NonNull String fileName, @NonNull byte[] md5sum) throws IOException
IOException
@Exported @CheckForNull public Fingerprint.BuildPtr getOriginal()
This is considered as the "source" of this file, or the owner, in the sense that this project "owns" this file.
@NonNull public String getDisplayName()
getDisplayName
in interface ModelObject
@Exported @NonNull public String getFileName()
@Exported(name="hash") @NonNull public String getHashString()
@Exported @NonNull public Date getTimestamp()
@NonNull public String getTimestampString()
@NonNull public Fingerprint.RangeSet getRangeSet(String jobFullName)
These builds of this job has used this file.
public Fingerprint.RangeSet getRangeSet(Job job)
@NonNull public List<String> getJobs()
@CheckForNull public Hashtable<String,Fingerprint.RangeSet> getUsages()
@Exported(name="usage") @NonNull public List<Fingerprint.RangeItem> _getUsages()
@Deprecated public void add(@NonNull AbstractBuild b) throws IOException
addFor(hudson.model.Run)
IOException
public void addFor(@NonNull Run b) throws IOException
b
- Run
to be referenced in usages
IOException
public void add(@NonNull String jobFullName, int n) throws IOException
IOException
protected Object readResolve()
public boolean isAlive()
This is used to find out old fingerprint records that can be removed without losing too much information.
public boolean trim() throws IOException
IOException
- Save failure@NonNull public Collection<FingerprintFacet> getFacets()
FingerprintFacet
s.
This method always return a non-empty collection, which is a synthetic collection.
It contains persisted FingerprintFacet
s (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 FingerprintFacet
s, and therefore regardless
of what you do, this collection will always contain a set of FingerprintFacet
s that are added
by TransientFingerprintFacetFactory
s.
@NonNull public final PersistedList<FingerprintFacet> getPersistedFacets()
@NonNull public Collection<FingerprintFacet> getSortedFacets()
FingerprintFacet
s by their timestamps.FingerprintFacet
s@CheckForNull public <T extends FingerprintFacet> T getFacet(Class<T> type)
T
- Class of the FingerprintFacet
@NonNull public List<Action> getActions()
getFacets()
public void save() throws IOException
save
in interface Saveable
IOException
- Save error@CheckForNull public FingerprintFacet getFacetBlockingDeletion()
public void rename(String oldName, String newName) throws IOException
IOException
public Api getApi()
@CheckForNull public static Fingerprint load(@NonNull String id) throws IOException
Fingerprint
from the Storage with the given unique id.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 fingerprintIOException
public static void delete(@NonNull String id) throws IOException
Fingerprint
in the configured storage with the given unique id.IOException
@NonNull public static XStream2 getXStream()
Copyright © 2004–2021. All rights reserved.