mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noël Rouvignac
13.15.2016 e61d6d0a55d022a0768e730521bfea36ad506f9d
opendj-server-legacy/src/main/java/org/opends/admin/ads/SuffixDescriptor.java
@@ -16,10 +16,9 @@
 */
package org.opends.admin.ads;
import static java.util.Collections.*;
import java.util.HashSet;
import java.util.Set;
import java.util.TreeSet;
import org.forgerock.opendj.ldap.DN;
@@ -44,7 +43,7 @@
  public SuffixDescriptor(DN suffixDn, ReplicaDescriptor replica)
  {
    this.suffixDN = suffixDn;
    setReplicas(singleton(replica));
    this.replicas.add(replica);
  }
  /**
@@ -80,16 +79,14 @@
  }
  /**
   * Sets the replicas associated with this SuffixDescriptor.
   * Associates the provided replica with this SuffixDescriptor.
   *
   * @param replicas
   *          a Set containing the replicas associated with this
   *          SuffixDescriptor.
   * @param replica
   *          the replicate to associate with this SuffixDescriptor.
   */
  public void setReplicas(Set<ReplicaDescriptor> replicas)
  void addReplica(ReplicaDescriptor replica)
  {
    this.replicas.clear();
    this.replicas.addAll(replicas);
    replicas.add(replica);
  }
  /**
@@ -129,4 +126,18 @@
    }
    return buf.toString();
  }
  @Override
  public String toString()
  {
    Set<String> replicaStrings = new TreeSet<>();
    for (ReplicaDescriptor replica : replicas)
    {
      replicaStrings.add(replica.getServer().getHostPort(true).toString());
    }
    return getClass().getSimpleName()
        + "(dn=" + suffixDN
        + ", replicas=" + replicaStrings
        + ")";
  }
}