KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * $Id: UserDatabase.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 2000-2004 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>Data Access Object</strong> (DAO) interface describing
23  * the available operations for retrieving and storing {@link User}s
24  * (and their associated {@link Subscription}s) in some persistence layer
25  * whose characteristics are not specified here. One or more implementations
26  * will be created to perform the actual I/O that is required.</p>
27  *
28  * @version $Rev: 54929 $ $Date: 2004-10-16 09:38:42 -0700 (Sat, 16 Oct 2004) $
29  * @since Struts 1.1
30  */

31
32 public interface UserDatabase {
33
34
35     // --------------------------------------------------------- Public Methods
36

37
38     /**
39      * <p>Create and return a new {@link User} defined in this user database.
40      * </p>
41      *
42      * @param username Username of the new user
43      *
44      * @exception IllegalArgumentException if the specified username
45      * is not unique
46      */

47     public User createUser(String JavaDoc username);
48
49
50     /**
51      * <p>Finalize access to the underlying persistence layer.</p>
52      *
53      * @exception Exception if a database access error occurs
54      */

55     public void close() throws Exception JavaDoc;
56
57
58     /**
59      * <p>Return the existing {@link User} with the specified username,
60      * if any; otherwise return <code>null</code>.</p>
61      *
62      * @param username Username of the user to retrieve
63      * @throws ExpiredPasswordException if user password has expired
64      * and must be changed
65      */

66     public User findUser(String JavaDoc username) throws ExpiredPasswordException;
67
68
69     /**
70      * <p>Return the set of {@link User}s defined in this user database.</p>
71      */

72     public User[] findUsers();
73
74
75     /**
76      * <p>Initiate access to the underlying persistence layer.</p>
77      *
78      * @exception Exception if a database access error occurs
79      */

80     public void open() throws Exception JavaDoc;
81
82
83     /**
84      * Remove the specified {@link User} from this database.
85      *
86      * @param user User to be removed
87      *
88      * @exception IllegalArgumentException if the specified user is not
89      * associated with this database
90      */

91     public void removeUser(User user);
92
93
94     /**
95      * <p>Save any pending changes to the underlying persistence layer.</p>
96      *
97      * @exception Exception if a database access error occurs
98      */

99     public void save() throws Exception JavaDoc;
100
101
102 }
103
Popular Tags