hudson.plugins.analysis.core
Class HealthAwareReporter<T extends BuildResult>

java.lang.Object
  extended by hudson.maven.MavenReporter
      extended by hudson.plugins.analysis.core.HealthAwareReporter<T>
Type Parameters:
T - the actual type of the build result
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.maven.MavenProjectActionBuilder, hudson.model.Describable<hudson.maven.MavenReporter>, HealthDescriptor, Serializable

public abstract class HealthAwareReporter<T extends BuildResult>
extends hudson.maven.MavenReporter
implements HealthDescriptor

A base class for Maven reporters with the following two characteristics:

Since:
1.20
Author:
Ulli Hafner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
HealthAwareReporter(String healthy, String unHealthy, String thresholdLimit, boolean useDeltaValues, String unstableTotalAll, String unstableTotalHigh, String unstableTotalNormal, String unstableTotalLow, String unstableNewAll, String unstableNewHigh, String unstableNewNormal, String unstableNewLow, String failedTotalAll, String failedTotalHigh, String failedTotalNormal, String failedTotalLow, String failedNewAll, String failedNewHigh, String failedNewNormal, String failedNewLow, boolean canRunOnFailed, boolean canComputeNew, String pluginName)
          Creates a new instance of HealthReportingMavenReporter.
HealthAwareReporter(String healthy, String unHealthy, String thresholdLimit, boolean useDeltaValues, String unstableTotalAll, String unstableTotalHigh, String unstableTotalNormal, String unstableTotalLow, String unstableNewAll, String unstableNewHigh, String unstableNewNormal, String unstableNewLow, String failedTotalAll, String failedTotalHigh, String failedTotalNormal, String failedTotalLow, String failedNewAll, String failedNewHigh, String failedNewNormal, String failedNewLow, boolean canRunOnFailed, String pluginName)
          Deprecated. 
 
Method Summary
protected abstract  boolean acceptGoal(String goal)
          Determines whether this plug-in will accept the specified goal.
 boolean canComputeNew()
          Returns whether new warnings should be computed (with respect to baseline).
protected  boolean canContinue(hudson.model.Result result)
          Returns whether this reporter can continue processing.
protected abstract  hudson.maven.MavenAggregatedReport createMavenAggregatedReport(hudson.maven.MavenBuild build, T result)
          Creates a new BuildResult instance.
