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:
ConfigurationAddListener<GroupImplementationCfg>,ConfigurationChangeListener<GroupImplementationCfg>,ConfigurationDeleteListener<GroupImplementationCfg>,LocalBackendInitializationListener
public class GroupManager extends InternalDirectoryServerPlugin implements ConfigurationChangeListener<GroupImplementationCfg>, ConfigurationAddListener<GroupImplementationCfg>, ConfigurationDeleteListener<GroupImplementationCfg>, 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 ConfigChangeResultapplyConfigurationAdd(GroupImplementationCfg configuration)Adds a new configuration to this add listener.ConfigChangeResultapplyConfigurationChange(GroupImplementationCfg configuration)Applies the configuration changes to this change listener.ConfigChangeResultapplyConfigurationDelete(GroupImplementationCfg configuration)Deletes an existing configuration from this delete listener.PluginResult.PostOperationdoPostOperation(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.PostOperationdoPostOperation(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.PostOperationdoPostOperation(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.PostOperationdoPostOperation(PostOperationModifyOperation modifyOperation)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.voiddoPostSynchronization(PostSynchronizationAddOperation addOperation)Performs any necessary processing that should be done after the Directory Server has completed processing for an add operation performed via synchronization.voiddoPostSynchronization(PostSynchronizationDeleteOperation deleteOperation)Performs any necessary processing that should be done after the Directory Server has completed processing for a delete operation performed via synchronization.voiddoPostSynchronization(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.voiddoPostSynchronization(PostSynchronizationModifyOperation modifyOperation)Performs any necessary processing that should be done after the Directory Server has completed processing for a modify operation performed via synchronization.voidfinalizeGroupManager()Performs any cleanup work that may be needed when the server is shutting down.Iterable<Group<?>>getGroupImplementations()Retrieves anIterableobject that may be used to cursor across the group implementations defined in the server.Group<?>getGroupInstance(DN entryDN)Retrieves the group instance defined in the entry with the specified DN.Iterable<Group<?>>getGroupInstances()Retrieves anIterableobject that may be used to cursor across the group instances defined in the server.booleanhasInstancesChanged(long token)Compare the specified token against the current group manager token value.voidinitializeGroupImplementations()Initializes all group implementations currently defined in the Directory Server configuration.booleanisConfigurationAddAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed addition of a new configuration is acceptable to this add listener.booleanisConfigurationChangeAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.booleanisConfigurationDeleteAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)Indicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.voidperformBackendPostFinalizationProcessing(LocalBackend<?> backend)Performs any processing that may be required whenever a backend is finalized.voidperformBackendPostInitializationProcessing(LocalBackend<?> backend)Performs any processing that may be required after the Initialisation cycle has been completed, that is all listeners have received the initialisation event, and the backend has been put into service,.voidperformBackendPreFinalizationProcessing(LocalBackend<?> backend)Performs any processing that may be required before starting the finalisation cycle, that is invoked before any listener receive the Finalization event.voidperformBackendPreInitializationProcessing(LocalBackend<?> backend)Performs any processing that may be required whenever a backend is initialized for use in the Directory Server.longrefreshToken()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
doLDIFExport, 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
-
-
-
-
Constructor Detail
-
GroupManager
public GroupManager(ServerContext serverContext) throws DirectoryException
Creates a new instance of this group manager.- Parameters:
serverContext- The server context.- Throws:
DirectoryException- If a problem occurs while creating an instance of the group manager.
-
-
Method Detail
-
initializeGroupImplementations
public void initializeGroupImplementations() throws ConfigException, InitializationExceptionInitializes all group implementations currently defined in the Directory Server configuration. This should only be called at Directory Server startup.- Throws:
ConfigException- If a configuration problem causes the group implementation initialization process to fail.InitializationException- If a problem occurs while initializing the group implementations that is not related to the server configuration.
-
isConfigurationAddAcceptable
public boolean isConfigurationAddAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationAddListenerIndicates whether the proposed addition of a new configuration is acceptable to this add listener.- Specified by:
isConfigurationAddAcceptablein interfaceConfigurationAddListener<GroupImplementationCfg>- Parameters:
configuration- The configuration that will be added.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed addition is acceptable, orfalseif it is not.
-
applyConfigurationAdd
public ConfigChangeResult applyConfigurationAdd(GroupImplementationCfg configuration)
Description copied from interface:ConfigurationAddListenerAdds a new configuration to this add listener.- Specified by:
applyConfigurationAddin interfaceConfigurationAddListener<GroupImplementationCfg>- Parameters:
configuration- The configuration that will be added.- Returns:
- Returns information about the result of adding the configuration.
-
isConfigurationDeleteAcceptable
public boolean isConfigurationDeleteAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationDeleteListenerIndicates whether the proposed deletion of an existing configuration is acceptable to this delete listener.- Specified by:
isConfigurationDeleteAcceptablein interfaceConfigurationDeleteListener<GroupImplementationCfg>- Parameters:
configuration- The configuration that will be deleted.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed deletion is acceptable, orfalseif it is not.
-
applyConfigurationDelete
public ConfigChangeResult applyConfigurationDelete(GroupImplementationCfg configuration)
Description copied from interface:ConfigurationDeleteListenerDeletes an existing configuration from this delete listener.- Specified by:
applyConfigurationDeletein interfaceConfigurationDeleteListener<GroupImplementationCfg>- Parameters:
configuration- The existing configuration that will be deleted.- Returns:
- Returns information about the result of deleting the configuration.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(GroupImplementationCfg configuration, List<org.forgerock.i18n.LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein interfaceConfigurationChangeListener<GroupImplementationCfg>- Parameters:
configuration- The new configuration containing the changes.unacceptableReasons- A list that can be used to hold messages about why the provided configuration is not acceptable.- Returns:
- Returns
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(GroupImplementationCfg configuration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<GroupImplementationCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
finalizeGroupManager
public void finalizeGroupManager()
Performs any cleanup work that may be needed when the server is shutting down.
-
getGroupImplementations
public Iterable<Group<?>> getGroupImplementations()
Retrieves anIterableobject that may be used to cursor across the group implementations defined in the server.- Returns:
- An
Iterableobject that may be used to cursor across the group implementations defined in the server.
-
getGroupInstances
public Iterable<Group<?>> getGroupInstances()
Retrieves anIterableobject that may be used to cursor across the group instances defined in the server.- Returns:
- An
Iterableobject 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
nullif 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:
performBackendPreInitializationProcessingin 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:
performBackendPostFinalizationProcessingin interfaceLocalBackendInitializationListener- Parameters:
backend- The backend that has been taken out of service and is about to be finalized.
-
performBackendPostInitializationProcessing
public void performBackendPostInitializationProcessing(LocalBackend<?> backend)
Description copied from interface:LocalBackendInitializationListenerPerforms any processing that may be required after the Initialisation cycle has been completed, that is all listeners have received the initialisation event, and the backend has been put into service,.- Specified by:
performBackendPostInitializationProcessingin interfaceLocalBackendInitializationListener- Parameters:
backend- The backend that has been initialized and has been put into service.
-
performBackendPreFinalizationProcessing
public void performBackendPreFinalizationProcessing(LocalBackend<?> backend)
Description copied from interface:LocalBackendInitializationListenerPerforms any processing that may be required before starting the finalisation cycle, that is invoked before any listener receive the Finalization event.- Specified by:
performBackendPreFinalizationProcessingin interfaceLocalBackendInitializationListener- Parameters:
backend- The backend that is about to be finalized.
-
doPostOperation
public PluginResult.PostOperation doPostOperation(PostOperationAddOperation addOperation)
Description copied from class:DirectoryServerPluginPerforms 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:
doPostOperationin 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:DirectoryServerPluginPerforms 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:
doPostOperationin 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 modifyOperation)
Description copied from class:DirectoryServerPluginPerforms 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:
doPostOperationin classDirectoryServerPlugin<PluginCfg>- Parameters:
modifyOperation- 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:DirectoryServerPluginPerforms 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:
doPostOperationin 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:DirectoryServerPluginPerforms any necessary processing that should be done after the Directory Server has completed processing for an add operation performed via synchronization.- Overrides:
doPostSynchronizationin classDirectoryServerPlugin<PluginCfg>- Parameters:
addOperation- The synchronized add operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationDeleteOperation deleteOperation)
Description copied from class:DirectoryServerPluginPerforms any necessary processing that should be done after the Directory Server has completed processing for a delete operation performed via synchronization.- Overrides:
doPostSynchronizationin classDirectoryServerPlugin<PluginCfg>- Parameters:
deleteOperation- The synchronized delete operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationModifyOperation modifyOperation)
Description copied from class:DirectoryServerPluginPerforms any necessary processing that should be done after the Directory Server has completed processing for a modify operation performed via synchronization.- Overrides:
doPostSynchronizationin classDirectoryServerPlugin<PluginCfg>- Parameters:
modifyOperation- The synchronized modify operation for which processing has been completed.
-
doPostSynchronization
public void doPostSynchronization(PostSynchronizationModifyDNOperation modifyDNOperation)
Description copied from class:DirectoryServerPluginPerforms any necessary processing that should be done after the Directory Server has completed processing for a modify DN operation performed via synchronization.- Overrides:
doPostSynchronizationin classDirectoryServerPlugin<PluginCfg>- Parameters:
modifyDNOperation- The synchronized modify DN operation for which processing has been completed.
-
hasInstancesChanged
public boolean hasInstancesChanged(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:
trueif the group class should reload its nested groups, orfalseif 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.
-
-