Class BasicAgentStorage

java.lang.Object
i5.las2peer.security.BasicAgentStorage
All Implemented Interfaces:
AgentStorage

public class BasicAgentStorage extends Object implements AgentStorage
A simple Hashtable based storage for agents.
  • Constructor Details

    • BasicAgentStorage

      public BasicAgentStorage(AgentStorage backupStorage)
      create a basic agent storage with a backupStorage to use, if a requested agent is not stored here (i.e. a Node to look for the requested agent in the whole network
      Parameters:
      backupStorage -
    • BasicAgentStorage

      public BasicAgentStorage()
      create a new basic agent storage
  • Method Details

    • registerAgent

      public void registerAgent(AgentImpl agent)
      register an agent for later use use a locked copy to store
      Parameters:
      agent -
    • registerAgents

      public void registerAgents(AgentImpl... agents)
      register multiple agents to this storage
      Parameters:
      agents -
    • unregisterAgent

      public void unregisterAgent(AgentImpl agent)
      remove an agent from this storage
      Parameters:
      agent -
    • unregisterAgent

      public void unregisterAgent(String id)
      remove an agent from this storage
      Parameters:
      id -
    • getAgent

      public AgentImpl getAgent(String id) throws AgentNotFoundException, AgentException
      Description copied from interface: AgentStorage
      get an agent from this storage
      Specified by:
      getAgent in interface AgentStorage
      Parameters:
      id - the agent id
      Returns:
      a new locked Agent instance
      Throws:
      AgentNotFoundException - If the agent is not found in this storage
      AgentException - If any other issue with the agent occurs, e. g. XML not readable
    • hasAgent

      public boolean hasAgent(String id)
      Description copied from interface: AgentStorage
      does this storage know the requested agent? Does not refer to the backup storage if applicable
      Specified by:
      hasAgent in interface AgentStorage
      Returns:
      true, if this storage knows an agent of the given id