Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo Plugin: Help with Repository and RepositoryDefinition

Ricardo Joseph
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 27, 2012

I use a foreach in Java to pull out the Repository that i require and then do the following...

svnRepositoryInstance = (SvnRepository)repositoryDefinitionInstance.getRepository();

svnRepositoryInstance.setUsername("myUsername");

svnRepositoryInstance.setUserPassword("myPassword");

I would then like to pass the svnRepositoryInstance to a RepositoryDefinition, so that I may put this into the BuildContext RepositoryDefiniton Map....

buildContext.getRepositoryDefinitionMap().put(repositioryDefiintionWithNewData.getId(), repositioryDefiintionWithNewData)

Please tell me how I go about getting a Repository into a RepositoryDefinition , as i cannot seem to find the right way?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 29, 2012

RepositoryDefinition is immutable, you need to create new object with updated xml configuration.

Try this:

svnRepositoryInstance = (SvnRepository) repositoryDefinitionInstance.getRepository();
        svnRepositoryInstance.setUsername("myUsername");
        svnRepositoryInstance.setUserPassword("myPassword");
        
        RepositoryDefinition repositoryDefinitionWithNewData = new RepositoryDefinitionImpl(
                repositoryDefinition.getId(), 
                repositoryDefinition.getPluginKey(), 
                repositoryDefinition.getName(), 
                repositoryDefinition.getPosition(), 
                repositoryDefinition.getDescription(),
                RepositoryConfigHelper.prepareXmlConfigurationString(svnRepositoryInstance, 
                                                                     repositoryDefinition.getWebRepositoryViewer()),
                repositoryDefinition.isBuildTrigger(),
                repositoryDefinition.isMarkedForDeletion(), 
                repositoryDefinition.isGlobal());
        
        buildContext.getRepositoryDefinitionMap().put(repositoryDefinitionWithNewData.getId(), repositoryDefinitionWithNewData);

TAGS
AUG Leaders

Atlassian Community Events