hudson.plugins.warnings
Class WarningsPublisher

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.plugins.warnings.util.HealthAwarePublisher
              extended by hudson.plugins.warnings.WarningsPublisher
All Implemented Interfaces:
hudson.model.Describable<hudson.tasks.Publisher>, HealthDescriptor, hudson.tasks.BuildStep, java.io.Serializable

public class WarningsPublisher
extends HealthAwarePublisher

Publishes the results of the warnings analysis (freestyle project type).

Author:
Ulli Hafner
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
static WarningsDescriptor WARNINGS_DESCRIPTOR
          Descriptor of this publisher.
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
WarningsPublisher(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 pattern, java.lang.String includePattern, java.lang.String excludePattern, java.lang.String defaultEncoding, boolean canRunOnFailed, boolean canScanConsole)
          Creates a new instance of WarningPublisher.
 
Method Summary
protected  boolean canContinue(hudson.model.Result result)
          Returns whether the publisher can continue processing.
 boolean getCanRunOnFailed()
          Returns whether this plug-in can run for failed builds, too.
 boolean getCanScanConsole()
          Returns whether this plug-in should scan the console or not.
 hudson.model.Descriptor<hudson.tasks.Publisher> getDescriptor()
          
 java.lang.String getExcludePattern()
          Returns the Ant file-set pattern of files to exclude from report.
 java.lang.String getIncludePattern()
          Returns the Ant file-set pattern of files to include in report.
 java.util.Set<java.lang.String> getParserNames()
          Returns the names of the configured parsers of this publisher.
 java.lang.String getPattern()
          Returns the Ant file-set pattern of files to work with.
 hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)
          
 BuildResult perform(hudson.model.AbstractBuild<?,?> build, PluginLogger logger)
          Performs the publishing of the results of this plug-in.
protected  java.lang.Object readResolve()
          Creates a new parser set for old versions of this class.
 void setParserNames(java.util.Set<java.lang.String> parserNames)
          Adds the specified parsers to this publisher.
 
Methods inherited from class hudson.plugins.warnings.util.HealthAwarePublisher
getDefaultEncoding, getFailureThreshold, getHealthy, getMinimumPriority, getNewFailureThreshold, getNewThreshold, getThreshold, getThresholdLimit, getUnHealthy, isAntBuild, isMavenBuild, perform
 
Methods inherited from class hudson.tasks.Publisher
all, getProjectAction, needsToRunAfterFinalized, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
perform, prebuild
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.tasks.BuildStep
prebuild
 

Field Detail

WARNINGS_DESCRIPTOR

public static final WarningsDescriptor WARNINGS_DESCRIPTOR
Descriptor of this publisher.

Constructor Detail

WarningsPublisher

@DataBoundConstructor
public WarningsPublisher(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 pattern,
                                              java.lang.String includePattern,
                                              java.lang.String excludePattern,
                                              java.lang.String defaultEncoding,
                                              boolean canRunOnFailed,
                                              boolean canScanConsole)
Creates a new instance of WarningPublisher.

Parameters:
threshold - Annotation 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 annotations is less than this value
unHealthy - Report health as 0% when the number of annotations is greater than this value
thresholdLimit - determines which warning priorities should be considered when evaluating the build stability and health
pattern - Ant file-set pattern that defines the files to scan for
includePattern - Ant file-set pattern of files to include in report
excludePattern - Ant file-set pattern of files to exclude from report
defaultEncoding - the default encoding to be used when reading and parsing files
canRunOnFailed - determines whether the plug-in can run for failed builds, too
canScanConsole - Determines whether the console should be scanned.
Method Detail

getParserNames

public java.util.Set<java.lang.String> getParserNames()
Returns the names of the configured parsers of this publisher.

Returns:
the parser names

getCanRunOnFailed

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

Returns:
the can run on failed

getCanScanConsole

public boolean getCanScanConsole()
Returns whether this plug-in should scan the console or not.

Returns:
the can run on failed

setParserNames

public void setParserNames(java.util.Set<java.lang.String> parserNames)
Adds the specified parsers to this publisher.

Parameters:
parserNames - the parsers to use when scanning the files

readResolve

protected java.lang.Object readResolve()
Creates a new parser set for old versions of this class.

Overrides:
readResolve in class HealthAwarePublisher
Returns:
this

getPattern

public java.lang.String getPattern()
Returns the Ant file-set pattern of files to work with.

Returns:
Ant file-set pattern of files to work with

getIncludePattern

public java.lang.String getIncludePattern()
Returns the Ant file-set pattern of files to include in report.

Returns:
Ant file-set pattern of files to include in report

getExcludePattern

public java.lang.String getExcludePattern()
Returns the Ant file-set pattern of files to exclude from report.

Returns:
Ant file-set pattern of files to exclude from report

getProjectAction

public hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)

Specified by:
getProjectAction in interface hudson.tasks.BuildStep
Overrides:
getProjectAction in class hudson.tasks.BuildStepCompatibilityLayer

perform

public BuildResult perform(hudson.model.AbstractBuild<?,?> build,
                           PluginLogger logger)
                    throws java.lang.InterruptedException,
                           java.io.IOException
Performs the publishing of the results of this plug-in.

Specified by:
perform in class HealthAwarePublisher
Parameters:
build - the build
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.

getDescriptor

public hudson.model.Descriptor<hudson.tasks.Publisher> getDescriptor()

Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Publisher>
Overrides:
getDescriptor in class hudson.tasks.Publisher

canContinue

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

Overrides:
canContinue in class HealthAwarePublisher
Parameters:
result - build result
Returns:
true if the build can continue


Copyright © 2009. All Rights Reserved.