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, java.io.Serializable

public class CCMBuilder
extends hudson.tasks.Builder
implements java.io.Serializable

When the user configures the project and enables this builder, Descriptor.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:
1.0
Author:
Bruno P. Kinoshita - http://www.kinoshita.eti.br
See Also:
Serialized Form

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 java.lang.String CCM_CONFIG_FILE
          Name of generated config file for CCM.
static java.lang.String CCM_RESULT_FILE
          Name of generated result file of CCM.
static java.lang.Integer DEFAULT_NUMBER_OF_METRICS
          Default number of metrics.
static CCMBuilderDescriptor DESCRIPTOR
           
 
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
 
Constructor Summary
CCMBuilder(java.lang.String ccmName, java.lang.String srcFolders, java.lang.String excludeFiles, java.lang.String excludeFolders, java.lang.String excludeFunctions, 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 getExcludeFiles()
           
 java.lang.String getExcludeFolders()
           
 java.lang.String getExcludeFunctions()
           
 java.lang.String getNumMetrics()
           
 java.lang.Boolean getRecursive()
           
 java.lang.String getSrcFolders()
           
 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 CCMBuilderDescriptor DESCRIPTOR

CCM_CONFIG_FILE

public static final java.lang.String CCM_CONFIG_FILE
Name of generated config file for CCM.

See Also:
Constant Field Values

CCM_RESULT_FILE

public static final java.lang.String CCM_RESULT_FILE
Name of generated result file of CCM.

See Also:
Constant Field Values

DEFAULT_NUMBER_OF_METRICS

public static final java.lang.Integer DEFAULT_NUMBER_OF_METRICS
Default number of metrics.

Constructor Detail

CCMBuilder

@DataBoundConstructor
public CCMBuilder(java.lang.String ccmName,
                                       java.lang.String srcFolders,
                                       java.lang.String excludeFiles,
                                       java.lang.String excludeFolders,
                                       java.lang.String excludeFunctions,
                                       java.lang.Boolean recursive,
                                       java.lang.Boolean outputXml,
                                       java.lang.String numMetrics)
Method Detail

getCcmName

public java.lang.String getCcmName()

getSrcFolders

public java.lang.String getSrcFolders()

getExcludeFiles

public java.lang.String getExcludeFiles()

getExcludeFolders

public java.lang.String getExcludeFolders()

getExcludeFunctions

public java.lang.String getExcludeFunctions()

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.