com.atlassian.bamboo.plan
Class PlanExecutionManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.plan.PlanExecutionManagerImpl
All Implemented Interfaces:
ExecutionStatusProvider, PlanExecutionManager

public class PlanExecutionManagerImpl
extends java.lang.Object
implements PlanExecutionManager


Constructor Summary
PlanExecutionManagerImpl(BuildExecutionManager buildExecutionManager, ChainExecutionManager chainExecutionManager, BuildDetectionActionFactory buildDetectionActionFactory, PlanExecutionPermitter planExecutionPermitter, ExecutionStatusProvider executionStatusProvider, PlanManager planManager, StopBuildManager stopBuildManager)
           
 
Method Summary
 java.util.List<CurrentlyBuilding> getCurrentlyBuildingForPlan(PlanKey planKey)
          Returns all for specified PlanKey In case plan is a Chain instance, all currently running jobs will be returned
 java.util.List<CurrentlyBuilding> getCurrentlyBuildingForPlanResult(PlanResultKey planResultKey)
          Returns all CurrentlyBuilding for specified PlanResultKey In case plan is a Chain instance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectively CurrentlyBuilding for all chain's children jobs will be returned)
 java.util.Collection<? extends ExecutionStatus> getExecutionStatus(PlanKey planKey)
          Returns a collection of current ExecutionStatuss for PlanKey
 ExecutionStatus getExecutionStatus(PlanResultKey planResultKey)
          Returns a ExecutionStatus for the given PlanResultKey
 BuildExecution getJobExecution(PlanResultKey planResultKey)
          Get the state of a single Job being executed
 boolean isBuildingAllowed(Plan plan)
          Checks if a particular build is allowed to be built.
 boolean isBusy(PlanKey planKey)
          Tests if the Plan represented by PlanKey is busy starting
 int numberOfExecutions(PlanKey planKey)
          Returns the number of current ExecutionStatuss available for PlanKey
 ExecutionRequestResult start(Plan plan, BuildDetectionAction buildDetectionAction, AcquisitionPolicy acquisitionPolicy)
          Execute the Plan with the provided BuildDetectionAction and AcquisitionPolicy Calls to this method will acquire a lock according to the AcquisitionPolicy on a per Plan granularity
 ExecutionRequestResult startManualExecution(Plan plan, com.atlassian.user.User user)
          Attempts to start a manual execution of the given Plan
 ExecutionRequestResult startManualExecution(Plan plan, com.atlassian.user.User user, java.util.Map<java.lang.String,java.lang.String> params)
          Attempts to start a manual execution of the given Plan
 void stopPlan(PlanKey planKey, boolean abandonResult, java.lang.String userName)
           
 void stopPlan(PlanResultKey planResultKey, boolean abandonResult, java.lang.String userName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlanExecutionManagerImpl

public PlanExecutionManagerImpl(BuildExecutionManager buildExecutionManager,
                                ChainExecutionManager chainExecutionManager,
                                BuildDetectionActionFactory buildDetectionActionFactory,
                                PlanExecutionPermitter planExecutionPermitter,
                                ExecutionStatusProvider executionStatusProvider,
                                PlanManager planManager,
                                StopBuildManager stopBuildManager)
Method Detail

numberOfExecutions

public int numberOfExecutions(@NotNull
                              PlanKey planKey)
Description copied from interface: ExecutionStatusProvider
Returns the number of current ExecutionStatuss available for PlanKey

Specified by:
numberOfExecutions in interface ExecutionStatusProvider
Returns:
noOfExecutions

getExecutionStatus

@NotNull
public java.util.Collection<? extends ExecutionStatus> getExecutionStatus(@NotNull
                                                                                  PlanKey planKey)
Description copied from interface: ExecutionStatusProvider
Returns a collection of current ExecutionStatuss for PlanKey

Specified by:
getExecutionStatus in interface ExecutionStatusProvider
Returns:
executionStatuses

getExecutionStatus

@Nullable
public ExecutionStatus getExecutionStatus(@NotNull
                                                   PlanResultKey planResultKey)
Description copied from interface: ExecutionStatusProvider
Returns a ExecutionStatus for the given PlanResultKey

Specified by:
getExecutionStatus in interface ExecutionStatusProvider
Returns:
executionStatus

getJobExecution

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

Specified by:
getJobExecution in interface ExecutionStatusProvider
Returns:

startManualExecution

@NotNull
public ExecutionRequestResult startManualExecution(@NotNull
                                                           Plan plan,
                                                           @NotNull
                                                           com.atlassian.user.User user)
Description copied from interface: PlanExecutionManager
Attempts to start a manual execution of the given Plan

Specified by:
startManualExecution in interface PlanExecutionManager
Returns:
executionRequestResult

startManualExecution

@NotNull
public ExecutionRequestResult startManualExecution(@NotNull
                                                           Plan plan,
                                                           @NotNull
                                                           com.atlassian.user.User user,
                                                           @NotNull
                                                           java.util.Map<java.lang.String,java.lang.String> params)
Description copied from interface: PlanExecutionManager
Attempts to start a manual execution of the given Plan

Specified by:
startManualExecution in interface PlanExecutionManager
Returns:
executionRequestResult

isBusy

public boolean isBusy(@NotNull
                      PlanKey planKey)
Description copied from interface: PlanExecutionManager
Tests if the Plan represented by PlanKey is busy starting

Specified by:
isBusy in interface PlanExecutionManager
Returns:
busy

start

@NotNull
public ExecutionRequestResult start(@NotNull
                                            Plan plan,
                                            @NotNull
                                            BuildDetectionAction buildDetectionAction,
                                            @NotNull
                                            AcquisitionPolicy acquisitionPolicy)
Description copied from interface: PlanExecutionManager
Execute the Plan with the provided BuildDetectionAction and AcquisitionPolicy Calls to this method will acquire a lock according to the AcquisitionPolicy on a per Plan granularity

Specified by:
start in interface PlanExecutionManager
Returns:
planExecutionResult

isBuildingAllowed

public boolean isBuildingAllowed(@NotNull
                                 Plan plan)
Description copied from interface: PlanExecutionManager
Checks if a particular build is allowed to be built. It checks if it exists, not suspened, and that there is no global flag that has stopped building

Specified by:
isBuildingAllowed in interface PlanExecutionManager
Returns:
true if plan is allowed to be built

getCurrentlyBuildingForPlan

@NotNull
public java.util.List<CurrentlyBuilding> getCurrentlyBuildingForPlan(PlanKey planKey)
Description copied from interface: PlanExecutionManager
Returns all for specified PlanKey In case plan is a Chain instance, all currently running jobs will be returned

Specified by:
getCurrentlyBuildingForPlan in interface PlanExecutionManager
Returns:

getCurrentlyBuildingForPlanResult

@NotNull
public java.util.List<CurrentlyBuilding> getCurrentlyBuildingForPlanResult(PlanResultKey planResultKey)
Description copied from interface: PlanExecutionManager
Returns all CurrentlyBuilding for specified PlanResultKey In case plan is a Chain instance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectively CurrentlyBuilding for all chain's children jobs will be returned)

Specified by:
getCurrentlyBuildingForPlanResult in interface PlanExecutionManager
Returns:

stopPlan

public void stopPlan(@NotNull
                     PlanResultKey planResultKey,
                     boolean abandonResult,
                     java.lang.String userName)
Specified by:
stopPlan in interface PlanExecutionManager

stopPlan

public void stopPlan(@NotNull
                     PlanKey planKey,
                     boolean abandonResult,
                     java.lang.String userName)
              throws java.lang.InterruptedException
Specified by:
stopPlan in interface PlanExecutionManager
Throws:
java.lang.InterruptedException


Copyright © 2011 Atlassian. All Rights Reserved.