com.atlassian.bamboo.buildqueue.manager
Class ExecutableAgentsMatrixImpl

java.lang.Object
  extended by com.atlassian.bamboo.buildqueue.manager.ExecutableAgentsMatrixImpl
All Implemented Interfaces:
ExecutableAgentsMatrix

public class ExecutableAgentsMatrixImpl
extends Object
implements ExecutableAgentsMatrix

A simple holder object that stores information about the executable agents on a per requirement basis


Constructor Summary
ExecutableAgentsMatrixImpl()
           
 
Method Summary
 void addBuildAgent(BuildAgent buildAgent)
          Record an agent matching ALL requirements
 void addBuildAgents(Collection<BuildAgent> buildAgents)
          Record a collection of agents matching ALL requirements
 void addImageMatch(ElasticImageConfiguration imageMatch)
          Record an image that matches all requirements
 void addImageToMatrix(String requirementKey, ElasticImageConfiguration image)
          Record an image matching a requirement.
 void addRequirementWithNoAgentMatch(Requirement requirement)
          Record a requirement that does not have any matching agents.
 void addRequirementWithNoImageMatch(Requirement requirement)
          Record a requirement that does not have any matching image.
 SortedSet<BuildAgent> getBuildAgents()
          Get a set of agents that match ALL requirements.
 Collection<BuildAgent> getBuildAgents(String key)
           
 Collection<ElasticImageConfiguration> getImageFromMatrix(String requirementKey)
           
 List<ElasticImageConfiguration> getImageMatches()
          Get a set of elastic images that match ALL requirements.
 Collection<BuildAgent> getOnlineEnabledBuildAgents()
          Get a set of agents that match ALL requirements AND are currently enabled and online.
 int getRequirementCount()
           
 Set<Requirement> getRequirementsWithNoMatches()
          Retrieve a list of all requirements which were not matched by any agent or image.
 boolean isElasticBambooEnabled()
          Check if elastic support is enabled
 void put(String key, BuildAgent value)
          Record an agent matching a requirement.
 void setElasticBambooEnabled(boolean elasticBambooEnabled)
          Mark whether elastic support is enabled or not
 void setRequirementCount(int requirementCount)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutableAgentsMatrixImpl

public ExecutableAgentsMatrixImpl()
Method Detail

put

public void put(@NotNull
                String key,
                @NotNull
                BuildAgent value)
Description copied from interface: ExecutableAgentsMatrix
Record an agent matching a requirement. May also get recorded to match all requirements

Specified by:
put in interface ExecutableAgentsMatrix
Parameters:
key - of requirement matched
value - that matches

getBuildAgents

@Nullable
public Collection<BuildAgent> getBuildAgents(@NotNull
                                                      String key)
Specified by:
getBuildAgents in interface ExecutableAgentsMatrix
Parameters:
key - of requirement
Returns:
a collection of agents that match a single requirement

getBuildAgents

@NotNull
public SortedSet<BuildAgent> getBuildAgents()
Description copied from interface: ExecutableAgentsMatrix
Get a set of agents that match ALL requirements. i.e. these agents could build the executable. Includes offline and disabled agents

Specified by:
getBuildAgents in interface ExecutableAgentsMatrix
Returns:
a set of agents that match all requirements.

getOnlineEnabledBuildAgents

@NotNull
public Collection<BuildAgent> getOnlineEnabledBuildAgents()
Description copied from interface: ExecutableAgentsMatrix
Get a set of agents that match ALL requirements AND are currently enabled and online. i.e. these agents could build the executable now

Specified by:
getOnlineEnabledBuildAgents in interface ExecutableAgentsMatrix
Returns:
set of online enabled build agents that match all requirements

addBuildAgent

public void addBuildAgent(@NotNull
                          BuildAgent buildAgent)
Description copied from interface: ExecutableAgentsMatrix
Record an agent matching ALL requirements

Specified by:
addBuildAgent in interface ExecutableAgentsMatrix
Parameters:
buildAgent - that matches

