com.atlassian.bamboo.v2.build
Class CurrentlyBuildingImpl

java.lang.Object
  extended by com.atlassian.bamboo.v2.build.CurrentlyBuildingImpl
All Implemented Interfaces:
ExecutionStatus, CurrentlyBuilding

@ThreadSafe
public class CurrentlyBuildingImpl
extends java.lang.Object
implements CurrentlyBuilding


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.atlassian.bamboo.v2.build.CurrentlyBuilding
CurrentlyBuilding.ExecutableInfo
 
Constructor Summary
CurrentlyBuildingImpl(BuildIdentifier buildIdentifier, BuildChanges buildChanges, TriggerReason triggerReason, java.lang.Long averageDuration)
           
 
Method Summary
 long getAverageDuration()
          Estimated total execution time of a task.
 java.lang.Long getBuildAgentId()
          The current build agent id iff the build is current building on an agent
 BuildCancelledDetails getBuildCancelledDetails()
           
 BuildChanges getBuildChanges()
          Changes associated with current build
 BuildHungDetails getBuildHangDetails()
          Details about the build if it hung.
 BuildIdentifier getBuildIdentifier()
          The ID of the build
 BuildQueueTimeoutDetails getBuildQueueTimeoutDetails()
          Details about the build if queue timeout was detected.
 java.lang.Long getBuildTime()
          How long has the build taken so far since checkout has finished? Method name should be getBuildDuration...
 long getElapsedTime()
          How long the task has taken up to now.
 java.util.Collection<BuildAgent> getExecutableBuildAgents()
          Get the list of executable agents for this build.
 java.util.Collection<ElasticImageConfiguration> getExecutableElasticImages()
          Get the list of elastic images that can execute this plan.
 PlanResultKey getPlanResultKey()
           
 BuildProgressBar getProgressBar()
          Track progress of the current build
 java.util.Date getQueueTime()
          The Date when the build was originally queued
 java.util.Date getStartTime()
          When was the execution started.
 TriggerReason getTriggerReason()
          The trigger reason of the current build
 java.util.Date getVcsUpdateTime()
          The time Date when updating / checking out source repository began
 boolean hasExecutableAgents()
          Determine whether this plan currently has any agent that can run it.
 boolean isCurrentlyQueuedOnly()
          Is the build queued? Effectively checks if the CurrentlyBuilding.getBuildAgentId() returns null
 boolean isExecutableAgentInfoInitialized()
           
 boolean isUpdatingVcs()
           
 void setBuildAgentId(java.lang.Long buildAgentId)
          Sets the fact that the build will now be building on an agent
 void setBuildCancelledDetails(BuildCancelledDetails buildCancelledDetails)
           
 void setBuildHangDetails(BuildHungDetails buildHungDetails)
          Set the details if the build was detected to be hung.
 void setBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)
          Sets build queue timeout details
 void setExecutableInfo(CurrentlyBuilding.ExecutableInfo executableInfo)
          Set the information about the current agents and elastic images.
 void setVcsUpdateTime(java.util.Date vcsUpdateTime)
           
 void startTimer()
          Starts an internal timer to the currently running build
 void stopTimer()
          Stops the internal timer for the current running build
 boolean tryToFinish()
          Attempt to mark this object for operation requiring exclusive access: i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrentlyBuildingImpl

public CurrentlyBuildingImpl(BuildIdentifier buildIdentifier,
                             BuildChanges buildChanges,
                             TriggerReason triggerReason,
                             java.lang.Long averageDuration)
Method Detail

getPlanResultKey

@NotNull
public PlanResultKey getPlanResultKey()

getBuildIdentifier

@NotNull
public BuildIdentifier getBuildIdentifier()
Description copied from interface: ExecutionStatus
The ID of the build

Specified by:
getBuildIdentifier in interface ExecutionStatus
Returns:
buildIdentifier

getBuildChanges

@NotNull
public BuildChanges getBuildChanges()
Description copied from interface: ExecutionStatus
Changes associated with current build

Specified by:
getBuildChanges in interface ExecutionStatus
Returns:
buildChanges

getTriggerReason

@NotNull
public TriggerReason getTriggerReason()
Description copied from interface: ExecutionStatus
The trigger reason of the current build

Specified by:
getTriggerReason in interface ExecutionStatus
Returns:
triggerReason

getProgressBar

@NotNull
public BuildProgressBar getProgressBar()
Description copied from interface: ExecutionStatus
Track progress of the current build

Specified by:
getProgressBar in interface ExecutionStatus
Returns:
progressBar

getAverageDuration

public long getAverageDuration()
Description copied from interface: ExecutionStatus
Estimated total execution time of a task.

Specified by:
getAverageDuration in interface ExecutionStatus
Returns:
long representing estimated execution time - in millis

tryToFinish

public boolean tryToFinish()
Description copied from interface: CurrentlyBuilding
Attempt to mark this object for operation requiring exclusive access: i.e. finishing build. Return value indicates if current thread is the first to call this method.

Specified by:
tryToFinish in interface CurrentlyBuilding
Returns:
true iff thread is free to request removal of this object

setExecutableInfo

public void setExecutableInfo(@NotNull
                              CurrentlyBuilding.ExecutableInfo executableInfo)
Description copied from interface: CurrentlyBuilding
Set the information about the current agents and elastic images.

Specified by:
setExecutableInfo in interface CurrentlyBuilding
Parameters:
executableInfo - to set.

getExecutableBuildAgents

@NotNull
public java.util.Collection<BuildAgent> getExecutableBuildAgents()
Description copied from interface: CurrentlyBuilding
Get the list of executable agents for this build. This mirrors the agent id's in the JMS message on the queue.

