com.atlassian.bamboo.repository
Class RepositoryConfigurationServiceImpl

java.lang.Object
  extended by com.atlassian.bamboo.repository.RepositoryConfigurationServiceImpl
All Implemented Interfaces:
RepositoryConfigurationService

public class RepositoryConfigurationServiceImpl
extends java.lang.Object
implements RepositoryConfigurationService


Constructor Summary
RepositoryConfigurationServiceImpl(PlanManager planManager, RepositoryManager repositoryManager, WebRepositoryViewerManager webRepositoryViewerManager, RepositoryDefinitionManager repositoryDefinitionManager, AuditLogService auditLogService, TaskConfigurationService taskConfigurationService, BuildDefinitionManager buildDefinitionManager, ChainBranchManager chainBranchManager, BranchDetectionService branchDetectionService, ScopedExclusionService scopedExclusionService, com.atlassian.event.api.EventPublisher eventPublisher, HibernateMutableAclService aclService)
           
 
Method Summary
 RepositoryDefinition attachGlobalRepositoryToPlan(Plan plan, long selectedGlobalRepositoryId, boolean buildTrigger)
          Creates relationship between global repository and a plan
 RepositoryData createGlobalRepository(java.lang.String repositoryName, java.lang.String pluginKey, java.lang.String webRepositoryKey, org.apache.commons.configuration.HierarchicalConfiguration configuration, boolean buildTrigger, com.atlassian.user.User user)
          Creates new global repository.
 org.acegisecurity.acls.MutableAcl createNewSharedRepositoryDefaultAcl(com.atlassian.user.User user, long repositoryId)
          Creates a defualt Acl for a specific repository which has: - ADMIN permissions for the creator (if applicable) - READ permission to logged in users
 RepositoryDefinition createRepository(Plan plan, java.lang.String repositoryName, java.lang.String pluginKey, java.lang.String webRepositoryKey, org.apache.commons.configuration.HierarchicalConfiguration configuration, boolean buildTrigger)
          Creates new repository and adds it to the plan configuration
 void deleteGlobalRepository(long repositoryId)
          Removes global repository
 void deleteRepository(Plan plan, long repositoryId)
          Removes repository definition for plan
 void deleteRepository(Plan plan, long repositoryId, long replacementReposiotryId)
          Removes repository definition for plan
 RepositoryData editGlobalRepository(java.lang.String repositoryName, java.lang.String pluginKey, java.lang.String webRepositoryKey, RepositoryData repositoryData, org.apache.commons.configuration.HierarchicalConfiguration configuration)
          Changes definition of a global repository.
 RepositoryDefinition editRepository(Plan plan, java.lang.String repositoryName, java.lang.String pluginKey, java.lang.String webRepositoryKey, RepositoryDefinition repositoryDefinition, org.apache.commons.configuration.HierarchicalConfiguration configuration)
          AOP advice cannot handle RepositoryDataEntity type so call to {@link RepositoryDefinitionManager#saveRepositoryDefinition(RepositoryDataEntity) will be unadvised.
protected  java.util.List<PlanRepositoryLink> getNewRepositoryList(java.util.List<PlanRepositoryLink> originalRepositories, PlanRepositoryLink toMove, long beforeId, long afterId)
           
 java.util.Map<Job,java.util.List<TaskDefinition>> getRelevantJobsForRepositoryIdChange(Plan plan, long repositoryId)
          Returns mapping between Job and TaskDefinition for tasks using repository by given repository id
 void moveRepository(PlanKey planKey, long repositoryId, long beforePosition, long afterPosition)
          Changes position of repository in the repository list.
 void shareRepository(Plan plan, RepositoryData repositoryData, java.lang.String repositoryName, java.lang.String userDescription, com.atlassian.user.User user)
          Converts existing Plan repository to Shared Repository.
 RepositoryDefinition toggleTriggerBuild(PlanKey planKey, long repositoryId)
          Changes flag indicating, if repository is taking part in change detection
 void updateTriggerBuild(Plan plan, java.util.Set<java.lang.Long> repositoryIds)
           
 boolean validateGlobalRepositoryName(java.lang.String name, RepositoryData repositoryData)
          Checks if name of global repository is unique.
 boolean validateRepositoryName(Plan plan, java.lang.String name, RepositoryDefinition repositoryDefinition)
          Checks if provided name for repository is unique in the Plan
 boolean validateRestartableStatus(ResultsSummary resultSummary)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryConfigurationServiceImpl

public RepositoryConfigurationServiceImpl(@NotNull
                                          PlanManager planManager,
                                          @NotNull
                                          RepositoryManager repositoryManager,
                                          @NotNull
                                          WebRepositoryViewerManager webRepositoryViewerManager,
                                          @NotNull
                                          RepositoryDefinitionManager repositoryDefinitionManager,
                                          @NotNull
                                          AuditLogService auditLogService,
                                          @NotNull
                                          TaskConfigurationService taskConfigurationService,
                                          @NotNull
                                          BuildDefinitionManager buildDefinitionManager,
                                          @NotNull
                                          ChainBranchManager chainBranchManager,
                                          @NotNull
                                          BranchDetectionService branchDetectionService,
                                          @NotNull
                                          ScopedExclusionService scopedExclusionService,
                                          @NotNull
                                          com.atlassian.event.api.EventPublisher eventPublisher,
                                          @NotNull
                                          HibernateMutableAclService aclService)
Method Detail

createRepository

public RepositoryDefinition createRepository(@NotNull
                                             Plan plan,
                                             @NotNull
                                             java.lang.String repositoryName,
                                             @NotNull
                                             java.lang.String pluginKey,
                                             @Nullable
                                             java.lang.String webRepositoryKey,
                                             @NotNull
                                             org.apache.commons.configuration.HierarchicalConfiguration configuration,
                                             boolean buildTrigger)
                                      throws java.lang.IllegalArgumentException
Description copied from interface: RepositoryConfigurationService
Creates new repository and adds it to the plan configuration

Specified by:
createRepository in interface RepositoryConfigurationService
repositoryName - repository name presented to the user, must be unique in plan
pluginKey - pluginKey of repository
webRepositoryKey - plugin key of web repository viewer
configuration - xml configuration of repository
buildTrigger - flag indicating if repository is taking part in change detection
Returns:
Throws:
java.lang.IllegalArgumentException

editRepository

public RepositoryDefinition editRepository(@NotNull
                                           Plan plan,
                                           @NotNull
                                           java.lang.String repositoryName,
                                           @NotNull
                                           java.lang.String pluginKey,
                                           @Nullable
                                           java.lang.String webRepositoryKey,
                                           @NotNull
                                           RepositoryDefinition repositoryDefinition,
                                           @NotNull
                                           org.apache.commons.configuration.HierarchicalConfiguration configuration)
                                    throws java.lang.IllegalArgumentException,
                                           java.lang.IllegalStateException
AOP advice cannot handle RepositoryDataEntity type so call to {@link RepositoryDefinitionManager#saveRepositoryDefinition(RepositoryDataEntity) will be unadvised. Therefore we need to add @PlanConfigurationModification annotation here

Specified by:
editRepository in interface RepositoryConfigurationService
repositoryName - repository name presented to the user, must be unique in plan
pluginKey - plugin key of repository or id of a global repository
webRepositoryKey - plugin key of web repository viewer
configuration - xml configuration of repository
Returns:
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

getRelevantJobsForRepositoryIdChange

public java.util.Map<Job,java.util.List<TaskDefinition>> getRelevantJobsForRepositoryIdChange(@NotNull
                                                                                              Plan plan,
                                                                                              long repositoryId)
Description copied from interface: RepositoryConfigurationService
Returns mapping between Job and TaskDefinition for tasks using repository by given repository id

Specified by:
getRelevantJobsForRepositoryIdChange in interface RepositoryConfigurationService
Returns:

shareRepository

public void shareRepository(@NotNull
                            Plan plan,
                            @NotNull
                            RepositoryData repositoryData,
                            @NotNull
                            java.lang.String repositoryName,
                            @Nullable
                            java.lang.String userDescription,
                            @NotNull
                            com.atlassian.user.User user)
Description copied from interface: RepositoryConfigurationService
Converts existing Plan repository to Shared Repository.

Specified by:
shareRepository in interface RepositoryConfigurationService
Parameters:
plan - plan that owns the repository
repositoryData - repository to share
repositoryName - new name of the repository
userDescription - of the repository

editGlobalRepository

public RepositoryData editGlobalRepository(@NotNull
                                           java.lang.String repositoryName,
                                           @NotNull
                                           java.lang.String pluginKey,
                                           @Nullable
                                           java.lang.String webRepositoryKey,
                                           @NotNull
                                           RepositoryData repositoryData,
                                           @NotNull
                                           org.apache.commons.configuration.HierarchicalConfiguration configuration)
                                    throws java.lang.IllegalArgumentException,
                                           java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Changes definition of a global repository.

Specified by:
editGlobalRepository in interface RepositoryConfigurationService
Returns:
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

createGlobalRepository

public RepositoryData createGlobalRepository(@NotNull
                                             java.lang.String repositoryName,
                                             @NotNull
                                             java.lang.String pluginKey,
                                             @Nullable
                                             java.lang.String webRepositoryKey,
                                             @NotNull
                                             org.apache.commons.configuration.HierarchicalConfiguration configuration,
                                             boolean buildTrigger,
                                             @NotNull
                                             com.atlassian.user.User user)
                                      throws java.lang.IllegalArgumentException
Description copied from interface: RepositoryConfigurationService
Creates new global repository.

Specified by:
createGlobalRepository in interface RepositoryConfigurationService
Returns:
Throws:
java.lang.IllegalArgumentException

attachGlobalRepositoryToPlan

public RepositoryDefinition attachGlobalRepositoryToPlan(Plan plan,
                                                         long selectedGlobalRepositoryId,
                                                         boolean buildTrigger)
Description copied from interface: RepositoryConfigurationService
Creates relationship between global repository and a plan

Specified by:
attachGlobalRepositoryToPlan in interface RepositoryConfigurationService
Returns:

deleteGlobalRepository

public void deleteGlobalRepository(long repositoryId)
                            throws java.lang.IllegalArgumentException,
                                   java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Removes global repository

Specified by:
deleteGlobalRepository in interface RepositoryConfigurationService
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

toggleTriggerBuild

public RepositoryDefinition toggleTriggerBuild(@NotNull
                                               PlanKey planKey,
                                               long repositoryId)
                                        throws java.lang.IllegalArgumentException,
                                               java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Changes flag indicating, if repository is taking part in change detection

Specified by:
toggleTriggerBuild in interface RepositoryConfigurationService
Returns:
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

updateTriggerBuild

public void updateTriggerBuild(@NotNull
                               Plan plan,
                               java.util.Set<java.lang.Long> repositoryIds)
                        throws java.lang.IllegalArgumentException,
                               java.lang.IllegalStateException
Specified by:
updateTriggerBuild in interface RepositoryConfigurationService
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

deleteRepository

public void deleteRepository(@NotNull
                             Plan plan,
                             long repositoryId)
                      throws java.lang.IllegalArgumentException,
                             java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Removes repository definition for plan

Specified by:
deleteRepository in interface RepositoryConfigurationService
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

deleteRepository

public void deleteRepository(@NotNull
                             Plan plan,
                             long repositoryId,
                             long replacementReposiotryId)
                      throws java.lang.IllegalArgumentException,
                             java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Removes repository definition for plan

Specified by:
deleteRepository in interface RepositoryConfigurationService
replacementReposiotryId - repository id to replace removed one in tasks depending on it
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

moveRepository

public void moveRepository(@NotNull
                           PlanKey planKey,
                           long repositoryId,
                           long beforePosition,
                           long afterPosition)
                    throws java.lang.IllegalArgumentException,
                           java.lang.IllegalStateException
Description copied from interface: RepositoryConfigurationService
Changes position of repository in the repository list. Important for setting default repository

Specified by:
moveRepository in interface RepositoryConfigurationService
repositoryId - the RepositoryDefinition to move
beforePosition - position of the RepositoryDefinition that will be before the moving Repository, -1 if the beginning of the list
afterPosition - position of the RepositoryDefinition that will be after the moving Repository, -1 if the end of the list
Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException

validateRepositoryName

public boolean validateRepositoryName(@NotNull
                                      Plan plan,
                                      @NotNull
                                      java.lang.String name,
                                      @Nullable
                                      RepositoryDefinition repositoryDefinition)
Description copied from interface: RepositoryConfigurationService
Checks if provided name for repository is unique in the Plan

Specified by:
validateRepositoryName in interface RepositoryConfigurationService
name - new name for repository
repositoryDefinition - existing repository definition being edited on null when repository is created
Returns:
true if name is unique or false when name already exists for other repository for the same plan

validateGlobalRepositoryName

public boolean validateGlobalRepositoryName(@NotNull
                                            java.lang.String name,
                                            @Nullable
                                            RepositoryData repositoryData)
Description copied from interface: RepositoryConfigurationService
Checks if name of global repository is unique.

Specified by:
validateGlobalRepositoryName in interface RepositoryConfigurationService
Returns:

validateRestartableStatus

public boolean validateRestartableStatus(@NotNull
                                         ResultsSummary resultSummary)
Specified by:
validateRestartableStatus in interface RepositoryConfigurationService

getNewRepositoryList

@NotNull
protected java.util.List<PlanRepositoryLink> getNewRepositoryList(@NotNull
                                                                          java.util.List<PlanRepositoryLink> originalRepositories,
                                                                          @NotNull
                                                                          PlanRepositoryLink toMove,
                                                                          long beforeId,
                                                                          long afterId)

createNewSharedRepositoryDefaultAcl

public org.acegisecurity.acls.MutableAcl createNewSharedRepositoryDefaultAcl(@NotNull
                                                                             com.atlassian.user.User user,
                                                                             long repositoryId)
Creates a defualt Acl for a specific repository which has: - ADMIN permissions for the creator (if applicable) - READ permission to logged in users

Parameters:
user - to create acl for
Returns:
MutableAcl representing a default permission set


Copyright © 2012 Atlassian. All Rights Reserved.