(no commit message)
[utils] / security / impl / src / main / java / org / wamblee / security / authentication / InMemoryUserSet.java
diff --git a/security/impl/src/main/java/org/wamblee/security/authentication/InMemoryUserSet.java b/security/impl/src/main/java/org/wamblee/security/authentication/InMemoryUserSet.java
deleted file mode 100644 (file)
index 5912921..0000000
+++ /dev/null
@@ -1,108 +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.security.authentication;
-
-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<User> users;
-
-    /**
-     * Constructs an empty user set.
-     */
-    public InMemoryUserSet(NameValidator aPasswordValidator,
-        MessageDigester aPasswordEncoder) {
-        super(aPasswordValidator, aPasswordEncoder);
-        users = new TreeSet<User>();
-    }
-
-    @Override
-    public void userModified(User aUser) {
-        users.remove(aUser);
-        setPasswordInfo(aUser);
-        users.add(aUser);
-    }
-
-    @Override
-    public User find(String aName) {
-        for (User user : users) {
-            if (user.getName().equals(aName)) {
-                return user;
-            }
-        }
-
-        return null;
-    }
-
-    @Override
-    public boolean add(User aUser) {
-        setPasswordInfo(aUser);
-
-        return users.add(aUser);
-    }
-
-    @Override
-    public boolean contains(User aUser) {
-        return users.contains(aUser);
-    }
-
-    @Override
-    public boolean remove(User aUser) {
-        return users.remove(aUser);
-    }
-
-    @Override
-    public Set<User> list() {
-        Set<User> list = new TreeSet<User>();
-        list.addAll(users);
-        return list;
-    }
-
-    @Override
-    public Set<User> list(Group aGroup) {
-        Set<User> result = new TreeSet<User>();
-
-        for (User user : users) {
-            if (user.getGroups().contains(aGroup)) {
-                result.add(user);
-            }
-        }
-
-        return result;
-    }
-
-    @Override
-    public int size() {
-        return users.size();
-    }
-    
-    @Override
-    public void clearCache() {
-        // Empty   
-    }
-}