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>, java.io.Serializable
Direct Known Subclasses:
CheckStyleReporter

public abstract class HealthAwareMavenReporter
extends hudson.maven.MavenReporter

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

Author:
Ulli Hafner
See Also:
Serialized Form

Constructor Summary
HealthAwareMavenReporter(java.lang.String threshold, java.lang.String healthy, java.lang.String unHealthy, java.lang.String height, 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  HealthReportBuilder createHealthBuilder(java.lang.String reportSingleCount, java.lang.String reportMultipleCount)
          Creates a new instance of HealthReportBuilder.
 java.lang.String getHealthy()
          Returns the healthy threshold, i.e. when health is reported as 100%.
 int getHealthyAnnotations()
          Returns the healthy threshold for annotations, i.e. when health is reported as 100%.
 java.lang.String getHeight()
          Returns the height of the trend graph.
 int getMinimumAnnotations()
          Returns the threshold 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 annotation threshold to be reached if a build should be considered as unstable.
 int getTrendHeight()
          Returns the height of the trend graph.
 java.lang.String getUnHealthy()
          Returns the unhealthy threshold, i.e. when health is reported as 0%.
 int getUnHealthyAnnotations()
          Returns the unhealthy threshold of annotations, i.e. when health is reported as 0%.
 boolean isHealthyReportEnabled()
          Returns the isHealthyReportEnabled.
 boolean isThresholdEnabled()
          Determines whether a threshold has been defined.
protected  void log(java.io.PrintStream logger, java.lang.String message)
          Logs the specified message.
protected abstract  JavaProject perform(hudson.maven.MavenBuildProxy build, org.apache.maven.project.MavenProject pom, hudson.maven.MojoInfo mojo, java.io.PrintStream logger)
          Performs the publishing of the results of this plug-in.
protected abstract  void persistResult(JavaProject 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
 
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 healthy,
                                java.lang.String unHealthy,
                                java.lang.String height,
                                java.lang.String pluginName)
Creates a new instance of HealthReportingMavenReporter.

Parameters:
threshold - Bug threshold to be reached if a build should be considered as unstable.
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
height - the height of the trend graph
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

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 JavaProject perform(hudson.maven.MavenBuildProxy build,
                                       org.apache.maven.project.MavenProject pom,
                                       hudson.maven.MojoInfo mojo,
                                       java.io.PrintStream 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 void persistResult(JavaProject 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)

log

protected void log(java.io.PrintStream logger,
                   java.lang.String message)
Logs the specified message.

Parameters:
logger - the logger
message - the message

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

createHealthBuilder

protected HealthReportBuilder createHealthBuilder(java.lang.String reportSingleCount,
                                                  java.lang.String reportMultipleCount)
Creates a new instance of HealthReportBuilder.

Parameters:
reportSingleCount - message to be shown if there is exactly one item found
reportMultipleCount - message to be shown if there are zero or more than one items found
Returns:
the new health report builder

isThresholdEnabled

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

Returns:
true if a threshold has been defined

getThreshold

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

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

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()
Returns the isHealthyReportEnabled.

Returns:
the isHealthyReportEnabled

getHealthy

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

Returns:
the 100% healthiness

getHealthyAnnotations

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

Returns:
the 100% healthiness

getUnHealthy

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

Returns:
the 0% unhealthiness

getUnHealthyAnnotations

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

Returns:
the 0% unhealthiness

getHeight

public java.lang.String getHeight()
Returns the height of the trend graph.

Returns:
the height of the trend graph

getTrendHeight

public int getTrendHeight()
Returns the height of the trend graph.

Returns:
the height of the trend graph


Copyright © 2008. All Rights Reserved.