com.atlassian.bamboo.repository
Class AbstractRepository

java.lang.Object
  extended by com.atlassian.bamboo.repository.AbstractRepository
All Implemented Interfaces:
ConvertibleFromConfig, InitablePluginModule, CleanCheckoutAwareRepository, CleanWorkingDirectoryAwareRepository, IncludeExcludeAwareRepository, Repository, DescriptionProvider, NameProvider, BambooPluginModule, ConfigurablePlugin, RepositoryV2, java.io.Serializable
Direct Known Subclasses:
CVSRepository, PerforceRepository, SvnRepository

public abstract class AbstractRepository
extends java.lang.Object
implements Repository, IncludeExcludeAwareRepository, CleanCheckoutAwareRepository, CleanWorkingDirectoryAwareRepository

This class provides common repository implementation code,

See Also:
Serialized Form

Field Summary
static java.lang.String BUILD_TRIGGER_IP
           
protected  BuildDirectoryManager buildDirectoryManager
           
protected  BuildLoggerManager buildLoggerManager
           
static java.lang.String CLEAN_CHECKOUT_PARAM
           
static java.lang.String CLEAN_WORKING_DIRECTORY_PARAM
           
protected  RepositoryModuleDescriptor repositoryModuleDescriptor
           
protected  TemplateRenderer templateRenderer
           
protected  com.opensymphony.xwork.TextProvider textProvider
           
protected  VariableSubstitutionBean variableSubstitutionBean
           
 
Fields inherited from interface com.atlassian.bamboo.repository.IncludeExcludeAwareRepository
FILTER_PATTERN_EXCLUDE, FILTER_PATTERN_INCLUDE, FILTER_PATTERN_OPTION, FILTER_PATTERN_REGEX
 
Fields inherited from interface com.atlassian.bamboo.repository.Repository
SELECTED_REPOSITORY, UNKNOWN_HOST
 
Constructor Summary
AbstractRepository()
           
 
Method Summary
 void addDefaultValues(BuildConfiguration buildConfiguration)
          Extension point for adding default values to the form for ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)
 ErrorCollection checkConnection()
          This method internally validates the current connection for the repository.
protected  java.lang.String createStringFromList(java.util.List list)
          Create a string from the collection of value in the given list
 void customizeBuildRequirements(BuildConfiguration buildConfiguration, RequirementSet requirementSet)
          Extension point for adding/customizing requirements when editing a build's builder configuration.
 java.lang.String getAdHocAccessEditHtml(BuildConfiguration buildConfiguration)
           
 java.lang.String getChangedDetectionEditHtml(BuildConfiguration buildConfiguration, Plan build)
          Returns HTML that represents the form fragment for editing the change detection repository configuration.
 java.lang.String getChangedDetectionViewHtml(Plan build)
          Returns the HTML that represents the view of the change detection repository configuration
 java.lang.String getDescription()
           
 java.lang.String getEditHtml(BuildConfiguration buildConfiguration, Plan plan)
          Returns HTML that represents the form fragment for editing the repository.
 java.lang.String getFilterFilePatternOption()
          Do we want to include files which match pattern or exclude files which match pattern?
 java.lang.String getFilterFilePatternRegex()
          The regex expression on which fileName (paths) are matched for inclusion/exclusion.
 java.lang.String getKey()
          The full complete plugin key for the repo
 java.lang.String getMavenPomCheckoutAccessEditHtml(BuildConfiguration buildConfiguration)
           
 java.lang.String getShortKey()
          The mini key from the plugin (should not contain plugin prefix)
 java.io.File getSourceCodeDirectory(java.lang.String planKey)
          For Subversion, we use the build name's directory within the system's working directory
 java.lang.String getTriggerIpAddress()
          What's the repositorys optional trigger IP address?
 VariableSubstitutionBean getVariableSubstitutionBean()
           
 java.lang.String getViewHtml(Plan plan)
          Returns the HTML that represents the view of the repository configuration
 java.io.File getWorkingDirectory()
           
 void init(com.atlassian.plugin.ModuleDescriptor moduleDescriptor)
          Initialises the Plugin with the plugin module descriptor
 boolean isCleanCheckout()
           
 boolean isCleanWorkingDirectory()
          Should the working directory be cleaned when the build is marked BuildState.SUCCESS?
