Package org.opends.server.core
Class GroupManager
- java.lang.Object
-
- org.opends.server.api.plugin.DirectoryServerPlugin<PluginCfg>
-
- org.opends.server.api.plugin.InternalDirectoryServerPlugin
-
- org.opends.server.core.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 Summary
Constructors Constructor Description GroupManager(ServerContext serverContext)
Creates a new instance of this group manager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deregisterAllGroups()
Removes all group instances that might happen to be registered with the group manager.PluginResult.PostOperation
doPostOperation(PostOperationAddOperation addOperation)
Performs any necessary processing that should be done after the Directory Server has completed the core processing for an add operation but before the response has been sent to the client.PluginResult.PostOperation
doPostOperation(PostOperationDeleteOperation deleteOperation)
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a delete operation but before the response has been sent to the client.PluginResult.PostOperation
doPostOperation(PostOperationModifyDNOperation modifyDNOperation)
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a modify DN operation but before the response has been sent to the client.PluginResult.PostOperation
doPostOperation(PostOperationModifyOperation modifyOp)
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a modify operation but before the response has been sent to the client.void
doPostSynchronization(PostSynchronizationAddOperation addOperation)
Performs any necessary processing that should be done after the Directory Server has completed processing for an add operation performed via synchronization.void
doPostSynchronization(PostSynchronizationDeleteOperation deleteOperation)
Performs any necessary processing that should be done after the Directory Server has completed processing for a delete operation performed via synchronization.void
doPostSynchronization(PostSynchronizationModifyDNOperation modifyDNOperation)
Performs any necessary processing that should be done after the Directory Server has completed processing for a modify DN operation performed via synchronization.void
doPostSynchronization(PostSynchronizationModifyOperation modifyOperation)
Performs any necessary processing that should be done after the Directory Server has completed processing for a modify operation performed via synchronization.<E extends Exception>
voiddoWithSharedLock(Action<E> action)
Executes the provided action after acquiring this group manager's lock.void
finalizeGroupManager()
Performs any cleanup work that may be needed when the server is shutting down.Group
getGroupInstance(Dn entryDN)
Retrieves the group instance defined in the entry with the specified DN.Iterable<Group>
getGroupInstances()
Retrieves anIterable
object that may be used to cursor across the group instances defined in the server.boolean
haveGroupInstancesChanged(long token)
Compare the specified token against the current group manager token value.void
performBackendPostFinalizationProcessing(LocalBackend<?> backend)
Performs any processing that may be required whenever a backend is finalized.void
performBackendPreInitializationProcessing(LocalBackend<?> backend)
Performs any processing that may be required whenever a backend is initialized for use in the Directory Server.long
refreshToken()
Return the current refresh token value.-
Methods inherited from class org.opends.server.api.plugin.InternalDirectoryServerPlugin
initializePlugin, isConfigurationAcceptable
-
Methods inherited from class org.opends.server.api.plugin.DirectoryServerPlugin
doLDIFImport, doLDIFImportBegin, doLDIFImportEnd, doPostConnect, doPostDisconnect, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doShutdown, doStartup, finalizePlugin, getPluginEntryDN, getPluginTypes, getServerContext, initializeInternal, invokeForInternalOperations, processIntermediateResponse, processSearchEntry, processSearchReference, processSubordinateDelete, processSubordinateModifyDN, setInvokeForInternalOperations
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opends.server.api.LocalBackendInitializationListener
performBackendPostInitializationProcessing, performBackendPreFinalizationProcessing
-
-
-
-
Constructor Detail
-
GroupManager
public GroupManager(ServerContext serverContext)
Creates a new instance of this group manager.- Parameters:
serverContext
- The server context.
-
-
Method Detail
-
finalizeGroupManager
public void finalizeGroupManager()
Performs any cleanup work that may be needed when the server is shutting down.
-
getGroupInstances
public Iterable<Group> getGroupInstances()
Retrieves anIterable
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.
-
getGroupInstance
public Group getGroupInstance(Dn entryDN)
Retrieves the group instance defined in the entry with the specified DN.- Parameters:
entryDN
- The DN of the entry containing the definition of the group instance to retrieve.- Returns:
- The group instance defined in the entry with the specified DN, or
null
if no such group is currently defined.
-
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 interfaceLocalBackendInitializationListener
- Parameters:
backend
- The backend that has been initialized and is about to be put into service.
-
performBackendPostFinalizationProcessing
public void performBackendPostFinalizationProcessing(LocalBackend<?> backend)
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 but before 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 interfaceLocalBackendInitializationListener
- Parameters:
backend
- The backend that has been taken out of service and is about to be finalized.
-
doPostOperation
public PluginResult.PostOperation doPostOperation(PostOperationAddOperation addOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed the core processing for an add operation but before the response has been sent to the client.- Overrides:
doPostOperation
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
addOperation
- The add operation for which processing has completed but no response has yet been sent.- Returns:
- Information about the result of the plugin processing.
-
doPostOperation
public PluginResult.PostOperation doPostOperation(PostOperationDeleteOperation deleteOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a delete operation but before the response has been sent to the client.- Overrides:
doPostOperation
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
deleteOperation
- The delete operation for which processing has completed but no response has yet been sent.- Returns:
- Information about the result of the plugin processing.
-
doPostOperation
public PluginResult.PostOperation doPostOperation(PostOperationModifyOperation modifyOp)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a modify operation but before the response has been sent to the client.- Overrides:
doPostOperation
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
modifyOp
- The modify operation for which processing has completed but no response has yet been sent.- Returns:
- Information about the result of the plugin processing.
-
doPostOperation
public PluginResult.PostOperation doPostOperation(PostOperationModifyDNOperation modifyDNOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed the core processing for a modify DN operation but before the response has been sent to the client.- Overrides:
doPostOperation
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
modifyDNOperation
- The modify DN operation for which processing has completed but no response has yet been sent.- Returns:
- Information about the result of the plugin processing.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationAddOperation addOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed processing for an add operation performed via synchronization.- Overrides:
doPostSynchronization
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
addOperation
- The synchronized add operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationDeleteOperation deleteOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed processing for a delete operation performed via synchronization.- Overrides:
doPostSynchronization
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
deleteOperation
- The synchronized delete operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationModifyOperation modifyOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed processing for a modify operation performed via synchronization.- Overrides:
doPostSynchronization
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
modifyOperation
- The synchronized modify operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationModifyDNOperation modifyDNOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done after the Directory Server has completed processing for a modify DN operation performed via synchronization.- Overrides:
doPostSynchronization
in classDirectoryServerPlugin<PluginCfg>
- Parameters:
modifyDNOperation
- The synchronized modify DN operation for which processing has been completed.
-
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 actionE 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.
-
haveGroupInstancesChanged
public boolean haveGroupInstancesChanged(long token)
Compare the specified token against the current group manager token value. Can be used to reload cached group instances if there has been a group instance change.- Parameters:
token
- The current token that the group class holds.- Returns:
true
if the group class should reload its nested groups, orfalse
if it shouldn't.
-
refreshToken
public long refreshToken()
Return the current refresh token value. Can be used to reload cached group instances if there has been a group instance change.- Returns:
- The current token value.
-
-