com.atlassian.bamboo.build
Class DefaultBuildExecutionManager

java.lang.Object
  extended by com.atlassian.bamboo.build.DefaultBuildExecutionManager
All Implemented Interfaces:
BuildExecutionManager, BuildExecutionUpdateManager, BuildLoggerManager

public class DefaultBuildExecutionManager
extends java.lang.Object
implements BuildExecutionManager


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.bamboo.build.BuildExecutionManager
BuildExecutionManager.BuildDetectionAction
 
Field Summary
 
Fields inherited from interface com.atlassian.bamboo.build.BuildExecutionManager
DEFAULT_WAITTIME
 
Constructor Summary
DefaultBuildExecutionManager()
           
 
Method Summary
 void finishBuild(java.lang.String planKey)
          Calls removeCurrentlyBuilding & finishProcess
 void finishProcess(java.lang.String planKey)
          Unmark the build for processing
 BuildLogger getBuildLogger(java.lang.String buildPlanKey)
           
 CurrentlyBuilding getBuildRunningOnAgent(java.lang.Long buildAgentId)
           
 CurrentlyBuilding getCurrentlyBuilding(java.lang.String planKey)
           
 boolean isBeingProcessed(java.lang.String planKey)
          Checks if this buildKey is being actively processed
 CurrentlyBuilding removeCurrentlyBuilding(java.lang.String planKey)
           
 void setBuildFinish(java.lang.String buildPlanKey)
           
 void setBuildManager(BuildManager buildManager)
           
 void setBuildRunningOnAgent(java.lang.String buildPlanKey, java.lang.Long buildAgentId)
           
 void setBuildStart(java.lang.String buildPlanKey)
           
 void setChangeDetectionManager(ChangeDetectionManager changeDetectionManager)
           
 void setCurrentlyBuilding(BuildContext buildContext, java.util.Collection<BuildAgent> executableAgents)
          Denotes that the passed build context is beginning the build process.
 void setErrorUpdateHandler(ErrorUpdateHandler errorUpdateHandler)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setTriggerReasonManager(TriggerReasonManager triggerReasonManager)
           
 void startManualBuild(Build buildPlan, com.atlassian.user.User user)
           
 boolean tryToBuild(java.lang.String planKey, boolean wait)
          Attempts to build the passed planKey.
 boolean tryToDetectAndBuild(java.lang.String planKey, BuildExecutionManager.BuildDetectionAction buildDetectionAction, boolean waitForProcessLock)
          Wraps up the passed callback BuildExecutionManager.BuildDetectionAction in a process lock, and also a check for currentlyBuilding.
 boolean tryToProcess(java.lang.String planKey)
          Attempts to gain control to process the build.
 boolean waitToProcess(java.lang.String planKey)
          Attempts to process the plan for up to BuildExecutionManager.DEFAULT_WAITTIME time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultBuildExecutionManager

public DefaultBuildExecutionManager()
Method Detail

isBeingProcessed

public boolean isBeingProcessed(@NotNull
                                java.lang.String planKey)
Description copied from interface: BuildExecutionManager
Checks if this buildKey is being actively processed

Specified by:
isBeingProcessed in interface BuildExecutionManager
Returns:
true if the builds is being processed

tryToProcess

public boolean tryToProcess(@NotNull
                            java.lang.String planKey)
Description copied from interface: BuildExecutionManager
Attempts to gain control to process the build. Returns true if access acquired and false if not successful

Specified by:
tryToProcess in interface BuildExecutionManager
Returns:
true to process acquisition successful and false if not

tryToDetectAndBuild

public boolean tryToDetectAndBuild(java.lang.String planKey,
                                   BuildExecutionManager.BuildDetectionAction buildDetectionAction,
                                   boolean waitForProcessLock)
Description copied from interface: BuildExecutionManager
Wraps up the passed callback BuildExecutionManager.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.

Specified by:
tryToDetectAndBuild in interface BuildExecutionManager
Returns:

waitToProcess

public boolean waitToProcess(java.lang.String planKey)
Description copied from interface: BuildExecutionManager
Attempts to process the plan for up to BuildExecutionManager.DEFAULT_WAITTIME time. You can force the method to abort and return by calling Thread.interrupt()

Specified by:
waitToProcess in interface BuildExecutionManager
Returns:
true if the "lock" has been obtianed, false if not

finishProcess

public void finishProcess(@NotNull
                          java.lang.String planKey)
Description copied from interface: BuildExecutionManager
Unmark the build for processing

Specified by:
finishProcess in interface BuildExecutionManager

startManualBuild

public void startManualBuild(@NotNull
                             Build buildPlan,
                             @NotNull
                             com.atlassian.user.User user)
Specified by:
startManualBuild in interface BuildExecutionManager

getCurrentlyBuilding

public CurrentlyBuilding getCurrentlyBuilding(@NotNull
                                              java.lang.String planKey)
Specified by:
getCurrentlyBuilding in interface BuildExecutionManager

setCurrentlyBuilding

public void setCurrentlyBuilding(@NotNull
                                 BuildContext buildContext,
                                 @NotNull
                                 java.util.Collection<BuildAgent> executableAgents)
Description copied from interface: BuildExecutionManager
Denotes that the passed build context is beginning the build process. (i.e. it's being queued)

Specified by:
setCurrentlyBuilding in interface BuildExecutionManager
executableAgents - - a list of agents on which this build can be run.

setBuildRunningOnAgent

public void setBuildRunningOnAgent(@NotNull
                                   java.lang.String buildPlanKey,
                                   java.lang.Long buildAgentId)
Specified by:
setBuildRunningOnAgent in interface BuildExecutionUpdateManager

getBuildRunningOnAgent

public CurrentlyBuilding getBuildRunningOnAgent(@NotNull
                                                java.lang.Long buildAgentId)
Specified by:
getBuildRunningOnAgent in interface BuildExecutionManager

tryToBuild

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

Specified by:
tryToBuild in interface BuildExecutionManager
wait - should it return fast, or wait if can't get the lock
Returns:

finishBuild

public void finishBuild(@NotNull
                        java.lang.String planKey)
Description copied from interface: BuildExecutionManager
Calls removeCurrentlyBuilding & finishProcess

Specified by:
finishBuild in interface BuildExecutionManager

removeCurrentlyBuilding

public CurrentlyBuilding removeCurrentlyBuilding(java.lang.String planKey)
Specified by:
removeCurrentlyBuilding in interface BuildExecutionManager

setBuildStart

public void setBuildStart(@NotNull
                          java.lang.String buildPlanKey)
Specified by:
setBuildStart in interface BuildExecutionUpdateManager

setBuildFinish

public void setBuildFinish(@NotNull
                           java.lang.String buildPlanKey)
Specified by:
setBuildFinish in interface BuildExecutionUpdateManager

getBuildLogger

@NotNull
public BuildLogger getBuildLogger(@NotNull
                                          java.lang.String buildPlanKey)
Specified by:
getBuildLogger in interface BuildLoggerManager

setBuildManager

public void setBuildManager(BuildManager buildManager)

setEventManager

public void setEventManager(com.atlassian.event.EventManager eventManager)

setTriggerReasonManager

public void setTriggerReasonManager(TriggerReasonManager triggerReasonManager)

setErrorUpdateHandler

public void setErrorUpdateHandler(ErrorUpdateHandler errorUpdateHandler)

setChangeDetectionManager

public void setChangeDetectionManager(ChangeDetectionManager changeDetectionManager)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.