UserInfoProvider.java 2.1 KB
Newer Older
Matt Tucker's avatar
Matt Tucker committed
1 2 3 4 5
/**
 * $RCSfile$
 * $Revision$
 * $Date$
 *
Matt Tucker's avatar
Matt Tucker committed
6
 * Copyright (C) 2004 Jive Software. All rights reserved.
Matt Tucker's avatar
Matt Tucker committed
7
 *
Matt Tucker's avatar
Matt Tucker committed
8 9
 * This software is published under the terms of the GNU Public License (GPL),
 * a copy of which is included in this distribution.
Matt Tucker's avatar
Matt Tucker committed
10
 */
Matt Tucker's avatar
Matt Tucker committed
11

Matt Tucker's avatar
Matt Tucker committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
package org.jivesoftware.messenger.user;

import org.jivesoftware.messenger.auth.UnauthorizedException;

/**
 * <p>A common interface to implement when creating a user management service plug-in.</p>
 * <p/>
 * <p>Provide meta-information about a user that's useful in server behavior. Implementation
 * of this provider is optional and systems where user information is stored and managed in
 * other systems may want to provide partial implementations or use the Jive dummy implementation
 * that returns no values.</p>
 * <p/>
 * <p>Messenger will cache much of the information it obtains from calling this provider. If you will be modifying
 * the underlying data outside of Messenger, please consult with Jive for information on maintaining a valid
 * cache.</p>
 *
 * @author Iain Shigeoka
 */
public interface UserInfoProvider {

    /**
     * <p>Obtain the UserInfo of a user.</p>
     * <p>If your implementation doesn't support user info, simply return a UserInfo object filled with default
     * values.</p>
     *
37
     * @param username the username of the user.
Matt Tucker's avatar
Matt Tucker committed
38 39 40
     * @return The user's info
     * @throws UserNotFoundException If a user with the given ID couldn't be found
     */
41
    UserInfo getInfo(String username) throws UserNotFoundException;
Matt Tucker's avatar
Matt Tucker committed
42 43 44 45

    /**
     * <p>Sets the user's info (optional operation).</p>
     *
46
     * @param username the username of the user.
Matt Tucker's avatar
Matt Tucker committed
47 48 49 50 51
     * @param info The user's new info
     * @throws UserNotFoundException         If a user with the given ID couldn't be found
     * @throws UnauthorizedException         If this operation is not allowed for the caller's permissions
     * @throws UnsupportedOperationException If the provider does not support the operation (this is an optional operation)
     */
52
    void setInfo(String username, UserInfo info)
Matt Tucker's avatar
Matt Tucker committed
53 54
            throws UserNotFoundException, UnauthorizedException, UnsupportedOperationException;
}