com.atlassian.bamboo.buildqueue.manager
Class LocalAgentManagerImpl

java.lang.Object
  extended by com.atlassian.bamboo.buildqueue.manager.LocalAgentManagerImpl
All Implemented Interfaces:
LocalAgentManager

public class LocalAgentManagerImpl
extends java.lang.Object
implements LocalAgentManager


Constructor Summary
LocalAgentManagerImpl()
           
 
Method Summary
 boolean allowNewLocalAgent()
          Allow a local agent to come online? Based on licensing restrictions.
 boolean allowNewRemoteAgent()
          Allow a remote agent to register and come online? Based on licensing restrictions.
 boolean checkPipelinesAreDisabled()
           
 void createDefaultAgent()
          sets up a default local agent if no local agent exists
 void createLocalAgent(PipelineDefinition pipelineDefinition)
          Create a new local agent.
 void disableAllAgents()
          Disable all pipelines
 void enableAllAgents()
          Enable all pipelines
<T> T
executeIfIdle(java.util.concurrent.Callable<T> callable)
          Executes a given Callable only if no builds are in progress.
 BuildAgent getAgent(long agentId)
           
 PipelineDefinition getAgentDefinition(java.lang.Long agentId)
           
 java.util.List<BuildAgent> getAllAgents()
           
 java.util.List<ExecutableBuildAgent> getAllLocalAgents()
          Returns all ExecutableBuildAgent objects
 java.util.List<BuildAgent> getAllRemoteAgents()
          Gets all remote agents in the system.
 java.util.List<BuildAgent> getAllRemoteAgents(boolean onlineOnly)
          Get remote agents.
 java.util.Collection<BuildAgent> getExecutableAgents(RequirementSet requirementSet, boolean includeDisabled)
          Gets all agents which can run a given RequirementSet
 ExecutableAgentsMatrix getExecutableAgentsMatrix(RequirementSet requirementSet, boolean includeDisabled)
          Returns a matrix of how many agents match each requirement in the set.
 ExecutableBuildAgent getLocalAgent(long pipelineId)
          Returns the pipeline that matches the passed id
 void initAgents()
          Inits the local agents Must be ran before any other methods.
 void removeAgent(long agentId)
          Removes the passed agent
 void savePipeline(PipelineDefinition pipelineDefinition)
          Stores the PipelineDefinition.
 void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)
           
 void setBuildAgentController(BuildAgentController buildAgentController)
           
 void setCapabilityRequirementsMatcher(CapabilityRequirementsMatcher capabilityRequirementsMatcher)
           
 void setCapabilitySetManager(CapabilitySetManager capabilitySetManager)
           
 void setEventManager(com.atlassian.event.EventManager eventManager)
           
 void setLocalAgentDao(LocalAgentDao localAgentDao)
           
 void setRemoteAgentDao(RemoteAgentDao remoteAgentDao)
           
 void startLocalAgents()
          Starts all current ExecutableBuildAgent objects
 void stopLocalAgents()
          Stops all ExecutableBuildAgent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalAgentManagerImpl

public LocalAgentManagerImpl()
Method Detail

createDefaultAgent

public void createDefaultAgent()
Description copied from interface: LocalAgentManager
sets up a default local agent if no local agent exists

Specified by:
createDefaultAgent in interface LocalAgentManager

initAgents

public void initAgents()
Description copied from interface: LocalAgentManager
Inits the local agents Must be ran before any other methods.

Specified by:
initAgents in interface LocalAgentManager

startLocalAgents

public void startLocalAgents()
Description copied from interface: LocalAgentManager
Starts all current ExecutableBuildAgent objects

Specified by:
startLocalAgents in interface LocalAgentManager

stopLocalAgents

public void stopLocalAgents()
                     throws java.lang.InterruptedException
Description copied from interface: LocalAgentManager
Stops all ExecutableBuildAgent

Specified by:
stopLocalAgents in interface LocalAgentManager
Throws:
java.lang.InterruptedException

getAllLocalAgents

@NotNull
public java.util.List<ExecutableBuildAgent> getAllLocalAgents()
Description copied from interface: LocalAgentManager
Returns all ExecutableBuildAgent objects

Specified by:
getAllLocalAgents in interface LocalAgentManager
Returns:
A copied collection of ExecutableBuildAgent objects, or an empty collection if none exists.

getAllRemoteAgents

@NotNull
public java.util.List<BuildAgent> getAllRemoteAgents(boolean onlineOnly)
Description copied from interface: LocalAgentManager
Get remote agents.

Specified by:
getAllRemoteAgents in interface LocalAgentManager
Parameters:
onlineOnly - - only return those agents which are online currently.
Returns:

getAllRemoteAgents

@NotNull
public java.util.List<BuildAgent> getAllRemoteAgents()
Description copied from interface: LocalAgentManager
Gets all remote agents in the system. They can be offline.

