com.atlassian.bamboo.repository
Class AbstractRepository

java.lang.Object
  extended by com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
      extended by com.atlassian.bamboo.v2.build.BaseConfigurablePlugin
          extended by com.atlassian.bamboo.repository.AbstractRepository
All Implemented Interfaces:
ConvertibleFromConfig, InitablePluginModule, AdvancedConfigurationAwareRepository, CleanCheckoutAwareRepository, CleanWorkingDirectoryAwareRepository, IncludeExcludeAwareRepository, QuietPeriodAwareRepository, Repository, DescriptionProvider, NameProvider, BambooPluginModule, BuildConfigurationAwarePlugin, ConfigurablePlugin, RenderableBuildConfiguration, RepositoryV2, java.io.Serializable
Direct Known Subclasses:
BitbucketRepository, CVSRepository, HgRepository, NullRepository, PerforceRepository, SvnRepository

public abstract class AbstractRepository
extends BaseConfigurablePlugin
implements Repository, IncludeExcludeAwareRepository, QuietPeriodAwareRepository, CleanCheckoutAwareRepository, CleanWorkingDirectoryAwareRepository, AdvancedConfigurationAwareRepository

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
          Deprecated. since 3.3 this functionality is configured in VcsCheckoutTask
static java.lang.String CLEAN_WORKING_DIRECTORY_PARAM
          Deprecated. since 3.3 this functionality is moved to Job configuration
protected  CustomVariableContext customVariableContext
           
protected  RepositoryModuleDescriptor repositoryModuleDescriptor
           
protected  TemplateRenderer templateRenderer
           
protected  com.opensymphony.xwork.TextProvider textProvider
           
 
Fields inherited from class com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
moduleDescriptor
 
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 RenderableBuildConfiguration.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.
 void customizeBuildRequirements(PlanKey planKey, BuildConfiguration buildConfiguration, RequirementSet requirementSet)
          Extension point for adding/customizing requirements when editing a build's builder configuration.
 java.lang.String getAdvancedEditHtml(BuildConfiguration buildConfiguration, Plan plan)
           
 java.lang.String getAdvancedViewHtml(Plan plan)
           
 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 getLocationIdentifier()
          A string representing the location of the repository
 java.lang.String getMavenPomCheckoutAccessEditHtml(BuildConfiguration buildConfiguration)
           
 int getMaxRetries()
          Returns the maximum number of times to collect changes
 java.lang.String getMinimalEditHtml(BuildConfiguration buildConfiguration)
          Returns HTML for the minimal configuration of the repository.
 int getQuietPeriod()
          Returns the number of seconds to wait between each retry
 java.lang.String getShortKey()
          The mini key from the plugin (should not contain plugin prefix)
 java.io.File getSourceCodeDirectory(PlanKey planKey)
          Deprecated. since 3.3 Repository must handle checkout to any subdirectory
 java.lang.String getTriggerIpAddress()
          What's the repositorys optional trigger IP address?
 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 isAdvancedOptionEnabled(BuildConfiguration buildConfiguration)
           
 boolean isCleanCheckout()
           
 boolean isCleanWorkingDirectory()
          Should the working directory be cleaned when the build is marked BuildState.SUCCESS?
 boolean isQuietPeriodEnabled()
          Returns true if we were to enable the quiet period
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(PlanKey planKey, 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 setCustomVariableContext(CustomVariableContext customVariableContext)
           
 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 setWorkingDir(java.io.File workingDir)
           
protected  java.lang.String substituteString(java.lang.String stringWithValuesToSubstitute)
           
 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 com.atlassian.bamboo.v2.build.BaseConfigurablePlugin
customizeBuildRequirements, removeBuildRequirements
 
Methods inherited from class com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
isConfigurationMissing, populateContextForEdit, populateContextForView, prepareConfigObject
 
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
 
Methods inherited from interface com.atlassian.bamboo.v2.build.repository.RepositoryV2
collectChangesSinceLastBuild, isRepositoryDifferent, retrieveSourceCode
 
Methods inherited from interface com.atlassian.bamboo.v2.build.BuildConfigurationAwarePlugin
prepareConfigObject
 

Field Detail

CLEAN_CHECKOUT_PARAM

@Deprecated
public static final java.lang.String CLEAN_CHECKOUT_PARAM
Deprecated. since 3.3 this functionality is configured in VcsCheckoutTask
See Also:
Constant Field Values

CLEAN_WORKING_DIRECTORY_PARAM

@Deprecated
public static final java.lang.String CLEAN_WORKING_DIRECTORY_PARAM
Deprecated. since 3.3 this functionality is moved to Job configuration
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

templateRenderer

protected transient TemplateRenderer templateRenderer

textProvider

protected transient com.opensymphony.xwork.TextProvider textProvider

buildLoggerManager

protected transient BuildLoggerManager buildLoggerManager

buildDirectoryManager

protected transient BuildDirectoryManager buildDirectoryManager

customVariableContext

protected transient CustomVariableContext customVariableContext
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
Overrides:
init in class BaseBuildConfigurationAwarePlugin
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:

getLocationIdentifier

@NotNull
public java.lang.String getLocationIdentifier()
Description copied from interface: Repository
A string representing the location of the repository

Specified by:
getLocationIdentifier 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: BuildConfigurationAwarePlugin
Extension point for adding default values to the form for RenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan)

