|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectuserDatabase.UserDatabaseController
public class UserDatabaseController
Controller class of component UserDatabase. Implements the
architecture interface UserDatabaseInterface.
Used to store user-specific data (e. g. identifiers, session keys and buffers).
| Nested Class Summary | |
|---|---|
private class |
UserDatabaseController.cleanDatabaseTask
Simple TimerTask, which calls cleanDatabase(). |
| Field Summary | |
|---|---|
private int |
INACTIVITY_TIMEOUT
Period of time without actions, after which a channel is considered as inactive. |
private static InternalInformationPortController |
internalInformationPort
Reference on component InternalInformationPort. |
private java.util.Hashtable<java.lang.Integer,User> |
localUserIDs
Hashtable containing references on all available
Users, retrievable via a local user identifier
(Integer). |
private static java.util.logging.Logger |
LOGGER
Logger used to log and display information. |
private java.util.Hashtable<java.lang.Integer,User> |
nextMixUserIDs
Hashtable containing references on all available
Users, retrievable via a the next mix' user identifier
(Integer). |
| Constructor Summary | |
|---|---|
UserDatabaseController()
Generates a new UserDatabase component. |
|
| Method Summary | |
|---|---|
void |
addUser(User user)
Adds the bypassed User to the internal database. |
private void |
cleanDatabase()
Removes Users from the internal database that were inactive
for at least INACTIVITY_TIMEOUT ms. |
java.util.Collection<User> |
getActiveUsers()
Returns all Users that are currently active. |
int |
getSize()
Returns the number of Users currently stored in the
internal database. |
User |
getUser(int identifier)
Returns the User with the bypassed identifier. |
User |
getUserByNextMixIdentifier(int nextMixIdentifier)
Returns the User with the bypassed identifier. |
void |
initialize()
Initializes the this component. |
boolean |
isExistingUser(int identifier)
Returns whether a User with the bypassed identifier is
present in the internal database or not. |
void |
removeUser(int identifier)
Removes the User with the bypassed identifier. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static InternalInformationPortController internalInformationPort
InternalInformationPort.
Used to display and/or log data and read general settings.
private static final java.util.logging.Logger LOGGER
private final int INACTIVITY_TIMEOUT
private java.util.Hashtable<java.lang.Integer,User> localUserIDs
Hashtable containing references on all available
Users, retrievable via a local user identifier
(Integer).
private java.util.Hashtable<java.lang.Integer,User> nextMixUserIDs
Hashtable containing references on all available
Users, retrievable via a the next mix' user identifier
(Integer).
Note: The identifier differs from mix to mix to prevent linkability.
| Constructor Detail |
|---|
public UserDatabaseController()
UserDatabase component.
Used to store user-specific data (e. g. identifiers, session keys and buffers).
| Method Detail |
|---|
public void initialize()
public void addUser(User user)
throws UserAlreadyExistingException
User to the internal database.
addUser in interface UserDatabaseInterfaceuser - The User to be added.
UserAlreadyExistingException - Thrown when the bypassed
User has already been added
(user's identifier already in use).public int getSize()
Users currently stored in the
internal database.
getSize in interface UserDatabaseInterfaceUsers currently stored in the internal
database.
public User getUser(int identifier)
throws UnknownUserException
User with the bypassed identifier.
getUser in interface UserDatabaseInterfaceidentifier - Identifier of the User to be returned.
User with the bypassed identifier.
UnknownUserException - Thrown when no User with
the bypassed identifier is existent.public boolean isExistingUser(int identifier)
User with the bypassed identifier is
present in the internal database or not.
isExistingUser in interface UserDatabaseInterfaceidentifier - Identifier to search for.
User present or not.
public void removeUser(int identifier)
throws UnknownUserException
User with the bypassed identifier.
removeUser in interface UserDatabaseInterfaceidentifier - Identifier of the User to be removed
from the internal database.
UnknownUserException - Thrown when no User with
the bypassed identifier is existent.
public User getUserByNextMixIdentifier(int nextMixIdentifier)
throws UnknownUserException
User with the bypassed identifier.
getUserByNextMixIdentifier in interface UserDatabaseInterfacenextMixIdentifier - Identifier of the User to be
returned.
User with the bypassed identifier.
UnknownUserException - Thrown when no User with
the bypassed identifier is existent.public java.util.Collection<User> getActiveUsers()
Users that are currently active.
getActiveUsers in interface UserDatabaseInterfaceUsers currently active.private void cleanDatabase()
Users from the internal database that were inactive
for at least INACTIVITY_TIMEOUT ms.
INACTIVITY_TIMEOUT
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||