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, FilterChangesetAwareRepository, IncludeExcludeAwareRepository, OnceOffCapableRepository, QuietPeriodAwareRepository, Repository, DescriptionProvider, NameProvider, BambooPluginModule, BuildConfigurationAwarePlugin, ConfigurablePlugin, RenderableBuildConfiguration, RepositoryV2, Serializable
Direct Known Subclasses:
AbstractStandaloneRepository

public abstract class AbstractRepository
extends BaseConfigurablePlugin
implements Repository, IncludeExcludeAwareRepository, QuietPeriodAwareRepository, AdvancedConfigurationAwareRepository, FilterChangesetAwareRepository, OnceOffCapableRepository

This class provides common repository implementation code,

See Also:
Serialized Form

Field Summary
protected  AdministrationConfigurationAccessor administrationConfigurationAccessor
           
static String BUILD_TRIGGER_IP
           
protected  BuildDirectoryManager buildDirectoryManager
           
protected  BuildLoggerManager buildLoggerManager
           
protected  CustomVariableContext customVariableContext
           
protected  FeatureManager featureManager
           
static String REPO_PREFIX
           
protected  RepositoryModuleDescriptorImpl repositoryModuleDescriptor
           
protected  TemplateRenderer templateRenderer
           
protected  com.opensymphony.xwork2.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.FilterChangesetAwareRepository
CHANGESET_FILTER_PATTERN_REGEX, MAVEN_RELEASE_PLUGIN_EXCLUSION_PATTERN
 
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.
 BuildRepositoryChanges collectChangesForRevision(PlanKey planKey, String targetRevision)
          Collects the changes for the targetRevision.
 void customizeBuildRequirements(PlanKey planKey, BuildConfiguration buildConfiguration, RequirementSet requirementSet)
          Extension point for adding/customizing requirements when editing a build's builder configuration.
 String getAdvancedEditHtml(BuildConfiguration buildConfiguration, Plan plan)
          Deprecated. since 5.5 use StandaloneRepository.getAdvancedEditHtml(org.apache.commons.configuration.HierarchicalConfiguration)
 String getAdvancedViewHtml(Plan plan)
          Deprecated. since 5.5 use StandaloneRepository.getAdvancedViewHtml()
 String getBranchIntegrationEditHtml()
           
 String getChangesetFilterPatternRegex()
          The regex expression on which changeset comments are matched for exclusion.
 TriggerModuleDescriptor getDefaultTriggerModule()
           
 String getDescription()
           
 String getEditHtml(BuildConfiguration buildConfiguration, Plan plan)
          Deprecated. since 5.5 use StandaloneRepository.getEditHtml(org.apache.commons.configuration.HierarchicalConfiguration)
 String getFilterFilePatternOption()
          Do we want to include files which match pattern or exclude files which match pattern?
 String getFilterFilePatternRegex()
          The regex expression on which fileName (paths) are matched for inclusion/exclusion.
 String getKey()
          The full complete plugin key for the repo
 String getLocationIdentifier()
          A string representing the location of the repository
 String getMavenPomCheckoutAccessEditHtml(BuildConfiguration buildConfiguration)
           
protected  int getMaxCommitsToReturn()
           
 int getMaxRetries()
          Returns the maximum number of times to collect changes
 String getMinimalEditHtml(BuildConfiguration buildConfiguration)
          Returns HTML for the minimal configuration of the repository.
static TriggerModuleDescriptor getPollingTriggerModule()
           
 int getQuietPeriod()
          Returns the number of seconds to wait between each retry
 String getShortKey()
          The mini key from the plugin (should not contain plugin prefix)
 File getSourceCodeDirectory(PlanKey planKey)
          For Subversion, we use the build name's directory within the system's working directory
 Collection<String> getSystemWideExclusionPatterns()
          Collection of system wide, hardcoded changeset filtering patterns
 String getViewHtml(Plan plan)
          Deprecated. since 5.5 use StandaloneRepository.getViewHtml()
 File getWorkingDirectory()
           
 void init(com.atlassian.plugin.ModuleDescriptor moduleDescriptor)
          Initialises the Plugin with the plugin module descriptor
 boolean isAdvancedOptionEnabled(BuildConfiguration buildConfiguration)
           
 boolean isQuietPeriodEnabled()
          Returns true if we were to enable the quiet period
protected  boolean isWorkspaceEmpty(File sourceCodeDirectory)
           
 void populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
          Update the current object with data in the HierarchicalConfiguration
 void removeBuildRequirements(PlanKey planKey, BuildConfiguration buildConfiguration, RequirementSet requirementSet)
          Extension point for removing requirements when given plugin is excluded from build's builder configuration.
 void setAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)
           
 void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)
           
 void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
           
 void setChangesetFilterPatternRegex(String changesetFilterPatternRegex)
           
 void setCustomVariableContext(CustomVariableContext customVariableContext)
           
 void setFeatureManager(FeatureManager featureManager)
           
 void setFilterFilePatternOption(String filterFilePatternOption)
           
 void setFilterFilePatternRegex(String filterFilePatternRegex)
           
 void setTemplateRenderer(TemplateRenderer templateRenderer)
           
 void setTextProvider(com.opensymphony.xwork2.TextProvider textProvider)
           
 void setWorkingDir(File workingDir)
           
protected  String substituteString(String stringWithValuesToSubstitute)
           
 org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
          Generate a HierarchicalConfiguration from the current state of the object
static BranchMergingAwareRepository toMergeCapableRepository(RepositoryV2 defaultRepository)
           
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 
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
 
