Class AgentPersistenceFacade

    • Method Detail

      • setTimeService

        public void setTimeService​(@NotNull
                                   TimeService timeService)
      • loadAgent

        @Nullable
        public AgentData loadAgent​(int agentId,
                                   boolean includeUnregistered)
        Description copied from interface: AgentPersister
        Load agent data from database
        Specified by:
        loadAgent in interface AgentPersister
      • setEnabled

        public void setEnabled​(@NotNull
                               BuildAgentEx agent,
                               boolean enabled)
        Description copied from interface: AgentPersister
        Persists this agent status enabled status in database.
        Specified by:
        setEnabled in interface AgentPersister
        Parameters:
        agent - which status to persist
        enabled - enabled value
      • setEnabled

        public void setEnabled​(@NotNull
                               BuildAgentEx agent,
                               boolean enabled,
                               long statusRestoringTimestamp)
        Description copied from interface: AgentPersister
        Persists this agent status enabled status in database.
        Specified by:
        setEnabled in interface AgentPersister
        Parameters:
        agent - which status to persist
        enabled - enabled value
        statusRestoringTimestamp - timestamp at which agent status will be restored
      • getAgentStatusToRestore

        @Nullable
        public Boolean getAgentStatusToRestore​(int agentId)
        Description copied from interface: AgentPersister
        Returns null if agent status will not be restored, otherwise returns status to restore
        Specified by:
        getAgentStatusToRestore in interface AgentPersister
        Parameters:
        agentId - agent id
        Returns:
        null if agent status will not be restored, otherwise returns status to restore
      • getAgentStatusRestoringTimestamp

        @Nullable
        public Long getAgentStatusRestoringTimestamp​(int agentId)
        Description copied from interface: AgentPersister
        Returns null if agent status will not be restored, otherwise returns status restoring timestamp
        Specified by:
        getAgentStatusRestoringTimestamp in interface AgentPersister
        Parameters:
        agentId - agent id
        Returns:
        null if agent status will not be restored, otherwise returns status restoring timestamp
      • setAuthorized

        public void setAuthorized​(@NotNull
                                  BuildAgentEx agent,
                                  boolean authorized)
        Description copied from interface: AgentPersister
        Persists this agent authorized status in database.
        Specified by:
        setAuthorized in interface AgentPersister
        Parameters:
        agent - which status to persist
        authorized - authorized value
      • setAgentTypeId

        public void setAgentTypeId​(@NotNull
                                   BuildAgentEx agent,
                                   int agentTypeId)
        Description copied from interface: AgentPersister
        Persists agent type id
        Specified by:
        setAgentTypeId in interface AgentPersister
        Parameters:
        agent - agent
        agentTypeId - agent type id
      • restoreAgentStatus

        public boolean restoreAgentStatus​(@NotNull
                                          BuildAgentEx agent)
        Description copied from interface: AgentPersister
        Returns true if agent exists in database and its' status has been restored.
        Specified by:
        restoreAgentStatus in interface AgentPersister
        Parameters:
        agent - agent to restore
        Returns:
        true if agent exists in database and its' status has been restored and false otherwise
      • updateAgentAuthorizationToken

        public void updateAgentAuthorizationToken​(@NotNull
                                                  BuildAgentEx agent)
      • authorizationTokenIsValid

        public static boolean authorizationTokenIsValid​(String authorizationToken)
      • register

        public void register​(@NotNull
                             BuildAgentEx agent)
        Description copied from interface: AgentPersister
        Marks agent as registered in database.
        Specified by:
        register in interface AgentPersister
        Parameters:
        agent - agent to update
      • unregister

        public void unregister​(@NotNull
                               BuildAgentEx agent,
                               @NotNull
                               String unregisterReason)
        Description copied from interface: AgentPersister
        Marks agent as unregistered in database.
        Specified by:
        unregister in interface AgentPersister
        Parameters:
        agent - agent to update
        unregisterReason - reason of unregistering
      • resetAgentCaches

        public void resetAgentCaches​(int agentId)
        Description copied from interface: AgentPersister
        Should be called to cleanup internal caches when server detected that agent was removed
        Specified by:
        resetAgentCaches in interface AgentPersister
      • setBindingTimestamp

        public void setBindingTimestamp​(int agentId,
                                        @NotNull
                                        Date timestamp)
        Description copied from interface: AgentPersister
        Updates agent server last binding timestamp
        Specified by:
        setBindingTimestamp in interface AgentPersister
        Parameters:
        agentId - agent id
        timestamp - timestamp
      • getBindingTimestamp

        public Date getBindingTimestamp​(int agentId)
        Description copied from interface: AgentPersister
        Returns last binding timestamp
        Specified by:
        getBindingTimestamp in interface AgentPersister
        Parameters:
        agentId - agent id
        Returns:
        see above