com.atlassian.bamboo.buildqueue.dao
Interface AgentDao

All Superinterfaces:
BambooObjectDao, bucket.core.persistence.ObjectDao
All Known Implementing Classes:
AgentHibernateDao

public interface AgentDao
extends BambooObjectDao

Agent Definition Dao that can search on PipelineDefinitions as well as it sub classes.


Method Summary
 PipelineDefinition findAgentByName(java.lang.String name)
          Retrieve a pipelineDefinition by name.
 java.util.List<PipelineDefinition> findAllAgents()
          Retrieves all agents();
 java.util.Set<PipelineDefinition> findAllAgentsForAgentIds(java.util.Collection<java.lang.Long> agentIds)
          Return a list of agents by their ids
 java.util.List<PipelineDefinition> findAllAgentsWithNameLike(java.lang.String likeName)
          Retrun a list of agents whose name is like the provided string.
 java.util.List<ElasticAgentDefinition> findAllElasticAgents(java.util.Collection<java.lang.String> instanceIds)
          Retrieves all elastic agents
 java.util.List<ElasticAgentDefinition> findAllElasticAgents(int firstResult, int maxResults)
          Retrieves n most recently terminated elastic agents, ordered by termination time, descending.
 java.util.List<LocalAgentDefinition> findAllLocalAgents()
          Retrieves all local agents
 java.util.List<RemoteAgentDefinition> findAllRemoteAgents()
          Retrieves all remote agents
 java.util.List<ElasticAgentDefinition> findNotShutDownElasticAgents()
          Retrieves all agents without a shutdown time defined
 PipelineDefinition getAgentById(long id)
          Retrieve the agentDefinition object.
 long getAgentCount(java.lang.Class<ElasticAgentDefinition> agentDefinitionClass)
          Retrieves the amount of agents of given type stored in the database
 PipelineDefinition getLocalAgentById(long id)
          Retrieve the localAgentDefinition
 PipelineDefinition getRemoteAgentById(long id)
          Retrieve the remoteAgentDefinition
 PipelineDefinition saveAndReturn(PipelineDefinition pipelineDefinition)
          Saves the passed definition and returns a new copy of the updated pipeline definition
 
Methods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findById
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, getPersistentClass, refresh, remove, replicate, save, saveRaw
 

Method Detail

saveAndReturn

@NotNull
PipelineDefinition saveAndReturn(@NotNull
                                         PipelineDefinition pipelineDefinition)
Saves the passed definition and returns a new copy of the updated pipeline definition

Parameters:
pipelineDefinition - to save
Returns:
the saved and updated (e.g with agentId) pipelineDefinition

getAgentById

@Nullable
PipelineDefinition getAgentById(long id)
Retrieve the agentDefinition object.

Parameters:
id - - the id for the agent to be retrieved
Returns:
agentDefinition associated with the agentId or null if it couldn't be found

getLocalAgentById

PipelineDefinition getLocalAgentById(long id)
Retrieve the localAgentDefinition

Parameters:
id - of the agent
Returns:
LocalAgentDefintion associated with the id if no agent found, returns null

getRemoteAgentById

PipelineDefinition getRemoteAgentById(long id)
Retrieve the remoteAgentDefinition

Parameters:
id - of the agent
Returns:
RemoteAgentDefintion associated with the id if no agent found, returns null

findAllRemoteAgents

java.util.List<RemoteAgentDefinition> findAllRemoteAgents()
Retrieves all remote agents

Returns:
List of all remote agents

findNotShutDownElasticAgents

java.util.List<ElasticAgentDefinition> findNotShutDownElasticAgents()
Retrieves all agents without a shutdown time defined

Returns:
all agents without a shutdown time defined

getAgentCount

long getAgentCount(java.lang.Class<ElasticAgentDefinition> agentDefinitionClass)
Retrieves the amount of agents of given type stored in the database

Parameters:
agentDefinitionClass - agent type
Returns:
amount of agents

findAllLocalAgents

java.util.List<LocalAgentDefinition> findAllLocalAgents()
Retrieves all local agents

Returns:
List of all local agents

findAllElasticAgents

@NotNull
java.util.List<ElasticAgentDefinition> findAllElasticAgents(int firstResult,
                                                                    int maxResults)
Retrieves n most recently terminated elastic agents, ordered by termination time, descending.


findAllElasticAgents

java.util.List<ElasticAgentDefinition> findAllElasticAgents(@NotNull
                                                            java.util.Collection<java.lang.String> instanceIds)
Retrieves all elastic agents

Parameters:
instanceIds - the instances ids on which the agents were running
Returns:
List

findAllAgents

java.util.List<PipelineDefinition> findAllAgents()
Retrieves all agents();

Returns:
List of all agents

findAllAgentsWithNameLike

@NotNull
java.util.List<PipelineDefinition> findAllAgentsWithNameLike(@NotNull
                                                                     java.lang.String likeName)
Retrun a list of agents whose name is like the provided string. Uses hibernate's "like" so % to mark wild card.

Parameters:
likeName - the string to match
Returns:
List of Pipeline Definitions

findAllAgentsForAgentIds

java.util.Set<PipelineDefinition> findAllAgentsForAgentIds(@NotNull
                                                           java.util.Collection<java.lang.Long> agentIds)
Return a list of agents by their ids

Parameters:
buildResultsSummaries -
Returns:
List of PipelineDefinition

findAgentByName

@Nullable
PipelineDefinition findAgentByName(@NotNull
                                            java.lang.String name)
Retrieve a pipelineDefinition by name. Names should be unique.

Parameters:
name - of the agent to find
Returns:
the agent that has the given name.


Copyright © 2013 Atlassian Software Systems Pty Ltd. All Rights Reserved.