Holger's Java API

## com.antelmann.db
Class AbstractUserLoginStore

    java.lang.Object
      com.antelmann.db.AbstractUserLoginStore

All Implemented Interfaces:
  UserLoginStore

Direct Known Subclasses:
  DefaultUserLoginStore

    public abstract class AbstractUserLoginStore

extends Object
implements UserLoginStore

a base for easily implementing a UserLoginStore. The only methods left to be implemented are:

- `getUserForName(String)`
- `getUserNames()`

Since:
  15. November 2006, 23:09
Author:
  Holger Antelmann

Constructor Summary
`AbstractUserLoginStore()`

Method Summary
`void` `addLoginListener(LoginListener listener)`
`User[]` `getActiveUsers()` returns a generated array of currently active users (never null).
`User` `getBackDoorUser()`
`User` `getCurrentUser()` returns the current user (that is also among the active users)
`LoginListener[]` `getLoginListeners()`
`Date` `getLoginTime(User user)` returns the time when the given user has logged in; returns null if the user is not an active user.
`boolean` `isActiveUser(User user)`
`ArrayList<User>` `listUsers(Filter<? super User> filter)`
`static ArrayList<User>` `listUsers(UserLoginStore uls, Filter<? super User> filter)` it may be more efficient to achieve this via an embedded DBClassStore if applicable
`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
`static void` `logoutAll(UserLoginStore uls)`
`boolean` `logoutUser(User user)` listeners are only informed if the user was actually logged in prior to this call
`void` `removeLoginListener(LoginListener listener)`
`void` `setBackDoorUser(User backDoorUser)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.antelmann.db.UserLoginStore
`getUserForName, getUserNames`

Constructor Detail

### AbstractUserLoginStore

    public AbstractUserLoginStore()

Method Detail

### getBackDoorUser

    public User getBackDoorUser()

### setBackDoorUser

    public void setBackDoorUser(User backDoorUser)

### addLoginListener

    public void addLoginListener(LoginListener listener)

  Specified by:
    `addLoginListener` in interface `UserLoginStore`

### removeLoginListener

    public void removeLoginListener(LoginListener listener)

  Specified by:
    `removeLoginListener` in interface `UserLoginStore`

### getLoginListeners

    public LoginListener[] getLoginListeners()

  Specified by:
    `getLoginListeners` in interface `UserLoginStore`

### getCurrentUser

    public User getCurrentUser()

  Description copied from interface: `UserLoginStore`
  returns the current user (that is also among the active users)

  Specified by:
    `getCurrentUser` in interface `UserLoginStore`

### getActiveUsers

    public User[] getActiveUsers()

  Description copied from interface: `UserLoginStore`
  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.

  Specified by:
    `getActiveUsers` in interface `UserLoginStore`

### isActiveUser

    public boolean isActiveUser(User user)

### getLoginTime

    public Date getLoginTime(User user)

  returns the time when the given user has logged in; returns null if the user is not an active user.

### loginUser

    public void loginUser(User user,
                          String fromLocation)
                   throws FailedLoginException,
                          DatabaseException

  Description copied from interface: `UserLoginStore`
  allows to login a user via API directly

  Specified by:
    `loginUser` in interface `UserLoginStore`
  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

### loginUser

    public User loginUser(String name,
                          char[] password,
                          String fromLocation)
                   throws FailedLoginException,
                          DatabaseException

  Description copied from interface: `UserLoginStore`
  returns the User that corresponds to the credentials provided; listeners are notified

  Specified by:
    `loginUser` in interface `UserLoginStore`
  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

### logoutUser

    public boolean logoutUser(User user)

  listeners are only informed if the user was actually logged in prior to this call

  Specified by:
    `logoutUser` in interface `UserLoginStore`
  Returns:
    true only if the user was actually logged out (and previously logged in)

### loginCanceled

    public void loginCanceled(String location)

  Description copied from interface: `UserLoginStore`
  allows to notify the listeners of a canceled login

  Specified by:
    `loginCanceled` in interface `UserLoginStore`

### listUsers

    public ArrayList<User> listUsers(Filter<? super User> filter)
                              throws DatabaseException

  Throws:
    `DatabaseException`

### listUsers

    public static ArrayList<User> listUsers(UserLoginStore uls,
                                            Filter<? super User> filter)
                                     throws DatabaseException

  it may be more efficient to achieve this via an embedded DBClassStore if applicable

  Throws:
    `DatabaseException`

### logoutAll

    public static void logoutAll(UserLoginStore uls)
                          throws DatabaseException

  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