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

Jean-Noël Rouvignac
03.25.2016 602b1987bab62b39cfce7d68d4f8e3b561fbc8a5
Prep work for OPENDJ-1342: align APIs for DNs

DN.NULL_DN => DN.rootDN()
11 files modified
62 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/DirectoryThread.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/ConsoleDebugLogPublisher.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/ChangeNumberIndexer.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java 21 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/LDAPEntryPanel.java
@@ -465,7 +465,7 @@
      }
      if (!isReadOnly)
      {
        isReadOnly = dn.equals(DN.NULL_DN);
        isReadOnly = dn.equals(DN.rootDN());
      }
    }
    catch (Throwable t)
@@ -487,7 +487,7 @@
    try
    {
      DN dn = DN.valueOf(sDn);
      return !dn.equals(DN.NULL_DN)
      return !dn.equals(DN.rootDN())
          && !nonDeletable.contains(dn)
          && isDescendantOfAny(dn, parentReadOnly);
    }
opendj-server-legacy/src/main/java/org/opends/server/admin/ACIPropertyDefinition.java
@@ -110,7 +110,7 @@
    ifNull(value);
    try {
      return Aci.decode(ByteString.valueOfUtf8(value), DN.NULL_DN);
      return Aci.decode(ByteString.valueOfUtf8(value), DN.rootDN());
    } catch (AciException e) {
      // TODO: it would be nice to throw the cause.
      throw PropertyException.illegalPropertyValueException(this, value);
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
@@ -952,7 +952,7 @@
    {
      if (operation.getAuthorizationDN().equals(
               authenticationInfo.getAuthorizationDN()) ||
          (operation.getAuthorizationDN().equals(DN.NULL_DN) &&
          (operation.getAuthorizationDN().equals(DN.rootDN()) &&
           !authenticationInfo.isAuthenticated())) {
        result = privileges.contains(privilege) ||
                 DirectoryServer.isDisabled(privilege);
opendj-server-legacy/src/main/java/org/opends/server/api/DirectoryThread.java
@@ -144,17 +144,14 @@
      this.threadNamePrefix = threadNamePrefix;
    }
    /** {@inheritDoc} */
    @Override
    public Thread newThread(Runnable r)
    {
      return new DirectoryThread(r, threadNamePrefix + " "
          + nextID.getAndIncrement());
    }
  }
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
@@ -194,19 +191,16 @@
          ALERT_DESCRIPTION_UNCAUGHT_EXCEPTION);
    }
    /** {@inheritDoc} */
    @Override
    public DN getComponentEntryDN() {
      return DN.NULL_DN;
      return DN.rootDN();
    }
    /** {@inheritDoc} */
    @Override
    public String getClassName() {
      return DirectoryThread.class.getName();
    }
    /** {@inheritDoc} */
    @Override
    public Map<String, String> getAlerts() {
      return alerts;
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
@@ -368,7 +368,7 @@
        pushNewParent(dn, entryID);
        return true;
      }
      popCompleteParents(DN.NULL_DN.toNormalizedByteString());
      popCompleteParents(DN.rootDN().toNormalizedByteString());
      return false;
    }
opendj-server-legacy/src/main/java/org/opends/server/extensions/DiskSpaceMonitor.java
@@ -471,7 +471,7 @@
    }
    catch (DirectoryException de)
    {
      return DN.NULL_DN;
      return DN.rootDN();
    }
  }