Methods inherited from interface com.atlassian.bamboo.v2.build.BuildConfigurationAwarePlugin
prepareConfigObject
 

Field Detail

REPO_PREFIX

public static final String REPO_PREFIX
See Also:
Constant Field Values

BUILD_TRIGGER_IP

public static final String BUILD_TRIGGER_IP
See Also:
Constant Field Values

repositoryModuleDescriptor

protected RepositoryModuleDescriptorImpl repositoryModuleDescriptor

templateRenderer

protected transient TemplateRenderer templateRenderer

textProvider

protected transient com.opensymphony.xwork2.TextProvider textProvider

buildLoggerManager

protected transient BuildLoggerManager buildLoggerManager

buildDirectoryManager

protected transient BuildDirectoryManager buildDirectoryManager

customVariableContext

protected transient CustomVariableContext customVariableContext

featureManager

protected transient FeatureManager featureManager

administrationConfigurationAccessor

protected transient AdministrationConfigurationAccessor administrationConfigurationAccessor
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 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 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 String getLocationIdentifier()
Description copied from interface: Repository
A string representing the location of the repository

Specified by:
getLocationIdentifier in interface Repository
Returns:

getDescription

public 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

getMaxCommitsToReturn

protected int getMaxCommitsToReturn()

collectChangesForRevision

@NotNull
public BuildRepositoryChanges collectChangesForRevision(@NotNull
                                                                PlanKey planKey,
                                                                @NotNull
                                                                String targetRevision)
                                                 throws RepositoryException
Description copied from interface: OnceOffCapableRepository
Collects the changes for the targetRevision. This method is called only on server side (never on agent).

Specified by:
collectChangesForRevision in interface OnceOffCapableRepository
Returns:
A build changes object with the appropriate build changes (that is - with the single commit data relevant for targetRevision)
Throws:
RepositoryException - if something goes wrong

getViewHtml

@Nullable
@Deprecated
public String getViewHtml(@NotNull
                                              Plan plan)
Deprecated. since 5.5 use StandaloneRepository.getViewHtml()

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
@Deprecated
public String getEditHtml(@NotNull
                                              BuildConfiguration buildConfiguration,
                                              @Nullable
                                              Plan plan)
Deprecated. since 5.5 use StandaloneRepository.getEditHtml(org.apache.commons.configuration.HierarchicalConfiguration)

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 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

@Deprecated
public String getAdvancedViewHtml(@NotNull
                                             Plan plan)
Deprecated. since 5.5 use StandaloneRepository.getAdvancedViewHtml()

Specified by:
getAdvancedViewHtml in interface AdvancedConfigurationAwareRepository

getAdvancedEditHtml

@Deprecated
public String getAdvancedEditHtml(@NotNull
                                             BuildConfiguration buildConfiguration,
                                             @Nullable
                                             Plan plan)
Deprecated. since 5.5 use StandaloneRepository.getAdvancedEditHtml(org.apache.commons.configuration.HierarchicalConfiguration)

Specified by:
getAdvancedEditHtml in interface AdvancedConfigurationAwareRepository

getMavenPomCheckoutAccessEditHtml

@Nullable
public String getMavenPomCheckoutAccessEditHtml(@NotNull
                                                         BuildConfiguration buildConfiguration)

getBranchIntegrationEditHtml

@Nullable
public String getBranchIntegrationEditHtml()

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

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(File workingDir)

getWorkingDirectory

public File getWorkingDirectory()

getSourceCodeDirectory

@NotNull
public File getSourceCodeDirectory(@NotNull
                                           PlanKey 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 - 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 errors should be translated to error messages, rather than field errors.

substituteString

protected String substituteString(@Nullable
                                  String stringWithValuesToSubstitute)

setTextProvider

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

setTemplateRenderer

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

getFilterFilePatternOption

public 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(String filterFilePatternOption)

getFilterFilePatternRegex

public 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(String filterFilePatternRegex)

getChangesetFilterPatternRegex

public String getChangesetFilterPatternRegex()
Description copied from interface: FilterChangesetAwareRepository
The regex expression on which changeset comments are matched for exclusion.

Specified by:
getChangesetFilterPatternRegex in interface FilterChangesetAwareRepository
Returns:

setChangesetFilterPatternRegex

public void setChangesetFilterPatternRegex(String changesetFilterPatternRegex)

getSystemWideExclusionPatterns

public Collection<String> getSystemWideExclusionPatterns()
Description copied from interface: FilterChangesetAwareRepository
Collection of system wide, hardcoded changeset filtering patterns

Specified by:
getSystemWideExclusionPatterns in interface FilterChangesetAwareRepository
Returns:

setBuildLoggerManager

public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)

setBuildDirectoryManager

public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager)

isWorkspaceEmpty

protected boolean isWorkspaceEmpty(File sourceCodeDirectory)

setCustomVariableContext

public void setCustomVariableContext(CustomVariableContext customVariableContext)

setFeatureManager

public void setFeatureManager(FeatureManager featureManager)

setAdministrationConfigurationAccessor

public void setAdministrationConfigurationAccessor(AdministrationConfigurationAccessor administrationConfigurationAccessor)

toMergeCapableRepository

@Nullable
public static BranchMergingAwareRepository toMergeCapableRepository(@Nullable
                                                                             RepositoryV2 defaultRepository)

getPollingTriggerModule

public static TriggerModuleDescriptor getPollingTriggerModule()

getDefaultTriggerModule

public TriggerModuleDescriptor getDefaultTriggerModule()


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.