com.atlassian.bamboo.build
Interface BuildExecutionManager

All Superinterfaces:
BuildExecutionUpdateManager, BuildLoggerManager
All Known Implementing Classes:
DefaultBuildExecutionManager

@ThreadSafe
public interface BuildExecutionManager
extends BuildExecutionUpdateManager

A class that is aware of all the goings on in executing builds.


Field Summary
static long DEFAULT_WAITTIME
           
 
Method Summary
 void addToCurrentlyBuilding(BuildContext buildContext)
          Denotes that the passed build context is beginning the build process.
 void execute(BuildContext buildContext)
          Checks if the Build is already building and if successful executes the BuildContext At this point a BuildResultsSummary that matches the given BuildContext
 void finishBuild(java.lang.String buildResultKey)
          Calls removeCurrentlyBuilding & finishProcess
 void finishProcess(java.lang.String buildKey)
          Unmark the build for processing
 CurrentlyBuilding getBuildRunningOnAgent(java.lang.Long buildAgentId)
           
 java.util.List<CurrentlyBuilding> getCurrentlyBuilding(java.lang.String planKey)
           
 CurrentlyBuilding getCurrentlyBuildingByBuildResult(BuildIdentifier buildIdentifier)
          Returns CurrentlyBuilding instance for build identifier (or BuildContext).
 CurrentlyBuilding getCurrentlyBuildingByBuildResultKey(java.lang.String buildResultKey)
          Returns CurrentlyBuilding instance for build identified by buildResultKey.
 java.util.List<CurrentlyBuilding> getCurrentlyExecutingBuilds()
          Retrieves a list of all builds being executed (i.e not just queued).
 boolean isBeingProcessed(java.lang.String buildKey)
          Checks if this buildKey is being actively processed
 CurrentlyBuilding removeCurrentlyBuilding(java.lang.String planKey)
           
 void setCurrentlyBuilding(BuildContext buildContext, java.util.Collection<BuildAgent> executableAgents)
          Deprecated. - does not initialize executable images
 void setCurrentlyBuilding(BuildContext buildContext, java.util.Collection<BuildAgent> executableAgents, java.util.Collection<ElasticImageConfiguration> executableImages)
          Denotes that the passed build context is beginning the build process.
 void startManualBuild(Build buildPlan, com.atlassian.user.User user)
           
 void startManualBuild(Build buildPlan, com.atlassian.user.User user, java.util.Map<java.lang.String,java.lang.String> params)
           
 boolean tryToBuild(java.lang.String planKey, boolean wait)
          Attempts to build the passed planKey.
 boolean tryToDetectAndBuild(java.lang.String planKey, BuildDetectionAction buildDetectionAction, boolean waitForProcessLock)
          Wraps up the passed callback BuildDetectionAction in a process lock, and also a check for currentlyBuilding.
 boolean tryToProcess(java.lang.String buildKey)
          Attempts to gain control to process the build.
 boolean waitToProcess(java.lang.String planKey)
          Attempts to process the plan for up to DEFAULT_WAITTIME time.
 
Methods inherited from interface com.atlassian.bamboo.build.BuildExecutionUpdateManager
setBuildFinish, setBuildRunningOnAgent, setBuildStart
 
Methods inherited from interface com.atlassian.bamboo.build.BuildLoggerManager
getBuildLogger, getBuildLogger, getBuildLogger, removeBuildLogger, removeBuildLogger
 

Field Detail

DEFAULT_WAITTIME

static final long DEFAULT_WAITTIME
See Also:
Constant Field Values
Method Detail

isBeingProcessed

boolean isBeingProcessed(@NotNull
                         java.lang.String buildKey)
Checks if this buildKey is being actively processed

Parameters:
buildKey -
Returns:
true if the builds is being processed

tryToProcess

boolean tryToProcess(@NotNull
                     java.lang.String buildKey)
Attempts to gain control to process the build. Returns true if access acquired and false if not successful

Parameters:
buildKey -
Returns:
true to process acquisition successful and false if not

finishProcess

void finishProcess(@NotNull
                   java.lang.String buildKey)
Unmark the build for processing

Parameters:
buildKey -

getCurrentlyExecutingBuilds

java.util.List<CurrentlyBuilding> getCurrentlyExecutingBuilds()
Retrieves a list of all builds being executed (i.e not just queued).

Returns:

