Source code: com/lilacsoftware/orca/User.java
1 /*
2 * $Header: /cvsroot/orca-system/orca-system/src/com/lilacsoftware/orca/User.java,v 1.1.1.1 2001/11/05 17:41:47 tomwadzinski Exp $
3 * $Revision: 1.1.1.1 $
4 * $Date: 2001/11/05 17:41:47 $
5 *
6 * ====================================================================
7 *
8 * The Apache Software License, Version 1.1
9 *
10 * Copyright (c) 1999-2001 The Apache Software Foundation. All rights
11 * reserved.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 *
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 *
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in
22 * the documentation and/or other materials provided with the
23 * distribution.
24 *
25 * 3. The end-user documentation included with the redistribution, if
26 * any, must include the following acknowlegement:
27 * "This product includes software developed by the
28 * Apache Software Foundation (http://www.apache.org/)."
29 * Alternately, this acknowlegement may appear in the software itself,
30 * if and wherever such third-party acknowlegements normally appear.
31 *
32 * 4. The names "The Jakarta Project", "Struts", and "Apache Software
33 * Foundation" must not be used to endorse or promote products derived
34 * from this software without prior written permission. For written
35 * permission, please contact apache@apache.org.
36 *
37 * 5. Products derived from this software may not be called "Apache"
38 * nor may "Apache" appear in their names without prior written
39 * permission of the Apache Group.
40 *
41 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
42 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
43 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
44 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
45 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
47 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
48 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
49 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
51 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * SUCH DAMAGE.
53 * ====================================================================
54 *
55 * This software consists of voluntary contributions made by many
56 * individuals on behalf of the Apache Software Foundation. For more
57 * information on the Apache Software Foundation, please see
58 * <http://www.apache.org/>.
59 *
60 */
61
62
63 package com.lilacsoftware.orca;
64
65 import java.io.Serializable;
66 import java.util.Enumeration;
67 import java.util.Hashtable;
68
69
70 /**
71 * Object that represents a registered user of the mail reader application.
72 *
73 * @author Craig R. McClanahan
74 * @version $Revision: 1.1.1.1 $ $Date: 2001/11/05 17:41:47 $
75 */
76
77 public final class User implements Serializable {
78
79
80 // =================================================== Instance Variables
81
82
83 /**
84 * The EMAIL address from which messages are sent.
85 */
86 private String fromAddress = null;
87
88
89 /**
90 * The full name of this user, included in from addresses.
91 */
92 private String fullName = null;
93
94
95 /**
96 * The password (in clear text).
97 */
98 private String password = null;
99
100
101 /**
102 * The EMAIL address to which replies should be sent.
103 */
104 private String replyToAddress = null;
105
106
107 /**
108 * The set of Subscriptions associated with this User.
109 */
110 private Hashtable subscriptions = new Hashtable();
111
112
113 /**
114 * The username (must be unique).
115 */
116 private String username = null;
117
118
119 // =========================================================== Properties
120
121
122 /**
123 * Return the from address.
124 */
125 public String getFromAddress() {
126
127 return (this.fromAddress);
128
129 }
130
131
132 /**
133 * Set the from address.
134 *
135 * @param fromAddress The new from address
136 */
137 public void setFromAddress(String fromAddress) {
138
139 this.fromAddress = fromAddress;
140
141 }
142
143
144
145 /**
146 * Return the full name.
147 */
148 public String getFullName() {
149
150 return (this.fullName);
151
152 }
153
154
155 /**
156 * Set the full name.
157 *
158 * @param fullName The new full name
159 */
160 public void setFullName(String fullName) {
161
162 this.fullName = fullName;
163
164 }
165
166
167 /**
168 * Return the password.
169 */
170 public String getPassword() {
171
172 return (this.password);
173
174 }
175
176
177 /**
178 * Set the password.
179 *
180 * @param password The new password
181 */
182 public void setPassword(String password) {
183
184 this.password = password;
185
186 }
187
188
189 /**
190 * Return the reply-to address.
191 */
192 public String getReplyToAddress() {
193
194 return (this.replyToAddress);
195
196 }
197
198
199 /**
200 * Set the reply-to address.
201 *
202 * @param replyToAddress The new reply-to address
203 */
204 public void setReplyToAddress(String replyToAddress) {
205
206 this.replyToAddress = replyToAddress;
207
208 }
209
210
211 /**
212 * Return the username.
213 */
214 public String getUsername() {
215
216 return (this.username);
217
218 }
219
220
221 /**
222 * Set the username.
223 *
224 * @param username The new username
225 */
226 public void setUsername(String username) {
227
228 this.username = username;
229
230 }
231
232
233 // ======================================================= Public Methods
234
235
236 // /**
237 // * Find and return the Subscription associated with the specified host.
238 // * If none is found, return <code>null</code>.
239 // *
240 // * @param host Host name to look up
241 // */
242 // public Subscription findSubscription(String host) {
243
244 // if (host == null)
245 // return (null);
246 // return ((Subscription) subscriptions.get(host));
247
248 // }
249
250
251 // /**
252 // * Find and return all Subscriptions associated with this user. If there
253 // * are none, a zero-length array is returned.
254 // */
255 // public Subscription[] getSubscriptions() {
256
257 // synchronized (subscriptions) {
258 // Subscription results[] = new Subscription[subscriptions.size()];
259 // Enumeration subs = subscriptions.elements();
260 // int n = 0;
261 // while (subs.hasMoreElements()) {
262 // results[n++] = (Subscription) subs.nextElement();
263 // }
264 // return (results);
265 // }
266
267 // }
268
269
270 /**
271 * Return a String representation of this object.
272 */
273 public String toString() {
274
275 StringBuffer sb = new StringBuffer("User[username=");
276 sb.append(username);
277 if (fullName != null) {
278 sb.append(", fullName=");
279 sb.append(fullName);
280 }
281 if (replyToAddress != null) {
282 sb.append(", replyToAddres=");
283 sb.append(replyToAddress);
284 }
285 sb.append("]");
286 return (sb.toString());
287
288 }
289
290
291 // ====================================================== Package Methods
292
293
294 // /**
295 // * Add the specified Subscription to the set associated with this User.
296 // *
297 // * @param subscription The subscription to add
298 // */
299 // void addSubscription(Subscription subscription) {
300
301 // subscriptions.put(subscription.getHost(), subscription);
302
303 // }
304
305
306 // /**
307 // * Remove the specified Subscription from the set associated with
308 // * this User.
309 // *
310 // * @param subscription The subscription to remove
311 // */
312 // void removeSubscription(Subscription subscription) {
313
314 // subscriptions.remove(subscription.getHost());
315
316 // }
317
318
319 }