hudson.plugins.findbugs.util
Class AbstractHealthDescriptor

java.lang.Object
  extended by hudson.plugins.findbugs.util.AbstractHealthDescriptor
All Implemented Interfaces:
HealthDescriptor, java.io.Serializable
Direct Known Subclasses:
FindBugsHealthDescriptor, NullHealthDescriptor

public abstract class AbstractHealthDescriptor
extends java.lang.Object
implements HealthDescriptor

A base class for serializable health descriptors. Instances of this class are immutable.

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
AbstractHealthDescriptor()
          Creates a new instance of AbstractHealthDescriptor.
AbstractHealthDescriptor(HealthDescriptor healthDescriptor)
          Creates a new instance of AbstractHealthDescriptor based on the values of the specified descriptor.
 
Method Summary
protected abstract  org.jvnet.localizer.Localizable createDescription(AnnotationProvider result)
          Returns a localized description of the build health.
 java.lang.String getFailureThreshold()
          Returns the annotation threshold to be reached if a build should be considered as failure.
 java.lang.String getHealthy()
          Returns the healthy threshold, i.e.
 int getHealthyAnnotations()
          Returns the healthy threshold for annotations, i.e.
 int getMinimumAnnotations()
          Returns the threshold to be reached if a build should be considered as unstable.
 Priority getMinimumPriority()
          Returns the minimum priority that should be considered when computing build health and stability.
 java.lang.String getNewFailureThreshold()
          Returns the threshold of new annotations to be reached if a build should be considered as failure.
 java.lang.String getNewThreshold()
          Returns the threshold for new annotations to be reached if a build should be considered as unstable.
 java.lang.String getThreshold()
          Returns the threshold of all annotations to be reached if a build should be considered as unstable.
 java.lang.String getUnHealthy()
          Returns the unhealthy threshold, i.e.
 int getUnHealthyAnnotations()
          Returns the unhealthy threshold of annotations, i.e.
 boolean isEnabled()
          Returns whether this health report build is enabled, i.e.
 boolean isHealthyReportEnabled()
          Determines whether a health report should be created.
 boolean isThresholdEnabled()
          Determines whether a threshold has been defined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractHealthDescriptor

public AbstractHealthDescriptor(HealthDescriptor healthDescriptor)
Creates a new instance of AbstractHealthDescriptor based on the values of the specified descriptor.

Parameters:
healthDescriptor - the descriptor to copy the values from

AbstractHealthDescriptor

public AbstractHealthDescriptor()
Creates a new instance of AbstractHealthDescriptor.

Method Detail

getMinimumPriority

public Priority getMinimumPriority()
Returns the minimum priority that should be considered when computing build health and stability. E.g., if Priority.NORMAL is returned, then annotations with priority Priority.LOW are ignored.

Specified by:
getMinimumPriority in interface HealthDescriptor
Returns:
the minimum priority to consider

getThreshold

public java.lang.String getThreshold()
Returns the threshold of all annotations to be reached if a build should be considered as unstable.

Specified by:
getThreshold in interface HealthDescriptor
Returns:
the threshold of all annotations to be reached if a build should be considered as unstable.

getNewThreshold

public java.lang.String getNewThreshold()
Returns the threshold for new annotations to be reached if a build should be considered as unstable.

Specified by:
getNewThreshold in interface HealthDescriptor
Returns:
the threshold for new annotations to be reached if a build should be considered as unstable.

getFailureThreshold

public java.lang.String getFailureThreshold()
Returns the annotation threshold to be reached if a build should be considered as failure.

Specified by:
getFailureThreshold in interface HealthDescriptor
Returns:
the annotation threshold to be reached if a build should be considered as failure.

getNewFailureThreshold

public java.lang.String getNewFailureThreshold()
Returns the threshold of new annotations to be reached if a build should be considered as failure.

Specified by:
getNewFailureThreshold in interface HealthDescriptor
Returns:
the threshold of new annotations to be reached if a build should be considered as failure.

getHealthy

public java.lang.String getHealthy()
Returns the healthy threshold, i.e. when health is reported as 100%.

Specified by:
getHealthy in interface HealthDescriptor
Returns:
the 100% healthiness

getUnHealthy

public java.lang.String getUnHealthy()
Returns the unhealthy threshold, i.e. when health is reported as 0%.

Specified by:
getUnHealthy in interface HealthDescriptor
Returns:
the 0% unhealthiness

isEnabled

public boolean isEnabled()
Returns whether this health report build is enabled, i.e. at least one of the health or failed thresholds are provided.

Returns:
true if health or failed thresholds are provided, false otherwise

createDescription

protected abstract org.jvnet.localizer.Localizable createDescription(AnnotationProvider result)
Returns a localized description of the build health.

Parameters:
result - the result of the build
Returns:
a localized description of the build health

isThresholdEnabled

public boolean isThresholdEnabled()
Determines whether a threshold has been defined.

Returns:
true if a threshold has been defined

getMinimumAnnotations

public int getMinimumAnnotations()
Returns the threshold to be reached if a build should be considered as unstable.

Returns:
the threshold to be reached if a build should be considered as unstable

isHealthyReportEnabled

public boolean isHealthyReportEnabled()
Determines whether a health report should be created.

Returns:
true if a health report should be created

getHealthyAnnotations

public int getHealthyAnnotations()
Returns the healthy threshold for annotations, i.e. when health is reported as 100%.

Returns:
the 100% healthiness
Throws:
java.lang.IllegalArgumentException - if the healthy values are not valid
See Also:
isHealthyReportEnabled()

getUnHealthyAnnotations

public int getUnHealthyAnnotations()
Returns the unhealthy threshold of annotations, i.e. when health is reported as 0%.

Returns:
the 0% unhealthiness
Throws:
java.lang.IllegalArgumentException - if the healthy values are not valid
See Also:
isHealthyReportEnabled()


Copyright © 2009. All Rights Reserved.