org.opends.server.plugins
Class ReferentialIntegrityPlugin

java.lang.Object
  extended by org.opends.server.api.plugin.DirectoryServerPlugin<ReferentialIntegrityPluginCfg>
      extended by 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
static java.lang.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
ReferentialIntegrityPlugin()
           
 
Method Summary
 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.
 void finalizePlugin()
          Performs any necessary finalization for this plugin.
 java.lang.String getShutdownListenerName()
          Return the listener name.
 void initializePlugin(java.util.Set<PluginType> pluginTypes, ReferentialIntegrityPluginCfg pluginCfg)
          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(ReferentialIntegrityPluginCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 void processServerShutdown(Message reason)
          Process a server shutdown.
 PluginResult.SubordinateModifyDN processSubordinateModifyDN(SubordinateModifyDNOperation modifyDNOperation, Entry oldEntry, Entry newEntry, java.util.List<Modification> modifications)
          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
doLDIFExport, doLDIFImport, 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, doPreOperation, doPreOperation, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doPreParse, doShutdown, doStartup, getPluginEntryDN, getPluginTypes, initializeInternal, invokeForInternalOperations, processIntermediateResponse, processSearchEntry, processSearchReference, setInvokeForInternalOperations
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODIFYDN_DNS

public static final java.lang.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
Constructor Detail

ReferentialIntegrityPlugin

public ReferentialIntegrityPlugin()
Method Detail

initializePlugin

public final void initializePlugin(java.util.Set<PluginType> pluginTypes,
                                   ReferentialIntegrityPluginCfg pluginCfg)
                            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<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)
Applies the configuration changes to this change listener.

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

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<ReferentialIntegrityPluginCfg>
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(ReferentialIntegrityPluginCfg 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<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, or false if it is not.

doPostOperation

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

Overrides:
doPostOperation in class DirectoryServerPlugin<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)
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 class DirectoryServerPlugin<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,
                                                                   Entry oldEntry,
                                                                   Entry newEntry,
                                                                   java.util.List<Modification> modifications)
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 class DirectoryServerPlugin<ReferentialIntegrityPluginCfg>
Parameters:
modifyDNOperation - The modify DN operation with which the subordinate entry is associated.
oldEntry - The subordinate entry prior to the move/rename operation.
newEntry - The subordinate enry after the move/rename operation.
modifications - A list into which any modifications made to the target entry should be placed.
Returns:
Information about the result of the plugin processing.

getShutdownListenerName

public java.lang.String getShutdownListenerName()
Return the listener name.

Specified by:
getShutdownListenerName in interface ServerShutdownListener
Returns:
The name of the listener.

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<ReferentialIntegrityPluginCfg>

processServerShutdown

public void processServerShutdown(Message 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 interface ServerShutdownListener
Parameters:
reason - The reason message for the shutdown.