X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=security%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fusermgt%2FInMemoryUserSet.java;fp=security%2Fsrc%2Fmain%2Fjava%2Forg%2Fwamblee%2Fusermgt%2FInMemoryUserSet.java;h=0000000000000000000000000000000000000000;hb=5ea8f0e2af53562c1507e8fb5a3ede2af5c5de6c;hp=e048849d81f0bdacc06f4df080f335208a2a1c92;hpb=b9eccdf9751b8e2e671e0792f885d05c6ed0f43c;p=utils diff --git a/security/src/main/java/org/wamblee/usermgt/InMemoryUserSet.java b/security/src/main/java/org/wamblee/usermgt/InMemoryUserSet.java deleted file mode 100644 index e048849d..00000000 --- a/security/src/main/java/org/wamblee/usermgt/InMemoryUserSet.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2005-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.wamblee.usermgt; - -import org.wamblee.security.encryption.MessageDigester; - -import java.util.Set; -import java.util.TreeSet; - -/** - * In-memory user set. - * - * @author Erik Brakkee - */ -public class InMemoryUserSet extends AbstractUserSet { - /** - * Users. All users in this set have their password validator and encoder - * set. - */ - private Set users; - - /** - * Constructs an empty user set. - */ - public InMemoryUserSet(NameValidator aPasswordValidator, - MessageDigester aPasswordEncoder) { - super(aPasswordValidator, aPasswordEncoder); - users = new TreeSet(); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#userModified(org.wamblee.usermgt.User) - */ - public void userModified(User aUser) { - users.remove(aUser); - setPasswordInfo(aUser); - users.add(aUser); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#find(java.lang.String) - */ - public User find(String aName) { - for (User user : users) { - if (user.getName().equals(aName)) { - return new User(user); - } - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#add(org.wamblee.usermgt.User) - */ - public boolean add(User aUser) { - setPasswordInfo(aUser); - - return users.add(aUser); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#contains(org.wamblee.usermgt.User) - */ - public boolean contains(User aUser) { - return users.contains(aUser); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#remove(org.wamblee.usermgt.User) - */ - public boolean remove(User aUser) { - return users.remove(aUser); - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#list() - */ - public Set list() { - Set list = new TreeSet(); - - for (User user : users) { - list.add(new User(user)); - } - - return list; - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#list(org.wamblee.usermgt.Group) - */ - public Set list(Group aGroup) { - Set result = new TreeSet(); - - for (User user : users) { - if (user.getGroups().contains(aGroup)) { - result.add(new User(user)); - } - } - - return result; - } - - /* - * (non-Javadoc) - * - * @see org.wamblee.usermgt.UserSet#size() - */ - public int size() { - return users.size(); - } -}