SimpleStaticGroupMemberList.java revision ea1068c292e9b341af6d6b563cd8988a96be20a9
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2008 Sun Microsystems, Inc.
* Portions Copyright 2011-2015 ForgeRock AS
*/
/**
* This class provides an implementation of the {@code MemberList} class that
* may be used in conjunction when static groups when no additional criteria is
* to be used to select a subset of the group members.
*/
public class SimpleStaticGroupMemberList extends MemberList
{
/** The DN of the static group with which this member list is associated. */
/** The iterator used to traverse the set of member DNs. */
/**
* Creates a new simple static group member list with the provided set of
* member DNs.
*
* @param groupDN The DN of the static group with which this member list
* is associated.
* @param memberDNs The set of DNs for the users that are members of the
* associated static group.
*/
{
}
/** {@inheritDoc} */
public boolean hasMoreMembers()
{
return memberDNIterator.hasNext();
}
/** {@inheritDoc} */
public DN nextMemberDN()
throws MembershipException
{
if (memberDNIterator.hasNext())
{
try
{
}
catch (LocalizedIllegalArgumentException e)
{
// Should not happen
logger.traceException(e);
throw new MembershipException(ERR_STATICMEMBERS_CANNOT_DECODE_DN.get(dn, groupDN, e.getMessageObject()),
true, e);
}
}
return dn;
}
/** {@inheritDoc} */
{
if (memberDNIterator.hasNext())
{
try
{
if (memberEntry == null)
{
throw new MembershipException(message, true);
}
return memberEntry;
}
catch (DirectoryException de)
{
throw new MembershipException(ERR_STATICMEMBERS_CANNOT_GET_ENTRY.get(memberDN, groupDN, de.getMessageObject()),
true, de);
}
}
return null;
}
/** {@inheritDoc} */
public void close()
{
// No implementation is required.
}
}