public abstract class KnowledgeBase extends Object implements Describable<KnowledgeBase>, Serializable
FailureCause
s. Extend this class and put @Extension
on
the descriptor to provide your own.Modifier and Type | Class and Description |
---|---|
static class |
KnowledgeBase.KnowledgeBaseDescriptor
Descriptor for
KnowledgeBase s. |
Constructor and Description |
---|
KnowledgeBase() |
Modifier and Type | Method and Description |
---|---|
abstract FailureCause |
addCause(FailureCause cause)
Saves a new cause to the db and generates a new id for the cause.
|
abstract void |
convertFrom(KnowledgeBase oldKnowledgeBase)
Converts the existing old knowledge base into this one.
|
protected void |
convertFromAbstract(KnowledgeBase oldKnowledgeBase)
Does a full copy of the data in the old one to this one.
|
abstract boolean |
equals(KnowledgeBase oldKnowledgeBase)
Called to see if the configuration has changed.
|
abstract List<String> |
getCategories()
Gets the unique categories of all FailureCauses.
|
abstract FailureCause |
getCause(String id)
Get the cause with the given id.
|
abstract Collection<FailureCause> |
getCauseNames()
Get the list of the
FailureCause 's names and ids. |
abstract Collection<FailureCause> |
getCauses()
Get the list of
FailureCause s. |
Date |
getCreationDateForCause(String id)
Find out when the FailureCause identified by id was first created.
|
List<ObjectCountPair<String>> |
getFailureCauseNames(GraphFilterBuilder filter)
Gets a list of
ObjectCountPair s where each pair contains a unique FailureCause -name as key
and the number of times that failure cause was triggered as count. |
Map<Integer,List<FailureCause>> |
getFailureCausesPerBuild(GraphFilterBuilder filter)
Gets a map where a lists of failure causes are mapped
by the build number for which they were triggered.
|
List<FailureCauseTimeInterval> |
getFailureCausesPerTime(int intervalSize,
GraphFilterBuilder filter,
boolean byCategories)
Fetches failure causes grouped in time intervals.
|
Date |
getLatestFailureForCause(String id)
Find the time at which the latest Failure occurred which matches the provided FailureCause.
|
List<ObjectCountPair<String>> |
getNbrOfFailureCategoriesPerName(GraphFilterBuilder filter,
int limit)
Gets a list of
ObjectCountPair where each pair contains a unique failure category string as key
and the number of times that the failure cause category was triggered as count. |
List<ObjectCountPair<FailureCause>> |
getNbrOfFailureCauses(GraphFilterBuilder filter)
Gets a list of
ObjectCountPair where each pair contains a unique FailureCause as key
and the number of times that failure cause was triggered as count. |
List<ObjectCountPair<String>> |
getNbrOfFailureCausesPerId(GraphFilterBuilder filter,
int limit)
Gets a list of
ObjectCountPair where each pair contains a unique FailureCause id as key
and a belonging count value for how many times that FailureCause was triggered. |
long |
getNbrOfNullFailureCauses(GraphFilterBuilder filter)
Counts how many statistics posts there are without FailureCause (null) for a given filter.
|
abstract Collection<FailureCause> |
getShallowCauses()
Get a shallow list of the
FailureCause s. |
List<Statistics> |
getStatistics(GraphFilterBuilder filter,
int limit)
Gets Statistics data.
|
Map<org.jfree.data.time.TimePeriod,Double> |
getUnknownFailureCauseQuotaPerTime(int intervalSize,
GraphFilterBuilder filter)
Gets the quota of unknown failure causes mapped by time periods.
|
abstract boolean |
isEnableStatistics()
If Statistics logging is enabled on this knowledge base or not.
|
abstract boolean |
isSuccessfulLogging()
If all builds should be added to statistics logging, not just unsuccessful builds.
|
void |
removeBuildfailurecause(AbstractBuild build)
Deprecated.
|
void |
removeBuildfailurecause(Run build)
Removes the build failure cause of particular build.
|
abstract FailureCause |
removeCause(String id)
Removes the cause from the knowledge base.
|
abstract FailureCause |
saveCause(FailureCause cause)
Saves a cause to the db.
|
abstract void |
saveStatistics(Statistics stat)
Saves the Statistics.
|
abstract void |
start()
Called when the KnowledgeBase should be up and running.
|
abstract void |
stop()
Called when it is time to clean up after the KnowledgeBase.
|
void |
updateLastSeen(List<String> ids,
Date seen)
Set the time at which FailureCauses identified by ids last occurred.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDescriptor
public abstract Collection<FailureCause> getCauses() throws Exception
FailureCause
s. It is intended to be used in the scanning phase hence it should be
returned as quickly as possible, so the list could be cached.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract Collection<FailureCause> getCauseNames() throws Exception
FailureCause
's names and ids. The list should be the latest possible from the DB as
they will be used for editing. The objects returned should contain at least the id and the name of the cause.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract Collection<FailureCause> getShallowCauses() throws Exception
FailureCause
s. The list should be the latest possible from the DB as
they will be used in the list of causes to edit.
shallow meaning no indications but information enough to show a nice list; at least id and name but description,
comment, lastOccurred and categories are preferred as well.Exception
- if something in the KnowledgeBase handling goes wrong.getCauseNames()
public abstract FailureCause getCause(String id) throws Exception
id
- the id of the cause.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract FailureCause addCause(FailureCause cause) throws Exception
cause
- the cause to add.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract FailureCause removeCause(String id) throws Exception
id
- the id of the cause to remove.Exception
- if so.public abstract FailureCause saveCause(FailureCause cause) throws Exception
KnowledgeBase
implementation with a preexisting id that is being converted via convertFrom(KnowledgeBase)
.cause
- the cause to add.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract void convertFrom(KnowledgeBase oldKnowledgeBase) throws Exception
oldKnowledgeBase
- the old one.Exception
- if something in the KnowledgeBase handling goes wrong.public abstract List<String> getCategories() throws Exception
Exception
- if something in the KnowledgeBase handling goes wrong.protected void convertFromAbstract(KnowledgeBase oldKnowledgeBase) throws Exception
convertFrom(KnowledgeBase)
to handle conversion from an unknown source type.oldKnowledgeBase
- the old one.Exception
- if anything goes wrong in the KnowledgeBase handling.convertFrom(KnowledgeBase)
public abstract boolean equals(KnowledgeBase oldKnowledgeBase)
oldKnowledgeBase
- the previous config.public abstract void start() throws Exception
Exception
- if anything goes wrong during the startup.public abstract void stop()
public abstract boolean isEnableStatistics()
public abstract boolean isSuccessfulLogging()
isEnableStatistics()
is true.public abstract void saveStatistics(Statistics stat) throws Exception
stat
- the Statistics.Exception
- if something in the KnowledgeBase handling goes wrong.public List<Statistics> getStatistics(GraphFilterBuilder filter, int limit) throws Exception
filter
- the filter to use when fetching datalimit
- number of statistics items to fetch, set to nonpositive value to fetch allException
- if something in the KnowledgeBase handling goes wrong.public List<ObjectCountPair<FailureCause>> getNbrOfFailureCauses(GraphFilterBuilder filter)
ObjectCountPair
where each pair contains a unique FailureCause
as key
and the number of times that failure cause was triggered as count.
The list is sorted by counts, meaning that the FailureCause that has been triggered the most comes first.
This method needs to be implemented in subclass for graph support.filter
- the filter to use when fetching datapublic Map<org.jfree.data.time.TimePeriod,Double> getUnknownFailureCauseQuotaPerTime(int intervalSize, GraphFilterBuilder filter)
intervalSize
- the interval sizes in which the data is grouped.
Should be set to Calendar.MONTH, Calendar.DATE or Calendar.HOUR_OF_DAY.filter
- The filter to use when fetching the datapublic List<ObjectCountPair<String>> getFailureCauseNames(GraphFilterBuilder filter)
ObjectCountPair
s where each pair contains a unique FailureCause
-name as key
and the number of times that failure cause was triggered as count.
This list is sorted by counts, meaning that the FailureCause that has been triggered the most comes first.
This method needs to be implemented in subclass for graph support.filter
- The filter to use when fetching the datapublic long getNbrOfNullFailureCauses(GraphFilterBuilder filter)
filter
- the filter to use when fetching datapublic List<ObjectCountPair<String>> getNbrOfFailureCategoriesPerName(GraphFilterBuilder filter, int limit)
ObjectCountPair
where each pair contains a unique failure category string as key
and the number of times that the failure cause category was triggered as count.
The list is sorted by counts, meaning that the Category that has been triggered the most comes first.
This method needs to be implemented in subclass for graph support.filter
- the filter to use when fetching datalimit
- the number of categories to fetch, set to nonpositive value to fetch allpublic Map<Integer,List<FailureCause>> getFailureCausesPerBuild(GraphFilterBuilder filter)
filter
- the filter to use when fetching datapublic List<FailureCauseTimeInterval> getFailureCausesPerTime(int intervalSize, GraphFilterBuilder filter, boolean byCategories)
intervalSize
- the interval sizes in which the data is grouped.
Should be set to Calendar.MONTH, Calendar.DATE or Calendar.HOUR_OF_DAY.filter
- the filter to use when fetching databyCategories
- set to true in order to group failure causes by their categoriespublic List<ObjectCountPair<String>> getNbrOfFailureCausesPerId(GraphFilterBuilder filter, int limit)
ObjectCountPair
where each pair contains a unique FailureCause id as key
and a belonging count value for how many times that FailureCause was triggered.
This method needs to be implemented in subclass for graph support.filter
- the filter to use when fetching datalimit
- the number of items to fetch, set to nonpositive value to fetch allpublic Date getLatestFailureForCause(String id)
id
- the FailureCause to match.public void updateLastSeen(List<String> ids, Date seen)
ids
- the ids of FailureCauses which occurred.seen
- the time at which the FailureCauses occurred.public Date getCreationDateForCause(String id)
id
- the id of the FailureCause which info to retrieve.@Deprecated public void removeBuildfailurecause(AbstractBuild build) throws Exception
removeBuildfailurecause(hudson.model.Run)
build
- the build.Exception
- if something in the KnowledgeBase handling goes wrong.Copyright © 2016–2019. All rights reserved.