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 * @author Erik Brakkee
28 public interface UserSet {
32 * @param aUsername User name.
33 * @param aPassword Password.
34 * @param aGroup Group.
36 * @throws UserMgtException In case the user cannot be created.
38 User createUser(String aUsername, String aPassword, Group aGroup) throws UserMgtException;
41 * Must be called whenever a user object has been modified to notify the
43 * @param aUser Modified user.
45 void userModified(User aUser);
49 * @param aName Username.
50 * @return User or null if not found.
52 User find(String aName);
55 * Checks if a user exists.
57 * @return True iff the user exists.
59 boolean contains(User aUser);
62 * Adds a user. If the user already exists, the user details are updated with that
63 * of the specified user object.
64 * @param aUser User to add.
66 boolean add(User aUser);
69 * Removes a user. If the user does not exist, nothing happens.
72 boolean remove(User aUser);
75 * Lists the current users.
81 * Lists the users belonging to a particular group.
82 * @param aGroup Group.
85 Set<User> list(Group aGroup);
89 * @return The number of users.