com.atlassian.bamboo.repository.svn
Class SvnRepository

java.lang.Object
  extended by com.atlassian.bamboo.repository.AbstractRepository
      extended by com.atlassian.bamboo.repository.svn.SvnRepository
All Implemented Interfaces:
ConvertibleFromConfig, CleanCheckoutAwareRepository, IncludeExcludeAwareRepository, InitialBuildAwareRepository, MutableQuietPeriodAwareRepository, QuietPeriodAwareRepository, Repository, SelectableAuthenticationRepository, WebRepositoryEnabledRepository, BambooPluginModule, ConfigurablePlugin, RepositoryEventAware, RepositoryV2, java.io.Serializable

public class SvnRepository
extends AbstractRepository
implements SelectableAuthenticationRepository, WebRepositoryEnabledRepository, InitialBuildAwareRepository, MutableQuietPeriodAwareRepository, RepositoryEventAware

This class provides a Subversion repository for Bamboo.

See Also:
Serialized Form

Field Summary
static org.tmatesoft.svn.core.wc.ISVNOptions DEFAULT_SVN_OPTIONS
           
static java.lang.String KEY
           
static java.lang.String NAME
           
static java.lang.String SVN_AUTH_TYPE
           
static java.lang.String SVN_KEYFILE
           
static java.lang.String SVN_PASSPHRASE
           
static java.lang.String SVN_PASSWORD
           
static java.lang.String SVN_REPO_URL
           
static java.lang.String SVN_SSL_KEYFILE
           
static java.lang.String SVN_SSL_PASSPHRASE
           
static java.lang.String SVN_USERNAME
           
 
Fields inherited from class com.atlassian.bamboo.repository.AbstractRepository
BUILD_TRIGGER_IP, buildDirectoryManager, buildLoggerManager, CLEAN_CHECKOUT_PARAM, repositoryModuleDescriptor, templateRenderer, textProvider, variableSubstitutionBean, WEB_REPO_MODULE_NAME, WEB_REPO_URL
 
Fields inherited from interface com.atlassian.bamboo.repository.Repository
SELECTED_REPOSITORY, UNKNOWN_HOST
 
Fields inherited from interface com.atlassian.bamboo.repository.IncludeExcludeAwareRepository
FILTER_PATTERN_EXCLUDE, FILTER_PATTERN_INCLUDE, FILTER_PATTERN_OPTION, FILTER_PATTERN_REGEX
 
Constructor Summary
SvnRepository()
           
 
Method Summary
 void addDefaultValues(BuildConfiguration buildConfiguration)
          Extension point for adding default values to the form for #getEditHtml()
 BuildChanges collectChangesSinceLastBuild(java.lang.String planKey, java.lang.String lastVcsRevisionKey)
          Collects the changes since the lastVcsRevisionKey
 int compareTo(java.lang.Object obj)
           
 boolean equals(java.lang.Object o)
           
 java.util.List<NameValuePair> getAuthenticationTypes()
          List all authentication types supported by repository.
 java.lang.String getAuthType()
           
 java.lang.String getEncryptedPassphrase()
           
 java.lang.String getEncryptedPassword()
           
 java.util.Map<java.lang.String,java.lang.Long> getExternalPathRevisionMappings()
           
 java.util.SortedMap<java.lang.String,java.lang.Long> getExternalPathRevisionMappingsSorted()
           
 java.lang.String getHost()
          What's the repostory server host
 java.lang.String getKeyFile()
           
 int getMaxRetries()
          Returns the maximum number of times to collect changes
 java.lang.String getName()
          What's the name of the plugin - appears in the GUI dropdown
 java.lang.String getPassphrase()
           
 int getQuietPeriod()
          Returns the number of seconds to wait between each retry
 java.lang.String getRepositoryUrl()
          Which repository URL are we using?
 java.lang.String getSubstitutedKeyFile()
           
 java.lang.String getSubstitutedRepositoryUrl()
          Return repository URL with extrapolated Bamboo variables
 java.lang.String getSubstitutedWebRepositoryUrl()
          Return web repository URL with extrapolated Bamboo variables
protected  org.tmatesoft.svn.core.wc.SVNClientManager getSvnClientManager()
          SVNClientManager factory.
 java.lang.String getUrl()
          Where is the documentation and help about using Subversion?
 java.lang.String getUsername()
          What username are we using to access the repository?
 java.lang.String getUserPassword()
          What password are we using to access the repository
 java.lang.String getWebRepositoryUrl()
          Return web repository URL
 java.lang.String getWebRepositoryUrlForCommit(Commit commit)
          Possibly return a URL for a given commit
 java.lang.String getWebRepositoryUrlForDiff(CommitFile file)
           
 java.lang.String getWebRepositoryUrlForFile(CommitFile file)
          What's the URL to the repostory for the modified file?
 java.lang.String getWebRepositoryUrlForRevision(CommitFile file)
           
 java.lang.String getWebRepositoryUrlRepoName()
          What's the repository's web url repository
 int hashCode()
           
 boolean hasWebBasedRepositoryAccess()
          Does this recpository provdide a web url intereface?
 boolean isAdvancedOptionEnabled(BuildConfiguration buildConfiguration)
           
 boolean isQuietPeriodEnabled()
          Returns true if we were to enable the quiet period
protected  boolean isRecoverableException(org.tmatesoft.svn.core.SVNException e)
          Check if provided exception object identifies recoverable exception.
 boolean isRepositoryDifferent(Repository repository)
          Checks if the current repo is the same or not and sets the referencesDifferentRepository flag accordingly
 boolean isUseExternals()
           
 void onInitialBuild(BuildContext buildContext)
          Allows the Repository to perform custom actions when an initial build is triggered.
 void populateFromConfig(org.apache.commons.configuration.HierarchicalConfiguration config)
          Update the current object with data in the HierarchicalConfiguration
 void postRetrieveSourceCode(BuildContext buildContext)
          postRetrieveSourceCode will run after the retrieveSourceCode method is called.
 void prepareConfigObject(BuildConfiguration buildConfiguration)
          Do any preprocessing work before validation occurs
 void preRetrieveSourceCode(BuildContext buildContext)
          Checks if the SVN URL has changed
 java.lang.String retrieveSourceCode(java.lang.String planKey, java.lang.String vcsRevisionKey)
          Checks out the latest source code to an appropriate repository
 void setAuthType(java.lang.String authType)
           
 void setEncryptedPassphrase(java.lang.String encryptedPassphrase)
           
 void setEncryptedPassword(java.lang.String encryptedPassword)
           
 void setKeyFile(java.lang.String myKeyFile)
           
 void setMaxRetries(int maxRetries)
           
 void setPassphrase(java.lang.String passphrase)
           
 void setQuietPeriod(int quietPeriod)
           
 void setQuietPeriodEnabled(boolean quietPeriodEnabled)
           
 void setRepositoryUrl(java.lang.String repositoryUrl)
          Specify the subversion repository we are using
 void setSvnClientManagerFactory(SVNClientManagerFactory svnClientManagerFactory)
           
 void setUseExternals(boolean useExternals)
           
 void setUsername(java.lang.String username)
          What's the username (if any) we are using to acces the repository?
 void setUserPassword(java.lang.String password)
          Specify the password required to access the resposotory
 void setWebRepositoryUrl(java.lang.String url)
          Where should we link to to show build file changes?
 void setWebRepositoryUrlRepoName(java.lang.String repoName)
          This is used to identify the repository on multi-repository configurations.
 org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
          Store SvnRepository data into configuration object.
 ErrorCollection validate(BuildConfiguration buildConfiguration)
          Validates the properties in the BuildConfiguration object.
 
