com.atlassian.bamboo.buildqueue.manager
Interface LocalAgentManager

All Known Implementing Classes:
LocalAgentManagerImpl

public interface LocalAgentManager

Manages the ExecutableBuildAgent and PipelineDefinition funnily enough. The class is fully synchronized.


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 startLocalAgents()
          Starts all current ExecutableBuildAgent objects
 void stopLocalAgents()
          Stops all ExecutableBuildAgent
 

Method Detail

createDefaultAgent

void createDefaultAgent()
sets up a default local agent if no local agent exists


initAgents

void initAgents()
Inits the local agents Must be ran before any other methods.


startLocalAgents

void startLocalAgents()
Starts all current ExecutableBuildAgent objects


stopLocalAgents

void stopLocalAgents()
                     throws java.lang.InterruptedException
Stops all ExecutableBuildAgent

Throws:
java.lang.InterruptedException

getAllLocalAgents

@NotNull
java.util.List<ExecutableBuildAgent> getAllLocalAgents()
Returns all ExecutableBuildAgent objects

Returns:
A copied collection of ExecutableBuildAgent objects, or an empty collection if none exists.

getAllRemoteAgents

@NotNull
java.util.List<BuildAgent> getAllRemoteAgents()
Gets all remote agents in the system. They can be offline.

Returns:
all remote agents.

getAllRemoteAgents

@NotNull
java.util.List<BuildAgent> getAllRemoteAgents(boolean onlineOnly)
Get remote agents.

Parameters:
onlineOnly - - only return those agents which are online currently.
Returns:

getAllAgents

@NotNull
java.util.List<BuildAgent> getAllAgents()

getExecutableAgents

java.util.Collection<BuildAgent> getExecutableAgents(RequirementSet requirementSet,
                                                     boolean includeDisabled)
Gets all agents which can run a given RequirementSet

Returns:

savePipeline

void savePipeline(PipelineDefinition pipelineDefinition)
Stores the PipelineDefinition. Updates any caches so calls to getLocalAgent(long) will return the ExecutableBuildAgent returns with the new definition

Parameters:
pipelineDefinition - - Must not be null

getLocalAgent

ExecutableBuildAgent getLocalAgent(long pipelineId)
Returns the pipeline that matches the passed id

Parameters:
pipelineId -
Returns:
Matching ExecutableBuildAgent object. Null if pipeline does not exist

getAgent

BuildAgent getAgent(long agentId)

getAgentDefinition

@Nullable
PipelineDefinition getAgentDefinition(@NotNull
                                               java.lang.Long agentId)

disableAllAgents

void disableAllAgents()
Disable all pipelines


enableAllAgents

void enableAllAgents()
Enable all pipelines


checkPipelinesAreDisabled

boolean checkPipelinesAreDisabled()
Returns:
whether or not all pipelines are disabled

executeIfIdle

<T> T executeIfIdle(java.util.concurrent.Callable<T> callable)
                throws java.lang.Exception

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

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

createLocalAgent

void createLocalAgent(PipelineDefinition pipelineDefinition)
                      throws BambooLicenseException
Create a new local agent.

Parameters:
pipelineDefinition -
Throws:
BambooLicenseException

removeAgent

void removeAgent(long agentId)
                 throws java.util.concurrent.TimeoutException
Removes the passed agent

Parameters:
agentId -
Throws:
java.util.concurrent.TimeoutException

getExecutableAgentsMatrix

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

Parameters:
requirementSet -
includeDisabled -
Returns:

allowNewRemoteAgent

boolean allowNewRemoteAgent()
Allow a remote agent to register and come online? Based on licensing restrictions.

Returns:

allowNewLocalAgent

boolean allowNewLocalAgent()
Allow a local agent to come online? Based on licensing restrictions.

Returns:


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.