Class BuildPromotionManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BuildPromotionManagerImpl
-
- All Implemented Interfaces:
BuildPromotionFactory,BuildPromotionManager,BuildPromotionManagerEx
public class BuildPromotionManagerImpl extends Object implements BuildPromotionManagerEx
- Author:
- Pavel.Sher Date: 21.05.2008
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classBuildPromotionManagerImpl.TemplateDummyBuildPromotion-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.BuildPromotionManager
BuildPromotionManager.BuildPromotionInitFromDbHint
-
-
Field Summary
Fields Modifier and Type Field Description static intFINISHED_PROMOTION_EXPIRATION_COUNTERstatic StringPROMOTIONS_CACHE_EXPIRATION_CHECK_THRESHOLD
-
Constructor Summary
Constructors Constructor Description BuildPromotionManagerImpl(EventDispatcher<BuildPromotionListener> buildPromotionListenerEventDispatcher, ServerResponsibility serverResponsibility, ExecutorServices executorServices)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuildsRemoved(String buildTypeId, BuildTypeRemovedBuilds predicate)voidclearCachedPromotions()DummyBuildPromotioncreateDummyPromotion(String branchName, BuildTypeEx buildType)Creates dummy (not real) build promotion, a build won't be able to start with this promotionDummyBuildPromotioncreateDummyPromotion(BuildTypeTemplateEx template)Creates dummy (not real) build promotion, a build won't be able to start with this promotionBuildPromotionExcreateNewPromotion(SBuildType buildType)Creates new promotion for specified build configurationBuildPromotionExfindCached(long promotionId)Collection<BuildPromotionEx>findCached(Collection<Long> ids)BuildPromotionExfindPromotionById(long promoId)Searches for a promotion with specified id.BuildPromotionfindPromotionOrReplacement(long origPromotionId)The method will return the original build promotion if it was not deleted by the queue optimization process.Collection<BuildPromotion>findPromotionsByIds(Collection<Long> promoIds, BuildPromotionManager.BuildPromotionInitFromDbHint... initHints)Accepts collection of promotion ids and returns corresponding objects.BuildPromotionContextgetContext()EventDispatcher<BuildPromotionListener>getDispatcher()LonggetLastBorrowedModificationId(SBuildType buildType, boolean ignoreCanceledAndNotStarted)Returns max modification id associated with last created promotion in the specified build configuration.LonggetMaxUsedModificationId(SBuildType buildType, String branch)Returns max modification id associated with last created promotion in the specified build configuration in the given branch.BuildPromotionExgetPromotionById(long promotionId)Searches for a promotion with specified id.intgetSize()voidpromotionDeleted(BuildPromotionEx promo)voidpromotionPersisted(BuildPromotionEx promotion)voidresetChanges(Collection<SProject> projects)Resets changes in promotions from specified projectsvoidrunCachedItemsExpirationCheck()voidsetContext(BuildPromotionContext context)voidsetEventDispatcher(EventDispatcher<BuildServerListener> eventDispatcher)voidsetSqlRunner(SQLRunnerEx sqlRunner)voidtraverseCachedBuildTypePromotions(Set<String> buildTypeIds, ItemProcessor<BuildPromotionEx> processor)
-
-
-
Field Detail
-
FINISHED_PROMOTION_EXPIRATION_COUNTER
public static final int FINISHED_PROMOTION_EXPIRATION_COUNTER
- See Also:
- Constant Field Values
-
PROMOTIONS_CACHE_EXPIRATION_CHECK_THRESHOLD
public static final String PROMOTIONS_CACHE_EXPIRATION_CHECK_THRESHOLD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BuildPromotionManagerImpl
public BuildPromotionManagerImpl(@NotNull EventDispatcher<BuildPromotionListener> buildPromotionListenerEventDispatcher, @NotNull ServerResponsibility serverResponsibility, @NotNull ExecutorServices executorServices)
-
-
Method Detail
-
getContext
@NotNull public BuildPromotionContext getContext()
-
setContext
public void setContext(@NotNull BuildPromotionContext context)
-
setSqlRunner
public void setSqlRunner(@NotNull SQLRunnerEx sqlRunner)
-
setEventDispatcher
public void setEventDispatcher(@NotNull EventDispatcher<BuildServerListener> eventDispatcher)
-
getSize
public int getSize()
-
traverseCachedBuildTypePromotions
public void traverseCachedBuildTypePromotions(@NotNull Set<String> buildTypeIds, @NotNull ItemProcessor<BuildPromotionEx> processor)
-
createNewPromotion
@NotNull public BuildPromotionEx createNewPromotion(@NotNull SBuildType buildType)
Description copied from interface:BuildPromotionFactoryCreates new promotion for specified build configuration- Specified by:
createNewPromotionin interfaceBuildPromotionFactory- Parameters:
buildType- build configuration (for personal promotion - RemoteBuildType)- Returns:
- newly created build promotion
-
createDummyPromotion
@NotNull public DummyBuildPromotion createDummyPromotion(@NotNull String branchName, @NotNull BuildTypeEx buildType)
Description copied from interface:BuildPromotionFactoryCreates dummy (not real) build promotion, a build won't be able to start with this promotion- Specified by:
createDummyPromotionin interfaceBuildPromotionFactorybuildType- build configuration- Returns:
- see above
-
createDummyPromotion
@NotNull public DummyBuildPromotion createDummyPromotion(@NotNull BuildTypeTemplateEx template)
Description copied from interface:BuildPromotionFactoryCreates dummy (not real) build promotion, a build won't be able to start with this promotion- Specified by:
createDummyPromotionin interfaceBuildPromotionFactory- Parameters:
template- build configuration template for which promotion is created- Returns:
- see above
-
getDispatcher
@NotNull public EventDispatcher<BuildPromotionListener> getDispatcher()
- Specified by:
getDispatcherin interfaceBuildPromotionManager
-
getPromotionById
@NotNull public BuildPromotionEx getPromotionById(long promotionId) throws InvalidBuildPromotionException
Description copied from interface:BuildPromotionManagerSearches for a promotion with specified id.- Specified by:
getPromotionByIdin interfaceBuildPromotionManager- Parameters:
promotionId- id of promotion- Returns:
- loaded promotion
- Throws:
InvalidBuildPromotionException- if promotion with specified id does not exist or is invalid
-
findCached
@Nullable public BuildPromotionEx findCached(long promotionId)
- Specified by:
findCachedin interfaceBuildPromotionManagerEx
-
findCached
@NotNull public Collection<BuildPromotionEx> findCached(@NotNull Collection<Long> ids)
- Specified by:
findCachedin interfaceBuildPromotionManagerEx
-
getLastBorrowedModificationId
@Nullable public Long getLastBorrowedModificationId(@NotNull SBuildType buildType, boolean ignoreCanceledAndNotStarted)
Description copied from interface:BuildPromotionManagerReturns max modification id associated with last created promotion in the specified build configuration.- Specified by:
getLastBorrowedModificationIdin interfaceBuildPromotionManager- Parameters:
buildType- build configuration (personal build configurations are accepted too)ignoreCanceledAndNotStarted- if true then cancelled and not yet started promotions are excluded- Returns:
- see above
-
getMaxUsedModificationId
@Nullable public Long getMaxUsedModificationId(@NotNull SBuildType buildType, @NotNull String branch)
Description copied from interface:BuildPromotionManagerReturns max modification id associated with last created promotion in the specified build configuration in the given branch.- Specified by:
getMaxUsedModificationIdin interfaceBuildPromotionManager- Parameters:
buildType- build type of interest (personal build configurations are accepted too)branch- branch of interest, empty branch means default- Returns:
- see above
-
findPromotionById
@Nullable public BuildPromotionEx findPromotionById(long promoId)
Description copied from interface:BuildPromotionManagerExSearches for a promotion with specified id. Similar toBuildPromotionManager.getPromotionById(long)but does not throw exception if promotion with specified id does not exist.- Specified by:
findPromotionByIdin interfaceBuildPromotionManager- Specified by:
findPromotionByIdin interfaceBuildPromotionManagerEx- Parameters:
promoId- id of the promotion- Returns:
- see above
-
findPromotionOrReplacement
@Nullable public BuildPromotion findPromotionOrReplacement(long origPromotionId)
Description copied from interface:BuildPromotionManagerThe method will return the original build promotion if it was not deleted by the queue optimization process. If this is the case, then the method will try to locate a replacement and return the replacement instead.- Specified by:
findPromotionOrReplacementin interfaceBuildPromotionManager- Parameters:
origPromotionId- id of original promotion- Returns:
- replacement promotion if original promotion was replaced and marked as deleted, or original promotion if it exists.
-
findPromotionsByIds
@NotNull public Collection<BuildPromotion> findPromotionsByIds(@NotNull Collection<Long> promoIds, BuildPromotionManager.BuildPromotionInitFromDbHint... initHints)
Description copied from interface:BuildPromotionManagerAccepts collection of promotion ids and returns corresponding objects. Order of returned objects may not be the same as order of ids passed as argument.- Specified by:
findPromotionsByIdsin interfaceBuildPromotionManager- Parameters:
promoIds- ids of promotionsinitHints- if promotion is not in cache and is loaded from the database, these hints specify what information should be prefetched from the DB- Returns:
- found build promotions
-
promotionPersisted
public void promotionPersisted(@NotNull BuildPromotionEx promotion)- Specified by:
promotionPersistedin interfaceBuildPromotionManagerEx
-
promotionDeleted
public void promotionDeleted(@NotNull BuildPromotionEx promo)- Specified by:
promotionDeletedin interfaceBuildPromotionManagerEx
-
buildsRemoved
public void buildsRemoved(@NotNull String buildTypeId, @NotNull BuildTypeRemovedBuilds predicate)- Specified by:
buildsRemovedin interfaceBuildPromotionManagerEx
-
resetChanges
public void resetChanges(@NotNull Collection<SProject> projects)Description copied from interface:BuildPromotionManagerExResets changes in promotions from specified projects- Specified by:
resetChangesin interfaceBuildPromotionManagerEx- Parameters:
projects- projects for changes reset
-
runCachedItemsExpirationCheck
public void runCachedItemsExpirationCheck()
-
clearCachedPromotions
public void clearCachedPromotions()
-
-