com.atlassian.bamboo.repository.svn
Class SvnRepository

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
              extended by com.atlassian.bamboo.repository.svn.SvnRepository
All Implemented Interfaces:
ConvertibleFromConfig, InitablePluginModule, CleanCheckoutAwareRepository, CleanWorkingDirectoryAwareRepository, IncludeExcludeAwareRepository, InitialBuildAwareRepository, MavenPomAccessorCapableRepository, QuietPeriodAwareRepository, Repository, SelectableAuthenticationRepository, DescriptionProvider, NameProvider, BambooPluginModule, BuildConfigurationAwarePlugin, ConfigurablePlugin, RenderableBuildConfiguration, RepositoryEventAware, RepositoryV2, java.io.Serializable

public class SvnRepository
extends AbstractRepository
implements SelectableAuthenticationRepository, InitialBuildAwareRepository, RepositoryEventAware, MavenPomAccessorCapableRepository

This class provides a Subversion repository for Bamboo.

See Also:
Serialized Form

Field Summary
static java.lang.String COMPLETE_PLUGIN_KEY
           
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
           
static java.lang.String TEMPORARY_SVN_PASSWORD
           
 
Fields inherited from class com.atlassian.bamboo.repository.AbstractRepository
BUILD_TRIGGER_IP, buildDirectoryManager, buildLoggerManager, CLEAN_CHECKOUT_PARAM, CLEAN_WORKING_DIRECTORY_PARAM, customVariableContext, repositoryModuleDescriptor, templateRenderer, textProvider
 
Fields inherited from class com.atlassian.bamboo.v2.build.BaseBuildConfigurationAwarePlugin
moduleDescriptor
 
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
 long checkout(org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision, java.io.File dstPath, boolean isRecursive)
          Checks out a working copy from a repository.
 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 repository server host
 java.lang.String getHost(BuildContext buildContext)
           
 java.lang.String getKeyFile()
           
 java.lang.String getLocationIdentifier()
          A string representing the location of the repository
 SvnRepositoryMavenPomAccessor getMavenPomAccessor()
           
 java.lang.String getName()
          What's the name of the plugin - appears in the GUI dropdown
 java.lang.String getPassphrase()
           
 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
protected  org.tmatesoft.svn.core.SVNURL getSubstitutedSvnUrl()
           
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
 int hashCode()
           
 org.tmatesoft.svn.core.wc.SVNInfo info(org.tmatesoft.svn.core.SVNURL url, org.tmatesoft.svn.core.wc.SVNRevision revision)
          Runs 'svn info' operation on a given URL.
 boolean isAdvancedOptionEnabled(BuildConfiguration buildConfiguration)
           
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 as the given repository
 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(BuildContext buildContext, java.lang.String vcsRevisionKey)
          Checks out the latest source code to an appropriate repository
 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 setPassphrase(java.lang.String passphrase)
           
 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
 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
addDefaultValues, checkConnection, createStringFromList, customizeBuildRequirements, getDescription, getEditHtml, getFilterFilePatternOption, getFilterFilePatternRegex, getKey, getMavenPomCheckoutAccessEditHtml, getMaxRetries, getMinimalEditHtml, getQuietPeriod, getShortKey, getSourceCodeDirectory, getSourceCodeDirectory, getTriggerIpAddress, getViewHtml, getWorkingDirectory, init, isCleanCheckout, isCleanWorkingDirectory, isQuietPeriodEnabled, isWorkspaceEmpty, referencesDifferentRepository, removeBuildRequirements, setBuildDirectoryManager, setBuildLoggerManager, setCleanCheckout, setCleanWorkingDirectory, setCustomVariableContext, setFilterFilePatternOption, setFilterFilePatternRegex, setReferencesDifferentRepository, setTemplateRenderer, setTextProvider, setTriggerIpAddress, setWorkingDir, substituteString
 
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
 
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, getMinimalEditHtml, getShortKey, getTriggerIpAddress, setReferencesDifferentRepository
 
