com.atlassian.user.impl.ehcache
Class EhcacheUserManager

java.lang.Object
  extended by com.atlassian.user.impl.ehcache.EhcacheUserManager
All Implemented Interfaces:
EntityManager, UserManager

public class EhcacheUserManager
extends Object
implements UserManager


Field Summary
protected  CacheManager cacheManager
           
static String REPOSITORY_CACHE
           
protected  UserManager underlyingUserManager
           
static String USER_CACHE
           
static String USER_READ_ONLY_CACHE
           
 
Constructor Summary
EhcacheUserManager(UserManager underlyingUserManager, CacheManager cacheManager)
           
 
Method Summary
 void alterPassword(User user, String plainTextPass)
          Encrypts the plain password, sets it on the user, and saves the user.
 User createUser(String username)
           
 Repository getRepository()
           
 Repository getRepository(Entity entity)
           
 User getUser(String username)
          Caches users retrieved.
Will also cache the fact that a user could not be found (so that we don't incur the expense of another search when have previously determined that a user doesn't exist) Hence this method will also cache null results.
 Pager getUserNames()
           
 Pager getUsers()
           
 void init(HashMap args)
          Used during configuration initialization.
 boolean isCreative()
          Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or GroupManager.createGroup(String)
 boolean isReadOnly(User user)
           
 void removeUser(User user)
          Removes the specified group, if it is present.
 void saveUser(User user)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_CACHE

public static final String USER_CACHE

USER_READ_ONLY_CACHE

public static final String USER_READ_ONLY_CACHE

REPOSITORY_CACHE

public static final String REPOSITORY_CACHE

underlyingUserManager

protected final UserManager underlyingUserManager

cacheManager

protected final CacheManager cacheManager
Constructor Detail

EhcacheUserManager

public EhcacheUserManager(UserManager underlyingUserManager,
                          CacheManager cacheManager)
Method Detail

getUsers

public Pager getUsers()
               throws EntityException
Specified by:
getUsers in interface UserManager
Returns:
a Pager holding all users being managed.
Throws:
EntityException

getUserNames

public Pager getUserNames()
                   throws EntityException
Specified by:
getUserNames in interface UserManager
Returns:
a Pager holding the names of all users being managed.
Throws:
EntityException

getUser

public User getUser(String username)
             throws EntityException
Caches users retrieved.
Will also cache the fact that a user could not be found (so that we don't incur the expense of another search when have previously determined that a user doesn't exist) Hence this method will also cache null results.

Specified by:
getUser in interface UserManager
Parameters:
username -
Returns:
- an User if one could be found, otherwise null.
Throws:
EntityException - - representing the exception which prohibited looking for or retrieving the user.

createUser

public User createUser(String username)
                throws EntityException
Specified by:
createUser in interface UserManager
Parameters:
username -
Returns:
Throws:
UnsupportedOperationException
EntityException - UnsupportedOperationException (optional)

alterPassword

public void alterPassword(User user,
                          String plainTextPass)
                   throws EntityException
Encrypts the plain password, sets it on the user, and saves the user.

Specified by:
alterPassword in interface UserManager
Parameters:
user -
plainTextPass -
Throws:
EntityException - - representing a system error.

saveUser

public void saveUser(User user)
              throws EntityException
Specified by:
saveUser in interface UserManager
Parameters:
user -
Throws:
EntityException

removeUser

public void removeUser(User user)
                throws EntityException
Removes the specified group, if it is present.

Specified by:
removeUser in interface UserManager
Parameters:
user -
Throws:
EntityException - - prohibited removal

isReadOnly

public boolean isReadOnly(User user)
                   throws EntityException
Specified by:
isReadOnly in interface UserManager
Parameters:
user -
Returns:
true indicates that information on the user object cannot be altered in the storage system (see Repository), false indicates that the storage system will save changes or that this UserManager does not know about the User.
Throws:
EntityException

getRepository

public Repository getRepository()
Specified by:
getRepository in interface EntityManager
Returns:
a PasswordEncryptor which handles the encrypytion of passwords for users managed by this object.
Throws:
UnsupportedOperationException - - for UserManager objects which do not create User objects.

getRepository

public Repository getRepository(Entity entity)
                         throws EntityException
Specified by:
getRepository in interface EntityManager
Parameters:
entity -
Returns:
the Repository in which the entity is stored, otherwise null.
Throws:
EntityException

isCreative

public boolean isCreative()
Used to detemine whether an entity can be created (eg, can call UserManager.createUser(String) or GroupManager.createGroup(String)

Specified by:
isCreative in interface EntityManager
Returns:
true to indicate that Entity objects can be created by this manager, or false to indicate not.

init

public void init(HashMap args)
Used during configuration initialization. Use a constructor for direct instantiation.

Specified by:
init in interface EntityManager
Parameters:
args -


Atlassian User is developed by Atlassian Software Systems.