com.atlassian.bamboo.chains
Class ChainExecutionManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.chains.ChainExecutionManagerImpl
All Implemented Interfaces:
ChainExecutionManager, org.springframework.beans.factory.InitializingBean

public class ChainExecutionManagerImpl
extends java.lang.Object
implements ChainExecutionManager, org.springframework.beans.factory.InitializingBean

This class is registered as event listener afterPropertiesSet()


Constructor Summary
ChainExecutionManagerImpl(PlanStatePersisterService planStatePersisterService, JobExecutionManager buildContextExecutor, ChainResultManager chainResultManager, ChainStateFactory chainStateFactory, BuildContextFactory buildContextFactory, com.atlassian.event.api.EventPublisher eventPublisher, ChainPluginSupport chainPluginSupport, ErrorUpdateHandler errorUpdateHandler, AuthorCreatorService authorCreatorService, ResultsSummaryManager resultsSummaryManager, BuildNumberGeneratorService buildNumberGeneratorService, BuildDirectoryManager buildDirectoryManager, BranchIntegrationHelper branchIntegrationHelper, CustomVariableContext customVariableContext, PlanExecutionLockService planExecutionLockService, PlanVcsRevisionHistoryService planVcsRevisionHistoryService)
           
 
Method Summary
 void afterPropertiesSet()
           
 ChainStateCreationRequestResult createChainStateNoDetection(ImmutableChain chain, UnconditionalBuildDetectionAction buildDetectionAction)
          Create a chain state ready for building but dont actually build.
 ChainExecutionRequestResult delayedStart(ImmutableChain chain, UnconditionalBuildDetectionAction buildDetectionAction, ChainState chainState)
          Starts the Chain if it's been created already
 ChainExecution getChainExecution(PlanResultKey planResultKey)
          Get the state of the single ChainExecution
 java.util.List<ChainExecution> getExecutingChains(PlanKey planKey)
          Get the Collection of the state of the ChainExecution or empty collection when no chain is executing
 BuildExecution getJobExecution(PlanResultKey planResultKey)
          Get the state of a single Job being executed
 boolean isActive(PlanKey planKey)
          Checks if the Chain is "active" ie being queued, or building
 boolean isExecuting(PlanKey planKey)
          Checks if the Chain is building
 boolean isExecuting(PlanResultKey planResultKey)
          Checks of BuildResultsSummary represented by PlanResultKey is currently building (ie started on an agent_
 int numberOfChainsExecuting()
           
 int numberOfChainsExecuting(PlanKey planKey)
          Determines the number of ChainExecutions are active for the given PlanKey
 void onBuildFinished(BuildFinishedEvent buildFinishedEvent)
           
 void onExecutionStartedTimingPoint(BuildTimingPoints.ExecutionStarted event)
           
 void onVcsSyncStartedTimingPoint(BuildTimingPoints.VcsSyncStarted event)
           
 ChainExecutionRequestResult start(ImmutableChain chain, ConditionalBuildDetectionAction buildDetectionAction)
          Starts the Chain
 void stop(PlanKey planKey)
          Stops all executing instances of the Chain represented by PlanKey
 void stop(PlanResultKey planResultKey)
          Stops the executing instance of the Chain represented by PlanResultKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChainExecutionManagerImpl

public ChainExecutionManagerImpl(PlanStatePersisterService planStatePersisterService,
                                 JobExecutionManager buildContextExecutor,
                                 ChainResultManager chainResultManager,
                                 ChainStateFactory chainStateFactory,
                                 BuildContextFactory buildContextFactory,
                                 com.atlassian.event.api.EventPublisher eventPublisher,
                                 ChainPluginSupport chainPluginSupport,
                                 ErrorUpdateHandler errorUpdateHandler,
                                 AuthorCreatorService authorCreatorService,
                                 ResultsSummaryManager resultsSummaryManager,
                                 BuildNumberGeneratorService buildNumberGeneratorService,
                                 BuildDirectoryManager buildDirectoryManager,
                                 BranchIntegrationHelper branchIntegrationHelper,
                                 CustomVariableContext customVariableContext,
                                 PlanExecutionLockService planExecutionLockService,
                                 PlanVcsRevisionHistoryService planVcsRevisionHistoryService)
Method Detail

start

@NotNull
public ChainExecutionRequestResult start(@NotNull
                                                 ImmutableChain chain,
                                                 @NotNull
                                                 ConditionalBuildDetectionAction buildDetectionAction)
Description copied from interface: ChainExecutionManager
Starts the Chain

Specified by:
start in interface ChainExecutionManager
Returns:
success or null if chain execution has not been started

delayedStart

@NotNull
public ChainExecutionRequestResult delayedStart(@NotNull
                                                        ImmutableChain chain,
                                                        @NotNull
                                                        UnconditionalBuildDetectionAction buildDetectionAction,
                                                        @NotNull
                                                        ChainState chainState)
Description copied from interface: ChainExecutionManager
Starts the Chain if it's been created already

Specified by:
delayedStart in interface ChainExecutionManager
chainState - if already created
Returns:
success or null if chain execution has not been started

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

onVcsSyncStartedTimingPoint

@EventListener
public void onVcsSyncStartedTimingPoint(@NotNull
                                                      BuildTimingPoints.VcsSyncStarted event)

onExecutionStartedTimingPoint

@EventListener
public void onExecutionStartedTimingPoint(@NotNull
                                                        BuildTimingPoints.ExecutionStarted event)

onBuildFinished

@EventListener
@HibernateEventListenerAspect
public void onBuildFinished(BuildFinishedEvent buildFinishedEvent)

createChainStateNoDetection

@NotNull
public ChainStateCreationRequestResult createChainStateNoDetection(@NotNull
                                                                           ImmutableChain chain,
                                                                           @NotNull
                                                                           UnconditionalBuildDetectionAction buildDetectionAction)
Description copied from interface: ChainExecutionManager
Create a chain state ready for building but dont actually build.

Specified by:
createChainStateNoDetection in interface ChainExecutionManager
Returns:

stop

public void stop(@NotNull
                 PlanResultKey planResultKey)
Description copied from interface: ChainExecutionManager
Stops the executing instance of the Chain represented by PlanResultKey

Specified by:
stop in interface ChainExecutionManager

stop

public void stop(@NotNull
                 PlanKey planKey)
Description copied from interface: ChainExecutionManager
Stops all executing instances of the Chain represented by PlanKey

Specified by:
stop in interface ChainExecutionManager

isActive

public boolean isActive(@NotNull
                        PlanKey planKey)
Description copied from interface: ChainExecutionManager
Checks if the Chain is "active" ie being queued, or building

Specified by:
isActive in interface ChainExecutionManager
Returns:
active

isExecuting

public boolean isExecuting(@NotNull
                           PlanKey planKey)
Description copied from interface: ChainExecutionManager
Checks if the Chain is building

Specified by:
isExecuting in interface ChainExecutionManager
Returns:
running

isExecuting

public boolean isExecuting(@NotNull
                           PlanResultKey planResultKey)
Description copied from interface: ChainExecutionManager
Checks of BuildResultsSummary represented by PlanResultKey is currently building (ie started on an agent_

Specified by:
isExecuting in interface ChainExecutionManager
Returns:
executing

getExecutingChains

@NotNull
public java.util.List<ChainExecution> getExecutingChains(@NotNull
                                                                 PlanKey planKey)
Description copied from interface: ChainExecutionManager
Get the Collection of the state of the ChainExecution or empty collection when no chain is executing

Specified by:
getExecutingChains in interface ChainExecutionManager
Returns:
chainExecution

getChainExecution

@Nullable
public ChainExecution getChainExecution(@NotNull
                                                 PlanResultKey planResultKey)
Description copied from interface: ChainExecutionManager
Get the state of the single ChainExecution

Specified by:
getChainExecution in interface ChainExecutionManager
Returns:

getJobExecution

@Nullable
public BuildExecution getJobExecution(@NotNull
                                               PlanResultKey planResultKey)
Description copied from interface: ChainExecutionManager
Get the state of a single Job being executed

Specified by:
getJobExecution in interface ChainExecutionManager
Returns:

numberOfChainsExecuting

public int numberOfChainsExecuting(@NotNull
                                   PlanKey planKey)
Description copied from interface: ChainExecutionManager
Determines the number of ChainExecutions are active for the given PlanKey

Specified by:
numberOfChainsExecuting in interface ChainExecutionManager
Returns:

numberOfChainsExecuting

public int numberOfChainsExecuting()
Specified by:
numberOfChainsExecuting in interface ChainExecutionManager


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.