org.exolab.jms.authentication
Class UserManager

java.lang.Object
  |
  +--org.exolab.jms.service.Service
        |
        +--org.exolab.jms.authentication.UserManager
All Implemented Interfaces:
Serviceable

public class UserManager
extends Service

The user manager is responsible for creating and managing users.

Version:
$Revision: 1.4 $ $Date: 2005/12/23 12:17:45 $
Author:
Knut Lerpold, Tim Anderson

Constructor Summary
UserManager(Configuration config, DatabaseService database)
          Construct a new UserManager.
 
Method Summary
protected  void addToUserCache(User user)
          Add the specified entry to the user cache.
 boolean createUser(User user)
          Create a new user.
 boolean deleteUser(User user)
          Delete an user.
protected  void doStart()
          Start the service.
protected  void doStop()
          Stop the service.
 User getUser(User user)
          Return a user.
protected  void init()
          Initialise user manager.
protected  void registerConfiguredUsers()
          Registers users specified in the configuration.
protected  void removeFromUserCache(User user)
          Remove the specified user from the cache.
 boolean updateUser(User user)
          Update an user.
 java.util.Iterator userNames()
          Return a list of user names currently supported by the user manager.
 boolean validateUser(java.lang.String username, java.lang.String password)
          Determines if a user's name and password are valid.
 
Methods inherited from class org.exolab.jms.service.Service
getName, isStarted, restart, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserManager

public UserManager(Configuration config,
                   DatabaseService database)
Construct a new UserManager.
Parameters:
config - the configuration
database - the database service
Method Detail

createUser

public boolean createUser(User user)
Create a new user.
Parameters:
user - the user to create
Returns:
true if the user is created otherwise false

updateUser

public boolean updateUser(User user)
Update an user. Only possible update is password.
Parameters:
user - the user to update
Returns:
true if password is updated otherwise false

deleteUser

public boolean deleteUser(User user)
Delete an user.
Parameters:
user - the userobject containing the username
Returns:
true if the is removed otherwise false

getUser

public User getUser(User user)
Return a user.
Parameters:
user - the user containing the username
Returns:
the user, or null if none exists.

userNames

public java.util.Iterator userNames()
Return a list of user names currently supported by the user manager. This includes all types of users.
Returns:
an enumeration of the user names

validateUser

public boolean validateUser(java.lang.String username,
                            java.lang.String password)
Determines if a user's name and password are valid.
Parameters:
username - the user's name
password - the user's password
Returns:
true if the name and password are valid, otherwise false

doStart

protected void doStart()
                throws ServiceException
Start the service.
Overrides:
doStart in class Service
Throws:
ServiceException - if the service fails to start

doStop

protected void doStop()
Stop the service.
Overrides:
doStop in class Service
Following copied from class: org.exolab.jms.service.Service
Throws:
ServiceException - if the service fails to stop

init

protected void init()
             throws ServiceException
Initialise user manager.
Throws:
ServiceException - if the user manager cannot be initialised

addToUserCache

protected void addToUserCache(User user)
Add the specified entry to the user cache.
Parameters:
user - the user to add

removeFromUserCache

protected void removeFromUserCache(User user)
Remove the specified user from the cache.
Parameters:
user - the user to remove

registerConfiguredUsers

protected void registerConfiguredUsers()
Registers users specified in the configuration.


Copyright © 1999-2007 The OpenJMS Group. All Rights Reserved.