protected abstract  T createResult(hudson.maven.MavenBuild build, ParserResult project)
          Creates a new BuildResult instance.
 boolean end(hudson.maven.MavenBuild build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Since aggregation is done in background we still need to log all messages of that step to the log.
 boolean getCanComputeNew()
          Returns whether new warnings should be computed (with respect to baseline).
 boolean getCanRunOnFailed()
          Returns whether this plug-in can run for failed builds, too.
protected  String getDefaultEncoding()
          Returns the default encoding derived from the maven pom file.
 ReporterDescriptor getDescriptor()
          
 String getHealthy()
          Returns the healthy threshold, i.e.
 Priority getMinimumPriority()
          Returns the minimum priority that should be considered when computing build health.
protected  String getModuleName(org.apache.maven.project.MavenProject pom)
          Returns the name of the module.
protected abstract  Class<? extends MavenResultAction<T>> getResultActionClass()
          Returns the type of the result action.
protected  hudson.FilePath getTargetPath(org.apache.maven.project.MavenProject pom)
          Returns the path to the target folder.
 String getThresholdLimit()
          Returns the threshold limit.
 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.
 boolean getUseDeltaValues()
          Returns whether absolute annotations delta or the actual annotations set difference should be used to evaluate the build stability.
protected abstract  ParserResult perform(hudson.maven.MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.maven.MojoInfo mojo, PluginLogger logger)
          Performs the publishing of the results of this plug-in.
 boolean postExecute(hudson.maven.MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.maven.MojoInfo mojo, hudson.model.BuildListener listener, Throwable error)
          
 
Methods inherited from class hudson.maven.MavenReporter
enterModule, getAggregatedProjectAction, getProjectAction, getProjectActions, leaveModule, postBuild, preBuild, preExecute, reportGenerated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HealthAwareReporter

public HealthAwareReporter(String healthy,
                           String unHealthy,
                           String thresholdLimit,
                           boolean useDeltaValues,
                           String unstableTotalAll,
                           String unstableTotalHigh,
                           String unstableTotalNormal,
                           String unstableTotalLow,
                           String unstableNewAll,
                           String unstableNewHigh,
                           String unstableNewNormal,
                           String unstableNewLow,
                           String failedTotalAll,
                           String failedTotalHigh,
                           String failedTotalNormal,
                           String failedTotalLow,
                           String failedNewAll,
                           String failedNewHigh,
                           String failedNewNormal,
                           String failedNewLow,
                           boolean canRunOnFailed,
                           boolean canComputeNew,
                           String pluginName)
Creates a new instance of HealthReportingMavenReporter.

Parameters:
healthy - Report health as 100% when the number of warnings is less than this value
unHealthy - Report health as 0% when the number of warnings is greater than this value
thresholdLimit - determines which warning priorities should be considered when evaluating the build stability and health
useDeltaValues - determines whether the absolute annotations delta or the actual annotations set difference should be used to evaluate the build stability
unstableTotalAll - annotation threshold
unstableTotalHigh - annotation threshold
unstableTotalNormal - annotation threshold
unstableTotalLow - annotation threshold
unstableNewAll - annotation threshold
unstableNewHigh - annotation threshold
unstableNewNormal - annotation threshold
unstableNewLow - annotation threshold
failedTotalAll - annotation threshold
failedTotalHigh - annotation threshold
failedTotalNormal - annotation threshold
failedTotalLow - annotation threshold
failedNewAll - annotation threshold
failedNewHigh - annotation threshold
failedNewNormal - annotation threshold
failedNewLow - annotation threshold
canRunOnFailed - determines whether the plug-in can run for failed builds, too
canComputeNew - determines whether new warnings should be computed (with respect to baseline)
pluginName - the name of the plug-in

HealthAwareReporter

@Deprecated
public HealthAwareReporter(String healthy,
                                      String unHealthy,
                                      String thresholdLimit,
                                      boolean useDeltaValues,
                                      String unstableTotalAll,
                                      String unstableTotalHigh,
                                      String unstableTotalNormal,
                                      String unstableTotalLow,
                                      String unstableNewAll,
                                      String unstableNewHigh,
                                      String unstableNewNormal,
                                      String unstableNewLow,
                                      String failedTotalAll,
                                      String failedTotalHigh,
                                      String failedTotalNormal,
                                      String failedTotalLow,
                                      String failedNewAll,
                                      String failedNewHigh,
                                      String failedNewNormal,
                                      String failedNewLow,
                                      boolean canRunOnFailed,
                                      String pluginName)
Deprecated. 

Method Detail

getCanComputeNew

public boolean getCanComputeNew()
Returns whether new warnings should be computed (with respect to baseline).

Returns:
true if new warnings should be computed (with respect to baseline), false otherwise

canComputeNew

public boolean canComputeNew()
Returns whether new warnings should be computed (with respect to baseline).

Returns:
true if new warnings should be computed (with respect to baseline), false otherwise

getUseDeltaValues

public boolean getUseDeltaValues()
Returns whether absolute annotations delta or the actual annotations set difference should be used to evaluate the build stability.

Returns:
true if the annotation count should be used, false if the actual (set) difference should be computed

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

postExecute

public final boolean postExecute(hudson.maven.MavenBuildProxy build,
                                 org.apache.maven.project.MavenProject pom,
                                 hudson.maven.MojoInfo mojo,
                                 hudson.model.BuildListener listener,
                                 Throwable error)
                          throws InterruptedException,
                                 IOException

Overrides:
postExecute in class hudson.maven.MavenReporter
Throws:
InterruptedException
IOException

getDescriptor

public ReporterDescriptor getDescriptor()

Specified by:
getDescriptor in interface hudson.model.Describable<hudson.maven.MavenReporter>
Overrides:
getDescriptor in class hudson.maven.MavenReporter

end

public boolean end(hudson.maven.MavenBuild build,
                   hudson.Launcher launcher,
                   hudson.model.BuildListener listener)
Since aggregation is done in background we still need to log all messages of that step to the log.

Overrides:
end in class hudson.maven.MavenReporter
Parameters:
build - the finished maven module build
launcher - the launcher
listener - the lister that holds the log
Returns:
true

getCanRunOnFailed

public boolean getCanRunOnFailed()
Returns whether this plug-in can run for failed builds, too.

Returns:
true if this plug-in can run for failed builds, false otherwise

canContinue

protected boolean canContinue(hudson.model.Result result)
Returns whether this reporter can continue processing. This default implementation returns true if the property canRunOnFailed is set or if the build is not aborted or failed.

Parameters:
result - build result
Returns:
true if the build can continue

acceptGoal

protected abstract boolean acceptGoal(String goal)
Determines whether this plug-in will accept the specified goal. The postExecute(MavenBuildProxy, MavenProject, MojoInfo, BuildListener, Throwable) will only by invoked if the plug-in returns true.

Parameters:
goal - the maven goal
Returns:
true if the plug-in accepts this goal

perform

protected abstract ParserResult perform(hudson.maven.MavenBuildProxy build,
                                        org.apache.maven.project.MavenProject pom,
                                        hudson.maven.MojoInfo mojo,
                                        PluginLogger logger)
                                 throws InterruptedException,
                                        IOException
Performs the publishing of the results of this plug-in.

Parameters:
build - the build proxy (on the slave)
pom - the pom of the module
mojo - the executed mojo
logger - the logger to report the progress to
Returns:
the java project containing the found annotations
Throws:
InterruptedException - If the build is interrupted by the user (in an attempt to abort the build.) Normally the BuildStep implementations may simply forward the exception it got from its lower-level functions.
IOException - If the implementation wants to abort the processing when an IOException happens, it can simply propagate the exception to the caller. This will cause the build to fail, with the default error message. Implementations are encouraged to catch IOException on its own to provide a better error message, if it can do so, so that users have better understanding on why it failed.

createResult

protected abstract T createResult(hudson.maven.MavenBuild build,
                                  ParserResult project)
Creates a new BuildResult instance.

Parameters:
build - the build (on the master)
project - the created project
Returns:
the created result

createMavenAggregatedReport

protected abstract hudson.maven.MavenAggregatedReport createMavenAggregatedReport(hudson.maven.MavenBuild build,
                                                                                  T result)
Creates a new BuildResult instance.

Parameters:
build - the build (on the master)
result - the build result
Returns:
the created result

getDefaultEncoding

protected String getDefaultEncoding()
Returns the default encoding derived from the maven pom file.

Returns:
the default encoding

getResultActionClass

protected abstract Class<? extends MavenResultAction<T>> getResultActionClass()
Returns the type of the result action.

Returns:
the type of the result action

getTargetPath

protected hudson.FilePath getTargetPath(org.apache.maven.project.MavenProject pom)
Returns the path to the target folder.

Parameters:
pom - the maven pom
Returns:
the path to the target folder

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

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

getThresholdLimit

public String getThresholdLimit()
Returns the threshold limit.

Returns:
the threshold limit

getModuleName

protected String getModuleName(org.apache.maven.project.MavenProject pom)
Returns the name of the module.

Parameters:
pom - the pom
Returns:
the name of the module


Copyright © 2004-2012 Hudson. All Rights Reserved.