hudson.plugins.analysis.core
Class AbstractHealthDescriptor

java.lang.Object
  extended by hudson.plugins.analysis.core.AbstractHealthDescriptor
All Implemented Interfaces:
HealthDescriptor, Serializable
Direct Known Subclasses:
NullHealthDescriptor

public abstract class AbstractHealthDescriptor
extends 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.
 String getHealthy()
          Returns the healthy threshold, i.e.
 int getHealthyAnnotations()
          Returns the healthy threshold for annotations, i.e.
 int getLowerBoundOfThresholds()
          Returns a lower bound of warnings that will guarantee that a build neither is unstable or failed.
 Priority getMinimumPriority()
          Returns the minimum priority that should be considered when computing build health.
 Thresholds getThresholds()
          Returns the threshold of all annotations to be reached if a build should be considered as unstable or failed, resp.
 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.
protected  Object readResolve()
          Initializes new fields that are not serialized yet.
 
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. 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

getHealthy

public 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 String getUnHealthy()
Returns the unhealthy threshold, i.e. when health is reported as 0%.

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

getThresholds

public Thresholds getThresholds()
Returns the threshold of all annotations to be reached if a build should be considered as unstable or failed, resp.

Specified by:
getThresholds in interface HealthDescriptor
Returns:
the threshold

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

getLowerBoundOfThresholds

public int getLowerBoundOfThresholds()
Returns a lower bound of warnings that will guarantee that a build neither is unstable or failed.

Returns:
the number of warnings

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:
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:
IllegalArgumentException - if the healthy values are not valid
See Also:
isHealthyReportEnabled()

readResolve

protected Object readResolve()
Initializes new fields that are not serialized yet.

Returns:
the object


Copyright © 2004-2012 Hudson. All Rights Reserved.