Package org.opends.server.plugins
Class UniqueAttributePlugin
- java.lang.Object
-
- org.opends.server.api.plugin.DirectoryServerPlugin<UniqueAttributePluginCfg>
-
- org.opends.server.plugins.UniqueAttributePlugin
-
- All Implemented Interfaces:
ConfigurationChangeListener<UniqueAttributePluginCfg>
,AlertGenerator
public class UniqueAttributePlugin extends DirectoryServerPlugin<UniqueAttributePluginCfg> implements ConfigurationChangeListener<UniqueAttributePluginCfg>, AlertGenerator
This class implements a Directory Server plugin that can be used to ensure that all values for a given attribute or set of attributes are unique within the server (or optionally, below a specified set of base DNs). It will examine all add, modify, and modify DN operations to determine whether any new conflicts are introduced. If a conflict is detected then the operation will be rejected, unless that operation is being applied through synchronization in which case an alert will be generated to notify administrators of the problem.
-
-
Constructor Summary
Constructors Constructor Description UniqueAttributePlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(UniqueAttributePluginCfg newConfiguration)
Applies the configuration changes to this change listener.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(PostOperationModifyDNOperation modifyDnOp)
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 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.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(PostSynchronizationModifyDNOperation modifyDnOp)
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.PluginResult.PreOperation
doPreOperation(PreOperationAddOperation addOperation)
Performs any necessary processing that should be done just before the Directory Server performs the core processing for an add operation.PluginResult.PreOperation
doPreOperation(PreOperationModifyDNOperation modifyDnOp)
Performs any necessary processing that should be done just before the Directory Server performs the core processing for a modify DN operation.PluginResult.PreOperation
doPreOperation(PreOperationModifyOperation modifyOperation)
Performs any necessary processing that should be done just before the Directory Server performs the core processing for a modify operation.void
finalizePlugin()
Performs any necessary finalization for this plugin.Map<String,String>
getAlerts()
Retrieves information about the set of alerts that this generator may produce.Dn
getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.void
initializePlugin(Set<PluginType> pluginTypes, UniqueAttributePluginCfg configuration)
Performs any initialization necessary for this plugin.boolean
isConfigurationAcceptable(UniqueAttributePluginCfg cfg, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this plugin.boolean
isConfigurationChangeAcceptable(UniqueAttributePluginCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.-
Methods inherited from class org.opends.server.api.plugin.DirectoryServerPlugin
doLDIFImport, doLDIFImportBegin, doLDIFImportEnd, doPostConnect, doPostDisconnect, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostSynchronization, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreOperation, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doShutdown, doStartup, 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.AlertGenerator
getClassName
-
-
-
-
Method Detail
-
initializePlugin
public final void initializePlugin(Set<PluginType> pluginTypes, UniqueAttributePluginCfg configuration) throws ConfigException
Description copied from class:DirectoryServerPlugin
Performs any initialization necessary for this plugin. This will be called as soon as the plugin has been loaded and before it is registered with the server.- Specified by:
initializePlugin
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
- Parameters:
pluginTypes
- The set of plugin types that indicate the ways in which this plugin will be invoked.configuration
- The configuration for this plugin.- Throws:
ConfigException
- If the provided entry does not contain a valid configuration for this plugin.
-
finalizePlugin
public final void finalizePlugin()
Description copied from class:DirectoryServerPlugin
Performs any necessary finalization for this plugin. This will be called just after the plugin has been deregistered with the server but before it has been unloaded.- Overrides:
finalizePlugin
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
-
doPreOperation
public final PluginResult.PreOperation doPreOperation(PreOperationAddOperation addOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done just before the Directory Server performs the core processing for an add operation. This method is not called when processing synchronization operations.- Overrides:
doPreOperation
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
- Parameters:
addOperation
- The add operation to be processed.- Returns:
- Information about the result of the plugin processing.
-
doPreOperation
public final PluginResult.PreOperation doPreOperation(PreOperationModifyOperation modifyOperation)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done just before the Directory Server performs the core processing for a modify operation. This method is not called when processing synchronization operations.- Overrides:
doPreOperation
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
- Parameters:
modifyOperation
- The modify operation to be processed.- Returns:
- Information about the result of the plugin processing.
-
doPreOperation
public final PluginResult.PreOperation doPreOperation(PreOperationModifyDNOperation modifyDnOp)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done just before the Directory Server performs the core processing for a modify DN operation. This method is not called when processing synchronization operations.- Overrides:
doPreOperation
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
- Parameters:
modifyDnOp
- The modify DN operation to be processed.- Returns:
- Information about the result of the plugin processing.
-
doPostSynchronization
public final 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<UniqueAttributePluginCfg>
- Parameters:
addOperation
- The synchronized add operation for which processing has been completed.
-
doPostSynchronization
public final 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<UniqueAttributePluginCfg>
- Parameters:
modifyOperation
- The synchronized modify operation for which processing has been completed.
-
doPostSynchronization
public final void doPostSynchronization(PostSynchronizationModifyDNOperation modifyDnOp)
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<UniqueAttributePluginCfg>
- Parameters:
modifyDnOp
- The synchronized modify DN operation for which processing has been completed.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(UniqueAttributePluginCfg cfg, List<LocalizableMessage> unacceptableReasons)
Description copied from class:DirectoryServerPlugin
Indicates whether the provided configuration is acceptable for this plugin. It should be possible to call this method on an uninitialized plugin instance in order to determine whether the plugin would be able to use the provided configuration.- Overrides:
isConfigurationAcceptable
in classDirectoryServerPlugin<UniqueAttributePluginCfg>
- Parameters:
cfg
- The plugin configuration for which to make the determination.unacceptableReasons
- A list that may be used to hold the reasons that the provided configuration is not acceptable.- Returns:
true
if the provided configuration is acceptable for this plugin, orfalse
if not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(UniqueAttributePluginCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<UniqueAttributePluginCfg>
- 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
true
if the proposed change is acceptable, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(UniqueAttributePluginCfg newConfiguration)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<UniqueAttributePluginCfg>
- Parameters:
newConfiguration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
getComponentEntryDN
public Dn getComponentEntryDN()
Description copied from interface:AlertGenerator
Retrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDN
in interfaceAlertGenerator
- Returns:
- The DN of the configuration entry with which this alert generator is associated.
-
getAlerts
public Map<String,String> getAlerts()
Description copied from interface:AlertGenerator
Retrieves information about the set of alerts that this generator may produce. The map returned should be between the notification type for a particular notification and the human-readable description for that notification. This alert generator must not generate any alerts with types that are not contained in this list.- Specified by:
getAlerts
in interfaceAlertGenerator
- Returns:
- Information about the set of alerts that this generator may produce.
-
doPostOperation
public final 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<UniqueAttributePluginCfg>
- 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 final PluginResult.PostOperation doPostOperation(PostOperationModifyOperation modifyOperation)
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<UniqueAttributePluginCfg>
- 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 final PluginResult.PostOperation doPostOperation(PostOperationModifyDNOperation modifyDnOp)
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<UniqueAttributePluginCfg>
- Parameters:
modifyDnOp
- 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.
-
-