| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.config.server.ConfigurationAddListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.config.server.ConfigurationDeleteListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.server.config.server.ReplicationDomainCfg; |
| | | import org.forgerock.opendj.server.config.server.ReplicationSynchronizationProviderCfg; |
| | | import org.opends.server.api.Backend; |
| | |
| | | import org.opends.server.replication.service.DSRSShutdownSync; |
| | | import org.opends.server.types.BackupConfig; |
| | | import org.opends.server.types.Control; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.Entry; |
| | | import org.opends.server.types.LDIFExportConfig; |
| | |
| | | BackupTaskListener, RestoreTaskListener, ImportTaskListener, |
| | | ExportTaskListener |
| | | { |
| | | |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | private ReplicationServerListener replicationServerListener; |
| | |
| | | private static int replayThreadNumber = 10; |
| | | |
| | | /** Enum that symbolizes the state of the multimaster replication. */ |
| | | private static enum State |
| | | private enum State |
| | | { |
| | | STARTING, RUNNING, STOPPING |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | LDAPReplicationDomain domain = null; |
| | | DN temp = dn; |
| | | while (domain == null && temp != null) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void initializeSynchronizationProvider( |
| | | ReplicationSynchronizationProviderCfg cfg) throws ConfigException |
| | |
| | | return value == null ? Platform.computeNumberOfThreads(16, 2.0f) : value; |
| | | } |
| | | |
| | | /** |
| | | * Create the threads that will wait for incoming update messages. |
| | | */ |
| | | /** Create the threads that will wait for incoming update messages. */ |
| | | private static synchronized void createReplayThreads() |
| | | { |
| | | replayThreads.clear(); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Stop the threads that are waiting for incoming update messages. |
| | | */ |
| | | /** Stop the threads that are waiting for incoming update messages. */ |
| | | private static synchronized void stopReplayThreads() |
| | | { |
| | | // stop the replay threads |
| | |
| | | replayThreads.clear(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationAddAcceptable( |
| | | ReplicationDomainCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | configuration, unacceptableReasons); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationAdd( |
| | | ReplicationDomainCfg configuration) |
| | |
| | | return ccr; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostOperation(PostOperationAddOperation addOperation) |
| | | { |
| | |
| | | genericPostOperation(addOperation, dn); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostOperation(PostOperationDeleteOperation deleteOperation) |
| | | { |
| | |
| | | genericPostOperation(deleteOperation, dn); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostOperation(PostOperationModifyDNOperation modifyDNOperation) |
| | | { |
| | |
| | | genericPostOperation(modifyDNOperation, dn); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void doPostOperation(PostOperationModifyOperation modifyOperation) |
| | | { |
| | |
| | | genericPostOperation(modifyOperation, dn); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult handleConflictResolution( |
| | | PreOperationModifyOperation modifyOperation) |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult handleConflictResolution( |
| | | PreOperationAddOperation addOperation) throws DirectoryException |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult handleConflictResolution( |
| | | PreOperationDeleteOperation deleteOperation) throws DirectoryException |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult handleConflictResolution( |
| | | PreOperationModifyDNOperation modifyDNOperation) throws DirectoryException |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult |
| | | doPreOperation(PreOperationModifyOperation modifyOperation) |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult doPreOperation( |
| | | PreOperationDeleteOperation deleteOperation) throws DirectoryException |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult doPreOperation( |
| | | PreOperationModifyDNOperation modifyDNOperation) |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public SynchronizationProviderResult doPreOperation( |
| | | PreOperationAddOperation addOperation) |
| | |
| | | return new SynchronizationProviderResult.ContinueProcessing(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void finalizeSynchronizationProvider() |
| | | { |
| | |
| | | * |
| | | * @param modifications The list of modifications that was |
| | | * applied to the schema. |
| | | * |
| | | */ |
| | | @Override |
| | | public void processSchemaChange(List<Modification> modifications) |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processBackupBegin(Backend backend, BackupConfig config) |
| | | public void processBackupBegin(Backend<?> backend, BackupConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processBackupEnd(Backend backend, BackupConfig config, |
| | | boolean successful) |
| | | public void processBackupEnd(Backend<?> backend, BackupConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processRestoreBegin(Backend backend, RestoreConfig config) |
| | | public void processRestoreBegin(Backend<?> backend, RestoreConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processRestoreEnd(Backend backend, RestoreConfig config, |
| | | boolean successful) |
| | | public void processRestoreEnd(Backend<?> backend, RestoreConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processImportBegin(Backend backend, LDIFImportConfig config) |
| | | public void processImportBegin(Backend<?> backend, LDIFImportConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processImportEnd(Backend backend, LDIFImportConfig config, |
| | | boolean successful) |
| | | public void processImportEnd(Backend<?> backend, LDIFImportConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processExportBegin(Backend backend, LDIFExportConfig config) |
| | | public void processExportBegin(Backend<?> backend, LDIFExportConfig config) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void processExportEnd(Backend backend, LDIFExportConfig config, |
| | | boolean successful) |
| | | public void processExportEnd(Backend<?> backend, LDIFExportConfig config, boolean successful) |
| | | { |
| | | for (DN dn : backend.getBaseDNs()) |
| | | { |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationDeleteAcceptable( |
| | | ReplicationDomainCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | return replicationServerListener; |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ReplicationSynchronizationProviderCfg configuration, |
| | |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange(ReplicationSynchronizationProviderCfg configuration) |
| | | { |
| | | |
| | | // Stop threads then restart new number of threads |
| | | stopReplayThreads(); |
| | | replayThreadNumber = getNumberOfReplayThreadsOrDefault(configuration); |
| | |
| | | return new ConfigChangeResult(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public void completeSynchronizationProvider() |
| | | { |
| | |
| | | { |
| | | return connectionTimeoutMS; |
| | | } |
| | | |
| | | } |