KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > webapp > example > 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
20 package org.apache.struts.webapp.example;
21
22
23 /**
24  * <p>A <strong>User</strong> which is stored, along with his or her
25  * associated {@link Subscription}s, in a {@link UserDatabase}.</p>
26  *
27  * @version $Rev: 54929 $ $Date: 2004-10-16 17:38:42 +0100 (Sat, 16 Oct 2004) $
28  * @since Struts 1.1
29  */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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