userDatabase
Class UserDatabaseController

java.lang.Object
  extended by userDatabase.UserDatabaseController
All Implemented Interfaces:
UserDatabaseInterface

public class UserDatabaseController
extends java.lang.Object
implements UserDatabaseInterface

Controller class of component UserDatabase. Implements the architecture interface UserDatabaseInterface.

Used to store user-specific data (e. g. identifiers, session keys and buffers).

Author:
Karl-Peter Fuchs

Constructor Summary
UserDatabaseController()
          Generates a new UserDatabase component.
 
Method Summary
 void addUser(User user)
          Adds the bypassed User to the internal database.
 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
 

Constructor Detail

UserDatabaseController

public UserDatabaseController()
Generates a new UserDatabase component.

Used to store user-specific data (e. g. identifiers, session keys and buffers).

Method Detail

initialize

public void initialize()
Initializes the this component.


addUser

public void addUser(User user)
             throws UserAlreadyExistingException
Adds the bypassed User to the internal database.

Specified by:
addUser in interface UserDatabaseInterface
Parameters:
user - The User to be added.
Throws:
UserAlreadyExistingException - Thrown when the bypassed User has already been added (user's identifier already in use).

getSize

public int getSize()
Returns the number of Users currently stored in the internal database.

Specified by:
getSize in interface UserDatabaseInterface
Returns:
Number of Users currently stored in the internal database.

getUser

public User getUser(int identifier)
             throws UnknownUserException
Returns the User with the bypassed identifier.

Specified by:
getUser in interface UserDatabaseInterface
Parameters:
identifier - Identifier of the User to be returned.
Returns:
User with the bypassed identifier.
Throws:
UnknownUserException - Thrown when no User with the bypassed identifier is existent.

isExistingUser

public boolean isExistingUser(int identifier)
Returns whether a User with the bypassed identifier is present in the internal database or not.

Specified by:
isExistingUser in interface UserDatabaseInterface
Parameters:
identifier - Identifier to search for.
Returns:
User present or not.

removeUser

public void removeUser(int identifier)
                throws UnknownUserException
Removes the User with the bypassed identifier.

Specified by:
removeUser in interface UserDatabaseInterface
Parameters:
identifier - Identifier of the User to be removed from the internal database.
Throws:
UnknownUserException - Thrown when no User with the bypassed identifier is existent.

getUserByNextMixIdentifier

public User getUserByNextMixIdentifier(int nextMixIdentifier)
                                throws UnknownUserException
Returns the User with the bypassed identifier.

Specified by:
getUserByNextMixIdentifier in interface UserDatabaseInterface
Parameters:
nextMixIdentifier - Identifier of the User to be returned.
Returns:
User with the bypassed identifier.
Throws:
UnknownUserException - Thrown when no User with the bypassed identifier is existent.

getActiveUsers

public java.util.Collection<User> getActiveUsers()
Returns all Users that are currently active.

Specified by:
getActiveUsers in interface UserDatabaseInterface
Returns:
Collection of all Users currently active.