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 ConfigChangeResultapplyConfigurationChange(UniqueAttributePluginCfg newConfiguration)Applies the configuration changes to this change 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(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.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(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.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.PluginResult.PreOperationdoPreOperation(PreOperationAddOperation addOperation)Performs any necessary processing that should be done just before the Directory Server performs the core processing for an add operation.PluginResult.PreOperationdoPreOperation(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.PreOperationdoPreOperation(PreOperationModifyOperation modifyOperation)Performs any necessary processing that should be done just before the Directory Server performs the core processing for a modify operation.voidfinalizePlugin()Performs any necessary finalization for this plugin.Map<String,String>getAlerts()Retrieves information about the set of alerts that this generator may produce.DngetComponentEntryDN()Retrieves the DN of the configuration entry with which this alert generator is associated.voidinitializePlugin(Set<PluginType> pluginTypes, UniqueAttributePluginCfg configuration)Performs any initialization necessary for this plugin.booleanisConfigurationAcceptable(UniqueAttributePluginCfg cfg, List<LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this plugin.booleanisConfigurationChangeAcceptable(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, doPostCommit, doPostCommit, doPostCommit, doPostCommit, 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:DirectoryServerPluginPerforms 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:
initializePluginin 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:DirectoryServerPluginPerforms 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:
finalizePluginin classDirectoryServerPlugin<UniqueAttributePluginCfg>
-
doPreOperation
public final PluginResult.PreOperation doPreOperation(PreOperationAddOperation addOperation)
Description copied from class:DirectoryServerPluginPerforms 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:
doPreOperationin 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:DirectoryServerPluginPerforms 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:
doPreOperationin 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:DirectoryServerPluginPerforms 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:
doPreOperationin 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: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<UniqueAttributePluginCfg>- Parameters:
addOperation- The synchronized add operation for which processing has been completed.
-
doPostSynchronization
public final 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<UniqueAttributePluginCfg>- Parameters:
modifyOperation- The synchronized modify operation for which processing has been completed.
-
doPostSynchronization
public final void doPostSynchronization(PostSynchronizationModifyDNOperation modifyDnOp)
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<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:DirectoryServerPluginIndicates 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:
isConfigurationAcceptablein 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:
trueif the provided configuration is acceptable for this plugin, orfalseif not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(UniqueAttributePluginCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(UniqueAttributePluginCfg newConfiguration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein 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:AlertGeneratorRetrieves the DN of the configuration entry with which this alert generator is associated.- Specified by:
getComponentEntryDNin 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:AlertGeneratorRetrieves 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:
getAlertsin 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: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<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: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<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: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<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.
-
-