Package org.opends.server.plugins
Class ReferentialIntegrityPlugin
- java.lang.Object
-
- org.opends.server.api.plugin.DirectoryServerPlugin<ReferentialIntegrityPluginCfg>
-
- org.opends.server.plugins.ReferentialIntegrityPlugin
-
- All Implemented Interfaces:
ConfigurationChangeListener<ReferentialIntegrityPluginCfg>
,ServerShutdownListener
public class ReferentialIntegrityPlugin extends DirectoryServerPlugin<ReferentialIntegrityPluginCfg> implements ConfigurationChangeListener<ReferentialIntegrityPluginCfg>, ServerShutdownListener
This class implements a Directory Server post operation plugin that performs Referential Integrity processing on successful delete and modify DN operations. The plugin uses a set of configuration criteria to determine what attribute types to check referential integrity on, and, the set of base DNs to search for entries that might need referential integrity processing. If none of these base DNs are specified in the configuration, then the public naming contexts are used as the base DNs by default.
The plugin also has an option to process changes in background using a thread that wakes up periodically looking for change records in a log file.
-
-
Field Summary
Fields Modifier and Type Field Description static String
DELETE_DNS
Used to save a set in the delete operation attachment map that holds the subordinate entry DNs related to a delete operation.static String
MODIFYDN_DNS
Used to save a map in the modifyDN operation attachment map that holds the old entry DNs and the new entry DNs related to a modify DN rename to new superior operation.
-
Constructor Summary
Constructors Constructor Description ReferentialIntegrityPlugin()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResult
applyConfigurationChange(ReferentialIntegrityPluginCfg newConfiguration)
Applies the configuration changes to this change listener.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.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(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.void
initializePlugin(Set<PluginType> pluginTypes, ReferentialIntegrityPluginCfg pluginCfg)
Performs any initialization necessary for this plugin.boolean
isConfigurationAcceptable(ReferentialIntegrityPluginCfg pluginCfg, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this plugin.boolean
isConfigurationChangeAcceptable(ReferentialIntegrityPluginCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.void
processServerShutdown(LocalizableMessage reason)
Process a server shutdown.PluginResult.SubordinateDelete
processSubordinateDelete(DeleteOperation deleteOperation, Dn entryDn, boolean isCommitted)
Performs any necessary processing that should be done whenever a subordinate entry is deleted as part of subtree delete operation.PluginResult.SubordinateModifyDN
processSubordinateModifyDN(SubordinateModifyDNOperation modifyDNOperation, Dn oldEntryDn, Dn newEntryDn)
Performs any necessary processing that should be done whenever a subordinate entry is moved or renamed as part of a modify DN operation.-
Methods inherited from class org.opends.server.api.plugin.DirectoryServerPlugin
doLDIFImport, doLDIFImportBegin, doLDIFImportEnd, doPostConnect, doPostDisconnect, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostOperation, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostResponse, doPostSynchronization, doPostSynchronization, doPostSynchronization, doPostSynchronization, doPreOperation, 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, setInvokeForInternalOperations
-
-
-
-
Field Detail
-
MODIFYDN_DNS
public static final String MODIFYDN_DNS
Used to save a map in the modifyDN operation attachment map that holds the old entry DNs and the new entry DNs related to a modify DN rename to new superior operation.- See Also:
- Constant Field Values
-
DELETE_DNS
public static final String DELETE_DNS
Used to save a set in the delete operation attachment map that holds the subordinate entry DNs related to a delete operation.- See Also:
- Constant Field Values
-
-
Method Detail
-
initializePlugin
public final void initializePlugin(Set<PluginType> pluginTypes, ReferentialIntegrityPluginCfg pluginCfg) 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<ReferentialIntegrityPluginCfg>
- Parameters:
pluginTypes
- The set of plugin types that indicate the ways in which this plugin will be invoked.pluginCfg
- The configuration for this plugin.- Throws:
ConfigException
- If the provided entry does not contain a valid configuration for this plugin.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(ReferentialIntegrityPluginCfg newConfiguration)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<ReferentialIntegrityPluginCfg>
- Parameters:
newConfiguration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(ReferentialIntegrityPluginCfg pluginCfg, 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<ReferentialIntegrityPluginCfg>
- Parameters:
pluginCfg
- 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(ReferentialIntegrityPluginCfg 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<ReferentialIntegrityPluginCfg>
- 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.
-
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<ReferentialIntegrityPluginCfg>
- 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.
-
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<ReferentialIntegrityPluginCfg>
- 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.
-
processSubordinateModifyDN
public PluginResult.SubordinateModifyDN processSubordinateModifyDN(SubordinateModifyDNOperation modifyDNOperation, Dn oldEntryDn, Dn newEntryDn)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done whenever a subordinate entry is moved or renamed as part of a modify DN operation. Note that if the entry is to be changed in any way, the new entry should be directly modified, and the changes made should also be added to the provided list of modifications.
NOTE: At the present time, OpenDS does not provide support for altering entries subordinate to the target of a modify DN operation. While this may be available in the future, current plugins should not attempt to alter the new or old entries in any way, nor should they attempt to add any modifications to the provided list.- Overrides:
processSubordinateModifyDN
in classDirectoryServerPlugin<ReferentialIntegrityPluginCfg>
- Parameters:
modifyDNOperation
- The modify DN operation with which the subordinate entry is associated.oldEntryDn
- The name of the subordinate entry prior to the move/rename operation.newEntryDn
- The name of the subordinate entry after the move/rename operation.- Returns:
- Information about the result of the plugin processing.
-
processSubordinateDelete
public PluginResult.SubordinateDelete processSubordinateDelete(DeleteOperation deleteOperation, Dn entryDn, boolean isCommitted)
Description copied from class:DirectoryServerPlugin
Performs any necessary processing that should be done whenever a subordinate entry is deleted as part of subtree delete operation.- Overrides:
processSubordinateDelete
in classDirectoryServerPlugin<ReferentialIntegrityPluginCfg>
- Parameters:
deleteOperation
- The delete operation with which the subordinate entry is associated.entryDn
- The name of the subordinate entry being deleted.isCommitted
-true
when a subtree delete cannot be done in a single isolated transaction. Each subordinate has already been deleted at the time this method is invoked.false
when a subtree delete can be done in a single isolated transaction. All the subordinate entries will effectively be deleted at once during the transaction commit. At which point, the deletion become effective only at the time of theDirectoryServerPlugin.doPostOperation(PostOperationDeleteOperation)
invocation.- Returns:
- Information about the result of the plugin processing.
-
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<ReferentialIntegrityPluginCfg>
-
processServerShutdown
public void processServerShutdown(LocalizableMessage reason)
Process a server shutdown. If the background thread is running it needs to be interrupted so it can read the stop request variable and exit.- Specified by:
processServerShutdown
in interfaceServerShutdownListener
- Parameters:
reason
- The reason message for the shutdown.
-
doPreOperation
public 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<ReferentialIntegrityPluginCfg>
- Parameters:
modifyOperation
- The modify operation to be processed.- Returns:
- Information about the result of the plugin processing.
-
doPreOperation
public 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<ReferentialIntegrityPluginCfg>
- Parameters:
addOperation
- The add operation to be processed.- Returns:
- Information about the result of the plugin processing.
-
-