protected  boolean isWorkspaceEmpty(java.io.File sourceCodeDirectory)
           
 void populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
          Update the current object with data in the HierarchicalConfiguration
 boolean referencesDifferentRepository()
          Default behaviour is to not support major configuration changes
 void removeBuildRequirements(BuildConfiguration buildConfiguration, RequirementSet requirementSet)
          Extension point for removing requirements when given plugin is excluded from build's builder configuration.
 void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)
           
 void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
           
 void setCleanCheckout(boolean cleanCheckout)
           
 void setCleanWorkingDirectory(boolean cleanWorkingDirectory)
          Set the working directory be cleaned or not cleaned when the build is marked BuildState.SUCCESS?
 void setFilterFilePatternOption(java.lang.String filterFilePatternOption)
           
 void setFilterFilePatternRegex(java.lang.String filterFilePatternRegex)
           
 void setReferencesDifferentRepository(boolean isDifferentRepository)
          Mark the repository as having changed/cleared of change,
 void setTemplateRenderer(TemplateRenderer templateRenderer)
           
 void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)
           
 void setTriggerIpAddress(java.lang.String triggerIpAddress)
          Bamboo checks to ensure a repository triggered build request comes from a valid host.
 void setVariableSubstitutionBean(VariableSubstitutionBean variableSubstitutionBean)
           
 void setWorkingDir(java.io.File workingDir)
           
 org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
          Generate a HierarchicalConfiguration from the current state of the object
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.repository.Repository
getHost, getName, isRepositoryDifferent
 
Methods inherited from interface com.atlassian.bamboo.v2.build.repository.RepositoryV2
collectChangesSinceLastBuild, retrieveSourceCode, retrieveSourceCode
 
Methods inherited from interface com.atlassian.bamboo.v2.build.ConfigurablePlugin
prepareConfigObject
 

Field Detail

CLEAN_CHECKOUT_PARAM

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

CLEAN_WORKING_DIRECTORY_PARAM

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

BUILD_TRIGGER_IP

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

repositoryModuleDescriptor

protected RepositoryModuleDescriptor repositoryModuleDescriptor

variableSubstitutionBean

protected transient VariableSubstitutionBean variableSubstitutionBean

templateRenderer

protected transient TemplateRenderer templateRenderer

textProvider

protected transient com.opensymphony.xwork.TextProvider textProvider

buildLoggerManager

protected transient BuildLoggerManager buildLoggerManager

buildDirectoryManager

protected transient BuildDirectoryManager buildDirectoryManager
Constructor Detail

AbstractRepository

public AbstractRepository()
Method Detail

init

public void init(@NotNull
                 com.atlassian.plugin.ModuleDescriptor moduleDescriptor)
Description copied from interface: InitablePluginModule
Initialises the Plugin with the plugin module descriptor

Specified by:
init in interface InitablePluginModule
Parameters:
moduleDescriptor - Plugin module descriptor

getKey

@NotNull
public java.lang.String getKey()
Description copied from interface: Repository
The full complete plugin key for the repo

Specified by:
getKey in interface Repository
Returns:

getShortKey

@NotNull
public java.lang.String getShortKey()
Description copied from interface: Repository
The mini key from the plugin (should not contain plugin prefix)

Specified by:
getShortKey in interface Repository
Returns:

getDescription

public java.lang.String getDescription()
Specified by:
getDescription in interface DescriptionProvider

addDefaultValues

public void addDefaultValues(@NotNull
                             BuildConfiguration buildConfiguration)
Description copied from interface: ConfigurablePlugin
Extension point for adding default values to the form for ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)

Specified by:
addDefaultValues in interface ConfigurablePlugin
Parameters:
buildConfiguration - - @NotNull

customizeBuildRequirements

public void customizeBuildRequirements(@NotNull
                                       BuildConfiguration buildConfiguration,
                                       @NotNull
                                       RequirementSet requirementSet)
Description copied from interface: ConfigurablePlugin
Extension point for adding/customizing requirements when editing a build's builder configuration.

Specified by:
customizeBuildRequirements in interface ConfigurablePlugin
Parameters:
buildConfiguration - source of information for customizing build requirements
requirementSet - requirements to be customized

removeBuildRequirements

public void removeBuildRequirements(@NotNull
                                    BuildConfiguration buildConfiguration,
                                    @NotNull
                                    RequirementSet requirementSet)
Description copied from interface: ConfigurablePlugin
Extension point for removing requirements when given plugin is excluded from build's builder configuration.

Specified by:
removeBuildRequirements in interface ConfigurablePlugin
Parameters:
buildConfiguration - source of information for customizing build requirements
requirementSet - requirements to be customized

getViewHtml

@Nullable
public java.lang.String getViewHtml(@NotNull
                                             Plan plan)
Description copied from interface: ConfigurablePlugin
Returns the HTML that represents the view of the repository configuration

Specified by:
getViewHtml in interface ConfigurablePlugin
Returns:
HTML string. May be null.

getEditHtml

@Nullable
public java.lang.String getEditHtml(@NotNull
                                             BuildConfiguration buildConfiguration,
                                             @NotNull
                                             Plan plan)
Description copied from interface: ConfigurablePlugin
Returns HTML that represents the form fragment for editing the repository. No opening and closing form tags are required.

Specified by:
getEditHtml in interface ConfigurablePlugin
Parameters:
buildConfiguration - BuildConfiguration for which edit HTML has to be rendered.
Returns:
HTML string. May be null.

getChangedDetectionViewHtml

@Nullable
public java.lang.String getChangedDetectionViewHtml(@NotNull
                                                             Plan build)
Description copied from interface: Repository
Returns the HTML that represents the view of the change detection repository configuration

Specified by:
getChangedDetectionViewHtml in interface Repository
Returns:
HTML string. May be null.

getChangedDetectionEditHtml

@Nullable
public java.lang.String getChangedDetectionEditHtml(@NotNull
                                                             BuildConfiguration buildConfiguration,
                                                             @NotNull
                                                             Plan build)
Description copied from interface: Repository
Returns HTML that represents the form fragment for editing the change detection repository configuration. No opening and closing form tags are required.

Specified by:
getChangedDetectionEditHtml in interface Repository
Returns:
HTMK string. May be null.

getAdHocAccessEditHtml

@Nullable
public java.lang.String getAdHocAccessEditHtml(@NotNull
                                                        BuildConfiguration buildConfiguration)

getMavenPomCheckoutAccessEditHtml

@Nullable
public java.lang.String getMavenPomCheckoutAccessEditHtml(@NotNull
                                                                   BuildConfiguration buildConfiguration)

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 ConfigurablePlugin.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) template.

Specified by:
validate in interface ConfigurablePlugin
Parameters:
buildConfiguration - - @NotNull
Returns:
ErrorCollection keyed by the field name. @NotNull

populateFromConfig

public void populateFromConfig(@NotNull
                               org.apache.commons.configuration.HierarchicalConfiguration config)
Description copied from interface: ConvertibleFromConfig
Update the current object with data in the HierarchicalConfiguration

Specified by:
populateFromConfig in interface ConvertibleFromConfig

toConfiguration

@NotNull
public org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
Description copied from interface: ConvertibleFromConfig
Generate a HierarchicalConfiguration from the current state of the object

Specified by:
toConfiguration in interface ConvertibleFromConfig
Returns:
Always returns an HierarchicalConfiguration. Never null

referencesDifferentRepository

public boolean referencesDifferentRepository()
Default behaviour is to not support major configuration changes

Specified by:
referencesDifferentRepository in interface RepositoryV2
Returns:
false

setReferencesDifferentRepository

public void setReferencesDifferentRepository(boolean isDifferentRepository)
Mark the repository as having changed/cleared of change,

Specified by:
setReferencesDifferentRepository in interface Repository
Parameters:
isDifferentRepository - true if it has changed, false it it has cleared

setTriggerIpAddress

