com.atlassian.bamboo.builder
Class ScriptBuilder

java.lang.Object
  extended by com.atlassian.bamboo.command.Command
      extended by com.atlassian.bamboo.builder.AbstractBuilder
          extended by com.atlassian.bamboo.builder.ScriptBuilder
All Implemented Interfaces:
Builder, EnvironmentVariablesAwareBuilder, MutableEnvironmentVariablesAwareBuilder, BambooPluginModule, BuilderV2, ConfigurablePlugin, java.io.Serializable

public class ScriptBuilder
extends AbstractBuilder

This class provides a command line Script version of Builder.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_EXECUTOR
           
static java.lang.String KEY
           
static java.lang.String KEY_PREFIX
           
static java.lang.String NAME
           
static java.lang.String PARAM_ARG
           
static java.lang.String PARAM_SCRIPT
           
 
Fields inherited from class com.atlassian.bamboo.builder.AbstractBuilder
BUILD_SUCCESSFUL_MARKER, buildDirectoryManager, DEFAULT_TEST_REPORTS_XML, errorUpdateHandler, FIND_SUCCESS_MESSAGE_IN_LAST, PARAM_BUILD_LABEL, PARAM_BUILDJDK, PARAM_ENV_VAR, PARAM_HASTESTS, PARAM_HOME, PARAM_TEST_RESULTS_DIRECTORY, PARAM_WORKING_SUB_DIR, templateRenderer, velocityManager
 
Fields inherited from class com.atlassian.bamboo.command.Command
buildLoggerManager, substitutionBean
 
Fields inherited from interface com.atlassian.bamboo.builder.Builder
CAPABILITY_BUILDER_PREFIX, CAPABILITY_BUILDER_TYPE
 
Constructor Summary
ScriptBuilder()
           
 
Method Summary
 java.util.Map<java.lang.String,LabelPathMap> addDefaultLabelPathMaps(java.util.Map<java.lang.String,LabelPathMap> labelPathMaps)
           
 void addDefaultValues(BuildConfiguration configuration)
          Extension point for adding default values to the form for #getEditHtml()
 java.util.Map customiseLabelTypeMap(java.util.Map labelPathMaps)
          Allows the builder to add extra label -> builder type key mappings
 java.lang.String getArgument()
           
 org.apache.tools.ant.types.Commandline getCommandLine(ReadOnlyCapabilitySet capabilitySet)
          Get the command line to execite the ant build

Note we have to execute windows different an Windoz can't execute a batch file...

 java.util.Map<java.lang.String,java.lang.String> getFullParams()
          Gets the full params that's used to persist.
 java.lang.String getName()
          Returns a human readable version of the current Builder type
 java.lang.String getScript()
          What is the name of the build script to be executed
 java.lang.String getUrl()
           
 boolean isLabelPathMapConfigurable()
          Returns true if the Builder can have its LabelPathMap configurable.
 boolean isPathValid(java.lang.String path)
          Returns true if the passed path is valid for this builder.
 void setArgument(java.lang.String argument)
           
 void setParams(FilteredMap filteredParams)
          Updates the current builder object with
 void setScript(java.lang.String script)
          Specify the script to be executed by the build
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 ErrorCollection validate(FilteredMap filteredBuilderParams)
          Validate that the scripts mandatory fields have been defined correctly
 
Methods inherited from class com.atlassian.bamboo.builder.AbstractBuilder
collateTestResults, customizeBuildRequirements, executeBuild, getBuildDir, getBuildJdk, getCompleteKey, getEditHtml, getEnvironmentVariables, getFilteredParams, getKey, getLabel, getPath, getPathHelp, getTemplateContext, getTestChecked, getTestResultsDirectory, getViewHtml, getWorkingDirectory, getWorkingSubDirectory, hasPassed, hasTests, init, isJdkValid, outputEndsWith, populateBuildErrors, prepareConfigObject, runBuild, setAdministrationConfiguration, setBuildDir, setBuildDirectoryManager, setBuildJdk, setEnvironmentVariables, setErrorUpdateHandler, setHasTests, setJdkManager, setKey, setLabel, setTemplateRenderer, setTestChecked, setTestResultsDirectory, setVelocityManager, setWorkingSubDirectory, toString, validate
 
