Package com.biglybt.ui.console.multiuser
Class UserManager
- java.lang.Object
-
- com.biglybt.ui.console.multiuser.UserManager
-
public class UserManager extends java.lang.Object
The usermanager is responsible for reading the users configuration file and loading in all of the possible users. It is also responsible for authenticating a username/password
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UserManager.UserManagerConfig
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
fileName
private static UserManager
instance
private static java.lang.String
USER_DB_CONFIG_FILE
private java.util.Map
usersMap
-
Constructor Summary
Constructors Constructor Description UserManager(java.lang.String fileName)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUser(UserProfile user)
adds another user to the users listUserProfile
authenticate(java.lang.String username, java.lang.String password)
attempts to locate a user with the specified username and then verifies that the specified password is the same as the password associated with that uservoid
deleteUser(java.lang.String userName)
removes the user with the specified nameprotected void
doLoad(java.io.InputStream in)
protected void
doSave(java.io.OutputStream out)
static UserManager
getInstance(PluginInterface pi)
UserProfile
getUser(java.lang.String username)
returns the profile for the user with the specified username otherwise null if there is no such userjava.util.Collection
getUsers()
void
load()
load a new UserManager object from the specified input stream.void
save()
write the UserManager configuration out to the specified output stream.
-
-
-
Field Detail
-
USER_DB_CONFIG_FILE
private static final java.lang.String USER_DB_CONFIG_FILE
- See Also:
- Constant Field Values
-
instance
private static UserManager instance
-
usersMap
private java.util.Map usersMap
-
fileName
private final java.lang.String fileName
-
-
Method Detail
-
authenticate
public UserProfile authenticate(java.lang.String username, java.lang.String password)
attempts to locate a user with the specified username and then verifies that the specified password is the same as the password associated with that user- Parameters:
username
-password
-- Returns:
-
getUser
public UserProfile getUser(java.lang.String username)
returns the profile for the user with the specified username otherwise null if there is no such user- Parameters:
username
-- Returns:
-
addUser
public void addUser(UserProfile user)
adds another user to the users list- Parameters:
user
-
-
getUsers
public java.util.Collection getUsers()
-
load
public void load() throws java.io.FileNotFoundException
load a new UserManager object from the specified input stream. The input stream should contain an XML document as encoded by the save() method- Parameters:
in
-- Throws:
java.io.FileNotFoundException
-
doLoad
protected void doLoad(java.io.InputStream in)
-
save
public void save() throws java.io.FileNotFoundException
write the UserManager configuration out to the specified output stream. the configuration is stored in XML format as specified by the XMLEncoder class- Parameters:
out
-- Throws:
java.io.FileNotFoundException
- See Also:
XMLEncoder
-
doSave
protected void doSave(java.io.OutputStream out)
-
getInstance
public static UserManager getInstance(PluginInterface pi)
-
deleteUser
public void deleteUser(java.lang.String userName)
removes the user with the specified name- Parameters:
userName
-
-
-