KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > api > internal > usergroup > UserGroupManager


1 package org.enhydra.shark.api.internal.usergroup;
2
3 import org.enhydra.shark.api.RootException;
4 import org.enhydra.shark.api.UserTransaction;
5 import org.enhydra.shark.api.internal.working.CallbackUtilities;
6
7 import java.util.List JavaDoc;
8
9 /**
10  * UserGroupManager handles users and groups and their relations in Shark.
11  *
12  * @author Sasa Bojanic, Vladimir Puskas, Tanja Jovanovic
13  *
14  */

15 public interface UserGroupManager {
16
17    /**
18     * Method configure is called at Shark start up, to configure
19     * implementation of UserGroupManager.
20     *
21     * @param cus an instance of CallbackUtilities used to get
22     * properties for configuring usergroup manager in Shark.
23     *
24     * @exception RootException Thrown if configuring doesn't succeed.
25     */

26    void configure (CallbackUtilities cus) throws RootException;
27
28    /**
29     * Returns Ids of all user groups.
30     *
31     * @param t user transaction.
32     * @return List of user group Ids.
33     *
34     * @throws RootException If something unexpected happens.
35     */

36    List JavaDoc getAllGroupnames (UserTransaction t) throws RootException;
37
38    /**
39     * Returns Ids of all users.
40     *
41     * @param t user transaction.
42     * @return List of user Ids.
43     *
44     * @throws RootException If something unexpected happens.
45     */

46    List JavaDoc getAllUsers (UserTransaction t) throws RootException;
47
48    /**
49     * Returns all usernames that belong to the given group.
50     *
51     * @param t user transaction.
52     * @param groupName name of the given group.
53     * @return List of all usernames that belong to given group.
54     *
55     * @throws RootException If something unexpected happens.
56     */

57    List JavaDoc getAllUsers (UserTransaction t,String JavaDoc groupName) throws RootException;
58
59    /**
60     * Returns all users that belong to the given groups.
61     *
62     * @param t user transaction.
63     * @param groupNames names of the given groups.
64     * @return List of all users that belong to given groups.
65     *
66     * @throws RootException If something unexpected happens.
67     */

68    List JavaDoc getAllUsers (UserTransaction t,List JavaDoc groupNames) throws RootException;
69
70    /**
71     * Returns all users that are immediate children of the given group.
72     *
73     * @param t user transaction.
74     * @param groupName name of the given group.
75     * @return List of all immediate (direct) users that belong to the given
76     * group.
77     *
78     * @throws RootException If something unexpected happens.
79     */

80    List JavaDoc getAllImmediateUsers (UserTransaction t,String JavaDoc groupName) throws RootException;
81
82    /**
83     * Returns all groups that belong to the given group.
84     *
85     * @param t user transaction.
86     * @param groupName name of the given group.
87     * @return List of all groups that belong to the given group.
88     *
89     * @throws RootException If something unexpected happens.
90     */

91    List JavaDoc getAllSubgroups (UserTransaction t, String JavaDoc groupName) throws RootException;
92
93    /**
94     * Returns all groups that belong to the given groups.
95     *
96     * @param t user transaction.
97     * @param groupNames names of the given groups.
98     * @return List of all groups that belong to the given groups.
99     *
100     * @throws RootException If something unexpected happens.
101     */

102    List JavaDoc getAllSubgroups (UserTransaction t, List JavaDoc groupNames) throws RootException;
103
104    /**
105     * Returns all groups that are immediate children of the given group
106     * (which are on the first level bellow the level of the given group).
107     *
108     * @param t user transaction.
109     * @param groupName name of the given group.
110     * @return List of all groups that are immediate children of the given group.
111     *
112     * @throws RootException If something unexpected happens.
113     */

114    List JavaDoc getAllImmediateSubgroups (UserTransaction t, String JavaDoc groupName) throws RootException;
115
116    /**
117     * Creates a new user group.
118     *
119     * @param t user transaction.
120     * @param groupName name of the given group.
121     * @param description group description.
122     *
123     * @throws RootException If something unexpected happens.
124     */

125    void createGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc description) throws RootException;
126
127    /**
128     * Removes user group.
129     *
130     * @param t user transaction.
131     * @param groupName name of the given group.
132     *
133     * @throws RootException If something unexpected happens.
134     */

135    void removeGroup (UserTransaction t,String JavaDoc groupName) throws RootException;
136
137    /**
138     * Returns true if user group with given name exists.
139     *
140     * @param t user transaction.
141     * @param groupName name of the given group.
142     * @return true if user group exists, otherwise false.
143     *
144     * @throws RootException If something unexpected happens.
145     */