Methods inherited from class com.atlassian.bamboo.repository.AbstractRepository
checkConnection, createStringFromList, customizeBuildRequirements, getEditHtml, getFilterFilePatternOption, getFilterFilePatternRegex, getKey, getSourceCodeDirectory, getTriggerIpAddress, getVariableSubstitutionBean, getViewHtml, getWorkingDirectory, init, isCleanCheckout, isWorkspaceEmpty, referencesDifferentRepository, setBuildDirectoryManager, setBuildLoggerManager, setCleanCheckout, setFilterFilePatternOption, setFilterFilePatternRegex, setReferencesDifferentRepository, setTemplateRenderer, setTextProvider, setTriggerIpAddress, setVariableSubstitutionBean, setWorkingDir
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.repository.Repository
checkConnection, getKey, getTriggerIpAddress, setReferencesDifferentRepository
 
Methods inherited from interface com.atlassian.bamboo.v2.build.repository.RepositoryV2
getSourceCodeDirectory, referencesDifferentRepository
 
Methods inherited from interface com.atlassian.bamboo.v2.build.ConfigurablePlugin
customizeBuildRequirements, getEditHtml, getViewHtml, init
 

Field Detail

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

SVN_REPO_URL

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

SVN_USERNAME

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

SVN_AUTH_TYPE

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

SVN_PASSWORD

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

SVN_KEYFILE

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

SVN_PASSPHRASE

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

SVN_SSL_KEYFILE

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

SVN_SSL_PASSPHRASE

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

DEFAULT_SVN_OPTIONS

public static final org.tmatesoft.svn.core.wc.ISVNOptions DEFAULT_SVN_OPTIONS
Constructor Detail

SvnRepository

public SvnRepository()
Method Detail

addDefaultValues

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

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

collectChangesSinceLastBuild

@NotNull
public BuildChanges collectChangesSinceLastBuild(@NotNull
                                                         java.lang.String planKey,
                                                         @NotNull
                                                         java.lang.String lastVcsRevisionKey)
                                          throws RepositoryException
Description copied from interface: RepositoryV2
Collects the changes since the lastVcsRevisionKey

Specified by:
collectChangesSinceLastBuild in interface RepositoryV2
lastVcsRevisionKey - - should not be null
Returns:
A build changes object with the appropriate build changes
Throws:
RepositoryException - if something goes wrong

retrieveSourceCode

@NotNull
public java.lang.String retrieveSourceCode(@NotNull
                                                   java.lang.String planKey,
                                                   @Nullable
                                                   java.lang.String vcsRevisionKey)
                                    throws RepositoryException
Description copied from interface: RepositoryV2
Checks out the latest source code to an appropriate repository

Specified by:
retrieveSourceCode in interface RepositoryV2
vcsRevisionKey - - may be null if you want latest code
Returns:
vcsRevisionKey - the revision
Throws:
RepositoryException

preRetrieveSourceCode

public void preRetrieveSourceCode(@NotNull
                                  BuildContext buildContext)
Checks if the SVN URL has changed

Specified by:
preRetrieveSourceCode in interface RepositoryEventAware
Parameters:
buildContext -

postRetrieveSourceCode

public void postRetrieveSourceCode(@NotNull
                                   BuildContext buildContext)
Description copied from interface: RepositoryEventAware
postRetrieveSourceCode will run after the retrieveSourceCode method is called. The extension point allows you to easily set custom data, do any post checkout collection of data.

Specified by:
postRetrieveSourceCode in interface RepositoryEventAware

isRecoverableException

protected boolean isRecoverableException(@NotNull
                                         org.tmatesoft.svn.core.SVNException e)
Check if provided exception object identifies recoverable exception.

Parameters:
e - Exception to be analyzed.
Returns:
True if exception is recognized as the one we can recover from.

getSvnClientManager

protected org.tmatesoft.svn.core.wc.SVNClientManager getSvnClientManager()
SVNClientManager factory.

Returns:
SVNClientManager appropriate for authorization mode

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.

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

isRepositoryDifferent

