Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base
Class UserManagerAdapter

java.lang.Object
  extended by com.jivesoftware.base.UserManagerAdapter
All Implemented Interfaces:
IntrospectiveUserManager, UserManager
Direct Known Subclasses:
DbUserManager

public abstract class UserManagerAdapter
extends java.lang.Object
implements IntrospectiveUserManager

UserManagerAdapter is an abstract class implementation of the IntrospectiveUserManager interface. It assumes that none of the optional capabilities are implemented, and it provides caching. Concrete subclasses must implement lookupUser(String username) and lookupUser(long userid) for the uncached, direct look up of the user data. If they implement any of the optional capabilities, they should also overide the corresponding "is...Supported()" method to return true.


Constructor Summary
UserManagerAdapter()
           
 
Method Summary
 User createUser(java.lang.String username, java.lang.String password, java.lang.String email)
          Factory method for creating a new User with all required values: a password, email address, and unique username.
 User createUser(java.lang.String username, java.lang.String password, java.lang.String name, java.lang.String email, boolean nameVisible, boolean emailVisible, java.util.Map properties)
          Factory method for creating a new User with all required AND optional values.
 void deleteUser(User user)
          Deletes a user.
 User getUser(long userID)
          Implementation that checks cache, if empty calls lookupUser(User)
 User getUser(java.lang.String username)
          Implementation that calls getUser(getUserID(username)).
 int getUserCount()
          Returns the number of users in the system.
 long getUserID(java.lang.String username)
          Checks cache for userID, if it does find it, calls lookupUser(String username), and caches and returns resulting userID.
 boolean isCreateUserSupported()
          Indicates whether user creation (createUser(String username, String password, String email)) is supported.
 boolean isDeleteUserSupported()
          Indicates whether user deletion (deleteUser(User user)) is supported.
 boolean isGetUserCountSupported()
          Indicates whether getting a count of all users (getUserCount()) is supported.
 boolean isGetUserFromEmailAddressSupported()
          Indicates whether retrieving a user for an email address (getUserFromEmailAddress(String emailAddr)) is supported.
 boolean isReadOnly()
           
 boolean isUserListSupported()
          Indicates whether getting an Iterator of all users (users()) is supported.
protected abstract  User lookupUser(long userID)
          Returns a User with a given user ID.
protected abstract  User lookupUser(java.lang.String username)
          Returns a User with a given username.
 java.util.Iterator users()
          Returns an iterator for all users in the system.
 java.util.Iterator users(int startIndex, int numResults)
          Returns an iterator for all users starting at startIndex with the given number of results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManagerAdapter

public UserManagerAdapter()
Method Detail

isCreateUserSupported

public boolean isCreateUserSupported()
Description copied from interface: IntrospectiveUserManager
Indicates whether user creation (createUser(String username, String password, String email)) is supported.

Specified by:
isCreateUserSupported in interface IntrospectiveUserManager
Returns:
true if user creation is supported.

isDeleteUserSupported

public boolean isDeleteUserSupported()
Description copied from interface: IntrospectiveUserManager
Indicates whether user deletion (deleteUser(User user)) is supported.

Specified by:
isDeleteUserSupported in interface IntrospectiveUserManager
Returns:
true if user deletion is supported.

isGetUserCountSupported

public boolean isGetUserCountSupported()
Description copied from interface: IntrospectiveUserManager
Indicates whether getting a count of all users (getUserCount()) is supported.

Specified by:
isGetUserCountSupported in interface IntrospectiveUserManager
Returns:
true if getting a count of all users is supported.

isUserListSupported

public boolean isUserListSupported()
Description copied from interface: IntrospectiveUserManager
Indicates whether getting an Iterator of all users (users()) is supported.

Specified by:
isUserListSupported in interface IntrospectiveUserManager
Returns:
true if getting an iterator of all users is supported.

isGetUserFromEmailAddressSupported

public boolean isGetUserFromEmailAddressSupported()
Description copied from interface: IntrospectiveUserManager
Indicates whether retrieving a user for an email address (getUserFromEmailAddress(String emailAddr)) is supported.