146    boolean doesGroupExist (UserTransaction t,String JavaDoc groupName) throws RootException;
147
148    /**
149     * Returns true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>.
150     *
151     * @param t user transaction.
152     * @param groupName name of the given group.
153     * @param subgroupName name of the given subgroup.
154     * @return true if group <i>subgroupName</i> is subgroup of group <i>groupName</i>,
155     * otherwise false.
156     *
157     * @throws RootException If something unexpected happens.
158     */

159    boolean doesGroupBelongToGroup (UserTransaction t,String JavaDoc groupName, String JavaDoc subgroupName) throws RootException;
160
161    /**
162     * Allows administrator to update data about group.
163     *
164     * @param t user transaction.
165     * @param groupName name of the given group.
166     * @param description group description.
167     *
168     * @throws RootException If something unexpected happens.
169     */

170    void updateGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc description) throws RootException;
171
172    /**
173     * Adds an existing group <i>subgroupName</i> to the group <i>groupName</i>.
174     *
175     * @param t user transaction.
176     * @param groupName name of the given group.
177     * @param subgroupName name of the given subgroup to be added.
178     *
179     * @throws RootException If something unexpected happens.
180     */

181    void addGroupToGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc subgroupName) throws RootException;
182
183    /**
184     * Removes group <i>subgroupName</i> from the group <i>groupName</i>.
185     *
186     * @param t user transaction.
187     * @param groupName name of the given group.
188     * @param subgroupName name of the given subgroup to be removed.
189     *
190     * @throws RootException If something unexpected happens.
191     */

192    void removeGroupFromGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc subgroupName) throws RootException;
193
194    /**
195     * Deletes group <i>groupName</i> and all its child groups that don't belong
196     * to any other group except this one.
197     *
198     * @param t user transaction.
199     * @param groupName name of the given group.
200     *
201     * @throws RootException If something unexpected happens.
202     */

203    void removeGroupTree (UserTransaction t,String JavaDoc groupName) throws RootException;
204
205    /**
206     * Removes all users from group <i>group</i> that don't belong to any other
207     * group except this one.
208     *
209     * @param t user transaction.
210     * @param groupName name of the given group.
211     *
212     * @throws RootException If something unexpected happens.
213     */

214    void removeUsersFromGroupTree (UserTransaction t,String JavaDoc groupName) throws RootException;
215
216    /**
217     * Moves group <i>subgroupName</i> from the group <i>currentParentGroup</i> to
218     * group <i>newParentGroup</i>.
219     *
220     * @param t user transaction.
221     * @param currentParentGroup current group that contains group subgroupName.
222     * @param newParentGroup new group where group subgroupName will be moved to.
223     * @param subgroupName subgroup that will be moved.
224     *
225     * @throws RootException If something unexpected happens.
226     */

227    void moveGroup (UserTransaction t,String JavaDoc currentParentGroup,String JavaDoc newParentGroup,String JavaDoc subgroupName) throws RootException;
228
229    /**
230     * Returns a group description.
231     *
232     * @param t user transaction.
233     * @param groupName name of the given group.
234     * @return Group description.
235     *
236     * @throws RootException If something unexpected happens.
237     */

238    String JavaDoc getGroupDescription (UserTransaction t,String JavaDoc groupName) throws RootException;
239
240    /**
241     * Adds an existing user with a given username to the given group.
242     *
243     * @param t user transaction.
244     * @param groupName name of the given group.
245     * @param username username used to uniquely identify shark user.
246     *
247     * @throws RootException If something unexpected happens.
248     */

249    void addUserToGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc username) throws RootException;
250
251    /**
252     * Removes the user from the group.
253     *
254     * @param t user transaction.
255     * @param groupName name of the given group.
256     * @param username username used to uniquely identify shark user.
257     *
258     * @throws RootException If something unexpected happens.
259     */

260    void removeUserFromGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc username) throws RootException;
261
262    /**
263     * Moves user <i>username</i> from the group <i>currentGroup</i> to group
264     * <i>newGroup</i>.
265     *
266     * @param t user transaction.
267     * @param currentGroup current group that contains the user.
268     * @param newGroup new group where the user will be moved to.
269     * @param username the user that will be moved.
270     *
271     * @throws RootException If something unexpected happens.
272     */

