|
|||||||||
| Home >> All >> gov >> lanl >> [ Web overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
gov.lanl.Web
Class UserMgr

java.lang.Objectgov.lanl.Web.UserMgr
- public class UserMgr
- extends java.lang.Object
This class manages a persistent storage of Users. It can add users from a file in LDAP's LDIF format. The values required are dn (Distinguished Name), cn (Common Name), userPassword, email, and role This is intended as an interface for LDAP, but provides a simple persistent Hashtables using JDBM. The id Hashtable (name "userids") contains the User objects with the email address as the key The country (name "countries") Hashtable contains a HashSet of all the organizations in a given country To get a list of all supported countries simply get the keys of the countries Hashtable There also is a persistent Hashtable for each organization with is LDAP "o" value as its name It returns a Hashtable of users within that organization, with key the "cn" (Username) and value "email" Thus a user can be looked up by username and organization and return the "key" email address from which the full User object can be obtained from the id Hashtable When a new organization is encountered (with a user with "o" and "c" dn parameters, it is registered into the list of organizations for that country in the country Hashtable JDBM (http://jdbm.sourceforge.net) persistent hashtable implemenation is used for persistence
- Version:
- $Id: UserMgr.java,v 1.7 2002/06/10 03:02:54 dwforslund Exp $
| Field Summary | |
private static org.apache.log4j.Logger |
cat
|
private static java.lang.String |
configFile
|
private JDBMHashtable |
country
|
private JDBMHashtable |
id
|
private java.util.Vector |
profile_vec
|
private static gov.lanl.Utility.ConfigProperties |
props
|
private JDBMRecordManager |
recman
|
private User |
user
|
private java.lang.String |
userdb
|
private static java.lang.String |
userfile
|
private java.lang.String |
username
|
private JDBMHashtable |
users
|
| Constructor Summary | |
UserMgr()
Public default constructor |
|
UserMgr(java.lang.String configProperties)
Constructor which specifies the configProperties to be read |
|
| Method Summary | |
private void |
addProfile()
Add the user profile |
void |
addUser(java.lang.String u)
addUser |
void |
addUser(java.lang.String theDN,
java.lang.String cn,
java.lang.String sn,
java.lang.String email,
java.lang.String role,
java.lang.String password)
add User to the Persistent Hashtable |
void |
addUser(User newUser)
Add a User already constructed |
void |
addUsers()
add Users from previously defined userfile |
void |
addUsers(java.lang.String userfile)
Add users from an input file |
void |
delUser(java.lang.String userId)
delete User based on the unique UserId |
java.lang.String |
export()
get all the users in in the persistent hashtable |
java.lang.String[] |
getMailbyOrg(java.lang.String org)
get the email addresses of all users in an organization |
java.lang.String[] |
getNamesbyOrg(java.lang.String org)
Get all the userNames for a given organization |
User |
getUser(java.lang.String userId)
get User by the unique userId (email) |
User |
getUser(java.lang.String userName,
java.lang.String org)
get the User based on name and organization |
User |
getUser(java.lang.String username,
java.lang.String org,
java.lang.String email)
get User with username, org and email |
User |
getUser(User findUser)
Find a User given a partially completed User object as a template |
java.lang.String[] |
getUserIds()
get list of all UserIds in DB |
java.lang.String[] |
getUserNames()
obtain list of valid users |
void |
init()
Initialize Persistent storage There are two primary hashtables. |
static void |
main(java.lang.String[] argv)
|
void |
parseLine(java.lang.String line)
parse the line and add the user to the list |
static void |
setConfigFile(java.lang.String theConfigFile)
Bean setter and getter methods |
static void |
setUserfile(java.lang.String file)
set the file of users to be read. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
id
private JDBMHashtable id
users
private JDBMHashtable users
country
private JDBMHashtable country
username
private java.lang.String username
userfile
private static java.lang.String userfile
userdb
private java.lang.String userdb
configFile
private static java.lang.String configFile
recman
private JDBMRecordManager recman
props
private static gov.lanl.Utility.ConfigProperties props
profile_vec
private java.util.Vector profile_vec
user
private User user
cat
private static org.apache.log4j.Logger cat
| Constructor Detail |
UserMgr
public UserMgr()
- Public default constructor
UserMgr
public UserMgr(java.lang.String configProperties)
- Constructor which specifies the configProperties to be read
| Method Detail |
init
public void init()
- Initialize Persistent storage
There are two primary hashtables. The first (country) contains a list of the organizations which are keys
to user hashtables for each organization. The organization hashtable is a map from the username
key to the userId (email address). The second (id) is the hashtable based on the email address
which is used as a userId since the email address is supposed to be unique. For each organization
there is a separate hashtable of the users for that organization. Thus one can look a user up
across organizations or within an organization. All the user objects are contained in the second (id) hashtable.
addUsers
public void addUsers()
- add Users from previously defined userfile
addUsers
public void addUsers(java.lang.String userfile)
- Add users from an input file
parseLine
public void parseLine(java.lang.String line)
- parse the line and add the user to the list
addProfile
private void addProfile()
- Add the user profile
addUser
public void addUser(java.lang.String u)
- addUser
addUser
public void addUser(java.lang.String theDN, java.lang.String cn, java.lang.String sn, java.lang.String email, java.lang.String role, java.lang.String password)
- add User to the Persistent Hashtable
addUser
public void addUser(User newUser)
- Add a User already constructed
delUser
public void delUser(java.lang.String userId)
- delete User based on the unique UserId
getUser
public User getUser(java.lang.String userName, java.lang.String org)
- get the User based on name and organization
getUser
public User getUser(java.lang.String userId)
- get User by the unique userId (email)
getUser
public User getUser(java.lang.String username, java.lang.String org, java.lang.String email)
- get User with username, org and email
getUser
public User getUser(User findUser)
- Find a User given a partially completed User object as a template
getNamesbyOrg
public java.lang.String[] getNamesbyOrg(java.lang.String org)
- Get all the userNames for a given organization
getMailbyOrg
public java.lang.String[] getMailbyOrg(java.lang.String org)
- get the email addresses of all users in an organization
getUserIds
public java.lang.String[] getUserIds()
- get list of all UserIds in DB
getUserNames
public java.lang.String[] getUserNames()
- obtain list of valid users
setConfigFile
public static void setConfigFile(java.lang.String theConfigFile)
- Bean setter and getter methods
setUserfile
public static void setUserfile(java.lang.String file)
- set the file of users to be read.
export
public java.lang.String export()
- get all the users in in the persistent hashtable
main
public static void main(java.lang.String[] argv)
|
|||||||||
| Home >> All >> gov >> lanl >> [ Web overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
gov.lanl.Web.UserMgr