KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > api > usermgr > db > dbUser


1 /*
2  * MmryUser.java
3  *
4  * Created on May 29, 2003, 10:26 AM
5  */

6
7 package com.raptus.owxv3.api.usermgr.db;
8
9 import com.raptus.owxv3.api.usermgr.*;
10 import java.util.*;
11
12 /**
13  *
14  * @author root
15  */

16 public class dbUser implements User
17 {
18     /**
19      * The display name of the user
20      */

21     String JavaDoc name = null;
22     
23     /**
24      * The user's password
25      */

26     String JavaDoc password = null;
27     
28     /**
29      * The user's login name
30      */

31     String JavaDoc username = null;
32     
33     /**
34      * The user's email
35      */

36     String JavaDoc email = null;
37     String JavaDoc locale = null;
38     
39     Locale llocale = null;
40     
41     /** Creates a new instance of MmryUser */
42     public dbUser(String JavaDoc name, String JavaDoc username, String JavaDoc password, String JavaDoc email, String JavaDoc locale)
43     {
44         this.email = email;
45         this.locale = locale;
46         this.password = password;
47         this.username = username;
48         this.name = name;
49     }
50     
51     /**
52      * return the email address of this user
53      *
54      * @return the email address of this user
55      */

56     public String JavaDoc getEmail()
57     {
58         return email;
59     }
60     
61     /**
62      * return the locale of this user
63      *
64      * @return the locale of this user
65      */

66     public Locale getLocale()
67     {
68         if(llocale ==null)
69         {
70             String JavaDoc sres[] = split(locale, "_");
71             if(sres.length==1)
72             {
73                 llocale = new Locale(sres[0]);
74             }
75             else
76             {
77                 llocale = new Locale(sres[0],sres[1]);
78             }
79         }
80         return llocale;
81     }
82     
83     /**
84      * Return the display name of this user
85      *
86      * @return the display name of this user
87      */

88     public String JavaDoc getName()
89     {
90         return name;
91     }
92     
93     /**
94      * return the password of this user
95      *
96      * @return the password of this user
97      */

98     public String JavaDoc getPassword()
99     {
100         return password;
101     }
102     
103     /**
104      * return the login name of this user
105      *
106      * @return the login name of this user
107      */

108     public String JavaDoc getUsername()
109     {
110         return username;
111     }
112     
113     /** Return the list of roles
114      *
115      * @return list of roles, as iterator
116      *
117      */

118     public Iterator getRoles()
119     {
120         return null;
121     }
122     
123     public String JavaDoc[] split(String JavaDoc str, String JavaDoc delim)
124     {
125         StringTokenizer st = new StringTokenizer(str, delim);
126         String JavaDoc[] res = new String JavaDoc[st.countTokens()];
127         int i=0;
128         while(st.hasMoreTokens())
129         {
130             res[i++] = st.nextToken();
131         }
132         
133         return res;
134     }
135 }
136
Popular Tags