Specified by:
getAllRemoteAgents in interface LocalAgentManager
Returns:
all remote agents.

getAllAgents

@NotNull
public java.util.List<BuildAgent> getAllAgents()
Specified by:
getAllAgents in interface LocalAgentManager

getExecutableAgents

public java.util.Collection<BuildAgent> getExecutableAgents(RequirementSet requirementSet,
                                                            boolean includeDisabled)
Description copied from interface: LocalAgentManager
Gets all agents which can run a given RequirementSet

Specified by:
getExecutableAgents in interface LocalAgentManager
Returns:

getExecutableAgentsMatrix

@NotNull
public ExecutableAgentsMatrix getExecutableAgentsMatrix(@NotNull
                                                                RequirementSet requirementSet,
                                                                boolean includeDisabled)
Description copied from interface: LocalAgentManager
Returns a matrix of how many agents match each requirement in the set. Also adds the total number of agents that matches the set

Specified by:
getExecutableAgentsMatrix in interface LocalAgentManager
Returns:

createLocalAgent

public void createLocalAgent(PipelineDefinition pipelineDefinition)
                      throws BambooLicenseException
Description copied from interface: LocalAgentManager
Create a new local agent.

Specified by:
createLocalAgent in interface LocalAgentManager
Throws:
BambooLicenseException

savePipeline

public void savePipeline(PipelineDefinition pipelineDefinition)
Description copied from interface: LocalAgentManager
Stores the PipelineDefinition. Updates any caches so calls to LocalAgentManager.getLocalAgent(long) will return the ExecutableBuildAgent returns with the new definition

Specified by:
savePipeline in interface LocalAgentManager
Parameters:
pipelineDefinition - - Must not be null

getLocalAgent

public ExecutableBuildAgent getLocalAgent(long pipelineId)
Description copied from interface: LocalAgentManager
Returns the pipeline that matches the passed id

Specified by:
getLocalAgent in interface LocalAgentManager
Returns:
Matching ExecutableBuildAgent object. Null if pipeline does not exist

getAgent

public BuildAgent getAgent(long agentId)
Specified by:
getAgent in interface LocalAgentManager

getAgentDefinition

@Nullable
public PipelineDefinition getAgentDefinition(@NotNull
                                                      java.lang.Long agentId)
Specified by:
getAgentDefinition in interface LocalAgentManager

disableAllAgents

public void disableAllAgents()
Description copied from interface: LocalAgentManager
Disable all pipelines

Specified by:
disableAllAgents in interface LocalAgentManager

enableAllAgents

public void enableAllAgents()
Description copied from interface: LocalAgentManager
Enable all pipelines

Specified by:
enableAllAgents in interface LocalAgentManager

checkPipelinesAreDisabled

public boolean checkPipelinesAreDisabled()
Specified by:
checkPipelinesAreDisabled in interface LocalAgentManager
Returns:
whether or not all pipelines are disabled

executeIfIdle

public <T> T executeIfIdle(java.util.concurrent.Callable<T> callable)
                throws java.lang.Exception
Description copied from interface: LocalAgentManager

Executes a given Callable only if no builds are in progress. Builds are prevented from starting while the Callable executes.

Specified by:
executeIfIdle in interface LocalAgentManager
Parameters:
callable - the Callable to be executed
Returns:
the result of callable
Throws:
BambooBusyException - if builds are in progress
java.lang.Exception - if thrown by callable

removeAgent

public void removeAgent(long agentId)
                 throws java.util.concurrent.TimeoutException
Description copied from interface: LocalAgentManager
Removes the passed agent

Specified by:
removeAgent in interface LocalAgentManager
Throws:
java.util.concurrent.TimeoutException

allowNewRemoteAgent

public boolean allowNewRemoteAgent()
Description copied from interface: LocalAgentManager
Allow a remote agent to register and come online? Based on licensing restrictions.

Specified by:
allowNewRemoteAgent in interface LocalAgentManager
Returns:

allowNewLocalAgent

public boolean allowNewLocalAgent()
Description copied from interface: LocalAgentManager
Allow a local agent to come online? Based on licensing restrictions.

Specified by:
allowNewLocalAgent in interface LocalAgentManager
Returns:

setLocalAgentDao

public void setLocalAgentDao(LocalAgentDao localAgentDao)

setBuildAgentController

public void setBuildAgentController(BuildAgentController buildAgentController)

setRemoteAgentDao

public void setRemoteAgentDao(RemoteAgentDao remoteAgentDao)

setCapabilityRequirementsMatcher

public void setCapabilityRequirementsMatcher(CapabilityRequirementsMatcher capabilityRequirementsMatcher)

setCapabilitySetManager

public void setCapabilitySetManager(CapabilitySetManager capabilitySetManager)

setEventManager

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

setBambooLicenseManager

public void setBambooLicenseManager(BambooLicenseManager bambooLicenseManager)


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.