Class Database.AgentEntry
java.lang.Object
edu.uky.cs.nil.tt.Database.Entry
edu.uky.cs.nil.tt.Database.Listable
edu.uky.cs.nil.tt.Database.AgentEntry
- All Implemented Interfaces:
Named
- Enclosing class:
Database
A
database entry for an agent.- Author:
- Stephen G. Ware
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetLimit()Returns the maximum number of agents with this entry's name that may be participating in sessions simultaneously.voidsetLimit(int limit) Sets the maximum number of agents with this entry's name that may be participating in sessions simultaneously.voidsetPassword(String password) Sets this agent's password.booleanChecks whether a given password matches this agent's password.Methods inherited from class Database.Listable
getListed, setListedMethods inherited from class Database.Entry
getDescription, getName, getTitle, setDescription, setTitle, toString
-
Constructor Details
-
AgentEntry
Constructs a new agent database entry from a name.- Parameters:
name- the system name of the agent
-
-
Method Details
-
verify
Checks whether a given password matches this agent's password. Technically, this method checks whether the salted hashes of the agent's password and the given password match; hash collisions are unlikely but possible.- Parameters:
password- the password to check against the agent's password- Returns:
- true if this agent has no password or if the passwords match, false otherwise
-
setPassword
Sets this agent's password. The given password can be null to remove password protection from this agent.- Parameters:
password- the new agent password, or null to remove password protection
-
getLimit
public int getLimit()Returns the maximum number of agents with this entry's name that may be participating in sessions simultaneously. Agent limits can be used to prevent agents which require many resources from overwhelming the server.- Returns:
- the maximum number of instances of this agent that may be in sessions simultaneously, or 0 if there is no limit
-
setLimit
public void setLimit(int limit) Sets the maximum number of agents with this entry's name that may be participating in sessions simultaneously.- Parameters:
limit- the maximum number of instances of this agent that may be in sessions simultaneously, or 0 for no limit
-