Methods inherited from class com.atlassian.bamboo.command.Command
executeCommand, getBuildLoggerManager, getCustomEnvironmentVars, getEnvironmentSetting, getVariableSubstitutionBean, isExecutableExists, isWindowsPlatform, setBuildLoggerManager, setVariableSubstitutionBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_EXECUTOR

public static final java.lang.String DEFAULT_EXECUTOR
See Also:
Constant Field Values

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

KEY_PREFIX

public static final java.lang.String KEY_PREFIX
See Also:
Constant Field Values

PARAM_SCRIPT

public static final java.lang.String PARAM_SCRIPT
See Also:
Constant Field Values

PARAM_ARG

public static final java.lang.String PARAM_ARG
See Also:
Constant Field Values
Constructor Detail

ScriptBuilder

public ScriptBuilder()
Method Detail

getName

@NotNull
public java.lang.String getName()
Description copied from interface: Builder
Returns a human readable version of the current Builder type

Returns:

getUrl

public java.lang.String getUrl()

getScript

public java.lang.String getScript()
What is the name of the build script to be executed

Returns:
The name of the script

setScript

public void setScript(java.lang.String script)
Specify the script to be executed by the build

Parameters:
script - The script file to execute

getCommandLine

public org.apache.tools.ant.types.Commandline getCommandLine(ReadOnlyCapabilitySet capabilitySet)
Get the command line to execite the ant build

Note we have to execute windows different an Windoz can't execute a batch file...

Specified by:
getCommandLine in class Command
Parameters:
capabilitySet -
Returns:
command line

validate

public ErrorCollection validate(FilteredMap filteredBuilderParams)
Validate that the scripts mandatory fields have been defined correctly

Specified by:
validate in class AbstractBuilder
Returns:
The collection of form errors. An empty list if there are no errors.

validate

@NotNull
public ErrorCollection validate(@NotNull
                                        BuildConfiguration buildConfiguration)
Description copied from interface: ConfigurablePlugin
Validates the properties in the BuildConfiguration object. The name of the properties match those passed in through the form fragments in #getEditHtml() template.

Parameters:
buildConfiguration - - @NotNull
Returns:
ErrorCollection keyed by the field name. @NotNull

addDefaultValues

public void addDefaultValues(@NotNull
                             BuildConfiguration configuration)
Description copied from interface: ConfigurablePlugin
Extension point for adding default values to the form for #getEditHtml()

Parameters:
configuration - - @NotNull

getFullParams

@NotNull
public java.util.Map<java.lang.String,java.lang.String> getFullParams()
Description copied from interface: Builder
Gets the full params that's used to persist.

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

setParams

public void setParams(@NotNull
                      FilteredMap filteredParams)
Description copied from interface: Builder
Updates the current builder object with

Specified by:
setParams in interface Builder
Overrides:
setParams in class AbstractBuilder
Parameters:
filteredParams - - Filtered Map with the prefix builder key stripped out

isPathValid

public boolean isPathValid(@NotNull
                           java.lang.String path)
Description copied from interface: Builder
Returns true if the passed path is valid for this builder. The definition of a path depends on the builder itself. It could be the path to the executable (e.g script builder) or just the home directory (e.g. Ant builder)

Returns:
true if valid

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
Overrides:
isLabelPathMapConfigurable in class AbstractBuilder
Returns:
true if LabelPathMap is configurable

customiseLabelTypeMap

public java.util.Map customiseLabelTypeMap(java.util.Map labelPathMaps)
Description copied from interface: Builder
Allows the builder to add extra label -> builder type key mappings

Specified by:
customiseLabelTypeMap in interface Builder
Overrides:
customiseLabelTypeMap in class AbstractBuilder
Parameters:
labelPathMaps - may be null

addDefaultLabelPathMaps

public java.util.Map<java.lang.String,LabelPathMap> addDefaultLabelPathMaps(java.util.Map<java.lang.String,LabelPathMap> labelPathMaps)
Returns:

getArgument

public java.lang.String getArgument()

setArgument

public void setArgument(java.lang.String argument)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.