Package i5.las2peer.security
Class BasicAgentStorage
java.lang.Object
i5.las2peer.security.BasicAgentStorage
- All Implemented Interfaces:
AgentStorage
A simple Hashtable based storage for agents.
-
Constructor Summary
ConstructorsConstructorDescriptioncreate a new basic agent storageBasicAgentStorage
(AgentStorage backupStorage) create a basic agent storage with a backupStorage to use, if a requested agent is not stored here (i.e. -
Method Summary
Modifier and TypeMethodDescriptionget an agent from this storageboolean
does this storage know the requested agent? Does not refer to the backup storage if applicablevoid
registerAgent
(AgentImpl agent) register an agent for later use use a locked copy to storevoid
registerAgents
(AgentImpl... agents) register multiple agents to this storagevoid
unregisterAgent
(AgentImpl agent) remove an agent from this storagevoid
remove an agent from this storage
-
Constructor Details
-
BasicAgentStorage
create a basic agent storage with a backupStorage to use, if a requested agent is not stored here (i.e. aNode
to look for the requested agent in the whole network- Parameters:
backupStorage
-
-
BasicAgentStorage
public BasicAgentStorage()create a new basic agent storage
-
-
Method Details
-
registerAgent
register an agent for later use use a locked copy to store- Parameters:
agent
-
-
registerAgents
register multiple agents to this storage- Parameters:
agents
-
-
unregisterAgent
remove an agent from this storage- Parameters:
agent
-
-
unregisterAgent
remove an agent from this storage- Parameters:
id
-
-
getAgent
Description copied from interface:AgentStorage
get an agent from this storage- Specified by:
getAgent
in interfaceAgentStorage
- Parameters:
id
- the agent id- Returns:
- a new locked Agent instance
- Throws:
AgentNotFoundException
- If the agent is not found in this storageAgentException
- If any other issue with the agent occurs, e. g. XML not readable
-
hasAgent
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 interfaceAgentStorage
- Returns:
- true, if this storage knows an agent of the given id
-