From 5515540a55fec581af09610837d99aa5d2794dc3 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 20 Nov 2007 13:02:16 +0000
Subject: [PATCH] Simplify the interface of InstallerHelper.configureReplication and add some checks to avoid problems with DN comparison in the code of the QuickSetup.
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java | 46 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index dc7bf31..38a226d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -1438,7 +1438,6 @@
is a degenerate case. Also, collect a set of all observed replication
servers as the set of ADS suffix replicas (all instances hosting the
replication server also replicate ADS). */
- Set<String> dns = new HashSet<String>();
Map<String, Set<String>> replicationServers
= new HashMap<String, Set<String>>();
HashSet<String> adsServers = new HashSet<String>();
@@ -1448,13 +1447,12 @@
{
LinkedList<String> baseDns =
getUserData().getNewSuffixOptions().getBaseDns();
- dns.addAll(baseDns);
HashSet<String> h = new HashSet<String>();
h.add(getLocalReplicationServer());
adsServers.add(getLocalReplicationServer());
for (String dn : baseDns)
{
- replicationServers.put(dn, h);
+ replicationServers.put(dn, new HashSet<String>(h));
}
}
else
@@ -1463,7 +1461,6 @@
getUserData().getSuffixesToReplicateOptions().getSuffixes();
for (SuffixDescriptor suffix : suffixes)
{
- dns.add(suffix.getDN());
HashSet<String> h = new HashSet<String>();
h.addAll(suffix.getReplicationServers());
adsServers.addAll(suffix.getReplicationServers());
@@ -1483,10 +1480,9 @@
replicationServers.put(suffix.getDN(), h);
}
}
- dns.add(ADSContext.getAdministrationSuffixDN());
replicationServers.put(ADSContext.getAdministrationSuffixDN(), adsServers);
- dns.add(Constants.SCHEMA_DN);
- replicationServers.put(Constants.SCHEMA_DN, adsServers);
+ replicationServers.put(Constants.SCHEMA_DN,
+ new HashSet<String>(adsServers));
InitialLdapContext ctx = null;
long localTime = -1;
@@ -1495,7 +1491,7 @@
try
{
ctx = createLocalContext();
- helper.configureReplication(ctx, dns, replicationServers,
+ helper.configureReplication(ctx, replicationServers,
getUserData().getReplicationOptions().getReplicationPort(),
getUserData().getReplicationOptions().useSecureReplication(),
getLocalHostPort(),
@@ -1582,16 +1578,46 @@
server.getHostPort(true));
}
}
- dns = new HashSet<String>();
+ HashSet<String> dns = new HashSet<String>();
for (ReplicaDescriptor replica : hm.get(server))
{
dns.add(replica.getSuffix().getDN());
}
dns.add(ADSContext.getAdministrationSuffixDN());
dns.add(Constants.SCHEMA_DN);
+ Map<String, Set<String>> remoteReplicationServers
+ = new HashMap<String, Set<String>>();
+ for (String dn : dns)
+ {
+ Set<String> repServer = replicationServers.get(dn);
+ if (repServer == null)
+ {
+ // Do the comparison manually
+ for (String dn1 : replicationServers.keySet())
+ {
+ if (Utils.areDnsEqual(dn, dn1))
+ {
+ repServer = replicationServers.get(dn1);
+ dn = dn1;
+ break;
+ }
+ }
+ }
+ if (repServer != null)
+ {
+ remoteReplicationServers.put(dn, repServer);
+ }
+ else
+ {
+ LOG.log(Level.WARNING, "Could not find replication server for: "+
+ dn);
+ }
+ }
+
+
ctx = getRemoteConnection(server, getTrustManager());
ConfiguredReplication repl =
- helper.configureReplication(ctx, dns, replicationServers,
+ helper.configureReplication(ctx, remoteReplicationServers,
replicationPort, enableSecureReplication,
server.getHostPort(true), knownReplicationServerIds,
knownServerIds);
--
Gitblit v1.10.0