Class AgentHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence.BambooHibernateObjectDao
com.atlassian.bamboo.buildqueue.dao.AgentHibernateDao
- All Implemented Interfaces:
bucket.core.persistence.ObjectDao,AgentDao,BambooObjectDao,org.springframework.beans.factory.InitializingBean
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable PipelineDefinitionfindAgentByName(@NotNull String name) Retrieve aPipelineDefinitionby name.@NotNull List<PipelineDefinition> findAgentsByName(@NotNull String name) RetrievePipelineDefinitions by name.findAll()Find all objects of the class provided by getPersistentClass()Retrieves all agents();findAllAgentsForAgentIds(@NotNull Collection<Long> agentIds) Return a list of agents by their ids@NotNull List<PipelineDefinition> findAllAgentsWithNameLike(@NotNull String nameLike) 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 agentsRetrieves 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.getAgentById(long id) Retrieve the agentDefinition object.longgetAgentCount(Class<? extends PipelineDefinition> agentDefinitionClass) Retrieves the amount of agents of given type stored in the databasegetLocalAgentById(long id) Retrieve the localAgentDefinitionlonggetOfflineAgentCount(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 PipelineDefinitionsaveAndReturn(@NotNull PipelineDefinition pipelineDefinition) Saves the passed definition and returns a new copy of the updated pipeline definitionvoidupdateAgentShutdownTime(@NotNull PipelineDefinition agentDefinition) Updates agent shutdown time taking into account that passed object might not be in session.Methods inherited from class com.atlassian.bamboo.persistence.BambooHibernateObjectDao
findAllSorted, findById, findById, refresh, remove, replicate, save, saveRaw, updateModificationDataMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDaoMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findByIdMethods inherited from interface bucket.core.persistence.ObjectDao
findAllSorted, refresh, remove, replicate, save, saveRaw
-
Constructor Details
-
AgentHibernateDao
public AgentHibernateDao()
-
-
Method Details
-
getPersistentClass
- Specified by:
getPersistentClassin interfacebucket.core.persistence.ObjectDao
-
saveAndReturn
@NotNull public @NotNull PipelineDefinition saveAndReturn(@NotNull @NotNull PipelineDefinition pipelineDefinition) Description copied from interface:AgentDaoSaves the passed definition and returns a new copy of the updated pipeline definition- Specified by:
saveAndReturnin interfaceAgentDao- Parameters:
pipelineDefinition- to save- Returns:
- the saved and updated (e.g with agentId) pipelineDefinition
-
getAgentById
Description copied from interface:AgentDaoRetrieve the agentDefinition object.- Specified by:
getAgentByIdin interfaceAgentDao- 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
Description copied from interface:AgentDaoRetrieve the localAgentDefinition- Specified by:
getLocalAgentByIdin interfaceAgentDao- Parameters:
id- of the agent- Returns:
- LocalAgentDefintion associated with the id if no agent found, returns null
-
getRemoteAgentById
Description copied from interface:AgentDaoRetrieve the remoteAgentDefinition- Specified by:
getRemoteAgentByIdin interfaceAgentDao- Parameters:
id- of the agent- Returns:
- RemoteAgentDefintion associated with the id if no agent found, returns null
-
findAll
Description copied from class:BambooHibernateObjectDaoFind all objects of the class provided by getPersistentClass()- Specified by:
findAllin interfacebucket.core.persistence.ObjectDao- Overrides:
findAllin classBambooHibernateObjectDao- Returns:
- a list of all objects of the appropriate class, or the empty list if no objects are found
-
findAllAgents
Description copied from interface:AgentDaoRetrieves all agents();- Specified by:
findAllAgentsin interfaceAgentDao- Returns:
- list of all agents
-
findAllRemoteAgents
Description copied from interface:AgentDaoRetrieves all remote agents- Specified by:
findAllRemoteAgentsin interfaceAgentDao- Returns:
- list of all remote agents
-
findAllEphemeralAgents
Description copied from interface:AgentDaoRetrieves all ephemeral agents- Specified by:
findAllEphemeralAgentsin interfaceAgentDao- Returns:
- list of all ephemeral agents
-
findAllLocalAgents
Description copied from interface:AgentDaoRetrieves all local agents- Specified by:
findAllLocalAgentsin interfaceAgentDao- Returns:
- list of all local agents
-
findNotShutDownElasticAgents
Description copied from interface:AgentDaoRetrieves all agents without a shutdown time defined- Specified by:
findNotShutDownElasticAgentsin interfaceAgentDao- Returns:
- all agents without a shutdown time defined
-
getOfflineRemoteAgentIds
Description copied from interface:AgentDaoRetrieves a list of offline remote agents IDs. Offline remote agents are those that are not currently connected to the server.- Specified by:
getOfflineRemoteAgentIdsin interfaceAgentDao- Parameters:
limit- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline remote agents IDs
-
getOfflineElasticAgentIds
Description copied from interface:AgentDaoRetrieves a list of offline elastic agents IDs. Offline elastic agents are those that are not currently connected to the server.- Specified by:
getOfflineElasticAgentIdsin interfaceAgentDao- Parameters:
limit- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline elastic agents IDs
-
getOfflineEphemeralAgentIds
Description copied from interface:AgentDaoRetrieves 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.- Specified by:
getOfflineEphemeralAgentIdsin interfaceAgentDao- Parameters:
limit- the maximum number of offline remote agents to retrieve- Returns:
- a list of offline ephemeral agents IDs
-
getAgentCount
Description copied from interface:AgentDaoRetrieves the amount of agents of given type stored in the database- Specified by:
getAgentCountin interfaceAgentDao- Parameters:
agentDefinitionClass- agent type- Returns:
- amount of agents
-
getOfflineAgentCount
Description copied from interface:AgentDaoRetrieves the amount of offline agents of given type stored in the database- Specified by:
getOfflineAgentCountin interfaceAgentDao- Parameters:
agentDefinitionClass- agent type- Returns:
- amount of agents
-
findAllElasticAgents
@NotNull public @NotNull List<ElasticAgentDefinition> findAllElasticAgents(int firstResult, int maxResults) Description copied from interface:AgentDaoRetrieves n most recently terminated elastic agents, ordered by termination time, descending.- Specified by:
findAllElasticAgentsin interfaceAgentDao
-
findOfflineElasticAgents
@NotNull public @NotNull List<ElasticAgentDefinition> findOfflineElasticAgents(int firstResult, int maxResults) Description copied from interface:AgentDaoRetrieves offline elastic agents.- Specified by:
findOfflineElasticAgentsin interfaceAgentDao
-
findAllElasticAgents
@NotNull public @NotNull List<ElasticAgentDefinition> findAllElasticAgents(@NotNull @NotNull Collection<String> instanceIds) Description copied from interface:AgentDaoRetrieves all elastic agents- Specified by:
findAllElasticAgentsin interfaceAgentDao- Parameters:
instanceIds- the instances ids on which the agents were running
-
findAllAgentsWithNameLike
@NotNull public @NotNull List<PipelineDefinition> findAllAgentsWithNameLike(@NotNull @NotNull String nameLike) Description copied from interface:AgentDaoRetrun a list of agents whose name is like the provided string. Uses hibernate's "like" so % to mark wild card.- Specified by:
findAllAgentsWithNameLikein interfaceAgentDao- Parameters:
nameLike- the string to match- Returns:
- List of Pipeline Definitions
-
findAllAgentsForAgentIds
public Set<PipelineDefinition> findAllAgentsForAgentIds(@NotNull @NotNull Collection<Long> agentIds) Description copied from interface:AgentDaoReturn a list of agents by their ids- Specified by:
findAllAgentsForAgentIdsin interfaceAgentDao- Returns:
- List of
PipelineDefinition
-
findAgentByName
Description copied from interface:AgentDaoRetrieve aPipelineDefinitionby name. Names should be unique. If duplicated names exist, this method will throwNonUniqueResultExceptionexception.- Specified by:
findAgentByNamein interfaceAgentDao- Parameters:
name- of the agent to find- Returns:
- the agent that has the given name.
-
findAgentsByName
Description copied from interface:AgentDaoRetrievePipelineDefinitions by name. Names should be unique. However, duplicates are possible due to not properly handled unsuccessful registration attempts.- Specified by:
findAgentsByNamein interfaceAgentDao- Parameters:
name- of the agent to find- Returns:
- the list of agents that have the given name.
-
updateAgentShutdownTime
Description copied from interface:AgentDaoUpdates agent shutdown time taking into account that passed object might not be in session.- Specified by:
updateAgentShutdownTimein interfaceAgentDao
-