From d088ec9cde2f4c9451ec22171f9c80c6262860bf Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Wed, 22 Aug 2007 07:36:24 +0000
Subject: [PATCH] issue 1804 : Ensure that conflicts are visible to administrators
---
opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java | 67 ++++++++++++++++++++++++++++++++-
1 files changed, 65 insertions(+), 2 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
index 4713ac4..e2840f8 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/replication/plugin/ReplicationDomain.java
@@ -38,11 +38,13 @@
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.util.StaticUtils.createEntry;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;
+import static org.opends.server.util.ServerConstants.*;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
@@ -56,6 +58,7 @@
import org.opends.server.admin.std.meta.MultimasterDomainCfgDefn.*;
import org.opends.server.admin.std.server.MultimasterDomainCfg;
import org.opends.server.admin.std.server.BackendCfg;
+import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
import org.opends.server.api.DirectoryThread;
import org.opends.server.api.SynchronizationProvider;
@@ -135,9 +138,16 @@
* handle protocol messages from the replicationServer.
*/
public class ReplicationDomain extends DirectoryThread
- implements ConfigurationChangeListener<MultimasterDomainCfg>
+ implements ConfigurationChangeListener<MultimasterDomainCfg>,
+ AlertGenerator
{
/**
+ * The fully-qualified name of this class.
+ */
+ private static final String CLASS_NAME =
+ "org.opends.server.replication.plugin.ReplicationDomain";
+
+ /**
* The attribute used to mark conflicting entries.
* The value of this attribute should be the dn that this entry was
* supposed to have when it was marked as conflicting.
@@ -238,6 +248,11 @@
private IsolationPolicy isolationpolicy;
/**
+ * The DN of the configuration entry of this domain.
+ */
+ private DN configDn;
+
+ /**
* This class contain the context related to an import or export
* launched on the domain.
*/
@@ -339,6 +354,7 @@
window = configuration.getWindowSize();
heartbeatInterval = configuration.getHeartbeatInterval();
isolationpolicy = configuration.getIsolationPolicy();
+ configDn = configuration.dn();
/*
* Modify conflicts are solved for all suffixes but the schema suffix
@@ -405,6 +421,9 @@
// listen for changes on the configuration
configuration.addChangeListener(this);
+
+ // register as an AltertGenerator
+ DirectoryServer.registerAlertGenerator(this);
}
@@ -1160,6 +1179,8 @@
DirectoryServer.deregisterMonitorProvider(monitor.getMonitorInstanceName());
+ DirectoryServer.deregisterAlertGenerator(this);
+
// stop the ReplicationBroker
broker.stop();
@@ -1899,10 +1920,16 @@
mb.append(String.valueOf(newOp.getResultCode()));
logError(mb.toMessage());
}
+
+ // Generate an alert to let the administratot know that some
+ // conflict could not be solved.
+ Message alertMessage = NOTE_UNRESOLVED_CONFLICT.get(conflictDN.toString());
+ DirectoryServer.sendAlertNotification(this,
+ ALERT_TYPE_REPLICATION_UNRESOLVED_CONFLICT, alertMessage);
}
/**
- * Add the conflict object class to an entry that could
+ * Add the conflict attribute to an entry that could
* not be added because it is conflicting with another entry.
*
* @param msg The conflicting Add Operation.
@@ -1912,6 +1939,13 @@
*/
private void addConflict(AddMsg msg) throws ASN1Exception
{
+ // Generate an alert to let the administratot know that some
+ // conflict could not be solved.
+ Message alertMessage = NOTE_UNRESOLVED_CONFLICT.get(msg.getDn());
+ DirectoryServer.sendAlertNotification(this,
+ ALERT_TYPE_REPLICATION_UNRESOLVED_CONFLICT, alertMessage);
+
+ // Add the conflict attribute
msg.addAttribute(DS_SYNC_CONFLICT, msg.getDn());
}
@@ -2916,4 +2950,33 @@
{
return true;
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public LinkedHashMap<String, String> getAlerts()
+ {
+ LinkedHashMap<String,String> alerts = new LinkedHashMap<String,String>();
+
+ alerts.put(ALERT_TYPE_REPLICATION_UNRESOLVED_CONFLICT,
+ ALERT_DESCRIPTION_REPLICATION_UNRESOLVED_CONFLICT);
+ return alerts;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getClassName()
+ {
+ return CLASS_NAME;
+
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public DN getComponentEntryDN()
+ {
+ return configDn;
+ }
}
--
Gitblit v1.10.0