Class AgentImpl

java.lang.Object
org.opencastproject.capture.admin.impl.AgentImpl
All Implemented Interfaces:
Agent

@Entity public class AgentImpl extends Object implements Agent
An in-memory construct to represent the state of a capture agent, and when it was last heard from.
  • Field Details

    • name

      protected String name
      The name of the agent.
    • state

      protected String state
      The state of the agent. This should be defined from the constants in AgentState.
    • url

      protected String url
      The URL of the agent. This is determined from the referer header parameter when the agent is registered.
    • organization

      protected String organization
    • lastHeardFrom

      protected Long lastHeardFrom
      The time at which the agent last checked in with this service. Note that this is an absolute timestamp (ie, milliseconds since 1970) rather than a relative timestamp (ie, it's been 3000 ms since it last checked in).
    • schedulerRoles

      protected Set<String> schedulerRoles
      The roles allowed to schedule this agent
    • configurationString

      protected String configurationString
      The capabilities the agent has Capabilities are the devices this agent can record from, with a friendly name associated to determine their nature (e.g. PRESENTER --> dev/video0)
  • Constructor Details

    • AgentImpl

      public AgentImpl()
      Required 0-arg constructor for JAXB, creates a blank agent.
    • AgentImpl

      public AgentImpl(String agentName, String organization, String agentState, String agentUrl, Properties configuration)
      Builds a representation of the agent.
      Parameters:
      agentName - The name of the agent.
      organization - The organization identifier to which this agent belongs
      agentState - The state of the agent. This should be defined from the constants in AgentState
      configuration - The configuration of the agent.
  • Method Details

    • getName

      public String getName()
      Gets the name of the agent.
      Specified by:
      getName in interface Agent
      Returns:
      The name of the agent.
      See Also:
    • setState

      public void setState(String newState)
      Sets the state of the agent, and updates the time it was last heard from.
      Specified by:
      setState in interface Agent
      Parameters:
      newState - The new state of the agent. This should defined from the constants in AgentState. This can be equal to the current one if the goal is to update the timestamp.
      See Also:
    • getState

      public String getState()
      Gets the state of the agent.
      Specified by:
      getState in interface Agent
      Returns:
      The state of the agent. This should be defined from the constants in AgentState.
      See Also:
    • setUrl

      public void setUrl(String agentUrl)
      Sets the url of the agent.
      Specified by:
      setUrl in interface Agent
      Parameters:
      agentUrl - The url of the agent as determined by the referer header field of its request while registering
      See Also:
    • getUrl

      public String getUrl()
      Gets the url of the agent.
      Specified by:
      getUrl in interface Agent
      Returns:
      the url of the agent.
      See Also:
    • setLastHeardFrom

      public void setLastHeardFrom(Long time)
      Sets the time at which the agent last checked in.
      Specified by:
      setLastHeardFrom in interface Agent
      Parameters:
      time - The number of milliseconds since 1970 when the agent last checked in.
      See Also:
    • getLastHeardFrom

      public Long getLastHeardFrom()
      Gets the time at which the agent last checked in.
      Specified by:
      getLastHeardFrom in interface Agent
      Returns:
      The number of milliseconds since 1970 when the agent last checked in.
      See Also:
    • getCapabilities

      public Properties getCapabilities()
      Gets the capture agent's capability list.
      Specified by:
      getCapabilities in interface Agent
      Returns:
      The agent's capabilities, or null if there is an error.
      See Also:
    • getConfiguration

      public Properties getConfiguration()
      Gets the capture agent's full configuration list.
      Specified by:
      getConfiguration in interface Agent
      Returns:
      The agent's configuration, or null if there is an error.
      See Also:
    • getSchedulerRoles

      public Set<String> getSchedulerRoles()
      Returns:
      the schedulerRoles
    • setSchedulerRoles

      public void setSchedulerRoles(Set<String> schedulerRoles)
      Parameters:
      schedulerRoles - the schedulerRoles to set
    • getOrganization

      public String getOrganization()
      Returns:
      the organization
    • setOrganization

      public void setOrganization(String organization)
      Parameters:
      organization - the organization to set
    • setConfiguration

      public void setConfiguration(Properties configuration)
      Sets the capture agent's configuration list.
      Specified by:
      setConfiguration in interface Agent
      Parameters:
      configuration - The agent's configuration.
      See Also:
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also: