| | |
| | | */ |
| | | public static final String DELETE_DNS="deleteDNs"; |
| | | |
| | | /** |
| | | * The buffered reader that is used to read the log file by the background |
| | | * thread. |
| | | */ |
| | | /** The buffered reader that is used to read the log file by the background thread. */ |
| | | private BufferedReader reader; |
| | | |
| | | /** |
| | |
| | | unacceptableReasons.add(ERR_PLUGIN_REFERENT_ATTR_NOT_LISTED.get(attr)); |
| | | } |
| | | |
| | | /* Verify the filter. |
| | | */ |
| | | /* Verify the filter. */ |
| | | try |
| | | { |
| | | SearchFilter.createFilterFromString(filtStr); |
| | |
| | | * @param log Set to <code>true</code> if the map should be written to a log |
| | | * file so that the background thread can process the changes at |
| | | * a later time. |
| | | * |
| | | */ |
| | | private void processModifyDN(Map<DN, DN> modDNMap, boolean log) |
| | | { |
| | |
| | | * @param log Set to <code>true</code> if the DN should be written to a log |
| | | * file so that the background thread can process the change at |
| | | * a later time. |
| | | * |
| | | */ |
| | | private void processDelete(Set<DN> deleteDNset, boolean log) |
| | | { |
| | |
| | | * @param oldEntryDN The entry DN before the modify DN operation. |
| | | * |
| | | * @param newEntryDN The entry DN after the modify DN operation. |
| | | * |
| | | */ |
| | | private void processModifyDN(DN oldEntryDN, DN newEntryDN) |
| | | { |
| | |
| | | * are used. |
| | | * |
| | | * @return A set of DNs to use in the reference searches. |
| | | * |
| | | */ |
| | | private Set<DN> getBaseDNsToSearch() |
| | | { |
| | |
| | | * |
| | | * @param newEntryDN The new entry DN that needs to be added. May be null |
| | | * if the original operation was a delete. |
| | | * |
| | | */ |
| | | private void searchBaseDN(DN baseDN, DN oldEntryDN, DN newEntryDN) |
| | | { |
| | |
| | | * @param baseDN The DN to base the search at. |
| | | * |
| | | * @param modifyDNmap The map containing the modify DN old and new entry DNs. |
| | | * |
| | | */ |
| | | private void doBaseDN(DN baseDN, Map<DN,DN> modifyDNmap) |
| | | { |
| | |
| | | * @param baseDN The DN to base the search at. |
| | | * |
| | | * @param deleteDNset The set containing the delete DNs. |
| | | * |
| | | */ |
| | | private void doBaseDN(DN baseDN, Set<DN> deleteDNset) |
| | | { |
| | |
| | | * |
| | | * @param newEntryDN The new entry DN to add a reference to, if it is not |
| | | * null. |
| | | * |
| | | */ |
| | | private void deleteAddAttributesEntry(Entry e, DN oldEntryDN, DN newEntryDN) |
| | | { |
| | |
| | | * @param logFileName The name of the file to use, may be absolute. |
| | | * |
| | | * @throws ConfigException If a new file cannot be created if needed. |
| | | * |
| | | */ |
| | | private void setUpLogFile(String logFileName) |
| | | throws ConfigException |
| | |
| | | * with. |
| | | * |
| | | * @throws IOException If a new file writer cannot be created. |
| | | * |
| | | */ |
| | | private void setupWriter() throws IOException { |
| | | writer=new BufferedWriter(new FileWriter(logFile, true)); |
| | |
| | | * update records with. |
| | | * |
| | | * @throws IOException If a new file reader cannot be created. |
| | | * |
| | | */ |
| | | private void setupReader() throws IOException { |
| | | reader=new BufferedReader(new FileReader(logFile)); |
| | |
| | | * modify DN operation. |
| | | * |
| | | * @param modDNmap The map of old entry and new entry DNs. |
| | | * |
| | | */ |
| | | private void writeLog(Map<DN,DN> modDNmap) { |
| | | synchronized(logFile) |
| | |
| | | * These entry DNs are related to a delete operation. |
| | | * |
| | | * @param deletedEntryDN The DN of the deleted entry. |
| | | * |
| | | */ |
| | | private void writeLog(Set<DN> deleteDNset) { |
| | | synchronized(logFile) |
| | |
| | | * integrity processing as though the operation was just processed. After |
| | | * all of the records in log file have been processed, the log file is |
| | | * cleared so that new records can be added. |
| | | * |
| | | */ |
| | | private void processLog() { |
| | | synchronized(logFile) { |
| | |
| | | * Return the listener name. |
| | | * |
| | | * @return The name of the listener. |
| | | * |
| | | */ |
| | | @Override |
| | | public String getShutdownListenerName() { |
| | |
| | | * to be interrupted so it can read the stop request variable and exit. |
| | | * |
| | | * @param reason The reason message for the shutdown. |
| | | * |
| | | */ |
| | | @Override |
| | | public void processServerShutdown(LocalizableMessage reason) |
| | |
| | | /** |
| | | * Sets up background processing of referential integrity by creating a |
| | | * new background thread to process updates. |
| | | * |
| | | */ |
| | | private void setUpBackGroundProcessing() { |
| | | if(backGroundThread == null) { |
| | |
| | | * Used by the background thread to determine if it should exit. |
| | | * |
| | | * @return Returns <code>true</code> if the background thread should exit. |
| | | * |
| | | */ |
| | | private boolean isShuttingDown() { |
| | | return stopRequested; |
| | |
| | | * The background referential integrity processing thread. Wakes up after |
| | | * sleeping for a configurable interval and checks the log file for update |
| | | * records. |
| | | * |
| | | */ |
| | | private class BackGroundThread extends DirectoryThread { |
| | | |
| | | /** |
| | | * Constructor for the background thread. |
| | | */ |
| | | /** Constructor for the background thread. */ |
| | | public |
| | | BackGroundThread() { |
| | | super(name); |
| | | } |
| | | |
| | | /** |
| | | * Run method for the background thread. |
| | | */ |
| | | /** Run method for the background thread. */ |
| | | @Override |
| | | public void run() { |
| | | while(!isShuttingDown()) { |
| | |
| | | public PluginResult.PreOperation doPreOperation( |
| | | PreOperationModifyOperation modifyOperation) |
| | | { |
| | | /* Skip the integrity checks if the enforcing is not enabled |
| | | */ |
| | | /* Skip the integrity checks if the enforcing is not enabled */ |
| | | |
| | | if (!currentConfiguration.isCheckReferences()) |
| | | { |
| | |
| | | final List<Modification> mods = modifyOperation.getModifications(); |
| | | final Entry entry = modifyOperation.getModifiedEntry(); |
| | | |
| | | /* Make sure the entry belongs to one of the configured naming |
| | | * contexts. |
| | | */ |
| | | /* Make sure the entry belongs to one of the configured naming contexts. */ |
| | | DN entryDN = entry.getName(); |
| | | DN entryBaseDN = getEntryBaseDN(entryDN); |
| | | if (entryBaseDN == null) |
| | |
| | | { |
| | | final ModificationType modType = mod.getModificationType(); |
| | | |
| | | /* Process only ADD and REPLACE modification types. |
| | | */ |
| | | /* Process only ADD and REPLACE modification types. */ |
| | | if (modType != ModificationType.ADD |
| | | && modType != ModificationType.REPLACE) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /* At this point, everything is fine. |
| | | */ |
| | | /* At this point, everything is fine. */ |
| | | return PluginResult.PreOperation.continueOperationProcessing(); |
| | | } |
| | | |
| | |
| | | */ |
| | | private DN getEntryBaseDN(DN dn) |
| | | { |
| | | /* Verify that the entry belongs to one of the configured naming |
| | | * contexts. |
| | | */ |
| | | /* Verify that the entry belongs to one of the configured naming contexts. */ |
| | | |
| | | DN namingContext = null; |
| | | |