com.atlassian.bamboo.builder
Class AbstractBuilder

java.lang.Object
  extended by com.atlassian.bamboo.command.Command
      extended by com.atlassian.bamboo.builder.AbstractBuilder
All Implemented Interfaces:
Builder
Direct Known Subclasses:
AbstractMavenBuilder, AntBuilder, CustomCommandBuilder, ScriptBuilder

public abstract class AbstractBuilder
extends Command
implements Builder

Common builder functionality.


Field Summary
protected  BuilderManager builderManager
           
protected static String DEFAULT_TEST_REPORTS_XML
           
static String PARAM_BUILD_LABEL
           
static String PARAM_BUILDJDK
           
static String PARAM_ENV_VAR
           
static String PARAM_HASTESTS
           
static String PARAM_HOME
           
static String PARAM_TEST_RESULTS_DIRECTORY
           
static String PARAM_WORKING_SUB_DIR
           
protected  PluginManager pluginManager
           
protected  TemplateRenderer templateRenderer
           
protected  VelocityManager velocityManager
           
 
Constructor Summary
protected AbstractBuilder()
           
 
Method Summary
 BuildResults build(Build build, BuildResults buildInfo)
          Build the given build
 void collateTestResults(BuildResults buildInfo)
          temp will morph into a TestResultsHanlder on route to a plugin!
 Map customiseLabelPathMaps(Map labelPathMaps)
          Allows the builder to add extra LabelPathMap objects as required
 Map filterParameters(Map incomingWebParams)
          Filter the parameters the builder needs from the incoming web parameters.
 AdministrationConfiguration getAdminConfig()
           
 String getBuildJdk()
          Provide the UI form with the JDK the build needs to be built on
 String getCompleteKey()
          Returns the full plugin descriptor key
 String getEditHtml(Map errors)
           
 String getEnvironmentVariables()
          Provides the ui form with the build's system environment variables
 FilteredMap getFilteredParams()
           
 String getFreemarkerEditHtml(Map errors)
           
 Map getFullParams()
          Subclasses should extend this method rather than Builder.getFilteredParams() since it calls back on this method (getFillParams)
 String getLabel()
          What is the label used to getPrettyPrint this item in the GUI?
 String getPath()
          The home path of the builder's command line
 String getPathHelp()
           
protected  Map getTemplateContext()
           
 String getTestChecked()
          Informs the UI if the build is testless.
 String getTestResultsDirectory()
          What are the build's junit test results stored? Can be a comma separated list
 String getViewHtml()
          Returns the HTML representing the builder configuration for the build
 File getWorkingDirectory()
          Get the location of the build file
 String getWorkingSubDirectory()
          Return the optional working subdirectory
protected  boolean hasPassed(int returnCode)
           
 boolean hasTests()
          Does the build have any tests to be included in the build results web pages?
 void init(ModuleDescriptor moduleDescriptor)
          Initialises the Builder with the plugin module descriptor
 boolean isLabelPathMapConfigurable()
          Returns true if the Builder can have its LabelPathMap configurable.
protected  boolean outputEndsWith(int positionFromEnd, String expectedText)
          Utility method to check the output contained the expected success text
 void setAdminConfig(AdministrationConfiguration adminConfig)
           
 void setBuildDir(File buildDirectory)
          Where is the build file file?
 void setBuilderManager(BuilderManager builderManager)
           
 void setBuildJdk(String buildJdk)
          Define the JDK the build beeds to be built on.
 void setEnvironmentVariables(String envVars)
          Define the system environment variabled required to build the build.
 void setHasTests(boolean hasTests)
          Does the build have any tests to be included in the build results web pages?
 void setLabel(String label)
           
 void setParams(FilteredMap filteredParams)
           
 void setPluginManager(PluginManager pluginManager)
           
 void setTemplateRenderer(TemplateRenderer templateRenderer)
           
 void setTestChecked(String enabled)
          The user has selected that the build has tests (via a checkbox)
 void setTestResultsDirectory(String testResultDirectory)
          Let the builder specify the location of the build's test result files.
 void setVelocityManager(VelocityManager velocityManager)
           
 void setWorkingSubDirectory(String workingSubDirectory)
          Specify the working sub directory
 String toString()
          Default toString simply displays the name so they can be slotted into drop down lists and such like.
 ErrorCollection validate()
          Validate the Builder's current internal settings are still valid
 
