KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > users > UserManager


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 package com.openedit.users;
14
15 import java.util.Collection JavaDoc;
16 import java.util.List JavaDoc;
17 import java.util.Map JavaDoc;
18
19 import com.openedit.hittracker.HitTracker;
20 import com.openedit.users.filesystem.PermissionsManager;
21
22
23 /**
24  * This interface allows the caller to retrieve users.
25  *
26  * @author Eric and Matt
27  */

28 public interface UserManager
29 {
30     /**
31      * Retrieve the list of permissions that may be assigned to groups.
32      *
33      * @return A list of {@link Permission}s
34      * @throws UserManagerException
35      */

36     List JavaDoc getPermissions() throws UserManagerException;
37     
38     List JavaDoc getSystemPermissionGroups();
39     
40     /**
41      * Retrieve the group with the given name.
42      *
43      * @param inGroupName The group name
44      *
45      * @return The group, or <code>null</code> if there is no such group
46      *
47      * @throws UserManagerException If something went wrong trying to retrieve the group
48      */

49     Group getGroup(String JavaDoc inGroupName) throws UserManagerException;
50
51     /**
52      * Get all the groups managed by this user manager.
53      *
54      * @return A collection of {@link Group}s
55      *
56      * @throws UserManagerException If the list of groups could not be retrieved
57      */

58     Collection JavaDoc getGroups();
59
60     /**
61      * Retrieve the user with the given username.
62      *
63      * @param inUserName The username
64      *
65      * @return The user, or <code>null</code> if there is no such user
66      *
67      * @throws UserManagerException If something went wrong trying to retrieve the user
68      */

69     User getUser(String JavaDoc inUserName) throws UserManagerException;
70
71     /**
72      * Get all the users managed by this user manager.
73      *
74      * @return A collection of {@link User}s
75      *
76      * @throws UserManagerException If the list of users could not be retrieved
77      */

78     HitTracker getUsers();
79
80     /**
81      * Authenticate the given user.
82      *
83      * @param inUser The user to authenticate
84      *
85      * @return <code>true</code> if the user was authenticated successfully, <code>false</code> if
86      * not
87      *
88      * @throws UserManagerException If something went wrong trying to authenticate the user
89      */

90     boolean authenticate(User inUser, String JavaDoc inPassword)
91         throws UserManagerException;
92
93     /**
94      * Create a new group with the given name.
95      *
96      * @param inGroupName The new group's name
97      *
98      * @return The new group
99      *
100      * @throws DuplicateGroupException If there is already a group with the given name
101      * @throws UserManagerException If the group could not be created for some reason
102      */

103     Group createGroup(String JavaDoc inGroupName) throws UserManagerException;
104
105     /**
106      * Create a user with the given username and password.
107      *
108      * @param inUserName The new user's username
109      * @param inPassword The new user's password
110      *
111      * @return The new user
112      *
113      * @throws DuplicateUserException If there is already a user with the given username
114      * @throws UserManagerException If the user could not be created for some reason
115      */

116     User createUser(String JavaDoc inUserName, String JavaDoc inPassword)
117         throws UserManagerException;
118
119     /**
120      * Delete the given group.
121      *
122      * @param inGroup The group to delete
123      *
124      * @throws UserManagerException If the group could not be deleted
125      */

126     void deleteGroup(Group inGroup) throws UserManagerException;
127
128     /**
129      * Delete the given user.
130      *
131      * @param inUser The user to delete
132      *
133      * @throws UserManagerException If the user could not be deleted
134      */

135     void deleteUser(User inUser) throws UserManagerException;
136
137     /**
138      * Delete the given groups.
139      *
140      * @param inGroups The groups to delete
141      *
142      * @throws UserManagerException If the groups could not be deleted
143      */

144     public void deleteGroups(List JavaDoc inGroups) throws UserManagerException;
145
146     /**
147      * Delete the given users.
148      *
149      * @param inUsers The users to delete
150      *
151      * @throws UserManagerException If the users could not be deleted
152      */

153     public void deleteUsers(List JavaDoc inUsers) throws UserManagerException;
154     
155
156     /**
157      * @param emailaddress
158      * @return
159      */

160     public User getUserByEmail(String JavaDoc emailaddress) throws UserManagerException;
161     
162     
163     /**
164      * Pass in a Lucene query and find users
165      * @param inQuery
166      * @return
167      * @throws UserManagerException
168      */

169     public HitTracker findUser( String JavaDoc inQuery ) throws UserManagerException;
170
171     /**
172      * Saves the given user to persistent storage.
173      *
174      * @param inUser The user to save
175      */

176     void saveUser( User inUser );
177
178     /**
179      * Saves the given group to persistent storage.
180      *
181      * @param inGroup The group to save
182      */

183     void saveGroup( Group inGroup );
184
185     HitTracker getUsersInGroup(Group inGroup);
186
187     HitTracker getUsersInGroup(String JavaDoc inString);
188     
189     void setAuthenticator(Authenticator inAuthen);
190
191     Authenticator getAuthenticator();
192     
193     public Map JavaDoc getUserListeners();
194
195     public void addUserListener( UserListener inListener );
196     
197     public void logout(User inUser);
198
199     public PermissionsManager getPermissionsManager();
200
201     User createGuestUser(String JavaDoc inAccount, String JavaDoc inPassword, String JavaDoc inGroupname);
202     
203
204 }
205
Popular Tags