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 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

        @NotNull
        @NotNull 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
      • 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
      • 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