Methods inherited from interface com.atlassian.bamboo.v2.build.repository.RepositoryV2
getSourceCodeDirectory, getSourceCodeDirectory, referencesDifferentRepository
 
Methods inherited from interface com.atlassian.bamboo.v2.build.ConfigurablePlugin
customizeBuildRequirements, removeBuildRequirements
 
Methods inherited from interface com.atlassian.bamboo.v2.build.BuildConfigurationAwarePlugin
addDefaultValues
 
Methods inherited from interface com.atlassian.bamboo.v2.build.RenderableBuildConfiguration
getEditHtml, getViewHtml
 
Methods inherited from interface com.atlassian.bamboo.utils.DescriptionProvider
getDescription
 

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

COMPLETE_PLUGIN_KEY

public static final java.lang.String COMPLETE_PLUGIN_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

TEMPORARY_SVN_PASSWORD

public static final java.lang.String TEMPORARY_SVN_PASSWORD
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

collectChangesSinceLastBuild

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

Specified by:
collectChangesSinceLastBuild in interface RepositoryV2
lastVcsRevisionKey - - can be null, if null you should ensure the correct vcsrevisionkey is returned in the BuildChanges object.
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

retrieveSourceCode

@NotNull
public java.lang.String retrieveSourceCode(@NotNull
                                                   BuildContext buildContext,
                                                   @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: 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 AbstractRepository
Parameters:
buildConfiguration - - @NotNull
Returns:
ErrorCollection keyed by the field name. @NotNull

isRepositoryDifferent

public boolean isRepositoryDifferent(@NotNull
                                     Repository repository)
Description copied from interface: RepositoryV2
Checks if the current repo is the same as the given repository

Specified by:
isRepositoryDifferent in interface RepositoryV2
Parameters:
repository - to compare against
Returns:
true of repositories are different, false if the same;

prepareConfigObject

public void prepareConfigObject(@NotNull
                                BuildConfiguration buildConfiguration)
Description copied from interface: BuildConfigurationAwarePlugin
Do any preprocessing work before validation occurs. For repository, builder and web repository plugins this will only be called if the plugin is select by the user.

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

checkout

public long checkout(org.tmatesoft.svn.core.SVNURL url,
                     org.tmatesoft.svn.core.wc.SVNRevision revision,
                     java.io.File dstPath,
                     boolean isRecursive)
              throws RepositoryException
Checks out a working copy from a repository. Like 'svn checkout URL[@REV] PATH (-r..)' command; It's done by invoking

Parameters:
url - repository location where a working copy is to be checked out from;
revision - a revision at which a working copy being checked out is to be;
dstPath - a local path where the working copy will be fetched into;
isRecursive - if true and url corresponds to a directory then doCheckout(..) recursively
Returns:
the number of the revision at which the working copy is
Throws:
RepositoryException - Failed!

getMavenPomAccessor

@NotNull
public SvnRepositoryMavenPomAccessor getMavenPomAccessor()
Specified by:
getMavenPomAccessor in interface MavenPomAccessorCapableRepository

info

@NotNull
public org.tmatesoft.svn.core.wc.SVNInfo info(org.tmatesoft.svn.core.SVNURL url,
                                                      org.tmatesoft.svn.core.wc.SVNRevision revision)
                                       throws RepositoryException
Runs 'svn info' operation on a given URL.

Parameters:
url - repository location which shall be queried
revision - a revision of repository location which shall be queried
Returns:
SVNInfo object holding data
Throws:
RepositoryException - Failed!

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
Specified by:
getName in interface DescriptionProvider
Specified by:
getName in interface NameProvider
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)

getSubstitutedSvnUrl

protected org.tmatesoft.svn.core.SVNURL getSubstitutedSvnUrl()
                                                      throws org.tmatesoft.svn.core.SVNException
Throws:
org.tmatesoft.svn.core.SVNException

getHost

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

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

getHost

public java.lang.String getHost(BuildContext buildContext)

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
Overrides:
getLocationIdentifier in class AbstractRepository
Returns:

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 © 2011 Atlassian. All Rights Reserved.