Holger's
Java API

com.antelmann.db
Interface UserLoginStore

All Known Implementing Classes:
AbstractUserLoginStore, DefaultUserLoginStore, UserImplStore

public interface UserLoginStore

defines the ability to manage a system that allows Users to log in/out

Author:
Holger Antelmann
See Also:
JUserLoginPanel

Method Summary
 void addLoginListener(LoginListener listener)
           
 User[] getActiveUsers()
          returns a generated array of currently active users (never null).
 User getCurrentUser()
          returns the current user (that is also among the active users)
 LoginListener[] getLoginListeners()
           
 User getUserForName(String name)
          returns the User associated with the given name or null if no such user exists
 Iterable<String> getUserNames()
          returns a list of valid user names (never null)
 void loginCanceled(String location)
          allows to notify the listeners of a canceled login
 User loginUser(String name, char[] password, String fromLocation)
          returns the User that corresponds to the credentials provided; listeners are notified
 void loginUser(User user, String fromLocation)
          allows to login a user via API directly
 boolean logoutUser(User user)
          logs the given user out of this store and notifies the listeners
 void removeLoginListener(LoginListener listener)
           
 

Method Detail

addLoginListener

void addLoginListener(LoginListener listener)

removeLoginListener

void removeLoginListener(LoginListener listener)

getLoginListeners

LoginListener[] getLoginListeners()

getCurrentUser

User getCurrentUser()
returns the current user (that is also among the active users)


getActiveUsers

User[] getActiveUsers()
                      throws DatabaseException
returns a generated array of currently active users (never null). Assuming that no more than one user can be logged in at any given time, this method would normally return an array with one element (i.e. the current user) - or an empty array if no users are currently logged in.

Throws:
DatabaseException

getUserNames

Iterable<String> getUserNames()
                              throws DatabaseException
returns a list of valid user names (never null)

Throws:
DatabaseException

getUserForName

User getUserForName(String name)
                    throws DatabaseException
returns the User associated with the given name or null if no such user exists

Throws:
DatabaseException

loginUser

User loginUser(String name,
               char[] password,
               String fromLocation)
               throws FailedLoginException,
                      DatabaseException
returns the User that corresponds to the credentials provided; listeners are notified

Throws:
FailedLoginException - if the given credentials don't match any valid active user or if the user is already logged in
DatabaseException - if there was a problem accessing the users in the database

loginUser

void loginUser(User user,
               String fromLocation)
               throws FailedLoginException,
                      DatabaseException
allows to login a user via API directly

Throws:
FailedLoginException - if the given user is not a valid user for this store or if the user is already logged in
DatabaseException - if there was a problem updating the active users in the database

loginCanceled

void loginCanceled(String location)
allows to notify the listeners of a canceled login


logoutUser

boolean logoutUser(User user)
                   throws DatabaseException
logs the given user out of this store and notifies the listeners

Returns:
true only if the user was actually logged out (and previously logged in)
Throws:
DatabaseException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads