KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > webapp > example > 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 package org.apache.struts.webapp.example;
19
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 17:38:42 +0100 (Sat, 16 Oct 2004) $
29  * @since Struts 1.1
30  */

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

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

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

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

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

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

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

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

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