Holger's Java API

## com.antelmann.sql
Class UserImplStore<T extends UserImpl>

    java.lang.Object
      com.antelmann.sql.JDBCRowStore<T>
          com.antelmann.sql.UserImplStore<T>

All Implemented Interfaces:
  DBClassStore<T>, TransactionRequired, UserLoginStore, MappingInfo, ProcessorHook<T,DatabaseException>, Wrapped<AbstractUserLoginStore>

    public class UserImplStore<T extends UserImpl>

extends JDBCRowStore<T>
implements UserLoginStore, Wrapped<AbstractUserLoginStore>

provides a user store implementation that implements UserLoginStore, so that the database can be queried based on that interface.

Since:
  27. März 2007, 23:31
Author:
  Holger Antelmann

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.db.DBClassStore
`DBClassStore.DBMethod`

Field Summary

Fields inherited from class com.antelmann.sql.JDBCRowStore
`database, ensureTransactionsOnFetch, helper, mapper`

Constructor Summary
`UserImplStore(Database<Connection> db, UserImplMapper<T> mapper, Class<T> userType)`

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()`
`UserImplMapper<T>` `getMapper()`
`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)`
`AbstractUserLoginStore` `unwrap()` returns the embedded instance that this wrapper encloses

Methods inherited from class com.antelmann.sql.JDBCRowStore

`add, checkTransaction, containsID, deleteEntries, deleteEntry, fetch, fetchStubs, generateNewID, getColumnNames, getColumnsForTopic, getColumnSize, getDatabase, getDisplayColumn, getDisplayNameForColumn, getEntry, getEntryClass, getIDColumn, getMappingForTopic, getSQLTypeforColumn, getStub, getTableName, getTableQuery, insert, insertAsNew, isFastDelete, isIgnoreInvalidProperties, remove, setFastDelete, setIgnoreInvalidProperties, size, trimIdString, update`

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

Constructor Detail

### UserImplStore

    public UserImplStore(Database<Connection> db,
                         UserImplMapper<T> mapper,
                         Class<T> userType)

Method Detail

### getMapper

    public UserImplMapper<T> getMapper()

  Overrides:
    `getMapper` in class `JDBCRowStore<T extends UserImpl>`

### addLoginListener

    public void addLoginListener(LoginListener listener)

  Specified by:
    `addLoginListener` 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()
                          throws DatabaseException

  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`
  Throws:
    `DatabaseException`

### getLoginListeners

    public LoginListener[] getLoginListeners()

  Specified by:
    `getLoginListeners` in interface `UserLoginStore`

### getUserNames

    public Iterable<String> getUserNames()
                                  throws DatabaseException

  Description copied from interface: `UserLoginStore`
  returns a list of valid user names (never null)

  Specified by:
    `getUserNames` in interface `UserLoginStore`
  Throws:
    `DatabaseException`

### getUserForName

    public User getUserForName(String name)
                        throws DatabaseException

  Description copied from interface: `UserLoginStore`
  returns the User associated with the given name or null if no such user exists

  Specified by:
    `getUserForName` in interface `UserLoginStore`
  Throws:
    `DatabaseException`

### 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`

### 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

### 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

### logoutUser

    public boolean logoutUser(User user)
                       throws DatabaseException

  Description copied from interface: `UserLoginStore`
  logs the given user out of this store and notifies the listeners

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

### removeLoginListener

    public void removeLoginListener(LoginListener listener)

  Specified by:
    `removeLoginListener` in interface `UserLoginStore`

### unwrap

    public AbstractUserLoginStore unwrap()

  Description copied from interface: `Wrapped`
  returns the embedded instance that this wrapper encloses

  Specified by:
    `unwrap` in interface `Wrapped<AbstractUserLoginStore>`

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