Class AgentHibernateDao

    • Constructor Detail

      • AgentHibernateDao

        public AgentHibernateDao()
    • Method Detail

      • getPersistentClass

        public Class getPersistentClass()
        Specified by:
        getPersistentClass in interface bucket.core.persistence.ObjectDao
      • saveAndReturn

        @NotNull
        public @NotNull PipelineDefinition saveAndReturn​(@NotNull
                                                         @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 List<PipelineDefinition> findAll()
        Description copied from class: BambooHibernateObjectDao
        Find all objects of the class provided by getPersistentClass()
        Specified by:
        findAll in interface bucket.core.persistence.ObjectDao
        Overrides:
        findAll in class BambooHibernateObjectDao
        Returns:
        a list of all objects of the appropriate class, or the empty list if no objects are found
      • getAgentCount

        public long getAgentCount​(Class<? extends PipelineDefinition> 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 @NotNull 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
      • findAllAgentsWithNameLike

        @NotNull
        public @NotNull List<PipelineDefinition> findAllAgentsWithNameLike​(@NotNull
                                                                           @NotNull 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
      • findAgentByName

        @Nullable
        public @Nullable PipelineDefinition findAgentByName​(@NotNull
                                                            @NotNull 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.
      • updateAgentShutdownTime

        public void updateAgentShutdownTime​(@NotNull
                                            @NotNull PipelineDefinition agentDefinition)
        Description copied from interface: AgentDao
        Updates agent shutdown time taking into account that passed object might not be in session.
        Specified by:
        updateAgentShutdownTime in interface AgentDao