hudson.plugins.ccm
Class CCMBuilder

java.lang.Object
  extended by hudson.tasks.BuildStepCompatibilityLayer
      extended by hudson.tasks.Builder
          extended by hudson.plugins.ccm.CCMBuilder
All Implemented Interfaces:
hudson.ExtensionPoint, hudson.model.Describable<hudson.tasks.Builder>, hudson.tasks.BuildStep

public class CCMBuilder
extends hudson.tasks.Builder

When the user configures the project and enables this builder, CCMBuilderDescriptor#newInstance(StaplerRequest) is invoked and a new CcmBuilder is created. The created instance is persisted to the project configuration XML by using XStream, so this allows you to use instance fields (like ccmName) to remember the configuration.

When a build is performed, the BuildStepCompatibilityLayer.perform(Build, Launcher, BuildListener) method will be invoked.

Since:
7 april, 2010
Author:
Bruno P. Kinoshita - http://www.kinoshita.eti.br

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
hudson.tasks.BuildStep.PublisherList
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
static CCMBuilderDescription DESCRIPTOR
           
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
CCMBuilder(java.lang.String ccmName, java.lang.String srcFolder, java.lang.Boolean recursive, java.lang.Boolean outputXml, java.lang.String numMetrics)
           
 
Method Summary
 CCMBuilderInstallation getCCM()
          Even though we may have many installations of the CCM in Hudson, CCM Plugin grabs the first one that it finds.
 java.lang.String getCcmName()
           
 hudson.model.Descriptor<hudson.tasks.Builder> getDescriptor()
           
 java.lang.String getNumMetrics()
           
 java.lang.Boolean getRecursive()
           
 java.lang.String getSrcFolder()
           
 java.lang.Boolean isOutputXml()
           
 java.lang.Boolean isRecursive()
           
 boolean perform(hudson.model.AbstractBuild<?,?> build, hudson.Launcher launcher, hudson.model.BuildListener listener)
          Called when the job is executed.
 
Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
 
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, 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
getProjectAction, getProjectActions, prebuild
 

Field Detail

DESCRIPTOR

@Extension
public static final CCMBuilderDescription DESCRIPTOR
Constructor Detail

CCMBuilder

@DataBoundConstructor
public CCMBuilder(java.lang.String ccmName,
                                       java.lang.String srcFolder,
                                       java.lang.Boolean recursive,
                                       java.lang.Boolean outputXml,
                                       java.lang.String numMetrics)
Method Detail

getCcmName

public java.lang.String getCcmName()

getSrcFolder

public java.lang.String getSrcFolder()

isRecursive

public java.lang.Boolean isRecursive()

getRecursive

public java.lang.Boolean getRecursive()

isOutputXml

public java.lang.Boolean isOutputXml()

getNumMetrics

public java.lang.String getNumMetrics()

getDescriptor

public hudson.model.Descriptor<hudson.tasks.Builder> getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<hudson.tasks.Builder>
Overrides:
getDescriptor in class hudson.tasks.Builder

getCCM

public CCMBuilderInstallation getCCM()

Even though we may have many installations of the CCM in Hudson, CCM Plugin grabs the first one that it finds.

Returns:
The CCMBuilderInstallation containing details of the CCM installed.

perform

public boolean perform(hudson.model.AbstractBuild<?,?> build,
                       hudson.Launcher launcher,
                       hudson.model.BuildListener listener)
                throws java.lang.InterruptedException,
                       java.io.IOException

Called when the job is executed.

It calls the CCM.exe executable passing the config xml file created using the inputs provided by the user. Then it redirects the output of the command (using >) to a new file (overwriting it if already created).

Later this output xml if processed by another extension point, the CCMPublisher.

Specified by:
perform in interface hudson.tasks.BuildStep
Overrides:
perform in class hudson.tasks.BuildStepCompatibilityLayer
Throws:
java.lang.InterruptedException
java.io.IOException


Copyright © 2010. All Rights Reserved.