KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > webapp > example2 > User


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

16
17
18 package org.apache.struts.webapp.example2;
19
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  * @author Craig R. McClanahan
26  * @version $Rev: 54934 $ $Date: 2004-10-16 18:07:50 +0100 (Sat, 16 Oct 2004) $
27  * @since Struts 1.1
28  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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