|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hackystat.sensorbase.resource.users.UserManager
public class UserManager
Manages access to the User resources. Loads default definitions if available. Thread Safety Note: This class must NOT invoke any methods from ProjectManager or SensorDataManager in order to avoid potential deadlock. (ProjectManager and SensorDataManager both invoke methods from UserManager, so if UserManager were to invoke a method from either of these two classes, then we would have multiple locks not being acquired in the same order, which produces the potential for deadlock.)
Field Summary | |
---|---|
(package private) DbManager |
dbManager
The DbManager associated with this server. |
(package private) Server |
server
The Server associated with this UserManager. |
static java.lang.String |
userIndexCloseTag
The UserIndex close tag. |
static java.lang.String |
userIndexOpenTag
The UserIndex open tag. |
Constructor Summary | |
---|---|
UserManager(Server server)
The constructor for UserManagers. |
Method Summary | |
---|---|
void |
deleteUser(java.lang.String email)
Ensures that the passed User is no longer present in this Manager, and deletes all Projects associated with this user. |
User |
getUser(java.lang.String email)
Returns the User associated with this email address if they are currently registered, or null if not found. |
java.lang.String |
getUserIndex()
Returns the XML string containing the UserIndex with all defined Users. |
java.util.Set<User> |
getUsers()
Returns a set containing the current User instances. |
java.lang.String |
getUserString(java.lang.String email)
Returns the User Xml String associated with this email address if they are registered, or null if user not found. |
boolean |
isAdmin(java.lang.String email)
Returns true if email is a defined User with Admin privileges. |
boolean |
isTestUser(User user)
Returns true if the passed user is a test user. |
boolean |
isUser(java.lang.String email)
Returns true if the User as identified by their email address is known to this Manager. |
boolean |
isUser(java.lang.String email,
java.lang.String password)
Returns true if the User as identified by their email address and password is known to this Manager. |
java.lang.String |
makeProperties(Properties properties)
Returns the passed Properties instance as a String encoding of its XML representation. |
Properties |
makeProperties(java.lang.String xmlString)
Takes a String encoding of a Properties in XML format and converts it to an instance. |
User |
makeUser(java.lang.String xmlString)
Takes a String encoding of a User in XML format and converts it to an instance. |
java.lang.String |
makeUser(User user)
Returns the passed User instance as a String encoding of its XML representation. |
UserIndex |
makeUserIndex(java.lang.String xmlString)
Takes a String encoding of a UserIndex in XML format and converts it to an instance. |
UserRef |
makeUserRef(User user)
Returns a UserRef instance constructed from a User instance. |
java.lang.String |
makeUserRefString(User user)
Returns the passed User instance as a String encoding of its XML representation as a UserRef object. |
void |
putUser(User user)
Updates the Manager with this User. |
User |
registerUser(java.lang.String email)
Registers a User, given their email address. |
void |
updateProperties(User user,
Properties properties)
Updates the given User with the passed Properties. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Server server
DbManager dbManager
public static final java.lang.String userIndexOpenTag
public static final java.lang.String userIndexCloseTag
Constructor Detail |
---|
public UserManager(Server server)
server
- The Server instance associated with this UserManager.Method Detail |
---|
public java.lang.String getUserIndex()
public void putUser(User user)
user
- The User.public void deleteUser(java.lang.String email)
email
- The email address of the User to remove if currently present.public User getUser(java.lang.String email)
email
- The email address
public java.lang.String getUserString(java.lang.String email)
email
- The email address
public void updateProperties(User user, Properties properties)
user
- The User whose properties are to be updated.properties
- The Properties.public java.util.Set<User> getUsers()
public boolean isUser(java.lang.String email)
email
- The email address of the User of interest.
public boolean isUser(java.lang.String email, java.lang.String password)
email
- The email address of the User of interest.password
- The password of this user.
public boolean isAdmin(java.lang.String email)
email
- An email address.
public boolean isTestUser(User user)
user
- The user.
public User registerUser(java.lang.String email)
email
- The email address for the user.
public final Properties makeProperties(java.lang.String xmlString) throws java.lang.Exception
xmlString
- The XML string representing a Properties.
java.lang.Exception
- If problems occur during unmarshalling.public final User makeUser(java.lang.String xmlString) throws java.lang.Exception
xmlString
- The XML string representing a User
java.lang.Exception
- If problems occur during unmarshalling.public final UserIndex makeUserIndex(java.lang.String xmlString) throws java.lang.Exception
xmlString
- The XML string representing a UserIndex.
java.lang.Exception
- If problems occur during unmarshalling.public final java.lang.String makeUser(User user) throws java.lang.Exception
user
- The User instance.
java.lang.Exception
- If problems occur during translation.public java.lang.String makeProperties(Properties properties) throws java.lang.Exception
properties
- The Properties instance.
java.lang.Exception
- If problems occur during translation.public final java.lang.String makeUserRefString(User user) throws java.lang.Exception
user
- The User instance.
java.lang.Exception
- If problems occur during translation.public UserRef makeUserRef(User user)
user
- The User instance.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |