| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | * |
| | | * It also extends the SynchronizationProvider class in order to have some |
| | | * replication code running during the operation process |
| | | * as pre-op, conflictRsolution, and post-op. |
| | | * as pre-op, conflictResolution, and post-op. |
| | | */ |
| | | public class MultimasterReplication |
| | | extends SynchronizationProvider<ReplicationSynchronizationProviderCfg> |
| | |
| | | * Don't run the special replication code on Operation that are |
| | | * specifically marked as don't synchronize. |
| | | */ |
| | | if ((pluginOp != null) && (pluginOp instanceof Operation)) |
| | | if (pluginOp != null && pluginOp instanceof Operation) |
| | | { |
| | | Operation op = ((Operation) pluginOp); |
| | | |
| | |
| | | * so that the core server let the operation modify the entryuuid |
| | | * and ds-sync-hist attributes. |
| | | * They are also tagged as dontSynchronize so that the replication |
| | | * code running later do not generate ChnageNumber, solve conflicts |
| | | * code running later do not generate ChangeNumber, solve conflicts |
| | | * and forward the operation to the replication server. |
| | | */ |
| | | for (Control c : op.getRequestControls()) |
| | |
| | | { |
| | | op.setSynchronizationOperation(true); |
| | | op.setDontSynchronize(true); |
| | | // remove this control from the list of controls since |
| | | // it has now been processed and the local backend will |
| | | // fail if it finds a control that it does not know about and |
| | | // that is marked as critical. |
| | | /* |
| | | remove this control from the list of controls since |
| | | it has now been processed and the local backend will |
| | | fail if it finds a control that it does not know about and |
| | | that is marked as critical. |
| | | */ |
| | | List<Control> controls = op.getRequestControls(); |
| | | controls.remove(c); |
| | | return null; |
| | |
| | | } |
| | | |
| | | |
| | | LDAPReplicationDomain domain = null; |
| | | LDAPReplicationDomain domain; |
| | | DN temp = dn; |
| | | do |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Stope the threads that are waiting for incoming update messages. |
| | | * Stop the threads that are waiting for incoming update messages. |
| | | */ |
| | | private synchronized static void stopReplayThreads() |
| | | { |
| | |
| | | |
| | | for (ReplayThread replayThread : replayThreads) |
| | | { |
| | | replayThread.waitForShutdown(); |
| | | try |
| | | { |
| | | replayThread.join(); |
| | | } |
| | | catch(InterruptedException e) |
| | | { |
| | | Thread.currentThread().interrupt(); |
| | | } |
| | | } |
| | | replayThreads.clear(); |
| | | } |
| | |
| | | } catch (ConfigException e) |
| | | { |
| | | // we should never get to this point because the configEntry has |
| | | // already been validated in configAddisAcceptable |
| | | // already been validated in isConfigurationAddAcceptable() |
| | | return new ConfigChangeResult(ResultCode.CONSTRAINT_VIOLATION, false); |
| | | } |
| | | } |
| | |
| | | DN operationDN = modifyDNOperation.getEntryDN(); |
| | | LDAPReplicationDomain domain = findDomain(operationDN, modifyDNOperation); |
| | | |
| | | if ((domain == null) || (!domain.solveConflict())) |
| | | if (domain == null || !domain.solveConflict()) |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | |
| | | // The historical object is retrieved from the attachment created |
| | |
| | | |
| | | historicalInformation.setPurgeDelay(domain.getHistoricalPurgeDelay()); |
| | | |
| | | // Add to the operation the historical attribute : "dn:changeNumger:moddn" |
| | | // Add to the operation the historical attribute : "dn:changeNumber:moddn" |
| | | historicalInformation.setHistoricalAttrToOperation(modifyDNOperation); |
| | | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | |
| | | if (!addOperation.isSynchronizationOperation()) |
| | | domain.doPreOperation(addOperation); |
| | | |
| | | // Add to the operation the historical attribute : "dn:changeNumger:add" |
| | | // Add to the operation the historical attribute : "dn:changeNumber:add" |
| | | EntryHistorical.setHistoricalAttrToOperation(addOperation); |
| | | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | |
| | | private void genericPostOperation(PostOperationOperation operation, DN dn) |
| | | { |
| | | LDAPReplicationDomain domain = findDomain(dn, operation); |
| | | if (domain == null) |
| | | return; |
| | | |
| | | domain.synchronize(operation); |
| | | |
| | | return; |
| | | if (domain != null) { |
| | | domain.synchronize(operation); |
| | | } |
| | | } |
| | | |
| | | /** |