InitialLdapContext rCtx = null;
try
{
rCtx = getRemoteConnection(server, getTrustManager(),
getPreferredConnections());
TopologyCacheFilter filter = new TopologyCacheFilter();
filter.setSearchMonitoringInformation(false);
filter.addBaseDNToSearch(ADSContext.getAdministrationSuffixDN());
filter.addBaseDNToSearch(Constants.SCHEMA_DN);
ServerDescriptor s = ServerDescriptor.createStandalone(rCtx, filter);
for (ReplicaDescriptor replica : s.getReplicas())
{
String dn = replica.getSuffix().getDN();
if (areDnsEqual(dn, ADSContext.getAdministrationSuffixDN()))
{
suffixes.add(replica.getSuffix());
}
else if (areDnsEqual(dn, Constants.SCHEMA_DN))
{
suffixes.add(replica.getSuffix());
}
}
}
catch (NamingException ne)
{
Message msg;
if (Utils.isCertificateException(ne))
{
msg = INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
getHostPort(server), ne.toString(true));
}
else
{
msg = INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(
getHostPort(server), ne.toString(true));
}
throw new ApplicationException(ReturnCode.CONFIGURATION_ERROR, msg,
ne);
}
finally
{
try{ rCtx.close(); }
catch (Throwable t){}
}
}
for (SuffixDescriptor suffix : suffixes)
{
String dn = suffix.getDN();
ReplicaDescriptor replica = suffix.getReplicas().iterator().next();
ServerDescriptor server = replica.getServer();
String hostPort = getHostPort(server);
boolean isADS = areDnsEqual(dn, ADSContext.getAdministrationSuffixDN());
boolean isSchema = areDnsEqual(dn, Constants.SCHEMA_DN);
if(isADS)
{
if (isVerbose())
{
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_INITIALIZING_ADS.get()));
}
}
else if (isSchema)
{
if (isVerbose())
{
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_INITIALIZING_SCHEMA.get()));
}
}
else
{
notifyListeners(getFormattedProgress(
INFO_PROGRESS_INITIALIZING_SUFFIX.get(dn, hostPort)));
notifyListeners(getLineBreak());
}
try
{
int replicationId = replica.getReplicationId();
if (replicationId == -1)
{
/**
* This occurs if the remote server had not replication configured.
*/
InitialLdapContext rCtx = null;
try
{
rCtx = getRemoteConnection(server, getTrustManager(),
getPreferredConnections());
TopologyCacheFilter filter = new TopologyCacheFilter();
filter.setSearchMonitoringInformation(false);
filter.addBaseDNToSearch(dn);
ServerDescriptor s = ServerDescriptor.createStandalone(rCtx,
filter);
for (ReplicaDescriptor r : s.getReplicas())
{
if (areDnsEqual(r.getSuffix().getDN(), dn))