001package org.apache.fulcrum.security.model.turbine;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021import org.apache.fulcrum.security.UserManager;
022import org.apache.fulcrum.security.entity.User;
023import org.apache.fulcrum.security.model.turbine.entity.TurbineUser;
024import org.apache.fulcrum.security.util.UnknownEntityException;
025
026/**
027 * This interface describes the methods that glue the "turbine" model together.
028 * 
029 * This Fulcrum user manager is as used as a delegate in the default Turbine user manager.
030 * 
031 * The user <T extends {@link User}> is wrapped using an extended user model, 
032 * which includes at least {@link TurbineUser} interface.
033 *  
034 * This interface's methods are wrapped in Turbine user manager (org.apache.turbine.services.security.UserManager) either in a method with the same name (and very similar signature) 
035 * or mapped to method names as listed below:
036 * 
037 * <ul>
038 * <li>Turbine (framework) user manager method(s) -&gt; method(s) in this (Fulcrum) manager
039 * <li>createAccount -&gt; {@link #addUser(User, String)}
040 * <li>removeAccount -&gt; {@link #removeUser(User)}
041 * <li>store -&gt; {@link #saveUser(User)}
042 * <li>retrieve (2x)-&gt; {@link #getUser(String)}, {@link #getUser(String, String)}
043 * <li>retrieveList -&gt; {@link #getAllUsers()}
044 * <li>accountExists (2x)-&gt; {@link #checkExists(String)}, {@link #checkExists(User)}
045 * </ul>
046 * 
047 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
048 * @version $Id$
049 */
050public interface TurbineUserManager extends UserManager
051{
052    /**
053     * Constructs an User object to represent an anonymous user of the
054     * application.
055     *
056     * @return An anonymous Turbine User. 
057     * @throws UnknownEntityException
058     *             if the anonymous User object couldn't be constructed.
059     */
060    <T extends User> T getAnonymousUser() throws UnknownEntityException;
061
062    /**
063     * Checks whether a passed user object matches the anonymous user pattern
064     * according to the configured user manager
065     *
066     * @param user A user object
067     * @return True if this is an anonymous user
068     */
069    boolean isAnonymousUser(User user);
070}