Specified by:
addDefaultValues in interface BuildConfigurationAwarePlugin
Overrides:
addDefaultValues in class BaseBuildConfigurationAwarePlugin
Parameters:
buildConfiguration - - @NotNull

customizeBuildRequirements

public void customizeBuildRequirements(@NotNull
                                       PlanKey planKey,
                                       @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
Overrides:
customizeBuildRequirements in class BaseConfigurablePlugin
Parameters:
planKey - key of Plan for which requirements has to be removed.
buildConfiguration - source of information for customizing build requirements
requirementSet - requirements to be customized

removeBuildRequirements

public void removeBuildRequirements(@NotNull
                                    PlanKey planKey,
                                    @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
Overrides:
removeBuildRequirements in class BaseConfigurablePlugin
Parameters:
planKey - key of Plan for which requirements has to be removed.
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: RenderableBuildConfiguration
Returns the HTML that represents the view of the repository configuration

Specified by:
getViewHtml in interface RenderableBuildConfiguration
Overrides:
getViewHtml in class BaseBuildConfigurationAwarePlugin
Returns:
HTML string. May be null.

getEditHtml

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

Specified by:
getEditHtml in interface RenderableBuildConfiguration
Overrides:
getEditHtml in class BaseBuildConfigurationAwarePlugin
Parameters:
buildConfiguration - BuildConfiguration for which edit HTML has to be rendered.
plan - Plan for which edit HTML has to be rendered. May be null during creation phase of plan.
Returns:
HTML string. May be null.

getMinimalEditHtml

@Nullable
public java.lang.String getMinimalEditHtml(@NotNull
                                                    BuildConfiguration buildConfiguration)
Description copied from interface: Repository
Returns HTML for the minimal configuration of the repository. i.e. the basic config required to get it working.

Specified by:
getMinimalEditHtml in interface Repository
Parameters:
buildConfiguration - BuildConfiguration object
Returns:
HTML for the minimal configuration of the repository

getAdvancedViewHtml

public java.lang.String getAdvancedViewHtml(@NotNull
                                            Plan plan)
Specified by:
getAdvancedViewHtml in interface AdvancedConfigurationAwareRepository

getAdvancedEditHtml

public java.lang.String getAdvancedEditHtml(@NotNull
                                            BuildConfiguration buildConfiguration,
                                            @Nullable
                                            Plan plan)
Specified by:
getAdvancedEditHtml in interface AdvancedConfigurationAwareRepository

getMavenPomCheckoutAccessEditHtml

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

validate

@NotNull
public ErrorCollection validate(@NotNull
                                        BuildConfiguration buildConfiguration)
Description copied from interface: BuildConfigurationAwarePlugin
Validates the properties in the BuildConfiguration object. The name of the properties match those passed in through the form fragments in RenderableBuildConfiguration.getEditHtml(com.atlassian.bamboo.ww2.actions.build.admin.create.BuildConfiguration, com.atlassian.bamboo.plan.Plan) template.

Specified by:
validate in interface BuildConfigurationAwarePlugin
Overrides:
validate in class BaseBuildConfigurationAwarePlugin
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

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

isQuietPeriodEnabled

public boolean isQuietPeriodEnabled()
Description copied from interface: QuietPeriodAwareRepository
Returns true if we were to enable the quiet period

Specified by:
isQuietPeriodEnabled in interface QuietPeriodAwareRepository
Returns:

getQuietPeriod

public int getQuietPeriod()
Description copied from interface: QuietPeriodAwareRepository
Returns the number of seconds to wait between each retry

Specified by:
getQuietPeriod in interface QuietPeriodAwareRepository
Returns:
seconds between retries

getMaxRetries

public int getMaxRetries()
Description copied from interface: QuietPeriodAwareRepository
Returns the maximum number of times to collect changes

Specified by:
getMaxRetries in interface QuietPeriodAwareRepository
Returns:

isAdvancedOptionEnabled

public boolean isAdvancedOptionEnabled(@NotNull
                                       BuildConfiguration buildConfiguration)

setWorkingDir

public void setWorkingDir(java.io.File workingDir)

getWorkingDirectory

public java.io.File getWorkingDirectory()

getSourceCodeDirectory

@NotNull
@Deprecated
public java.io.File getSourceCodeDirectory(@NotNull
                                                              PlanKey planKey)
                                    throws RepositoryException
Deprecated. since 3.3 Repository must handle checkout to any subdirectory

For Subversion, we use the build name's directory within the system's working directory

Specified by:
getSourceCodeDirectory in interface RepositoryV2
Parameters:
planKey - Plan key
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.

substituteString

protected java.lang.String substituteString(java.lang.String stringWithValuesToSubstitute)

setTextProvider

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

setTemplateRenderer

public void setTemplateRenderer(TemplateRenderer templateRenderer)
Overrides:
setTemplateRenderer in class BaseBuildConfigurationAwarePlugin

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)

setBuildLoggerManager

public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)

setBuildDirectoryManager

public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)

isWorkspaceEmpty

protected boolean isWorkspaceEmpty(java.io.File sourceCodeDirectory)

setCustomVariableContext

public void setCustomVariableContext(CustomVariableContext customVariableContext)


Copyright © 2011 Atlassian. All Rights Reserved.