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: DataStoreProvider.java,v 1.2 2008/06/25 05:47:27 qcheng Exp $ 026 * 027 */ 028 029package com.sun.identity.plugin.datastore; 030 031import java.util.Map; 032import java.util.Set; 033 034 035/** 036 * Interface used for storing & retrieving information. Also used to search 037 * user. 038 * @supported.all.api 039 */ 040public interface DataStoreProvider { 041 042 /** 043 * Initializes the provider. 044 * @param componentName Component name, such as saml, saml2, id-ff, disco, 045 * authnsvc, and idpp. 046 * @throws DataStoreProviderException if an error occurred during 047 * initialization. 048 */ 049 public void init(String componentName) 050 throws DataStoreProviderException; 051 052 /** 053 * Gets user attribute. 054 * @param userID ID value for the user. 055 * @param attrName Name of the attribute whose value to be retrieved. 056 * @return Set of the values for the attribute. 057 * @throws DataStoreProviderException if an error occurred. 058 */ 059 public Set getAttribute(String userID, String attrName) 060 throws DataStoreProviderException; 061 062 /** 063 * Gets user attributes. 064 * @param userID ID value for the user. 065 * @param attrNames The Set of attribute names. 066 * @return Map of specified attributes. Map key is the attribute 067 * name and value is the attribute value Set. 068 * @throws DataStoreProviderException if an error occurred. 069 */ 070 public Map getAttributes(String userID, Set attrNames) 071 throws DataStoreProviderException; 072 073 /** 074 * Sets user attrbiutes. 075 * @param userID ID value for the user. 076 * @param attrMap Map of specified attrbibutes to be set. Map key is 077 * the attribute name and value is the attribute value Set. 078 * @throws DataStoreProviderException if an error occurred. 079 */ 080 public void setAttributes(String userID, Map attrMap) 081 throws DataStoreProviderException; 082 083 /** 084 * Searches user. 085 * @param orgDN The organization to search the user. 086 * @param avPairs Attribute value pairs that will be used for searching 087 * the user. 088 * @throws DataStoreProviderException if an error occurred. 089 */ 090 public String getUserID(String orgDN, Map avPairs) 091 throws DataStoreProviderException; 092 093 /** 094 * Checks if the user exists with a given userid. 095 * @param userID ID of an user 096 * @return <code>true</code> if the user exists; <code>false</code> 097 * otherwise. 098 * @throws DataStoreProviderException if an error occurred. 099 */ 100 public boolean isUserExists(String userID) 101 throws DataStoreProviderException; 102 103}