com.atlassian.bamboo.buildqueue.dao
Class AgentHibernateDao

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate.support.HibernateDaoSupport
          extended by com.atlassian.hibernate.HibernateObjectDao
              extended by com.atlassian.bamboo.persistence.BambooHibernateObjectDao
                  extended by com.atlassian.bamboo.buildqueue.dao.AgentHibernateDao
All Implemented Interfaces:
bucket.core.persistence.ObjectDao, AgentDao, BambooObjectDao, org.springframework.beans.factory.InitializingBean

public class AgentHibernateDao
extends BambooHibernateObjectDao
implements AgentDao


Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
AgentHibernateDao()
           
 
Method Summary
 PipelineDefinition findAgentByName(java.lang.String name)
          Retrieve a pipelineDefinition by name.
 java.util.List<PipelineDefinition> findAll()
           
 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 nameLike)
          Retrun a list of agents whose name is like the provided string.
 java.util.List<ElasticAgentDefinition> findAllElasticAgents()
          Retrieves all elastic agents
 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
 LocalAgentDefinition getLocalAgentById(long id)
          Retrieve the localAgentDefinition
 java.lang.Class getPersistentClass()
           
 RemoteAgentDefinition 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 class com.atlassian.bamboo.persistence.BambooHibernateObjectDao
executeCountQuery, executeReturnLong, findById, findById
 
Methods inherited from class com.atlassian.hibernate.HibernateObjectDao
findAllSorted, findNamedQuery, findNamedQuery, findNamedQuery, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParam, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findNamedQueryStringParams, findSingleObject, getByClassId, index, refresh, reIndex, remove, replicate, save, saveRaw, setIndexer, unIndex, updateModificationData
 
Methods inherited from class org.springframework.orm.hibernate.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.persistence.BambooObjectDao
findById
 
Methods inherited from interface bucket.core.persistence.ObjectDao
findAllSorted, refresh, remove, replicate, save, saveRaw
 

Constructor Detail

AgentHibernateDao

public AgentHibernateDao()
Method Detail

getPersistentClass

public java.lang.Class getPersistentClass()
Specified by:
getPersistentClass in interface bucket.core.persistence.ObjectDao

saveAndReturn

@NotNull
public PipelineDefinition saveAndReturn(@NotNull
                                                PipelineDefinition pipelineDefinition)
Description copied from interface: AgentDao
Saves the passed definition and returns a new copy of the updated pipeline definition

Specified by:
saveAndReturn in interface AgentDao
Parameters:
pipelineDefinition - to save
Returns:
the saved and updated (e.g with agentId) pipelineDefinition

getAgentById

public PipelineDefinition getAgentById(long id)
Description copied from interface: AgentDao
Retrieve the agentDefinition object.

Specified by:
getAgentById in interface AgentDao
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

public LocalAgentDefinition getLocalAgentById(long id)
Description copied from interface: AgentDao
Retrieve the localAgentDefinition

Specified by:
getLocalAgentById in interface AgentDao
Parameters:
id - of the agent
Returns:
LocalAgentDefintion associated with the id if no agent found, returns null

getRemoteAgentById

public RemoteAgentDefinition getRemoteAgentById(long id)
Description copied from interface: AgentDao
Retrieve the remoteAgentDefinition

Specified by:
getRemoteAgentById in interface AgentDao
Parameters:
id - of the agent
Returns:
RemoteAgentDefintion associated with the id if no agent found, returns null

findAll

public java.util.List<PipelineDefinition> findAll()
Specified by:
findAll in interface bucket.core.persistence.ObjectDao
Overrides:
findAll in class com.atlassian.hibernate.HibernateObjectDao

findAllAgents

public java.util.List<PipelineDefinition> findAllAgents()
Description copied from interface: AgentDao
Retrieves all agents();

Specified by:
findAllAgents in interface AgentDao
Returns:
List of all agents

findAllRemoteAgents

public java.util.List<RemoteAgentDefinition> findAllRemoteAgents()
Description copied from interface: AgentDao
Retrieves all remote agents

Specified by:
findAllRemoteAgents in interface AgentDao
Returns:
List of all remote agents

findAllLocalAgents

public java.util.List<LocalAgentDefinition> findAllLocalAgents()
Description copied from interface: AgentDao
Retrieves all local agents

Specified by:
findAllLocalAgents in interface AgentDao
Returns:
List of all local agents

findNotShutDownElasticAgents

public java.util.List<ElasticAgentDefinition> findNotShutDownElasticAgents()
Description copied from interface: AgentDao
Retrieves all agents without a shutdown time defined

Specified by:
findNotShutDownElasticAgents in interface AgentDao
Returns:
all agents without a shutdown time defined

getAgentCount

public long getAgentCount(java.lang.Class<ElasticAgentDefinition> agentDefinitionClass)
Description copied from interface: AgentDao
Retrieves the amount of agents of given type stored in the database

Specified by:
getAgentCount in interface AgentDao
Parameters:
agentDefinitionClass - agent type
Returns:
amount of agents

findAllElasticAgents

@NotNull
public java.util.List<ElasticAgentDefinition> findAllElasticAgents()
Description copied from interface: AgentDao
Retrieves all elastic agents

Specified by:
findAllElasticAgents in interface AgentDao

findAllElasticAgents

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

Specified by:
findAllElasticAgents in interface AgentDao

findAllElasticAgents

public java.util.List<ElasticAgentDefinition> findAllElasticAgents(@NotNull
                                                                   java.util.Collection<java.lang.String> instanceIds)
Description copied from interface: AgentDao
Retrieves all elastic agents

Specified by:
findAllElasticAgents in interface AgentDao
Parameters:
instanceIds - the instances ids on which the agents were running
Returns:
List

findAllAgentsWithNameLike

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

Specified by:
findAllAgentsWithNameLike in interface AgentDao
Parameters:
nameLike - the string to match
Returns:
List of Pipeline Definitions

findAllAgentsForAgentIds

public java.util.Set<PipelineDefinition> findAllAgentsForAgentIds(@NotNull
                                                                  java.util.Collection<java.lang.Long> agentIds)
Description copied from interface: AgentDao
Return a list of agents by their ids

Specified by:
findAllAgentsForAgentIds in interface AgentDao
Returns:
List of PipelineDefinition

findAgentByName

@Nullable
public PipelineDefinition findAgentByName(@NotNull
                                                   java.lang.String name)
Description copied from interface: AgentDao
Retrieve a pipelineDefinition by name. Names should be unique.

Specified by:
findAgentByName in interface AgentDao
Parameters:
name - of the agent to find
Returns:
the agent that has the given name.


Copyright © 2011 Atlassian. All Rights Reserved.