2 * Copyright 2005 the original author or authors.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.wamblee.usermgt;
22 * Represents a set of users.
23 * Typical implementations would be an implementation based on a static configuration file or
24 * an implementation backed by a database.
26 public interface UserSet {
30 * @param aUsername User name.
31 * @param aPassword Password.
32 * @param aGroup Group.
34 * @throws UserMgtException In case the user cannot be created.
36 User createUser(String aUsername, String aPassword, Group aGroup) throws UserMgtException;
39 * Must be called whenever a user object has been modified to notify the
41 * @param aUser Modified user.
43 void userModified(User aUser);
47 * @param aName Username.
48 * @return User or null if not found.
50 User find(String aName);
53 * Checks if a user exists.
55 * @return True iff the user exists.
57 boolean contains(User aUser);
60 * Adds a user. If the user already exists, the user details are updated with that
61 * of the specified user object.
62 * @param aUser User to add.
64 boolean add(User aUser);
67 * Removes a user. If the user does not exist, nothing happens.
70 boolean remove(User aUser);
73 * Lists the current users.
79 * Lists the users belonging to a particular group.
80 * @param aGroup Group.
83 Set<User> list(Group aGroup);
87 * @return The number of users.