KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > examples > mailreader > User


1 /*
2  * $Id: User.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.apache.struts.examples.mailreader;
20
21 /**
22  * <p>A <strong>User</strong> which is stored, along with his or her
23  * associated {@link Subscription}s, in a {@link UserDatabase}.</p>
24  *
25  * @version $Rev: 54929 $ $Date: 2004-10-16 09:38:42 -0700 (Sat, 16 Oct 2004) $
26  * @since Struts 1.1
27  */

28
29 public interface User {
30
31
32     // ------------------------------------------------------------- Properties
33

34
35     /**
36      * Return the {@link UserDatabase} with which we are associated.
37      */

38     public UserDatabase getDatabase();
39
40
41     /**
42      * Return the from address.
43      */

44     public String JavaDoc getFromAddress();
45
46
47     /**
48      * Set the from address.
49      *
50      * @param fromAddress The new from address
51      */

52     public void setFromAddress(String JavaDoc fromAddress);
53
54
55     /**
56      * Return the full name.
57      */

58     public String JavaDoc getFullName();
59
60
61     /**
62      * Set the full name.
63      *
64      * @param fullName The new full name
65      */

66     public void setFullName(String JavaDoc fullName);
67
68
69     /**
70      * Return the password.
71      */

72     public String JavaDoc getPassword();
73
74
75     /**
76      * Set the password.
77      *
78      * @param password The new password
79      */

80     public void setPassword(String JavaDoc password);
81
82
83     /**
84      * Return the reply-to address.
85      */

86     public String JavaDoc getReplyToAddress();
87
88
89     /**
90      * Set the reply-to address.
91      *
92      * @param replyToAddress The new reply-to address
93      */

94     public void setReplyToAddress(String JavaDoc replyToAddress);
95
96
97     /**
98      * Find and return all {@link Subscription}s associated with this user.
99      * If there are none, a zero-length array is returned.
100      */

101     public Subscription[] getSubscriptions();
102
103
104     /**
105      * Return the username.
106      */

107     public String JavaDoc getUsername();
108
109
110     // --------------------------------------------------------- Public Methods
111

112
113     /**
114      * Create and return a new {@link Subscription} associated with this
115      * User, for the specified host name.
116      *
117      * @param host Host name for which to create a subscription
118      *
119      * @exception IllegalArgumentException if the host name is not unique
120      * for this user
121      */

122     public Subscription createSubscription(String JavaDoc host);
123
124
125     /**
126      * Find and return the {@link Subscription} associated with the specified
127      * host. If none is found, return <code>null</code>.
128      *
129      * @param host Host name to look up
130      */

131     public Subscription findSubscription(String JavaDoc host);
132
133
134     /**
135      * Remove the specified {@link Subscription} from being associated
136      * with this User.
137      *
138      * @param subscription Subscription to be removed
139      *
140      * @exception IllegalArgumentException if the specified subscription is not
141      * associated with this User
142      */

143     public void removeSubscription(Subscription subscription);
144
145
146 }
147
Popular Tags