public void setTriggerIpAddress(java.lang.String triggerIpAddress)
Bamboo checks to ensure a repository triggered build request comes from a valid host.

By default Bamboo checks the request came from repository server's primary IP address.

This may not work on machines with multiple ip addresses. The user can use this option to override the IP address.

Parameters:
triggerIpAddress - The IP address of the repository server

getTriggerIpAddress

public java.lang.String getTriggerIpAddress()
What's the repositorys optional trigger IP address?

Specified by:
getTriggerIpAddress in interface Repository
Returns:
the ip address, null if it does not have a trigger address.

isCleanCheckout

public boolean isCleanCheckout()
Specified by:
isCleanCheckout in interface CleanCheckoutAwareRepository

setCleanCheckout

public void setCleanCheckout(boolean cleanCheckout)
Specified by:
setCleanCheckout in interface CleanCheckoutAwareRepository

isCleanWorkingDirectory

public boolean isCleanWorkingDirectory()
Description copied from interface: CleanWorkingDirectoryAwareRepository
Should the working directory be cleaned when the build is marked BuildState.SUCCESS?

Specified by:
isCleanWorkingDirectory in interface CleanWorkingDirectoryAwareRepository
Returns:
cleanWorkingDirectory

setCleanWorkingDirectory

public void setCleanWorkingDirectory(boolean cleanWorkingDirectory)
Description copied from interface: CleanWorkingDirectoryAwareRepository
Set the working directory be cleaned or not cleaned when the build is marked BuildState.SUCCESS?

Specified by:
setCleanWorkingDirectory in interface CleanWorkingDirectoryAwareRepository

setWorkingDir

public void setWorkingDir(java.io.File workingDir)

getWorkingDirectory

public java.io.File getWorkingDirectory()

getSourceCodeDirectory

@NotNull
public java.io.File getSourceCodeDirectory(@NotNull
                                                   java.lang.String planKey)
                                    throws RepositoryException
For Subversion, we use the build name's directory within the system's working directory

Specified by:
getSourceCodeDirectory in interface RepositoryV2
Parameters:
planKey -
Returns:
The source code directory
Throws:
RepositoryException - A generic failure

checkConnection

@NotNull
public ErrorCollection checkConnection()
Description copied from interface: Repository
This method internally validates the current connection for the repository. Usually the same as running validate

Specified by:
checkConnection in interface Repository
Returns:
ErrorCollection must not be null. The errros should be translated to error messages, rather than field errors.

createStringFromList

protected java.lang.String createStringFromList(java.util.List list)
Create a string from the collection of value in the given list

Parameters:
list - the list we are using to create the string
Returns:
the resulting string

setTextProvider

public void setTextProvider(com.opensymphony.xwork.TextProvider textProvider)

setTemplateRenderer

public void setTemplateRenderer(TemplateRenderer templateRenderer)

getFilterFilePatternOption

public java.lang.String getFilterFilePatternOption()
Description copied from interface: IncludeExcludeAwareRepository
Do we want to include files which match pattern or exclude files which match pattern?

Specified by:
getFilterFilePatternOption in interface IncludeExcludeAwareRepository
Returns:

setFilterFilePatternOption

public void setFilterFilePatternOption(java.lang.String filterFilePatternOption)

getFilterFilePatternRegex

public java.lang.String getFilterFilePatternRegex()
Description copied from interface: IncludeExcludeAwareRepository
The regex expression on which fileName (paths) are matched for inclusion/exclusion.

Specified by:
getFilterFilePatternRegex in interface IncludeExcludeAwareRepository
Returns:

setFilterFilePatternRegex

public void setFilterFilePatternRegex(java.lang.String filterFilePatternRegex)

getVariableSubstitutionBean

public VariableSubstitutionBean getVariableSubstitutionBean()

setVariableSubstitutionBean

public void setVariableSubstitutionBean(VariableSubstitutionBean variableSubstitutionBean)

setBuildLoggerManager

public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)

setBuildDirectoryManager

public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)

isWorkspaceEmpty

protected boolean isWorkspaceEmpty(java.io.File sourceCodeDirectory)


Copyright © 2010 Atlassian. All Rights Reserved.