View Javadoc

1   /*
2    * $Id: User.java 471754 2006-11-06 14:55:09Z husted $
3    *
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *  http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  
23  package org.apache.struts.apps.mailreader.dao;
24  
25  
26  /**
27   * <p>A <strong>User</strong> which is stored, along with his or her
28   * associated {@link Subscription}s, in a {@link UserDatabase}.</p>
29   *
30   * @version $Rev: 471754 $ $Date: 2006-11-06 08:55:09 -0600 (Mon, 06 Nov 2006) $
31   * @since Struts 1.1
32   */
33  
34  public interface User {
35  
36  
37      // ------------------------------------------------------------- Properties
38  
39  
40      /**
41       * Return the {@link UserDatabase} with which we are associated.
42       */
43      public UserDatabase getDatabase();
44  
45  
46      /**
47       * Return the from address.
48       */
49      public String getFromAddress();
50  
51  
52      /**
53       * Set the from address.
54       *
55       * @param fromAddress The new from address
56       */
57      public void setFromAddress(String fromAddress);
58  
59  
60      /**
61       * Return the full name.
62       */
63      public String getFullName();
64  
65  
66      /**
67       * Set the full name.
68       *
69       * @param fullName The new full name
70       */
71      public void setFullName(String fullName);
72  
73  
74      /**
75       * Return the password.
76       */
77      public String getPassword();
78  
79  
80      /**
81       * Set the password.
82       *
83       * @param password The new password
84       */
85      public void setPassword(String password);
86  
87  
88      /**
89       * Return the reply-to address.
90       */
91      public String getReplyToAddress();
92  
93  
94      /**
95       * Set the reply-to address.
96       *
97       * @param replyToAddress The new reply-to address
98       */
99      public void setReplyToAddress(String replyToAddress);
100 
101 
102     /**
103      * Find and return all {@link Subscription}s associated with this user.
104      * If there are none, a zero-length array is returned.
105      */
106     public Subscription[] getSubscriptions();
107 
108 
109     /**
110      * Return the username.
111      */
112     public String getUsername();
113 
114 
115     // --------------------------------------------------------- Public Methods
116 
117 
118     /**
119      * Create and return a new {@link Subscription} associated with this
120      * User, for the specified host name.
121      *
122      * @param host Host name for which to create a subscription
123      *
124      * @exception IllegalArgumentException if the host name is not unique
125      *  for this user
126      */
127     public Subscription createSubscription(String host);
128 
129 
130     /**
131      * Find and return the {@link Subscription} associated with the specified
132      * host.  If none is found, return <code>null</code>.
133      *
134      * @param host Host name to look up
135      */
136     public Subscription findSubscription(String host);
137 
138 
139     /**
140      * Remove the specified {@link Subscription} from being associated
141      * with this User.
142      *
143      * @param subscription Subscription to be removed
144      *
145      * @exception IllegalArgumentException if the specified subscription is not
146      *  associated with this User
147      */
148     public void removeSubscription(Subscription subscription);
149 
150 
151 }