001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: ResourceIDMapper.java,v 1.2 2008/06/25 05:47:18 qcheng Exp $
026 *
027 */
028
029
030package com.sun.identity.liberty.ws.interfaces;
031
032import com.sun.identity.liberty.ws.soapbinding.Message;
033
034/**
035 * The class <code>ResourceIDMapper</code> is an interface that is 
036 * used to map between an <code>userID</code> and the <code>ResourceID</code>
037 * associated with it.
038 * <p>
039 * A different implementation of the interface may be developed by different
040 * service provider. The implementation class(s) should be given to the provider
041 * that hosts discovery service. The mapping between the <code>providerID</code>
042 * and the implementation class can be configured through the
043 * <code>Class for ResourceID Mapper Plugin</code> field in Discovery service.
044 * @supported.all.api 
045 */
046public interface ResourceIDMapper {
047
048    /**
049     * Returns the resource ID that is associated with the user in a provider.
050     * @param providerID ID of the provider.
051     * @param userID ID of the user.
052     * @return resource ID. Return null if the resource ID cannot be found.
053     */
054    public String getResourceID(String providerID, String userID);
055
056    /**
057     * Returns the ID of the user who has the resource ID in a provider.
058     * @param providerID ID of the provider.
059     * @param resourceID ID of the resource.
060     * @return user ID. Return null if the user is not found.
061     */
062    public String getUserID(String providerID, String resourceID);
063
064    /**
065     * Returns the ID of the user who has the resource ID in a provider.
066     * @param providerID ID of the provider.
067     * @param resourceID ID of the resource.
068     * @param message Request message.
069     * @return user ID. Return null if the user is not found.
070     */
071    public String getUserID(String providerID,
072                        String resourceID,
073                        Message message);
074}