273    void moveUser (UserTransaction t,String JavaDoc currentGroup,String JavaDoc newGroup,String JavaDoc username) throws RootException;
274
275    /**
276     * Returns true if the given user belongs to the given group.
277     *
278     * @param t user transaction.
279     * @param groupName name of the given group.
280     * @param username username used to uniquely identify shark user.
281     * @return true if the given user belongs to the given group, otherwise
282     * false.
283     *
284     * @throws RootException If something unexpected happens.
285     */

286    boolean doesUserBelongToGroup (UserTransaction t,String JavaDoc groupName,String JavaDoc username) throws RootException;
287
288    /**
289     * Allows administrator to create new user. After its creation, the client
290     * application will always be able to log onto shark using username and
291     * password defined for the user.
292     *
293     * @param t user transaction.
294     * @param groupName groupName used to uniquely identify group -
295     * this parameter is mandatory.
296     * @param username username used to uniquely identify user -
297     * this parameter is mandatory.
298     * @param password password used to authenticate -
299     * this parameter is mandatory.
300     * @param firstName the user's first name.
301     * @param lastName the user's last name.
302     * @param emailAddress email address of the user.
303     *
304     * @throws RootException If something unexpected happens (i.e the user with
305     * given username already exists).
306     */

307    void createUser (UserTransaction t,String JavaDoc groupName,String JavaDoc username, String JavaDoc password, String JavaDoc firstName, String JavaDoc lastName, String JavaDoc emailAddress) throws RootException;
308
309    /**
310     * Allows administrator to update data about user.
311     *
312     * @param t user transaction.
313     * @param username username used to uniquely identify user -
314     * this parameter is mandatory.
315     * @param firstName the user's first name.
316     * @param lastName the user's last name.
317     * @param emailAddress email address of the user.
318     *
319     * @throws RootException If something unexpected happens (i.e the user with
320     * given username does not exist).
321     */

322    void updateUser (UserTransaction t,String JavaDoc username,String JavaDoc firstName, String JavaDoc lastName,String JavaDoc emailAddress) throws RootException;
323
324    /**
325     * Allows administrator to remove the user.
326     *
327     * @param t user transaction.
328     * @param username username used to uniquely identify user.
329     *
330     * @throws RootException If something unexpected happens (i.e the user with
331     * given username does not exist, or this is a user that can't be removed).
332     */

333    void removeUser (UserTransaction t,String JavaDoc username) throws RootException;
334
335    /**
336     * Returns true if user with given username exists.
337     *
338     * @param t user transaction.
339     * @param username username of the shark user.
340     * @return true if the user with the given username exists, otherwise false.
341     *
342     * @throws RootException If something unexpected happens.
343     */

344    boolean doesUserExist (UserTransaction t,String JavaDoc username) throws RootException;
345
346    /**
347     * Sets user password.
348     *
349     * @param t user transaction.
350     * @param username username of the shark user.
351     * @param password new password of the shark user.
352     *
353     * @throws RootException If something unexpected happens.
354     */

355    void setPassword (UserTransaction t,String JavaDoc username,String JavaDoc password) throws RootException;
356
357    /**
358     * Returns string representing the real name for the shark user with the
359     * given username (first and last name).
360     *
361     * @param t user transaction.
362     * @param username username of the shark user.
363     * @return Real name of the shark user.
364     *
365     * @throws RootException If something unexpected happens.
366     */

367    String JavaDoc getUserRealName (UserTransaction t,String JavaDoc username) throws RootException;
368
369    /**
370     * Returns string representing user's first name.
371     *
372     * @param t user transaction.
373     * @param username username of the shark user.
374     * @return First name of the shark user.
375     *
376     * @throws RootException If something unexpected happens.
377     */

378    String JavaDoc getUserFirstName (UserTransaction t,String JavaDoc username) throws RootException;
379
380    /**
381     * Returns string representing user's last name.
382     *
383     * @param t user transaction.
384     * @param username username of the shark user.
385     * @return Last name of the shark user.
386     *
387     * @throws RootException If something unexpected happens.
388     */

389    String JavaDoc getUserLastName (UserTransaction t,String JavaDoc username) throws RootException;
390
391    /**
392     * Returns string representing email address for the user with the given
393     * username.
394     *
395     * @param t user transaction.
396     * @param username username of the shark user.
397     * @return Email of the shark user.
398     *
399     * @throws RootException If something unexpected happens.
400     */

401    String JavaDoc getUserEMailAddress (UserTransaction t,String JavaDoc username) throws RootException;
402
403 }
404
Popular Tags