opendj-server-legacy/src/main/java/org/opends/server/loggers/ConsoleDebugLogPublisher.java
@@ -149,7 +149,7 @@
  public DN getDN()
  {
    // There is no configuration DN associated with this publisher.
    return DN.NULL_DN;
    return DN.rootDN();
  }
}
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/ChangeNumberIndexer.java
@@ -41,9 +41,9 @@
import org.opends.server.replication.server.changelog.api.ChangeNumberIndexRecord;
import org.opends.server.replication.server.changelog.api.ChangelogDB;
import org.opends.server.replication.server.changelog.api.ChangelogException;
import org.opends.server.replication.server.changelog.api.ChangelogStateProvider;
import org.opends.server.replication.server.changelog.api.DBCursor.CursorOptions;
import org.opends.server.replication.server.changelog.api.ReplicationDomainDB;
import org.opends.server.replication.server.changelog.api.ChangelogStateProvider;
import org.opends.server.types.DN;
import static org.opends.messages.ReplicationMessages.*;
@@ -69,7 +69,7 @@
   * If it contains nothing, then the run method executes normally.
   * Otherwise, the {@link #run()} method must clear its state
   * for the supplied domain baseDNs. If a supplied domain is
   * {@link DN#NULL_DN}, then all domains will be cleared.
   * {@link DN#rootDN()}, then all domains will be cleared.
   */
  private final ConcurrentSkipListSet<DN> domainsToClear = new ConcurrentSkipListSet<>();
  private final ChangelogDB changelogDB;
@@ -586,13 +586,13 @@
   * <p>
   * Note: This method blocks the current thread until state is cleared.
   *
   * @param baseDN the baseDN to be cleared from this thread's state.
   *               {@code null} and {@link DN#NULL_DN} mean "clear all domains".
   * @param baseDN
   *          the baseDN to be cleared from this thread's state. {@code null} and
   *          {@link DN#rootDN()} mean "clear all domains".
   */
  public void clear(DN baseDN)
  {
    // Use DN.NULL_DN to say "clear all domains"
    final DN baseDNToClear = baseDN != null ? baseDN : DN.NULL_DN;
    final DN baseDNToClear = baseDN != null ? baseDN : DN.rootDN();
    domainsToClear.add(baseDNToClear);
    while (domainsToClear.contains(baseDNToClear)
        && !State.TERMINATED.equals(getState()))
@@ -606,5 +606,4 @@
      Thread.yield();
    }
  }
}
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -61,11 +61,8 @@
public final class DN implements Comparable<DN>, Serializable
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /**
   * A singleton instance of the null DN (a DN with no components).
   */
  public static final DN NULL_DN = new DN();
  /** A singleton instance of the root/null DN (a DN with no components). */
  private static final DN ROOT_DN = new DN();
  /** RDN separator for normalized byte string of a DN. */
  public static final byte NORMALIZED_RDN_SEPARATOR = 0x00;
@@ -200,7 +197,7 @@
   */
  public static DN rootDN()
  {
    return NULL_DN;
    return ROOT_DN;
  }
@@ -548,13 +545,13 @@
    // A null or empty DN is acceptable.
    if (dnString == null)
    {
      return NULL_DN;
      return rootDN();
    }
    int    length  = dnString.length();
    if (length == 0)
    {
      return NULL_DN;
      return rootDN();
    }
@@ -585,7 +582,7 @@
      // This means that the DN was completely comprised of spaces
      // and therefore should be considered the same as a null or
      // empty DN.
      return NULL_DN;
      return rootDN();
    }
    dnReader.skip(-1);
@@ -838,13 +835,13 @@
    // A null or empty DN is acceptable.
    if (dnString == null)
    {
      return NULL_DN;
      return rootDN();
    }
    int length = dnString.length();
    if (length == 0)
    {
      return NULL_DN;
      return rootDN();
    }
@@ -860,7 +857,7 @@
        // This means that the DN was completely comprised of spaces
        // and therefore should be considered the same as a null or
        // empty DN.
        return NULL_DN;
        return rootDN();
      }
      else
      {
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -3367,7 +3367,7 @@
      DN dn;
      if (config.excludeDN())
      {
        dn = DN.NULL_DN;
        dn = DN.rootDN();
      }
      else
      {
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -445,7 +445,7 @@
    operation.setAuthorizationEntry(authorizationEntry);
    operation.setProxiedAuthorizationDN(
      authorizationEntry != null ? authorizationEntry.getName() : DN.NULL_DN);
      authorizationEntry != null ? authorizationEntry.getName() : DN.rootDN());
  }
  /**