Package com.atlassian.bamboo.plan
Class DelegatingPlanExecutionManager
- java.lang.Object
-
- com.atlassian.bamboo.plan.DelegatingPlanExecutionManager
-
- All Implemented Interfaces:
ExecutionStatusProvider
,PlanExecutionManager
public class DelegatingPlanExecutionManager extends Object implements PlanExecutionManager
-
-
Constructor Summary
Constructors Constructor Description DelegatingPlanExecutionManager(@NotNull PlanExecutionManager target, @NotNull com.atlassian.bamboo.plan.PlanExecutionManagerCallWatcher planExecutionManagerCallWatcher)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull List<CurrentlyBuilding>
getCurrentlyBuildingForPlan(PlanKey planKey)
@NotNull List<CurrentlyBuilding>
getCurrentlyBuildingForPlanResult(PlanResultKey planKey)
Returns allCurrentlyBuilding
for specifiedPlanResultKey
In case plan is aChain
instance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectivelyCurrentlyBuilding
for all chain's children jobs will be returned)@NotNull Collection<? extends ExecutionStatus>
getExecutionStatus(@NotNull PlanKey planKey)
Returns a collection of currentExecutionStatus
s forPlanKey
@Nullable ExecutionStatus
getExecutionStatus(@NotNull PlanResultKey planResultKey)
Returns aExecutionStatus
for the givenPlanResultKey
@Nullable BuildExecution
getJobExecution(@NotNull PlanResultKey planResultKey)
Get the state of a single Job being executedboolean
isBuildingAllowed(@NotNull ImmutableChain chain)
Checks if a particular build is allowed to be built.boolean
isBusy()
boolean
isBusy(@NotNull PlanKey planKey)
int
numberOfExecutions(@NotNull PlanKey planKey)
Returns the number of currentExecutionStatus
s available forPlanKey
Future<Boolean>
shutdown()
@NotNull ExecutionRequestResult
start(@NotNull ImmutableChain chain, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy)
@NotNull ExecutionRequestResult
start(@NotNull ImmutableChain chain, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy, PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions)
@NotNull ExecutionRequestResult
start(@NotNull ImmutableChain chain, @Nullable PlanExecutionConfig planExecutionConfig, @NotNull String triggerReasonPluginKey, @NotNull String planTriggerPluginKey, @NotNull Map<String,String> params, @NotNull Map<String,String> variables, @NotNull AcquisitionPolicy acquisitionPolicy)
@NotNull ExecutionRequestResult
start(@NotNull Triggerable triggerable, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy)
@NotNull ExecutionRequestResult
start(@NotNull Triggerable triggerable, @NotNull BuildDetectionAction buildDetectionAction, @NotNull AcquisitionPolicy acquisitionPolicy, PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions)
@NotNull ExecutionRequestResult
startManualExecution(@NotNull ImmutableChain chain, @NotNull com.atlassian.user.User user, @NotNull Map<String,String> params, @NotNull Map<String,String> variables)
Attempts to start a manual execution of the givenPlan
@NotNull ExecutionRequestResult
startManualExecution(@NotNull ImmutableChain chain, PlanExecutionConfig planExecutionConfig, @NotNull com.atlassian.user.User user, @NotNull String triggerReasonPluginKey, @NotNull String planTriggerPluginKey, @NotNull Map<String,String> params, @NotNull Map<String,String> variables)
Attempts to start a manual execution of a givenPlan
controlled byPlanExecutionConfig
PlanExecutionConfig
allows to control manual stages execution as well as enforcing execution of manual stages@NotNull ExecutionRequestResult
startManualExecution(@NotNull ImmutableChain chain, PlanExecutionConfig planExecutionConfig, @NotNull com.atlassian.user.User user, @NotNull Map<String,String> params, @NotNull Map<String,String> variables)
Attempts to start a manual execution of a givenPlan
controlled byPlanExecutionConfig
PlanExecutionConfig
allows to control manual stages execution as well as enforcing execution of manual stagesvoid
stopPlan(@NotNull PlanKey planKey, boolean abandonResult, String userName)
void
stopPlan(@NotNull PlanResultKey planResultKey, boolean abandonResult, String userName)
void
stopRequest(@NotNull PlanKey planKey)
Stops a build requests for the givenPlanKey
-
-
-
Constructor Detail
-
DelegatingPlanExecutionManager
public DelegatingPlanExecutionManager(@NotNull @NotNull PlanExecutionManager target, @NotNull @NotNull com.atlassian.bamboo.plan.PlanExecutionManagerCallWatcher planExecutionManagerCallWatcher)
-
-
Method Detail
-
isBusy
public boolean isBusy()
- Specified by:
isBusy
in interfacePlanExecutionManager
- Returns:
- if the server is busy building
-
isBusy
public boolean isBusy(@NotNull @NotNull PlanKey planKey)
Description copied from interface:PlanExecutionManager
- Specified by:
isBusy
in interfacePlanExecutionManager
- Returns:
- busy
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy)
Description copied from interface:PlanExecutionManager
Execute theImmutableChain
with the providedBuildDetectionAction
andAcquisitionPolicy
Calls to this method will acquire a lock according to the
AcquisitionPolicy
on a perPlan
granularity- Specified by:
start
in interfacePlanExecutionManager
- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions)
Description copied from interface:PlanExecutionManager
Execute theImmutableChain
with the providedBuildDetectionAction
andAcquisitionPolicy
Calls to this method will acquire a lock according to the
AcquisitionPolicy
on a perPlan
granularity- Specified by:
start
in interfacePlanExecutionManager
releaseLocksActions
- actions used for releasing repositories caches locks- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy)
Description copied from interface:PlanExecutionManager
Execute theTriggerable
with the providedBuildDetectionAction
andAcquisitionPolicy
Calls to this method will acquire a lock according to the
AcquisitionPolicy
on a perPlan
granularity- Specified by:
start
in interfacePlanExecutionManager
- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull Triggerable triggerable, @NotNull @NotNull BuildDetectionAction buildDetectionAction, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy, @NotNull PlanExecutionLaunchControl.ReleaseLocksActions releaseLocksActions)
Description copied from interface:PlanExecutionManager
Execute theTriggerable
with the providedBuildDetectionAction
andAcquisitionPolicy
Calls to this method will acquire a lock according to the
AcquisitionPolicy
on a perPlan
granularity- Specified by:
start
in interfacePlanExecutionManager
releaseLocksActions
- actions used for releasing repositories caches locks- Returns:
- planExecutionResult
-
start
@NotNull public @NotNull ExecutionRequestResult start(@NotNull @NotNull ImmutableChain chain, @Nullable @Nullable PlanExecutionConfig planExecutionConfig, @NotNull @NotNull String triggerReasonPluginKey, @NotNull @NotNull String planTriggerPluginKey, @NotNull @NotNull Map<String,String> params, @NotNull @NotNull Map<String,String> variables, @NotNull @NotNull AcquisitionPolicy acquisitionPolicy)
Description copied from interface:PlanExecutionManager
- Specified by:
start
in interfacePlanExecutionManager
planExecutionConfig
- extended configuration for executiontriggerReasonPluginKey
- full plugin key for aTriggerReason
planTriggerPluginKey
- full plugin key for aPlanTrigger
params
- custom paramsvariables
- overriden variablesacquisitionPolicy
- to aquire the lock- Returns:
- planExecutionResult
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull Map<String,String> params, @NotNull @NotNull Map<String,String> variables)
Description copied from interface:PlanExecutionManager
Attempts to start a manual execution of the givenPlan
- Specified by:
startManualExecution
in interfacePlanExecutionManager
params
- - additional execution parameters set in code to parametrized build - not exposed to uservariables
- - user defined variables that could be parametrized in manual execution - contain only values changed by user in UI- Returns:
- executionRequestResult
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, PlanExecutionConfig planExecutionConfig, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull Map<String,String> params, @NotNull @NotNull Map<String,String> variables)
Description copied from interface:PlanExecutionManager
Attempts to start a manual execution of a givenPlan
controlled byPlanExecutionConfig
PlanExecutionConfig
allows to control manual stages execution as well as enforcing execution of manual stages- Specified by:
startManualExecution
in interfacePlanExecutionManager
- Returns:
-
startManualExecution
@NotNull public @NotNull ExecutionRequestResult startManualExecution(@NotNull @NotNull ImmutableChain chain, PlanExecutionConfig planExecutionConfig, @NotNull @NotNull com.atlassian.user.User user, @NotNull @NotNull String triggerReasonPluginKey, @NotNull @NotNull String planTriggerPluginKey, @NotNull @NotNull Map<String,String> params, @NotNull @NotNull Map<String,String> variables)
Description copied from interface:PlanExecutionManager
Attempts to start a manual execution of a givenPlan
controlled byPlanExecutionConfig
PlanExecutionConfig
allows to control manual stages execution as well as enforcing execution of manual stages- Specified by:
startManualExecution
in interfacePlanExecutionManager
- Returns:
-
isBuildingAllowed
public boolean isBuildingAllowed(@NotNull @NotNull ImmutableChain chain)
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 interfacePlanExecutionManager
- Returns:
- true if plan is allowed to be built
-
getCurrentlyBuildingForPlan
@NotNull public @NotNull List<CurrentlyBuilding> getCurrentlyBuildingForPlan(PlanKey planKey)
Description copied from interface:PlanExecutionManager
Returns all for specifiedPlanKey
In case plan is aChain
instance, all currently running jobs will be returned- Specified by:
getCurrentlyBuildingForPlan
in interfacePlanExecutionManager
- Returns:
-
getCurrentlyBuildingForPlanResult
@NotNull public @NotNull List<CurrentlyBuilding> getCurrentlyBuildingForPlanResult(PlanResultKey planKey)
Description copied from interface:PlanExecutionManager
Returns allCurrentlyBuilding
for specifiedPlanResultKey
In case plan is aChain
instance, all currently running jobs will be returned, however, chain itself will be not included in the list (effectivelyCurrentlyBuilding
for all chain's children jobs will be returned)- Specified by:
getCurrentlyBuildingForPlanResult
in interfacePlanExecutionManager
- Returns:
-
stopPlan
public void stopPlan(@NotNull @NotNull PlanResultKey planResultKey, boolean abandonResult, String userName)
- Specified by:
stopPlan
in interfacePlanExecutionManager
-
stopPlan
public void stopPlan(@NotNull @NotNull PlanKey planKey, boolean abandonResult, String userName) throws InterruptedException
- Specified by:
stopPlan
in interfacePlanExecutionManager
- Throws:
InterruptedException
-
stopRequest
public void stopRequest(@NotNull @NotNull PlanKey planKey)
Description copied from interface:PlanExecutionManager
Stops a build requests for the givenPlanKey
- Specified by:
stopRequest
in interfacePlanExecutionManager
-
numberOfExecutions
public int numberOfExecutions(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ExecutionStatusProvider
Returns the number of currentExecutionStatus
s available forPlanKey
- Specified by:
numberOfExecutions
in interfaceExecutionStatusProvider
- Returns:
- noOfExecutions
-
getExecutionStatus
@NotNull public @NotNull Collection<? extends ExecutionStatus> getExecutionStatus(@NotNull @NotNull PlanKey planKey)
Description copied from interface:ExecutionStatusProvider
Returns a collection of currentExecutionStatus
s forPlanKey
- Specified by:
getExecutionStatus
in interfaceExecutionStatusProvider
- Returns:
- executionStatuses
-
getExecutionStatus
@Nullable public @Nullable ExecutionStatus getExecutionStatus(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ExecutionStatusProvider
Returns aExecutionStatus
for the givenPlanResultKey
- Specified by:
getExecutionStatus
in interfaceExecutionStatusProvider
- Returns:
- executionStatus
-
getJobExecution
@Nullable public @Nullable BuildExecution getJobExecution(@NotNull @NotNull PlanResultKey planResultKey)
Description copied from interface:ExecutionStatusProvider
Get the state of a single Job being executed- Specified by:
getJobExecution
in interfaceExecutionStatusProvider
- Returns:
-
shutdown
public Future<Boolean> shutdown()
- Specified by:
shutdown
in interfacePlanExecutionManager
-
-