Removed DOCUMENT ME comments that were generated and applied source code
[utils] / security / src / main / java / org / wamblee / usermgt / UserSet.java
1 /*
2  * Copyright 2005 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.wamblee.usermgt;
17
18 import java.util.Set;
19
20 /**
21  * Represents a set of users. Typical implementations would be an implementation
22  * based on a static configuration file or an implementation backed by a
23  * database.
24  * 
25  * @author Erik Brakkee
26  */
27 public interface UserSet {
28     /**
29      * Creates a user.
30      * 
31      * @param aUsername
32      *            User name.
33      * @param aPassword
34      *            Password.
35      * @param aGroup
36      *            Group.
37      * 
38      * @return New user.
39      * 
40      * @throws UserMgtException
41      *             In case the user cannot be created.
42      */
43     User createUser(String aUsername, String aPassword, Group aGroup)
44         throws UserMgtException;
45
46     /**
47      * Must be called whenever a user object has been modified to notify the
48      * user set.
49      * 
50      * @param aUser
51      *            Modified user.
52      */
53     void userModified(User aUser);
54
55     /**
56      * Finds user.
57      * 
58      * @param aName
59      *            Username.
60      * 
61      * @return User or null if not found.
62      */
63     User find(String aName);
64
65     /**
66      * Checks if a user exists.
67      * 
68      * @param aUser
69      *            User.
70      * 
71      * @return True iff the user exists.
72      */
73     boolean contains(User aUser);
74
75     /**
76      * Adds a user. If the user already exists, the user details are updated
77      * with that of the specified user object.
78      * 
79      * @param aUser
80      *            User to add.
81      * 
82      */
83     boolean add(User aUser);
84
85     /**
86      * Removes a user. If the user does not exist, nothing happens.
87      * 
88      * @param aUser
89      * 
90      */
91     boolean remove(User aUser);
92
93     /**
94      * Lists the current users.
95      * 
96      * @return Users.
97      */
98     Set<User> list();
99
100     /**
101      * Lists the users belonging to a particular group.
102      * 
103      * @param aGroup
104      *            Group.
105      * @return Groups.
106      */
107     Set<User> list(Group aGroup);
108
109     /**
110      * 
111      * @return The number of users.
112      */
113     int size();
114 }