public class UserManager
extends java.lang.Object
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
Constructor and Description |
---|
UserManager(java.io.File userDataDir)
Constructor for the UserManager object
|
Modifier and Type | Method and Description |
---|---|
User |
createUser(java.lang.String username)
Create a new User instance for provided user name.
|
void |
deleteUser(java.lang.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(java.lang.String username)
Gets the User instance having supplied username, or null if user cannot be
found.
|
java.util.List |
getUserDisplayNames()
Return a listing of users including username and fullNames.
|
java.util.List |
getUsers()
Returns a list of all user instances managed by this UserManager.
|
java.util.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(java.lang.String[] args)
The main program for the UserManager class
|
protected static void |
prtln(java.lang.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.
|
public UserManager(java.io.File userDataDir) throws java.lang.Exception
userDataDir
- directory containing XML files of user datajava.lang.Exception
- if the directory cannot be processedpublic void load()
public User getUser(java.lang.String username)
username
- the usernamepublic User createUser(java.lang.String username) throws java.lang.Exception
username
- the usernamejava.lang.Exception
- if user for provided username exists.public void deleteUser(java.lang.String username)
username
- username of user to deletepublic void saveUser(User user) throws java.lang.Exception
user
- user to be savedjava.lang.Exception
- if provided user does not have a usernamepublic java.util.List getUsers()
public java.util.List getUsers(Roles.Role maxRole)
maxRole
- NOT YET DOCUMENTEDpublic void register(User user)
user
- The feature to be added to the User attributepublic void unregister(User user)
user
- User to unregisterpublic void flush() throws java.lang.Exception
First creates Document containing all user data, then reinitializes docMap with the Document so it will be written to disk.
java.lang.Exception
- NOT YET DOCUMENTEDpublic static void main(java.lang.String[] args) throws java.lang.Exception
args
- The command line argumentsjava.lang.Exception
- NOT YET DOCUMENTEDpublic java.util.List getUserDisplayNames()
public void showUsers()
public void destroy()
public static void setDebug(boolean bool)
protected static void prtln(java.lang.String s)
s
- NOT YET DOCUMENTED