IdRepoDataStoreProvider.java revision 4a2f0f0be43dfd4c1b490cbf3cc48b6ba6084b1c
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: IdRepoDataStoreProvider.java,v 1.6 2008/08/06 17:29:26 exu Exp $
*
*/
/**
* The <code>IdRepoDataStoreProvider</code> is an implementation of
* <code>DataStoreProvider</code> using <code>IdRepo</code> APIs. It can be
*
* @see com.sun.identity.plugin.datastore.DataStoreProvider
*/
public class IdRepoDataStoreProvider implements DataStoreProvider {
private static ResourceBundle bundle =
// Identity repository instance map
/**
* Default Constructor.
*/
public IdRepoDataStoreProvider() {
}
/**
* Initializes the provider.
* @param componentName name of the component.
* @throws DataStoreProviderException if an error occurred during
* initialization.
*/
throws DataStoreProviderException
{
}
/**
* Returns values for a given attribute.
* @param userID Universal identifier of the user.
* @param attrName Name of the attribute whose value to be retrieved.
* @return Set of the values for the attribute.
* @throws DataStoreProviderException if unable to retrieve the attribute.
*/
throws DataStoreProviderException
{
"nullUserId"));
}
"nullAttrName"));
}
try {
} catch (SSOException ssoe) {
+ "invalid admin SSOtoken", ssoe);
} catch (IdRepoException ide) {
+ "IdRepo exception", ide);
}
}
/**
* Returns attribute values for a user.
* @param userID Universal identifier of the user.
* @param attrNames Set of attributes whose values are to be retrieved.
* attribute name, value is a Set of values.
* @throws DataStoreProviderException if unable to retrieve the values.
*/
throws DataStoreProviderException
{
"nullUserId"));
}
"nullAttrSet"));
}
try {
} catch (SSOException ssoe) {
+ "invalid admin SSOtoken", ssoe);
} catch (IdRepoException ide) {
+ "IdRepo exception", ide);
}
}
/**
* Sets attributes for a user.
* @param userID Universal identifier of the user.
* @param attrMap Map of attributes to be set, key is the
* attribute name and value is a Set containing the attribute values.
* @throws DataStoreProviderException if unable to set values.
*/
throws DataStoreProviderException
{
"nullUserId"));
}
"nullAttrMap"));
}
try {
} catch (SSOException ssoe) {
+ "invalid admin SSOtoken", ssoe);
} catch (IdRepoException ide) {
+ "IdRepo exception", ide);
}
}
/**
* Returns user matching the search criteria.
* @param orgDN The realm to search the user. If null,
* searches the root realm.
* searching the user. Key is the attribute name, value
* is a Set containing attribute value(s).
* @return Universal identifier of the matching user, null if
* the matching user could not be found.
* @throws DataStoreProviderException if error occurs during search or
* multiple matching users found.
*/
throws DataStoreProviderException
{
}
"nullAvPair"));
}
try {
} catch (IdRepoException ame) {
ame);
} catch (SSOException ssoe) {
ssoe);
}
return null;
"multipleMatches"));
}
// single user found.
if (debug.messageEnabled()) {
}
}
/**
* Checks if a given user exists.
* @param userID Universal identifier of the user to be checked.
* @return <code>true</code> if the user exists.
* @throws DataStoreProviderException if an error occurred.
*/
throws DataStoreProviderException
{
"nullUserId"));
}
try {
// treat inactive as user does not exist
} catch (IdRepoException ide) {
return false;
} catch (SSOException ssoe) {
ssoe);
}
}
/**
* Returns identity repository for a realm.
* @param realm Name of the realm.
* @return identity repository for a realm.
* @throws DataStoreProviderException if unable to get the identity
* repository for the realm.
*/
private synchronized AMIdentityRepository getAMIdentityRepository(
throws DataStoreProviderException
{
try {
if (amIdentityRepository == null) {
if (debug.messageEnabled()) {
+ " create IdRepo for realm " + realm);
}
}
} catch (IdRepoException ie) {
"IdRepoException: ", ie);
} catch (SSOException se) {
"SSOException: ", se);
}
return amIdentityRepository;
}
/**
* Returns <code>IdSearchControl</code> object.
* search control. Key is the attribute name, value
* is a Set containing attribute value(s).
* @param modifier Search modification, could be one of:
* <code>IdSearchOpModifier.OR</code>
* <code>IdSearchOpModifier.AND</code>.
* @return <code>IdSearchControl</code> object, null if the
* passing map is null.
*/
private static IdSearchControl getIdSearchControl(
{
return null;
}
searchControl.setAllReturnAttributes(false);
return searchControl;
}
}