getCurrentlyBuilding

@NotNull
java.util.List<CurrentlyBuilding> getCurrentlyBuilding(@NotNull
                                                               java.lang.String planKey)

removeCurrentlyBuilding

@Nullable
CurrentlyBuilding removeCurrentlyBuilding(@NotNull
                                                   java.lang.String planKey)

waitToProcess

boolean waitToProcess(@NotNull
                      java.lang.String planKey)
Attempts to process the plan for up to DEFAULT_WAITTIME time. You can force the method to abort and return by calling Thread.interrupt()

Parameters:
planKey -
Returns:
true if the "lock" has been obtianed, false if not

setCurrentlyBuilding

void setCurrentlyBuilding(@NotNull
                          BuildContext buildContext,
                          @NotNull
                          java.util.Collection<BuildAgent> executableAgents,
                          @NotNull
                          java.util.Collection<ElasticImageConfiguration> executableImages)
Denotes that the passed build context is beginning the build process. (i.e. it's being queued)

Parameters:
buildContext - -
executableAgents - - a list of agents on which this build can be run.
executableImages - - a list of images on which the build can be run.

setCurrentlyBuilding

@Deprecated
void setCurrentlyBuilding(@NotNull
                                     BuildContext buildContext,
                                     @NotNull
                                     java.util.Collection<BuildAgent> executableAgents)
Deprecated. - does not initialize executable images

Denotes that the passed build context is beginning the build process. (i.e. it's being queued)

Parameters:
buildContext -
executableAgents - - a list of agents on which this build can be run.

addToCurrentlyBuilding

void addToCurrentlyBuilding(@NotNull
                            BuildContext buildContext)
Denotes that the passed build context is beginning the build process. (i.e. it's being queued).

Parameters:
buildContext -

getBuildRunningOnAgent

CurrentlyBuilding getBuildRunningOnAgent(@NotNull
                                         java.lang.Long buildAgentId)

tryToBuild

boolean tryToBuild(@NotNull
                   java.lang.String planKey,
                   boolean wait)
Attempts to build the passed planKey. A simple shortcut method that calls #isAllowBuilding(String), getCurrentlyBuilding(String) and tryToProcess(String). If the call returns true, you also have the "lock" on the plan.

Parameters:
planKey -
wait - should it return fast, or wait if can't get the lock
Returns:

finishBuild

void finishBuild(@NotNull
                 java.lang.String buildResultKey)
Calls removeCurrentlyBuilding & finishProcess

Parameters:
buildResultKey -

execute

void execute(@NotNull
             BuildContext buildContext)
Checks if the Build is already building and if successful executes the BuildContext At this point a BuildResultsSummary that matches the given BuildContext

Parameters:
buildContext -

tryToDetectAndBuild

boolean tryToDetectAndBuild(@NotNull
                            java.lang.String planKey,
                            @NotNull
                            BuildDetectionAction buildDetectionAction,
                            boolean waitForProcessLock)
Wraps up the passed callback BuildDetectionAction in a process lock, and also a check for currentlyBuilding. Will fire off BuildTriggeredEvent if the callback completes successfully and a BuildContext is returned by the callback action.

Parameters:
planKey -
buildDetectionAction -
waitForProcessLock -
Returns:
success

startManualBuild

void startManualBuild(@NotNull
                      Build buildPlan,
                      @NotNull
                      com.atlassian.user.User user)

startManualBuild

void startManualBuild(@NotNull
                      Build buildPlan,
                      @NotNull
                      com.atlassian.user.User user,
                      @NotNull
                      java.util.Map<java.lang.String,java.lang.String> params)

getCurrentlyBuildingByBuildResultKey

CurrentlyBuilding getCurrentlyBuildingByBuildResultKey(@NotNull
                                                       java.lang.String buildResultKey)
Returns CurrentlyBuilding instance for build identified by buildResultKey. Should be used only if BuildIdentifier is not available - basically in actions

Parameters:
buildResultKey -
Returns:

getCurrentlyBuildingByBuildResult

CurrentlyBuilding getCurrentlyBuildingByBuildResult(@NotNull
                                                    BuildIdentifier buildIdentifier)
Returns CurrentlyBuilding instance for build identifier (or BuildContext).

Parameters:
buildIdentifier -
Returns:


Copyright © 2010 Atlassian. All Rights Reserved.