Interface AgentDao
- All Superinterfaces:
BambooObjectDao
,bucket.core.persistence.ObjectDao
- All Known Implementing Classes:
AgentHibernateDao
Agent Definition Dao that can search on PipelineDefinitions as well as it subclasses.
-
Method Summary
Modifier and TypeMethodDescription@Nullable PipelineDefinition
findAgentByName
(@NotNull String name) Deprecated.@NotNull List<PipelineDefinition>
findAgentsByName
(@NotNull String name) RetrievePipelineDefinition
s by name.Retrieves all agents();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 agentsRetrieves all ephemeral agents@NotNull List<LocalAgentDefinition>
Retrieves all local agentsRetrieves all remote agentsRetrieves all agents without a shutdown time defined@NotNull List<ElasticAgentDefinition>
findOfflineElasticAgents
(int firstResult, int maxResults) Retrieves offline elastic agents.@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 databasegetLocalAgentById
(long id) Retrieve the localAgentDefinitionlong
getOfflineAgentCount
(Class<? extends PipelineDefinition> agentDefinitionClass) Retrieves the amount of offline agents of given type stored in the databasegetOfflineElasticAgentIds
(int limit) Retrieves a list of offline elastic agents IDs.getOfflineEphemeralAgentIds
(int limit) Retrieves a list of offline ephemeral agents IDs.getOfflineRemoteAgentIds
(int limit) Retrieves a list of offline remote agents IDs.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
Methods inherited from interface bucket.core.persistence.ObjectDao
findAll, findAllSorted, getPersistentClass, refresh, remove, replicate, save, saveRaw
-
Method Details
-
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
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
Retrieve the localAgentDefinition- Parameters:
id
- of the agent- Returns:
- LocalAgentDefintion associated with the id if no agent found, returns null
-
getRemoteAgentById
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
-
getOfflineRemoteAgentIds
Retrieves a list of offline remote agents IDs. Offline remote agents are those that are not currently connected to the server.- Parameters:
limit
- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline remote agents IDs
- Since:
- 11.0
-
getOfflineElasticAgentIds
Retrieves a list of offline elastic agents IDs. Offline elastic agents are those that are not currently connected to the server.- Parameters:
limit
- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline elastic agents IDs
- Since:
- 11.0
-
getOfflineEphemeralAgentIds
Retrieves a list of offline ephemeral agents IDs. Offline ephemeral agents are those that are not currently connected to the server. As ephemeral agents take care of the self-removal once they finish executing the executable they were launched for, this should return only a small portion of agents that couldn't be removed due to errors or temporary unavailability.- Parameters:
limit
- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline ephemeral agents IDs
- Since:
- 11.0
-
getAgentCount
Retrieves the amount of agents of given type stored in the database- Parameters:
agentDefinitionClass
- agent type- Returns:
- amount of agents
-
getOfflineAgentCount
Retrieves the amount of offline agents of given type stored in the database- Parameters:
agentDefinitionClass
- agent type- Returns:
- amount of agents
- Since:
- 11.0
-
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. -
findOfflineElasticAgents
@NotNull @NotNull List<ElasticAgentDefinition> findOfflineElasticAgents(int firstResult, int maxResults) Retrieves offline elastic agents.- Since:
- 11.0
-
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
Return a list of agents by their ids- Returns:
- List of
PipelineDefinition
-
findAgentByName
Deprecated.since 9.2, usefindAgentsByName(String)
insteadRetrieve aPipelineDefinition
by name. Names should be unique. If duplicated names exist, this method will throwNonUniqueResultException
exception.- Parameters:
name
- of the agent to find- Returns:
- the agent that has the given name.
-
findAgentsByName
RetrievePipelineDefinition
s by name. Names should be unique. However, duplicates are possible due to not properly handled unsuccessful registration attempts.- Parameters:
name
- of the agent to find- Returns:
- the list of agents that have the given name.
- Since:
- 9.2
-
updateAgentShutdownTime
Updates agent shutdown time taking into account that passed object might not be in session.- Since:
- 9.4
-
findAgentsByName(String)
instead