Class 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 groupOfNames object class: which stores the member list in the member attribute
    • one based on the groupOfEntries object class, which also stores the member list in the member attribute
    • one based on the groupOfUniqueNames object class, which stores the member list in the uniqueMember attribute.
    • Constructor Detail

      • StaticGroup

        public StaticGroup()
        Creates an uninitialized static group. This is intended for internal use only, to allow GroupManager to dynamically create a group.
    • Method Detail

      • newInstance

        public StaticGroup newInstance​(ServerContext serverContext,
                                       Entry groupEntry)
                                throws DirectoryException
        Description copied from class: Group
        Creates 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 the initializeGroupImplementation method.
        Specified by:
        newInstance in class Group<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: Group
        Retrieves 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 the initializeGroupImplementation method.
        Specified by:
        getGroupDefinitionFilter in class Group<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: Group
        Indicates whether the provided entry contains a valid definition for this type of group.
        Specified by:
        isGroupDefinition in class Group<StaticGroupImplementationCfg>
        Parameters:
        entry - The entry for which to make the determination.
        Returns:
        true if the provided entry does contain a valid definition for this type of group, or false if it does not.
      • getGroupDN

        public DN getGroupDN()
        Description copied from class: Group
        Retrieves the DN of the entry that contains the definition for this group.
        Specified by:
        getGroupDN in class Group<StaticGroupImplementationCfg>
        Returns:
        The DN of the entry that contains the definition for this group.
      • setGroupDN

        public void setGroupDN​(DN groupDN)
        Description copied from class: Group
        Sets the DN of the entry that contains the definition for this group.
        Specified by:
        setGroupDN in class Group<StaticGroupImplementationCfg>
        Parameters:
        groupDN - The DN of the entry that contains the definition for this group.
      • supportsNestedGroups

        public boolean supportsNestedGroups()
        Description copied from class: Group
        Indicates 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:
        supportsNestedGroups in class Group<StaticGroupImplementationCfg>
        Returns:
        true if this group supports nesting other groups, or false if it does not.
      • getNestedGroupDNs

        public List<DN> getNestedGroupDNs()
        Description copied from class: Group
        Retrieves a list of the DNs of any nested groups whose members should be considered members of this group.
        Specified by:
        getNestedGroupDNs in class Group<StaticGroupImplementationCfg>
        Returns:
        A list of the DNs of any nested groups whose members should be considered members of this group.
      • isMember

        public boolean isMember​(DN userDN,
                                AtomicReference<Set<DN>> examinedGroups)
                         throws DirectoryException
        Description copied from class: Group
        Indicates 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:
        isMember in class Group<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:
        true if the specified user is currently a member of this group, or false if 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: Group
        Indicates 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:
        isMember in class Group<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:
        true if the specified user is currently a member of this group, or false if not.
        Throws:
        DirectoryException - If a problem occurs while attempting to make the determination.
      • getMembers

        public MemberList getMembers()
                              throws DirectoryException
        Description copied from class: Group
        Retrieves 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:
        getMembers in class Group<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: Group
        Retrieves 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:
        getMembers in class Group<StaticGroupImplementationCfg>
        Parameters:
        baseDN - The base DN that should be used when determining whether a given entry will be returned. If this is null, 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 be null if the provided base DN is not null. 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 is null, 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: Group
        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).
        Specified by:
        mayAlterMemberList in class Group<StaticGroupImplementationCfg>
        Returns:
        true if it is possible to add members to this group, or false if not.
      • toString

        public void toString​(StringBuilder buffer)
        Description copied from class: Group
        Appends a string representation of this group to the provided buffer.
        Specified by:
        toString in class Group<StaticGroupImplementationCfg>
        Parameters:
        buffer - The buffer to which the string representation should be appended.