Specified by:
getExecutableBuildAgents in interface CurrentlyBuilding
Returns:
- a list of BuildAgent which can execute this build.

hasExecutableAgents

public boolean hasExecutableAgents()
Description copied from interface: CurrentlyBuilding
Determine whether this plan currently has any agent that can run it.

Specified by:
hasExecutableAgents in interface CurrentlyBuilding
Returns:
True if at least one agent: meets all of the plans requirements is enabled is active (i.e. online), otherwise False.

getExecutableElasticImages

@NotNull
public java.util.Collection<ElasticImageConfiguration> getExecutableElasticImages()
Description copied from interface: CurrentlyBuilding
Get the list of elastic images that can execute this plan.

Specified by:
getExecutableElasticImages in interface CurrentlyBuilding
Returns:
collection of ElasticImageConfiguration which can execute this plan

isExecutableAgentInfoInitialized

public boolean isExecutableAgentInfoInitialized()
Specified by:
isExecutableAgentInfoInitialized in interface CurrentlyBuilding
Returns:
true if executable agent lists have been updated at least once since triggering of the build

getBuildAgentId

@Nullable
public java.lang.Long getBuildAgentId()
Description copied from interface: CurrentlyBuilding
The current build agent id iff the build is current building on an agent

Specified by:
getBuildAgentId in interface CurrentlyBuilding
Returns:

setBuildAgentId

public void setBuildAgentId(@NotNull
                            java.lang.Long buildAgentId)
Description copied from interface: CurrentlyBuilding
Sets the fact that the build will now be building on an agent

Specified by:
setBuildAgentId in interface CurrentlyBuilding

isCurrentlyQueuedOnly

public boolean isCurrentlyQueuedOnly()
Description copied from interface: CurrentlyBuilding
Is the build queued? Effectively checks if the CurrentlyBuilding.getBuildAgentId() returns null

Specified by:
isCurrentlyQueuedOnly in interface CurrentlyBuilding
Returns:

getStartTime

@Nullable
public java.util.Date getStartTime()
Description copied from interface: ExecutionStatus
When was the execution started.

Specified by:
getStartTime in interface ExecutionStatus
Returns:
Date - when the execution started

getQueueTime

@NotNull
public java.util.Date getQueueTime()
Description copied from interface: CurrentlyBuilding
The Date when the build was originally queued

Specified by:
getQueueTime in interface ExecutionStatus
Specified by:
getQueueTime in interface CurrentlyBuilding
Returns:
Date - when the process was queued for execution

getVcsUpdateTime

@Nullable
public java.util.Date getVcsUpdateTime()
Description copied from interface: CurrentlyBuilding
The time Date when updating / checking out source repository began

Specified by:
getVcsUpdateTime in interface CurrentlyBuilding
Returns:

setVcsUpdateTime

public void setVcsUpdateTime(@NotNull
                             java.util.Date vcsUpdateTime)
Specified by:
setVcsUpdateTime in interface CurrentlyBuilding

getBuildTime

@NotNull
public java.lang.Long getBuildTime()
Description copied from interface: CurrentlyBuilding
How long has the build taken so far since checkout has finished? Method name should be getBuildDuration...

Specified by:
getBuildTime in interface CurrentlyBuilding
Returns:
Long representing build time - in millis. 0 if not started

getElapsedTime

public long getElapsedTime()
Description copied from interface: ExecutionStatus
How long the task has taken up to now.

Specified by:
getElapsedTime in interface ExecutionStatus
Returns:
long representing task's elapsed time - in millis

isUpdatingVcs

public boolean isUpdatingVcs()
Specified by:
isUpdatingVcs in interface CurrentlyBuilding

startTimer

public void startTimer()
Description copied from interface: CurrentlyBuilding
Starts an internal timer to the currently running build

Specified by:
startTimer in interface CurrentlyBuilding

stopTimer

public void stopTimer()
Description copied from interface: CurrentlyBuilding
Stops the internal timer for the current running build

Specified by:
stopTimer in interface CurrentlyBuilding

getBuildHangDetails

@Nullable
public BuildHungDetails getBuildHangDetails()
Description copied from interface: CurrentlyBuilding
Details about the build if it hung. Will be null if build was fine.

Specified by:
getBuildHangDetails in interface CurrentlyBuilding
Returns:

setBuildHangDetails

public void setBuildHangDetails(@Nullable
                                BuildHungDetails buildHungDetails)
Description copied from interface: CurrentlyBuilding
Set the details if the build was detected to be hung.

Specified by:
setBuildHangDetails in interface CurrentlyBuilding

getBuildCancelledDetails

@Nullable
public BuildCancelledDetails getBuildCancelledDetails()
Specified by:
getBuildCancelledDetails in interface CurrentlyBuilding

setBuildCancelledDetails

public void setBuildCancelledDetails(@Nullable
                                     BuildCancelledDetails buildCancelledDetails)
Specified by:
setBuildCancelledDetails in interface CurrentlyBuilding

getBuildQueueTimeoutDetails

public BuildQueueTimeoutDetails getBuildQueueTimeoutDetails()
Description copied from interface: CurrentlyBuilding
Details about the build if queue timeout was detected.

Specified by:
getBuildQueueTimeoutDetails in interface CurrentlyBuilding
Returns:

setBuildQueueTimeoutDetails

public void setBuildQueueTimeoutDetails(BuildQueueTimeoutDetails buildQueueTimeoutDetails)
Description copied from interface: CurrentlyBuilding
Sets build queue timeout details

Specified by:
setBuildQueueTimeoutDetails in interface CurrentlyBuilding


Copyright © 2011 Atlassian. All Rights Reserved.