hudson.plugins.jdepend
Class JDependRecorder

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Publisher
          extended by hudson.tasks.Recorder
              extended by hudson.plugins.jdepend.JDependRecorder
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Publisher>, hudson.tasks.BuildStep

public class JDependRecorder
extends hudson.tasks.Recorder

Processes JDepend metrics after a build, and outputs them to the a page for the build

Author:
Chris Lewis

Nested Class Summary
static class JDependRecorder.DescriptorImpl
          Descriptor for JDependRecorder.
 
Nested classes/interfaces inherited from class hudson.tasks.Publisher
hudson.tasks.Publisher.DescriptorExtensionListImpl
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Field Summary
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
JDependRecorder()
           
 
Method Summary
protected  boolean generateJDependReport(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          The protected method of generating a JDepend report to allow extensions to override the perform step to add pre/post-stages
protected  JDependParser getJDependParser(java.io.File jDependOutputFile, java.lang.String sourcePath)
          Gets a location to output a JDepend file, the source to run JDepend on, then returns a parsed version of the JDepend file
 hudson.model.Action getProjectAction(hudson.model.AbstractProject<?,?> project)
           
protected  void log(java.lang.String message)
          Log output to the given logger, using the JDepend identifier
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          This runs a JDepend analysis job when the build is performed.
 
Methods inherited from class hudson.tasks.Recorder
getDescriptor
 
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
 

Constructor Detail

JDependRecorder

@DataBoundConstructor
public JDependRecorder()
Method Detail

log

protected void log(java.lang.String message)
Log output to the given logger, using the JDepend identifier

Parameters:
message - The message to be outputted

getJDependParser

protected JDependParser getJDependParser(java.io.File jDependOutputFile,
                                         java.lang.String sourcePath)
                                  throws java.io.IOException,
                                         javax.xml.parsers.ParserConfigurationException,
                                         org.xml.sax.SAXException
Gets a location to output a JDepend file, the source to run JDepend on, then returns a parsed version of the JDepend file

Parameters:
jDependOutputFile - the temporary file that JDepend should output to
sourcePath - the path to the source that JDepend should analyze
Returns:
a parsed version of the JDepend output
Throws:
java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException

generateJDependReport

protected boolean generateJDependReport(hudson.model.AbstractBuild<?,?> build,
                                        hudson.Launcher launcher,
                                        hudson.model.BuildListener listener)
The protected method of generating a JDepend report to allow extensions to override the perform step to add pre/post-stages

Parameters:
build -
launcher -
listener -
Returns:
True if report generated successfully.

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
This runs a JDepend analysis job when the build is performed. Gets the location of the workspace (copying to a temp local directory, if needed), then creates the JDepend report and parses it. It then attempts to delete the temporary files afterwards, but if it's not possible, they should be removed by the host OS when it cleans it's temp directories. Warning: Usage on multiple machines, and the copying of data thereof, has not been adequately tested yet.

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

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


Copyright © 2009. All Rights Reserved.