hudson.plugins.checkstyle.util
Class HealthAwareMavenReporter

java.lang.Object
  extended by hudson.maven.MavenReporter
      extended by hudson.plugins.checkstyle.util.HealthAwareMavenReporter
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.maven.MavenReporter>, HealthDescriptor, java.io.Serializable
Direct Known Subclasses:
CheckStyleReporter

public abstract class HealthAwareMavenReporter
extends hudson.maven.MavenReporter
implements HealthDescriptor

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

Author:
Ulli Hafner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
HealthAwareMavenReporter(java.lang.String threshold, java.lang.String newThreshold, java.lang.String failureThreshold, java.lang.String newFailureThreshold, java.lang.String healthy, java.lang.String unHealthy, java.lang.String thresholdLimit, java.lang.String pluginName)
          Creates a new instance of HealthReportingMavenReporter.
 
Method Summary
protected abstract  boolean acceptGoal(java.lang.String goal)
          Determines whether this plug-in will accept the specified goal.
protected  boolean canContinue(hudson.model.Result result)
          Returns whether the reporter can continue processing.
protected  java.lang.String getDefaultEncoding()
          Returns the default encoding derived from the maven pom file.
 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.
 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.
protected abstract  java.lang.Class<? extends hudson.model.Action> 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.
 java.lang.String getThreshold()
          Returns the threshold of all annotations to be reached if a build should be considered as unstable.
 java.lang.String getThresholdLimit()
          Returns the threshold limit.
 java.lang.String getUnHealthy()
          Returns the unhealthy threshold, i.e.
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.
protected abstract  BuildResult persistResult(ParserResult project, hudson.maven.MavenBuild build)
          Persists the result in the build (on the master).
 boolean postExecute(hudson.maven.MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.maven.MojoInfo mojo, hudson.model.BuildListener listener, java.lang.Throwable error)
          
 
Methods inherited from class hudson.maven.MavenReporter
end, enterModule, getAggregatedProjectAction, getDescriptor, getProjectAction, 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

HealthAwareMavenReporter

public HealthAwareMavenReporter(java.lang.String threshold,
                                java.lang.String newThreshold,
                                java.lang.String failureThreshold,
                                java.lang.String newFailureThreshold,
                                java.lang.String healthy,
                                java.lang.String unHealthy,
                                java.lang.String thresholdLimit,
                                java.lang.String pluginName)
Creates a new instance of HealthReportingMavenReporter.

Parameters:
threshold - Annotations threshold to be reached if a build should be considered as unstable.
newThreshold - New annotations threshold to be reached if a build should be considered as unstable.
failureThreshold - Annotation threshold to be reached if a build should be considered as failure.
newFailureThreshold - New annotations threshold to be reached if a build should be considered as failure.
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
pluginName - the name of the plug-in
Method Detail

postExecute

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

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

canContinue

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

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

acceptGoal

protected abstract boolean acceptGoal(java.lang.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 java.lang.InterruptedException,
                                        java.io.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:
java.lang.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.
java.io.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.

persistResult

protected abstract BuildResult persistResult(ParserResult project,
                                             hudson.maven.MavenBuild build)
Persists the result in the build (on the master).

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

getDefaultEncoding

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

Returns:
the default encoding

getResultActionClass

protected abstract java.lang.Class<? extends hudson.model.Action> 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

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

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

getThresholdLimit

public java.lang.String getThresholdLimit()
Returns the threshold limit.

Returns:
the threshold limit


Copyright © 2009. All Rights Reserved.