Specified by:
isGetUserFromEmailAddressSupported in interface IntrospectiveUserManager
Returns:
true if getting a user with a specific email address is supported.

createUser

public User createUser(java.lang.String username,
                       java.lang.String password,
                       java.lang.String email)
                throws UserAlreadyExistsException
Description copied from interface: UserManager
Factory method for creating a new User with all required values: a password, email address, and unique username.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
createUser in interface UserManager
Parameters:
username - the new and unique username for the account.
password - the password for the account as plain text.
email - the email address for the account.
Returns:
a new User.
Throws:
UserAlreadyExistsException - if the username already exists in the system.

createUser

public User createUser(java.lang.String username,
                       java.lang.String password,
                       java.lang.String name,
                       java.lang.String email,
                       boolean nameVisible,
                       boolean emailVisible,
                       java.util.Map properties)
                throws UserAlreadyExistsException
Description copied from interface: UserManager
Factory method for creating a new User with all required AND optional values.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
createUser in interface UserManager
Parameters:
username - the new and unique username for the account.
password - the password for the account as plain text.
name - the name for the account.
email - the email address for the account.
nameVisible - true if the user's name should be visible to others.
emailVisible - true if the user's email address should be visible to others.
properties - the user's extended properties.
Returns:
a new User.
Throws:
UserAlreadyExistsException - if the username already exists in the system.

deleteUser

public void deleteUser(User user)
                throws UnauthorizedException
Description copied from interface: UserManager
Deletes a user. To maintain data consistency, deleting a user will cause all messages created by the user to switch to being from an anonymous author.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
deleteUser in interface UserManager
Parameters:
user - the user to delete.
Throws:
UnauthorizedException

getUserCount

public int getUserCount()
Description copied from interface: UserManager
Returns the number of users in the system.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
getUserCount in interface UserManager
Returns:
the total number of users.

users

public java.util.Iterator users()
Description copied from interface: UserManager
Returns an iterator for all users in the system.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
users in interface UserManager
Returns:
an Iterator for all users.

users

public java.util.Iterator users(int startIndex,
                                int numResults)
Description copied from interface: UserManager
Returns an iterator for all users starting at startIndex with the given number of results. This is useful to support pagination in a GUI where you may only want to display a certain number of results per page. It is possible that the number of results returned will be less than that specified by numResults if numResults is greater than the number of records left in the system to display.

If your back-end user store does not support this operation, throw an UnsupportedOperationException.

Specified by:
users in interface UserManager
Parameters:
startIndex - the beginning index to start the results at.
numResults - the total number of results to return.
Returns:
an Iterator for all users in the specified range.

isReadOnly

public boolean isReadOnly()
Specified by:
isReadOnly in interface IntrospectiveUserManager

getUser

public User getUser(long userID)
             throws UserNotFoundException
Implementation that checks cache, if empty calls lookupUser(User)

Specified by:
getUser in interface UserManager
Parameters:
userID - the id of the User to lookup.
Returns:
the User specified by userID.
Throws:
UserNotFoundException - if the user does not exist.

getUser

public User getUser(java.lang.String username)
             throws UserNotFoundException
Implementation that calls getUser(getUserID(username)).

Specified by:
getUser in interface UserManager
Parameters:
username - the username of the user.
Returns:
the User that matches username.
Throws:
UserNotFoundException - if the user does not exist.

getUserID

public long getUserID(java.lang.String username)
               throws UserNotFoundException
Checks cache for userID, if it does find it, calls lookupUser(String username), and caches and returns resulting userID.

Specified by:
getUserID in interface UserManager
Parameters:
username - the username of the usedr.
Returns:
the userID that matches username.
Throws:
UserNotFoundException - if the user does not exist.

lookupUser

protected abstract User lookupUser(long userID)
                            throws UserNotFoundException
Returns a User with a given user ID. This method does not cache -- it checks the underlying User directory or data store.

Throws:
UserNotFoundException

lookupUser

protected abstract User lookupUser(java.lang.String username)
                            throws UserNotFoundException
Returns a User with a given username. This method does not cache -- it checks the underlying User directory or data store.

Throws:
UserNotFoundException

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.