Methods inherited from class com.atlassian.bamboo.command.Command
executeCommand, getCommandLine, getEnvironmentSetting, getErrorOutput, getOutput, hasErrors, isExecutableExists, isWindowsPlatform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.builder.Builder
addDefaultLabelPathMaps, addDefaultValues, getKey, getName, isPathValid, validate, validate
 

Field Detail

DEFAULT_TEST_REPORTS_XML

protected static final String DEFAULT_TEST_REPORTS_XML
See Also:
Constant Field Values

PARAM_BUILD_LABEL

public static final String PARAM_BUILD_LABEL
See Also:
Constant Field Values

PARAM_HASTESTS

public static final String PARAM_HASTESTS
See Also:
Constant Field Values

PARAM_TEST_RESULTS_DIRECTORY

public static final String PARAM_TEST_RESULTS_DIRECTORY
See Also:
Constant Field Values

PARAM_BUILDJDK

public static final String PARAM_BUILDJDK
See Also:
Constant Field Values

PARAM_HOME

public static final String PARAM_HOME
See Also:
Constant Field Values

PARAM_WORKING_SUB_DIR

public static final String PARAM_WORKING_SUB_DIR
See Also:
Constant Field Values

PARAM_ENV_VAR

public static final String PARAM_ENV_VAR
See Also:
Constant Field Values

builderManager

protected transient BuilderManager builderManager

velocityManager

protected transient VelocityManager velocityManager

templateRenderer

protected transient TemplateRenderer templateRenderer

pluginManager

protected transient PluginManager pluginManager
Constructor Detail

AbstractBuilder

protected AbstractBuilder()
Method Detail

setAdminConfig

public void setAdminConfig(AdministrationConfiguration adminConfig)
Specified by:
setAdminConfig in interface Builder

getAdminConfig

public AdministrationConfiguration getAdminConfig()

setBuilderManager

public void setBuilderManager(BuilderManager builderManager)
Specified by:
setBuilderManager in interface Builder

setVelocityManager

public void setVelocityManager(VelocityManager velocityManager)

setTemplateRenderer

public void setTemplateRenderer(TemplateRenderer templateRenderer)

setPluginManager

public void setPluginManager(PluginManager pluginManager)

init

public void init(ModuleDescriptor moduleDescriptor)
Description copied from interface: Builder
Initialises the Builder with the plugin module descriptor

Specified by:
init in interface Builder

getCompleteKey

public String getCompleteKey()
Description copied from interface: Builder
Returns the full plugin descriptor key

Specified by:
getCompleteKey in interface Builder
Returns:

getPath

public String getPath()
Description copied from interface: Builder
The home path of the builder's command line

Specified by:
getPath in interface Builder
Returns:
The path

getEditHtml

public String getEditHtml(Map errors)
Specified by:
getEditHtml in interface Builder

getFreemarkerEditHtml

public String getFreemarkerEditHtml(Map errors)
Specified by:
getFreemarkerEditHtml in interface Builder

isLabelPathMapConfigurable

public boolean isLabelPathMapConfigurable()
Description copied from interface: Builder
Returns true if the Builder can have its LabelPathMap configurable. If it can't be, it won't be displayed on the ConfigureBuilder page.

Specified by:
isLabelPathMapConfigurable in interface Builder
Returns:
true if LabelPathMap is configurable

customiseLabelPathMaps

public Map customiseLabelPathMaps(Map labelPathMaps)
Description copied from interface: Builder
Allows the builder to add extra LabelPathMap objects as required

Specified by:
customiseLabelPathMaps in interface Builder
Parameters:
labelPathMaps - may be null

getTemplateContext

protected Map getTemplateContext()

build

public BuildResults build(Build build,
                          BuildResults buildInfo)
Description copied from interface: Builder
Build the given build

Specified by:
build in interface Builder
Parameters:
build - The build to build
buildInfo - The change list that triggered the build
Returns:
The build results

collateTestResults

public void collateTestResults(BuildResults buildInfo)
Description copied from interface: Builder
temp will morph into a TestResultsHanlder on route to a plugin!

Specified by:
collateTestResults in interface Builder

hasPassed

protected boolean hasPassed(int returnCode)

setBuildDir

public void setBuildDir(File buildDirectory)
Where is the build file file?

Specified by:
setBuildDir in interface Builder
Parameters:
buildDirectory - The directory containing the build file

getWorkingDirectory