public boolean isRepositoryDifferent(@NotNull
                                     Repository repository)
Description copied from interface: Repository
Checks if the current repo is the same or not and sets the referencesDifferentRepository flag accordingly

Specified by:
isRepositoryDifferent in interface Repository

prepareConfigObject

public void prepareConfigObject(@NotNull
                                BuildConfiguration buildConfiguration)
Description copied from interface: ConfigurablePlugin
Do any preprocessing work before validation occurs

Specified by:
prepareConfigObject in interface ConfigurablePlugin
Parameters:
buildConfiguration - - @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
Overrides:
populateFromConfig in class AbstractRepository

toConfiguration

@NotNull
public org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
Store SvnRepository data into configuration object.

Specified by:
toConfiguration in interface ConvertibleFromConfig
Overrides:
toConfiguration in class AbstractRepository
Returns:

onInitialBuild

public void onInitialBuild(BuildContext buildContext)
Description copied from interface: InitialBuildAwareRepository
Allows the Repository to perform custom actions when an initial build is triggered.

Specified by:
onInitialBuild in interface InitialBuildAwareRepository

isAdvancedOptionEnabled

public boolean isAdvancedOptionEnabled(@NotNull
                                       BuildConfiguration buildConfiguration)

getName

@NotNull
public java.lang.String getName()
What's the name of the plugin - appears in the GUI dropdown

Specified by:
getName in interface Repository
Returns:
The name

getPassphrase

public java.lang.String getPassphrase()

setPassphrase

public void setPassphrase(java.lang.String passphrase)

getEncryptedPassphrase

public java.lang.String getEncryptedPassphrase()

setEncryptedPassphrase

public void setEncryptedPassphrase(java.lang.String encryptedPassphrase)

getKeyFile

public java.lang.String getKeyFile()

getSubstitutedKeyFile

public java.lang.String getSubstitutedKeyFile()

setKeyFile

public void setKeyFile(java.lang.String myKeyFile)

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface SelectableAuthenticationRepository
Returns:
the authentication type for this repository configuration

setAuthType

public void setAuthType(java.lang.String authType)

getUrl

public java.lang.String getUrl()
Where is the documentation and help about using Subversion?

Returns:
The web url

setRepositoryUrl

public void setRepositoryUrl(java.lang.String repositoryUrl)
Specify the subversion repository we are using

Parameters:
repositoryUrl - The subversion repository

getRepositoryUrl

public java.lang.String getRepositoryUrl()
Which repository URL are we using?

Returns:
The subversion repository

getSubstitutedRepositoryUrl

public java.lang.String getSubstitutedRepositoryUrl()
Return repository URL with extrapolated Bamboo variables

Returns:
Repository URL with extrapolated Bamboo variables

setUsername

public void setUsername(java.lang.String username)
What's the username (if any) we are using to acces the repository?

Parameters:
username - The user name, null if there is no user

getUsername

public java.lang.String getUsername()
What username are we using to access the repository?

Returns:
The username, null if we are not using user authentication

setUserPassword

public void setUserPassword(java.lang.String password)
Specify the password required to access the resposotory

Parameters:
password - The password (null if we are not using user authentication)

getUserPassword

public java.lang.String getUserPassword()
What password are we using to access the repository

Returns:
The password (null if we are not using user authentication)

getEncryptedPassword

public java.lang.String getEncryptedPassword()

setEncryptedPassword

public void setEncryptedPassword(java.lang.String encryptedPassword)

hasWebBasedRepositoryAccess

public boolean hasWebBasedRepositoryAccess()
Description copied from interface: WebRepositoryEnabledRepository
Does this recpository provdide a web url intereface?

Specified by:
hasWebBasedRepositoryAccess in interface WebRepositoryEnabledRepository
Returns:
true if we can link changes to the repositories web interface.

getWebRepositoryUrl

public java.lang.String getWebRepositoryUrl()
Return web repository URL

