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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable PipelineDefinition
findAgentByName(@NotNull String name)
Retrieve a pipelineDefinition by name.List<PipelineDefinition>
findAllAgents()
Retrieves all agents();Set<PipelineDefinition>
findAllAgentsForAgentIds(@NotNull Collection<Long> agentIds)
Return a list of agents by their ids@NotNull List<PipelineDefinition>
findAllAgentsWithNameLike(@NotNull String likeName)
Retrun a list of agents whose name is like the provided string.@NotNull List<ElasticAgentDefinition>
findAllElasticAgents(int firstResult, int maxResults)
Retrieves n most recently terminated elastic agents, ordered by termination time, descending.@NotNull List<ElasticAgentDefinition>
findAllElasticAgents(@NotNull Collection<String> instanceIds)
Retrieves all elastic agentsList<EphemeralAgentDefinition>
findAllEphemeralAgents()
Retrieves all ephemeral agentsList<LocalAgentDefinition>
findAllLocalAgents()
Retrieves all local agentsList<RemoteAgentDefinition>
findAllRemoteAgents()
Retrieves all remote agentsList<ElasticAgentDefinition>
findNotShutDownElasticAgents()
Retrieves all agents without a shutdown time defined@Nullable PipelineDefinition
getAgentById(long id)
Retrieve the agentDefinition object.long
getAgentCount(Class<? extends PipelineDefinition> agentDefinitionClass)
Retrieves the amount of agents of given type stored in the databasePipelineDefinition
getLocalAgentById(long id)
Retrieve the localAgentDefinitionPipelineDefinition
getRemoteAgentById(long id)
Retrieve the remoteAgentDefinition@NotNull PipelineDefinition
saveAndReturn(@NotNull PipelineDefinition pipelineDefinition)
Saves the passed definition and returns a new copy of the updated pipeline definitionvoid
updateAgentShutdownTime(@NotNull PipelineDefinition agentDefinition)
Updates agent shutdown time taking into account that passed object might not be in session.-
Methods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findById
-
-
-
-
Method Detail
-
saveAndReturn
@NotNull @NotNull PipelineDefinition saveAndReturn(@NotNull @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 @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
List<RemoteAgentDefinition> findAllRemoteAgents()
Retrieves all remote agents- Returns:
- list of all remote agents
-
findAllEphemeralAgents
List<EphemeralAgentDefinition> findAllEphemeralAgents()
Retrieves all ephemeral agents- Returns:
- list of all ephemeral agents
- Since:
- 9.5
-
findNotShutDownElasticAgents
List<ElasticAgentDefinition> findNotShutDownElasticAgents()
Retrieves all agents without a shutdown time defined- Returns:
- all agents without a shutdown time defined
-
getAgentCount
long getAgentCount(Class<? extends PipelineDefinition> agentDefinitionClass)
Retrieves the amount of agents of given type stored in the database- Parameters:
agentDefinitionClass
- agent type- Returns:
- amount of agents
-
findAllLocalAgents
List<LocalAgentDefinition> findAllLocalAgents()
Retrieves all local agents- Returns:
- list of all local agents
-
findAllElasticAgents
@NotNull @NotNull List<ElasticAgentDefinition> findAllElasticAgents(int firstResult, int maxResults)
Retrieves n most recently terminated elastic agents, ordered by termination time, descending.
-
findAllElasticAgents
@NotNull @NotNull List<ElasticAgentDefinition> findAllElasticAgents(@NotNull @NotNull Collection<String> instanceIds)
Retrieves all elastic agents- Parameters:
instanceIds
- the instances ids on which the agents were running
-
findAllAgents
List<PipelineDefinition> findAllAgents()
Retrieves all agents();- Returns:
- list of all agents
-
findAllAgentsWithNameLike
@NotNull @NotNull List<PipelineDefinition> findAllAgentsWithNameLike(@NotNull @NotNull 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
Set<PipelineDefinition> findAllAgentsForAgentIds(@NotNull @NotNull Collection<Long> agentIds)
Return a list of agents by their ids- Returns:
- List of
PipelineDefinition
-
findAgentByName
@Nullable @Nullable PipelineDefinition findAgentByName(@NotNull @NotNull 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.
-
updateAgentShutdownTime
void updateAgentShutdownTime(@NotNull @NotNull PipelineDefinition agentDefinition)
Updates agent shutdown time taking into account that passed object might not be in session.- Since:
- 9.4
-
-