public File getWorkingDirectory()
Get the location of the build file

Specified by:
getWorkingDirectory in class Command
Returns:
The build file directory

getLabel

public String getLabel()
What is the label used to getPrettyPrint this item in the GUI?

Specified by:
getLabel in interface Builder
Returns:
The label

setLabel

public void setLabel(String label)
Specified by:
setLabel in interface Builder

getTestResultsDirectory

public String getTestResultsDirectory()
What are the build's junit test results stored? Can be a comma separated list

Specified by:
getTestResultsDirectory in interface Builder
Returns:
Directory containing the Junit xml test files

setTestResultsDirectory

public void setTestResultsDirectory(String testResultDirectory)
Let the builder specify the location of the build's test result files.

Parameters:
testResultDirectory - The location of the junit test result xml files

getWorkingSubDirectory

public String getWorkingSubDirectory()
Return the optional working subdirectory

Returns:
The subirectory, null if the working directory id the build root

setWorkingSubDirectory

public void setWorkingSubDirectory(String workingSubDirectory)
Specify the working sub directory


toString

public String toString()
Default toString simply displays the name so they can be slotted into drop down lists and such like.

Overrides:
toString in class Object
Returns:
the string

hasTests

public boolean hasTests()
Does the build have any tests to be included in the build results web pages?

Specified by:
hasTests in interface Builder
Returns:
true if the build should have tests.

setHasTests

public void setHasTests(boolean hasTests)
Description copied from interface: Builder
Does the build have any tests to be included in the build results web pages?

Specified by:
setHasTests in interface Builder
Parameters:
hasTests - True if the build should have tests.

setTestChecked

public void setTestChecked(String enabled)
The user has selected that the build has tests (via a checkbox)

Parameters:
enabled - set to "on" by the webwork framework

getTestChecked

public String getTestChecked()
Informs the UI if the build is testless.

Returns:
true if the build should have tests, false if it's testless.

setEnvironmentVariables

public void setEnvironmentVariables(String envVars)
Define the system environment variabled required to build the build.

Specified by:
setEnvironmentVariables in interface Builder
Parameters:
envVars - The params

getEnvironmentVariables

public String getEnvironmentVariables()
Provides the ui form with the build's system environment variables

Specified by:
getEnvironmentVariables in interface Builder
Returns:
build environment variables

getBuildJdk

public String getBuildJdk()
Provide the UI form with the JDK the build needs to be built on

Specified by:
getBuildJdk in interface Builder
Returns:
The JAVA_HOME of the JDK

setBuildJdk

public void setBuildJdk(String buildJdk)
Define the JDK the build beeds to be built on.

Specified by:
setBuildJdk in interface Builder
Parameters:
buildJdk - The JAVA_HOME JDK

outputEndsWith

protected boolean outputEndsWith(int positionFromEnd,
                                 String expectedText)
Utility method to check the output contained the expected success text

Parameters:
positionFromEnd - The expectedText should be wihtin positionFromEnd lines of the end of the output
expectedText - The text
Returns:
true if the expectedText is within positionFromEnd lines from the end

filterParameters

public Map filterParameters(Map incomingWebParams)
Description copied from interface: Builder
Filter the parameters the builder needs from the incoming web parameters.

Specified by:
filterParameters in interface Builder
Parameters:
incomingWebParams - Raw build parameters coming from BuildPage action
Returns:
filtered parameters relevant to this builder

setParams

public void setParams(FilteredMap filteredParams)
Specified by:
setParams in interface Builder

validate

public ErrorCollection validate()
Description copied from interface: Builder
Validate the Builder's current internal settings are still valid

Specified by:
validate in interface Builder
Returns:

getFullParams

public Map getFullParams()
Description copied from interface: Builder
Subclasses should extend this method rather than Builder.getFilteredParams() since it calls back on this method (getFillParams)

Specified by:
getFullParams in interface Builder
Returns:
Map key by the full param key (e.g. builder.ant.label). Never null

getFilteredParams

public FilteredMap getFilteredParams()
Specified by:
getFilteredParams in interface Builder

getViewHtml

public String getViewHtml()
Description copied from interface: Builder
Returns the HTML representing the builder configuration for the build

Specified by:
getViewHtml in interface Builder
Returns:
HTML of

getPathHelp

public String getPathHelp()
Specified by:
getPathHelp in interface Builder


Copyright © 2006 Atlassian Software Systems. All Rights Reserved.