Package org.opends.server.extensions
Class StaticGroup
- java.lang.Object
-
- org.opends.server.api.Group<StaticGroupImplementationCfg>
-
- org.opends.server.extensions.StaticGroup
-
public class StaticGroup extends Group<StaticGroupImplementationCfg>
A static group implementation, in which the DNs of all members are explicitly listed.There are three variants of static groups:
- one based on the
groupOfNamesobject class: which stores the member list in thememberattribute - one based on the
groupOfEntriesobject class, which also stores the member list in thememberattribute - one based on the
groupOfUniqueNamesobject class, which stores the member list in theuniqueMemberattribute.
- one based on the
-
-
Constructor Summary
Constructors Constructor Description StaticGroup()Creates an uninitialized static group.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMember(Entry userEntry)Attempts to add the provided user as a member of this group.voidaddNestedGroup(DN nestedGroupDN)Attempts to add the provided group DN as a nested group within this group.SearchFiltergetGroupDefinitionFilter()Retrieves a search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server.DNgetGroupDN()Retrieves the DN of the entry that contains the definition for this group.MemberListgetMembers()Retrieves an iterator that may be used to cursor through the entries of the members contained in this group.MemberListgetMembers(DN baseDN, SearchScope scope, SearchFilter filter)Retrieves an iterator that may be used to cursor through the entries of the members contained in this group.List<DN>getNestedGroupDNs()Retrieves a list of the DNs of any nested groups whose members should be considered members of this group.voidinitializeGroupImplementation(StaticGroupImplementationCfg configuration)Initializes a "shell" instance of this group implementation that may be used to identify and instantiate instances of this type of group in the directory data.booleanisGroupDefinition(Entry entry)Indicates whether the provided entry contains a valid definition for this type of group.booleanisMember(DN userDN, AtomicReference<Set<DN>> examinedGroups)Indicates whether the user with the specified DN is a member of this group.booleanisMember(Entry userEntry, AtomicReference<Set<DN>> examinedGroups)Indicates whether the user described by the provided user entry is a member of this group.booleanmayAlterMemberList()Indicates whether it is possible to alter the member list for this group (e.g., in order to add members to the group or remove members from it).StaticGroupnewInstance(ServerContext serverContext, Entry groupEntry)Creates a new group of this type based on the definition contained in the provided entry.voidremoveMember(DN userDN)Attempts to remove the specified user as a member of this group.voidremoveNestedGroup(DN nestedGroupDN)Attempts to remove the provided group as a nested group within this group.voidsetGroupDN(DN groupDN)Sets the DN of the entry that contains the definition for this group.booleansupportsNestedGroups()Indicates whether this group supports nesting other groups, such that the members of the nested groups will also be considered members of this group.voidtoString(StringBuilder buffer)Appends a string representation of this group to the provided buffer.voidupdateMembers(List<Modification> modifications)Attempt to make multiple changes to the group's member list.-
Methods inherited from class org.opends.server.api.Group
finalizeGroupImplementation, isConfigurationAcceptable, isMember, isMember, toString
-
-
-
-
Method Detail
-
initializeGroupImplementation
public void initializeGroupImplementation(StaticGroupImplementationCfg configuration) throws ConfigException, InitializationException
Description copied from class:GroupInitializes a "shell" instance of this group implementation that may be used to identify and instantiate instances of this type of group in the directory data.- Specified by:
initializeGroupImplementationin classGroup<StaticGroupImplementationCfg>- Parameters:
configuration- The configuration for this group implementation.- Throws:
ConfigException- If there is a problem with the provided configuration entry.InitializationException- If a problem occurs while attempting to initialize this group implementation that is not related to the server configuration.
-
newInstance
public StaticGroup newInstance(ServerContext serverContext, Entry groupEntry) throws DirectoryException
Description copied from class:GroupCreates a new group of this type based on the definition contained in the provided entry. This method must be designed so that it may be invoked on the "shell" instance created using the default constructor and initialized with theinitializeGroupImplementationmethod.- Specified by:
newInstancein classGroup<StaticGroupImplementationCfg>- Parameters:
serverContext- The server context.groupEntry- The entry containing the definition for the group to be created.- Returns:
- The group instance created from the definition in the provided entry.
- Throws:
DirectoryException- If a problem occurs while trying to create the group instance.
-
getGroupDefinitionFilter
public SearchFilter getGroupDefinitionFilter() throws DirectoryException
Description copied from class:GroupRetrieves a search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server. This method must be designed so that it may be invoked on the "shell" instance created using the default constructor and initialized with theinitializeGroupImplementationmethod.- Specified by:
getGroupDefinitionFilterin classGroup<StaticGroupImplementationCfg>- Returns:
- A search filter that may be used to identify entries containing definitions for groups of this type in the Directory Server.
- Throws:
DirectoryException- If a problem occurs while trying to locate all of the applicable group definition entries.
-
isGroupDefinition
public boolean isGroupDefinition(Entry entry)
Description copied from class:GroupIndicates whether the provided entry contains a valid definition for this type of group.- Specified by:
isGroupDefinitionin classGroup<StaticGroupImplementationCfg>- Parameters:
entry- The entry for which to make the determination.- Returns:
trueif the provided entry does contain a valid definition for this type of group, orfalseif it does not.
-
getGroupDN
public DN getGroupDN()
Description copied from class:GroupRetrieves the DN of the entry that contains the definition for this group.- Specified by:
getGroupDNin classGroup<StaticGroupImplementationCfg>- Returns:
- The DN of the entry that contains the definition for this group.
-
setGroupDN
public void setGroupDN(DN groupDN)
Description copied from class:GroupSets the DN of the entry that contains the definition for this group.- Specified by:
setGroupDNin classGroup<StaticGroupImplementationCfg>- Parameters:
groupDN- The DN of the entry that contains the definition for this group.
-
supportsNestedGroups
public boolean supportsNestedGroups()
Description copied from class:GroupIndicates whether this group supports nesting other groups, such that the members of the nested groups will also be considered members of this group.- Specified by:
supportsNestedGroupsin classGroup<StaticGroupImplementationCfg>- Returns:
trueif this group supports nesting other groups, orfalseif it does not.
-
getNestedGroupDNs
public List<DN> getNestedGroupDNs()
Description copied from class:GroupRetrieves a list of the DNs of any nested groups whose members should be considered members of this group.- Specified by:
getNestedGroupDNsin classGroup<StaticGroupImplementationCfg>- Returns:
- A list of the DNs of any nested groups whose members should be considered members of this group.
-
addNestedGroup
public void addNestedGroup(DN nestedGroupDN) throws UnsupportedOperationException, DirectoryException
Description copied from class:GroupAttempts to add the provided group DN as a nested group within this group. The change should be committed to persistent storage through an internal operation.- Specified by:
addNestedGroupin classGroup<StaticGroupImplementationCfg>- Parameters:
nestedGroupDN- The DN of the group that should be added to the set of nested groups for this group.- Throws:
UnsupportedOperationException- If this group does not support nesting.DirectoryException- If a problem occurs while attempting to nest the provided group DN.
-
removeNestedGroup
public void removeNestedGroup(DN nestedGroupDN) throws UnsupportedOperationException, DirectoryException
Description copied from class:GroupAttempts to remove the provided group as a nested group within this group. The change should be committed to persistent storage through an internal operation.- Specified by:
removeNestedGroupin classGroup<StaticGroupImplementationCfg>- Parameters:
nestedGroupDN- The DN of the group that should be removed from the set of nested groups for this group.- Throws:
UnsupportedOperationException- If this group does not support nesting.DirectoryException- If a problem occurs while attempting to nest the provided group DN.
-
isMember
public boolean isMember(DN userDN, AtomicReference<Set<DN>> examinedGroups) throws DirectoryException
Description copied from class:GroupIndicates whether the user with the specified DN is a member of this group. Note that this is a point-in-time determination and the caller must not cache the result. Also note that group implementations that support nesting should use this version of the method rather than the version that does not take a set of DNs when attempting to determine whether a nested group includes the target member.- Specified by:
isMemberin classGroup<StaticGroupImplementationCfg>- Parameters:
userDN- The DN of the user for which to make the determination.examinedGroups- A set of groups that have already been examined in the process of making the determination. This provides a mechanism to prevent infinite recursion due to circular references (e.g., two groups include each other as nested groups). Each time a group instance is checked, its DN should be added to the list, and any DN already contained in the list should be skipped. The use of an atomic reference allow to lazily create the Set to optimize memory when there is no nested groups.- Returns:
trueif the specified user is currently a member of this group, orfalseif not.- Throws:
DirectoryException- If a problem occurs while attempting to make the determination.
-
isMember
public boolean isMember(Entry userEntry, AtomicReference<Set<DN>> examinedGroups) throws DirectoryException
Description copied from class:GroupIndicates whether the user described by the provided user entry is a member of this group. Note that this is a point-in-time determination and the caller must not cache the result. Also note that group implementations that support nesting should use this version of the method rather than the version that does not take a set of DNs when attempting to determine whether a nested group includes the target member.- Specified by:
isMemberin classGroup<StaticGroupImplementationCfg>- Parameters:
userEntry- The entry for the user for which to make the determination.examinedGroups- A set of groups that have already been examined in the process of making the determination. This provides a mechanism to prevent infinite recursion due to circular references (e.g., two groups include each other as nested groups). Each time a group instance is checked, its DN should be added to the list, and any DN already contained in the list should be skipped. The use of an atomic reference allow to lazily create the Set to optimize memory when there is no nested groups.- Returns:
trueif the specified user is currently a member of this group, orfalseif not.- Throws:
DirectoryException- If a problem occurs while attempting to make the determination.
-
getMembers
public MemberList getMembers() throws DirectoryException
Description copied from class:GroupRetrieves an iterator that may be used to cursor through the entries of the members contained in this group. Note that this is a point-in-time determination, and the caller must not cache the result. Further, the determination should only include this group and not members from nested groups.- Overrides:
getMembersin classGroup<StaticGroupImplementationCfg>- Returns:
- An iterator that may be used to cursor through the entries of the members contained in this group.
- Throws:
DirectoryException- If a problem occurs while attempting to retrieve the set of members.
-
getMembers
public MemberList getMembers(DN baseDN, SearchScope scope, SearchFilter filter) throws DirectoryException
Description copied from class:GroupRetrieves an iterator that may be used to cursor through the entries of the members contained in this group. It may optionally retrieve a subset of the member entries based on a given set of criteria. Note that this is a point-in-time determination, and the caller must not cache the result.- Specified by:
getMembersin classGroup<StaticGroupImplementationCfg>- Parameters:
baseDN- The base DN that should be used when determining whether a given entry will be returned. If this isnull, then all entries will be considered in the scope of the criteria.scope- The scope that should be used when determining whether a given entry will be returned. It must not benullif the provided base DN is notnull. The scope will be ignored if no base DN is provided.filter- The filter that should be used when determining whether a given entry will be returned. If this isnull, then any entry in the scope of the criteria will be included in the results.- Returns:
- An iterator that may be used to cursor through the entries of the members contained in this group.
- Throws:
DirectoryException- If a problem occurs while attempting to retrieve the set of members.
-
mayAlterMemberList
public boolean mayAlterMemberList()
Description copied from class:GroupIndicates whether it is possible to alter the member list for this group (e.g., in order to add members to the group or remove members from it).- Specified by:
mayAlterMemberListin classGroup<StaticGroupImplementationCfg>- Returns:
trueif it is possible to add members to this group, orfalseif not.
-
updateMembers
public void updateMembers(List<Modification> modifications) throws UnsupportedOperationException, DirectoryException
Description copied from class:GroupAttempt to make multiple changes to the group's member list.- Specified by:
updateMembersin classGroup<StaticGroupImplementationCfg>- Parameters:
modifications- The list of modifications being made to the group, which may include changes to non-member attributes.- Throws:
UnsupportedOperationException- If this group does not support altering the member list.DirectoryException- If a problem occurs while attempting to update the members.
-
addMember
public void addMember(Entry userEntry) throws UnsupportedOperationException, DirectoryException
Description copied from class:GroupAttempts to add the provided user as a member of this group. The change should be committed to persistent storage through an internal operation.- Specified by:
addMemberin classGroup<StaticGroupImplementationCfg>- Parameters:
userEntry- The entry for the user to be added as a member of this group.- Throws:
UnsupportedOperationException- If this group does not support altering the member list.DirectoryException- If a problem occurs while attempting to add the provided user as a member of this group.
-
removeMember
public void removeMember(DN userDN) throws UnsupportedOperationException, DirectoryException
Description copied from class:GroupAttempts to remove the specified user as a member of this group. The change should be committed to persistent storage through an internal operation.- Specified by:
removeMemberin classGroup<StaticGroupImplementationCfg>- Parameters:
userDN- The DN of the user to remove as a member of this group.- Throws:
UnsupportedOperationException- If this group does not support altering the member list.DirectoryException- If a problem occurs while attempting to remove the provided user as a member of this group.
-
toString
public void toString(StringBuilder buffer)
Description copied from class:GroupAppends a string representation of this group to the provided buffer.- Specified by:
toStringin classGroup<StaticGroupImplementationCfg>- Parameters:
buffer- The buffer to which the string representation should be appended.
-
-