DLESE Tools
v1.6.0

org.dlese.dpc.schemedit.security.user
Class UserManager

java.lang.Object
  extended by org.dlese.dpc.schemedit.security.user.UserManager

public class UserManager
extends Object

Manages User instances and provides information about users inlcuding roles, attributes, preferences, etc.

Reads user data from disk as XML Files, provides run-time services to suport UI, and authentication

Author:
Jonathan Ostwald
See Also:
User.

Constructor Summary
UserManager(File userDataDir)
          Constructor for the UserManager object
 
Method Summary
 User createUser(String username)
          Create a new User instance for provided user name.
 void deleteUser(String username)
          Remove user associated with provided username from registry
 void destroy()
          Destroy this Usermanager and all the managed users.
 void flush()
          Write user data to disk.
 User getUser(String username)
          Gets the User instance having supplied username, or null if user cannot be found.
 List getUserDisplayNames()
          Return a listing of users including username and fullNames.
 List getUsers()
          Returns a list of all user instances managed by this UserManager.
 List getUsers(Roles.Role maxRole)
          Returns all users having role equal to or below maxRole.
 void load()
          Reads the data dir, constructs user instances, and registers them
static void main(String[] args)
          The main program for the UserManager class
protected static void prtln(String s)
          NOT YET DOCUMENTED
 void register(User user)
          Adds provided User instance to the managed users.
 void saveUser(User user)
          Writes data for specified user to disk as XML file
static void setDebug(boolean bool)
           
 void showUsers()
          Debugging method to print string representation of all managed users
 void unregister(User user)
          Removes provided user from the managed users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserManager

public UserManager(File userDataDir)
            throws Exception
Constructor for the UserManager object

Parameters:
userDataDir - directory containing XML files of user data
Throws:
Exception - if the directory cannot be processed
Method Detail

load

public void load()
Reads the data dir, constructs user instances, and registers them


getUser

public User getUser(String username)
Gets the User instance having supplied username, or null if user cannot be found.

Parameters:
username - the username
Returns:
The user value

createUser

public User createUser(String username)
                throws Exception
Create a new User instance for provided user name.

Parameters:
username - the username
Returns:
a User instance
Throws:
Exception - if user for provided username exists.

deleteUser

public void deleteUser(String username)
Remove user associated with provided username from registry

Parameters:
username - username of user to delete

saveUser

public void saveUser(User user)
              throws Exception
Writes data for specified user to disk as XML file

Parameters:
user - user to be saved
Throws:
Exception - if provided user does not have a username

getUsers

public List getUsers()
Returns a list of all user instances managed by this UserManager.

Returns:
The users value

getUsers

public List getUsers(Roles.Role maxRole)
Returns all users having role equal to or below maxRole.

Parameters:
maxRole - NOT YET DOCUMENTED
Returns:
The users value

register

public void register(User user)
Adds provided User instance to the managed users.

Parameters:
user - The feature to be added to the User attribute

unregister

public void unregister(User user)
Removes provided user from the managed users.

Parameters:
user - User to unregister

flush

public void flush()
           throws Exception
Write user data to disk.

First creates Document containing all user data, then reinitializes docMap with the Document so it will be written to disk.

Throws:
Exception - NOT YET DOCUMENTED

main

public static void main(String[] args)
                 throws Exception
The main program for the UserManager class

Parameters:
args - The command line arguments
Throws:
Exception - NOT YET DOCUMENTED

getUserDisplayNames

public List getUserDisplayNames()
Return a listing of users including username and fullNames.

Returns:
The userDisplayNames value

showUsers

public void showUsers()
Debugging method to print string representation of all managed users


destroy

public void destroy()
Destroy this Usermanager and all the managed users.


setDebug

public static void setDebug(boolean bool)

prtln

protected static void prtln(String s)
NOT YET DOCUMENTED

Parameters:
s - NOT YET DOCUMENTED

DLESE Tools
v1.6.0