addBuildAgents

public void addBuildAgents(@NotNull
                           Collection<BuildAgent> buildAgents)
Description copied from interface: ExecutableAgentsMatrix
Record a collection of agents matching ALL requirements

Specified by:
addBuildAgents in interface ExecutableAgentsMatrix
Parameters:
buildAgents - that match

addRequirementWithNoAgentMatch

public void addRequirementWithNoAgentMatch(@NotNull
                                           Requirement requirement)
Description copied from interface: ExecutableAgentsMatrix
Record a requirement that does not have any matching agents.

Specified by:
addRequirementWithNoAgentMatch in interface ExecutableAgentsMatrix
Parameters:
requirement - that didn't have a match

addRequirementWithNoImageMatch

public void addRequirementWithNoImageMatch(@NotNull
                                           Requirement requirement)
Description copied from interface: ExecutableAgentsMatrix
Record a requirement that does not have any matching image.

Specified by:
addRequirementWithNoImageMatch in interface ExecutableAgentsMatrix
Parameters:
requirement - that didn't have a match

getRequirementsWithNoMatches

@NotNull
public Set<Requirement> getRequirementsWithNoMatches()
Description copied from interface: ExecutableAgentsMatrix
Retrieve a list of all requirements which were not matched by any agent or image. If elastic capability is disabled it will ignore images and just look at agent matches.

Specified by:
getRequirementsWithNoMatches in interface ExecutableAgentsMatrix
Returns:
Set of requirements with no matches

setElasticBambooEnabled

public void setElasticBambooEnabled(boolean elasticBambooEnabled)
Description copied from interface: ExecutableAgentsMatrix
Mark whether elastic support is enabled or not

Specified by:
setElasticBambooEnabled in interface ExecutableAgentsMatrix
Parameters:
elasticBambooEnabled - whether elastic bamboo is enabled

isElasticBambooEnabled

public boolean isElasticBambooEnabled()
Description copied from interface: ExecutableAgentsMatrix
Check if elastic support is enabled

Specified by:
isElasticBambooEnabled in interface ExecutableAgentsMatrix
Returns:
true if elastic bamboo is enabled, otherwise false

getRequirementCount

public int getRequirementCount()
Specified by:
getRequirementCount in interface ExecutableAgentsMatrix
Returns:
How many requirements were used to generate this matrix

setRequirementCount

public void setRequirementCount(int requirementCount)
Specified by:
setRequirementCount in interface ExecutableAgentsMatrix
Parameters:
requirementCount - How many requirements were used to generate this matrix

getImageMatches

@NotNull
public List<ElasticImageConfiguration> getImageMatches()
Description copied from interface: ExecutableAgentsMatrix
Get a set of elastic images that match ALL requirements. i.e. these images could build the executable.

Specified by:
getImageMatches in interface ExecutableAgentsMatrix
Returns:
a list of images that match all requirements.

addImageMatch

public void addImageMatch(@NotNull
                          ElasticImageConfiguration imageMatch)
Description copied from interface: ExecutableAgentsMatrix
Record an image that matches all requirements

Specified by:
addImageMatch in interface ExecutableAgentsMatrix
Parameters:
imageMatch - image that matches

getImageFromMatrix

@Nullable
public Collection<ElasticImageConfiguration> getImageFromMatrix(@NotNull
                                                                         String requirementKey)
Specified by:
getImageFromMatrix in interface ExecutableAgentsMatrix
Parameters:
requirementKey - of requirement
Returns:
a collection of images that match a single requirement

addImageToMatrix

public void addImageToMatrix(@NotNull
                             String requirementKey,
                             @NotNull
                             ElasticImageConfiguration image)
Description copied from interface: ExecutableAgentsMatrix
Record an image matching a requirement. May also get recorded to match all requirements

Specified by:
addImageToMatrix in interface ExecutableAgentsMatrix
Parameters:
requirementKey - for requirement that matches
image - that matches


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.