org.opends.server.plugins
Class UniqueAttributePlugin

java.lang.Object
  extended by org.opends.server.api.plugin.DirectoryServerPlugin<UniqueAttributePluginCfg>
      extended by 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
UniqueAttributePlugin()
           
 
Method Summary
 ConfigChangeResult applyConfigurationChange(UniqueAttributePluginCfg newConfiguration)
          Applies the configuration changes to this change listener.
 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 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.
 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 modifyDNOperation)
          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.
 java.util.LinkedHashMap<java.lang.String,java.lang.String> getAlerts()
          Retrieves information about the set of alerts that this generator may produce.
 java.lang.String getClassName()
          Retrieves the fully-qualified name of the Java class for this alert generator implementation.
 DN getComponentEntryDN()
          Retrieves the DN of the configuration entry with which this alert generator is associated.
 void initializePlugin(java.util.Set<PluginType> pluginTypes, UniqueAttributePluginCfg configuration)
          Performs any initialization necessary for this plugin.
 boolean isConfigurationAcceptable(PluginCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this plugin.
 boolean isConfigurationChangeAcceptable(UniqueAttributePluginCfg configuration, java.util.List<Message> 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
doLDIFExport, doLDIFImport, doPostConnect, doPostDisconnect, doPostOperation, doPostOperation, doPostOperation, 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, initializeInternal, invokeForInternalOperations, processIntermediateResponse, processSearchEntry, processSearchReference, processSubordinateModifyDN, setInvokeForInternalOperations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UniqueAttributePlugin

public UniqueAttributePlugin()
Method Detail

initializePlugin

public final void initializePlugin(java.util.Set<PluginType> pluginTypes,
                                   UniqueAttributePluginCfg configuration)
                            throws ConfigException
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 class DirectoryServerPlugin<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()
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 class DirectoryServerPlugin<UniqueAttributePluginCfg>

doPreOperation

public final 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. This method is not called when processing synchronization operations.

Overrides:
doPreOperation in class DirectoryServerPlugin<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)
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 class DirectoryServerPlugin<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 modifyDNOperation)
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 class DirectoryServerPlugin<UniqueAttributePluginCfg>
Parameters:
modifyDNOperation - The modify DN operation to be processed.
Returns:
Information about the result of the plugin processing.

doPostSynchronization

public final 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.

Overrides:
doPostSynchronization in class DirectoryServerPlugin<UniqueAttributePluginCfg>
Parameters:
addOperation - The synchronized add operation for which processing has been completed.

doPostSynchronization

public final 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.

Overrides:
doPostSynchronization in class DirectoryServerPlugin<UniqueAttributePluginCfg>
Parameters:
modifyOperation - The synchronized modify operation for which processing has been completed.

doPostSynchronization

public final 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.

Overrides:
doPostSynchronization in class DirectoryServerPlugin<UniqueAttributePluginCfg>
Parameters:
modifyDNOperation - The synchronized modify DN operation for which processing has been completed.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(PluginCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
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 class DirectoryServerPlugin<UniqueAttributePluginCfg>
Parameters:
configuration - 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, or false if not.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(UniqueAttributePluginCfg configuration,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<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, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(UniqueAttributePluginCfg newConfiguration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<UniqueAttributePluginCfg>
Parameters:
newConfiguration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.

getComponentEntryDN

public DN getComponentEntryDN()
Retrieves the DN of the configuration entry with which this alert generator is associated.

Specified by:
getComponentEntryDN in interface AlertGenerator
Returns:
The DN of the configuration entry with which this alert generator is associated.

getClassName

public java.lang.String getClassName()
Retrieves the fully-qualified name of the Java class for this alert generator implementation.

Specified by:
getClassName in interface AlertGenerator
Returns:
The fully-qualified name of the Java class for this alert generator implementation.

getAlerts

public java.util.LinkedHashMap<java.lang.String,java.lang.String> getAlerts()
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 interface AlertGenerator
Returns:
Information about the set of alerts that this generator may produce.