Specified by:
getWebRepositoryUrl in interface WebRepositoryEnabledRepository
Returns:
Web repository URL

getSubstitutedWebRepositoryUrl

public java.lang.String getSubstitutedWebRepositoryUrl()
Return web repository URL with extrapolated Bamboo variables

Returns:
Web repository URL with extrapolated Bamboo variables

setWebRepositoryUrl

public void setWebRepositoryUrl(java.lang.String url)
Description copied from interface: WebRepositoryEnabledRepository
Where should we link to to show build file changes?

Specified by:
setWebRepositoryUrl in interface WebRepositoryEnabledRepository
Parameters:
url - The url of the repositories web interface

getWebRepositoryUrlRepoName

public java.lang.String getWebRepositoryUrlRepoName()
Description copied from interface: WebRepositoryEnabledRepository
What's the repository's web url repository

Specified by:
getWebRepositoryUrlRepoName in interface WebRepositoryEnabledRepository
Returns:
The repository (only used in multi-build repositories). Null if not used.

setWebRepositoryUrlRepoName

public void setWebRepositoryUrlRepoName(java.lang.String repoName)
Description copied from interface: WebRepositoryEnabledRepository
This is used to identify the repository on multi-repository configurations.

Specified by:
setWebRepositoryUrlRepoName in interface WebRepositoryEnabledRepository
Parameters:
repoName - The name of the repository we are viewing

getWebRepositoryUrlForFile

public java.lang.String getWebRepositoryUrlForFile(CommitFile file)
Description copied from interface: WebRepositoryEnabledRepository
What's the URL to the repostory for the modified file?

Specified by:
getWebRepositoryUrlForFile in interface WebRepositoryEnabledRepository
Parameters:
file - The file that has been modified
Returns:
The url

getWebRepositoryUrlForDiff

public java.lang.String getWebRepositoryUrlForDiff(CommitFile file)

getWebRepositoryUrlForRevision

public java.lang.String getWebRepositoryUrlForRevision(CommitFile file)

getWebRepositoryUrlForCommit

@Nullable
public java.lang.String getWebRepositoryUrlForCommit(@NotNull
                                                              Commit commit)
Description copied from interface: WebRepositoryEnabledRepository
Possibly return a URL for a given commit

Specified by:
getWebRepositoryUrlForCommit in interface WebRepositoryEnabledRepository
Overrides:
getWebRepositoryUrlForCommit in class AbstractRepository
Returns:

getHost

public java.lang.String getHost()
Description copied from interface: Repository
What's the repostory server host

Specified by:
getHost in interface Repository
Returns:
The host!

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:

setQuietPeriodEnabled

public void setQuietPeriodEnabled(boolean quietPeriodEnabled)
Specified by:
setQuietPeriodEnabled in interface MutableQuietPeriodAwareRepository

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

setQuietPeriod

public void setQuietPeriod(int quietPeriod)
Specified by:
setQuietPeriod in interface MutableQuietPeriodAwareRepository

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:

setMaxRetries

public void setMaxRetries(int maxRetries)
Specified by:
setMaxRetries in interface MutableQuietPeriodAwareRepository

isUseExternals

public boolean isUseExternals()

setUseExternals

public void setUseExternals(boolean useExternals)

setSvnClientManagerFactory

public void setSvnClientManagerFactory(SVNClientManagerFactory svnClientManagerFactory)

getExternalPathRevisionMappings

public java.util.Map<java.lang.String,java.lang.Long> getExternalPathRevisionMappings()

getExternalPathRevisionMappingsSorted

public java.util.SortedMap<java.lang.String,java.lang.Long> getExternalPathRevisionMappingsSorted()

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)

getAuthenticationTypes

@NotNull
public java.util.List<NameValuePair> getAuthenticationTypes()
Description copied from interface: SelectableAuthenticationRepository
List all authentication types supported by repository.

Specified by:
getAuthenticationTypes in interface SelectableAuthenticationRepository
Returns:
List of authentication types supported by repository


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.