Class GroupManager

  • All Implemented Interfaces:
    LocalBackendInitializationListener

    public final class GroupManager
    extends InternalDirectoryServerPlugin
    implements LocalBackendInitializationListener
    This class provides a mechanism for interacting with all groups defined in the Directory Server. It will handle all necessary processing at server startup to identify and load all group implementations, as well as to find all group instances within the server.

    FIXME: At the present time, it assumes that all of the necessary information about all of the groups defined in the server can be held in memory. If it is determined that this approach is not workable in all cases, then we will need an alternate strategy.
    • Constructor Detail

      • GroupManager

        public GroupManager​(ServerContext serverContext)
        Creates a new instance of this group manager.
        Parameters:
        serverContext - The server context.
    • Method Detail

      • getStaticGroupCache

        public EntryCache<? extends EntryCacheCfg> getStaticGroupCache()
        Returns the cache for static groups.
        Returns:
        the cache for static groups.
      • finalizeGroupManager

        public void finalizeGroupManager()
        Performs any cleanup work that may be needed when the server is shutting down.
      • getAllGroups

        public Iterable<Group> getAllGroups()
        Retrieves an Iterable object that may be used to cursor across the group instances defined in the server.
        Returns:
        An Iterable object that may be used to cursor across the group instances defined in the server.
      • getGroup

        public Group getGroup​(Dn entryDN)
        Retrieves the group defined in the entry with the specified DN.
        Parameters:
        entryDN - The DN of the entry containing the definition of the group to retrieve.
        Returns:
        The group defined in the entry with the specified DN, or null if no such group is currently defined.
      • doStartup

        public PluginResult.Startup doStartup()
        Description copied from class: DirectoryServerPlugin
        Performs any processing that should be done when the Directory Server is in the process of starting. This method will be called after virtually all other initialization has been performed but before the connection handlers are started.
        Overrides:
        doStartup in class DirectoryServerPlugin<PluginCfg>
        Returns:
        The result of the startup plugin processing.
      • performBackendPreInitializationProcessing

        public void performBackendPreInitializationProcessing​(LocalBackend<?> backend)
        Performs any processing that may be required whenever a backend is initialized for use in the Directory Server. This method will be invoked after the backend has been initialized but before it has been put into service.

        In this case, the server will search the backend to find all group instances that it may contain and register them with this group manager.

        Specified by:
        performBackendPreInitializationProcessing in interface LocalBackendInitializationListener
        Parameters:
        backend - The backend that has been initialized and is about to be put into service.
      • performBackendPostFinalizationProcessing

        public void performBackendPostFinalizationProcessing​(String backendId,
                                                             Predicate<Dn> handlesEntry)
        Performs any processing that may be required whenever a backend is finalized. This method will be invoked after the backend has been taken out of service and after it has been finalized.

        In this case, the server will de-register all group instances associated with entries in the provided backend.

        Specified by:
        performBackendPostFinalizationProcessing in interface LocalBackendInitializationListener
        Parameters:
        backendId - The backend ID of the backend that has been taken out of service.
        handlesEntry - A predicate which can be used for determining whether the finalized backend contained an entry.
      • doWithSharedLock

        public <E extends Exception> void doWithSharedLock​(Action<E> action)
                                                    throws E extends Exception
        Executes the provided action after acquiring this group manager's lock.
        Type Parameters:
        E - the exception that may be thrown by the action
        Parameters:
        action - the action to execute
        Throws:
        E - the exception thrown by the action
        E extends Exception
      • deregisterAllGroups

        public void deregisterAllGroups()
        Removes all group instances that might happen to be registered with the group manager. This method is only intended for testing purposes and should not be called by any other code.