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

Jean-Noël Rouvignac
05.55.2016 e1b3d6e88e9af227b69fed69de86a248fe6bce46
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -410,7 +410,7 @@
    // If so, then it must point to a backup directory.  Otherwise, it must be
    // two levels below the backup base entry and must point to a specific
    // backup.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      return -1;
@@ -437,7 +437,7 @@
      }
      return count;
    }
    else if (backupBaseDN.equals(parentDN.getParentDNInSuffix()))
    else if (backupBaseDN.equals(DirectoryServer.getParentDNInSuffix(parentDN)))
    {
      return 0;
    }
@@ -471,7 +471,7 @@
    // If so, then it must point to a backup directory.  Otherwise, it must be
    // two levels below the backup base entry and must point to a specific
    // backup.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
@@ -481,7 +481,7 @@
    {
      return getBackupDirectoryEntry(entryDN);
    }
    else if (backupBaseDN.equals(parentDN.getParentDNInSuffix()))
    else if (backupBaseDN.equals(DirectoryServer.getParentDNInSuffix(parentDN)))
    {
      return getBackupEntry(entryDN);
    }
@@ -595,7 +595,7 @@
    String backupID = idValue.toString();
    // Next, get the backup directory from the parent DN.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null) {
      throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN));
    }
@@ -823,7 +823,7 @@
        }
      }
    }
    else if (backupBaseDN.equals(parentDN = baseDN.getParentDNInSuffix()))
    else if (backupBaseDN.equals(parentDN = DirectoryServer.getParentDNInSuffix(baseDN)))
    {
      Entry backupDirEntry = getBackupDirectoryEntry(baseDN);
@@ -845,7 +845,7 @@
    else
    {
      if (parentDN == null
          || !backupBaseDN.equals(parentDN.getParentDNInSuffix()))
          || !backupBaseDN.equals(DirectoryServer.getParentDNInSuffix(parentDN)))
      {
        LocalizableMessage message = ERR_BACKUP_NO_SUCH_ENTRY.get(backupBaseDN);
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, message);
opendj-server-legacy/src/main/java/org/opends/server/backends/LDIFBackend.java
@@ -538,7 +538,7 @@
      }
      else
      {
        DN parentDN = entryDN.getParentDNInSuffix();
        DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
        if (parentDN != null && entryMap.containsKey(parentDN))
        {
          entryMap.put(entryDN, entry.duplicate(false));
@@ -560,7 +560,7 @@
          {
            while (true)
            {
              parentDN = parentDN.getParentDNInSuffix();
              parentDN = DirectoryServer.getParentDNInSuffix(parentDN);
              if (parentDN == null)
              {
                break;
@@ -597,7 +597,7 @@
      // Get the DN of the target entry's parent, if it exists.  We'll need to
      // also remove the reference to the target entry from the parent's set of
      // children.
      DN parentDN = entryDN.getParentDNInSuffix();
      DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
      // Make sure that the target entry exists.  If not, then fail.
      if (! entryMap.containsKey(entryDN))
@@ -611,7 +611,7 @@
            break;
          }
          parentDN = parentDN.getParentDNInSuffix();
          parentDN = DirectoryServer.getParentDNInSuffix(parentDN);
        }
        LocalizableMessage m = ERR_LDIF_BACKEND_DELETE_NO_SUCH_ENTRY.get(entryDN);
@@ -720,7 +720,7 @@
      if (! entryMap.containsKey(entryDN))
      {
        DN matchedDN = null;
        DN parentDN = entryDN.getParentDNInSuffix();
        DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
        while (parentDN != null)
        {
          if (entryMap.containsKey(parentDN))
@@ -729,7 +729,7 @@
            break;
          }
          parentDN = parentDN.getParentDNInSuffix();
          parentDN = DirectoryServer.getParentDNInSuffix(parentDN);
        }
        LocalizableMessage m = ERR_LDIF_BACKEND_MODIFY_NO_SUCH_ENTRY.get(entryDN);
@@ -762,7 +762,7 @@
      if (! entryMap.containsKey(currentDN))
      {
        DN matchedDN = null;
        DN parentDN = currentDN.getParentDNInSuffix();
        DN parentDN = DirectoryServer.getParentDNInSuffix(currentDN);
        while (parentDN != null)
        {
          if (entryMap.containsKey(parentDN))
@@ -771,7 +771,7 @@
            break;
          }
          parentDN = parentDN.getParentDNInSuffix();
          parentDN = DirectoryServer.getParentDNInSuffix(parentDN);
        }
        LocalizableMessage m = ERR_LDIF_BACKEND_MODDN_NO_SUCH_SOURCE_ENTRY.get(currentDN);
@@ -784,7 +784,7 @@
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, m);
      }
      DN newParentDN = newDN.getParentDNInSuffix();
      DN newParentDN = DirectoryServer.getParentDNInSuffix(newDN);
      if (! entryMap.containsKey(newParentDN))
      {
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
@@ -793,7 +793,7 @@
      // Remove the entry from the list of children for the old parent and
      // add the new entry DN to the set of children for the new parent.
      DN oldParentDN = currentDN.getParentDNInSuffix();
      DN oldParentDN = DirectoryServer.getParentDNInSuffix(currentDN);
      Set<DN> parentChildDNs = childDNs.get(oldParentDN);
      if (parentChildDNs != null)
      {
@@ -902,7 +902,7 @@
      Entry baseEntry = entryMap.get(baseDN);
      if (baseEntry == null && handlesEntry(baseDN))
      {
        DN matchedDN = baseDN.getParentDNInSuffix();
        DN matchedDN = DirectoryServer.getParentDNInSuffix(baseDN);
        while (matchedDN != null)
        {
          if (entryMap.containsKey(matchedDN))
@@ -910,7 +910,7 @@
            break;
          }
          matchedDN = matchedDN.getParentDNInSuffix();
          matchedDN = DirectoryServer.getParentDNInSuffix(matchedDN);
        }
        LocalizableMessage m = ERR_LDIF_BACKEND_SEARCH_NO_SUCH_BASE.get(baseDN);
@@ -1146,7 +1146,7 @@
            continue;
          }
          DN parentDN = entryDN.getParentDNInSuffix();
          DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
          if (parentDN == null || !entryMap.containsKey(parentDN))
          {
            LocalizableMessage m = ERR_LDIF_BACKEND_MISSING_PARENT.get(
opendj-server-legacy/src/main/java/org/opends/server/backends/MemoryBackend.java
@@ -44,6 +44,7 @@
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.admin.std.server.MemoryBackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.controls.SubtreeDeleteControl;
@@ -54,7 +55,6 @@
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.Control;
@@ -355,7 +355,7 @@
    // Get the parent DN and ensure that it exists in the backend.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
@@ -434,7 +434,7 @@
    childDNs.remove(entryDN);
    entryMap.remove(entryDN);
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN != null)
    {
      HashSet<DN> parentsChildren = childDNs.get(parentDN);
@@ -528,7 +528,7 @@
    // Make sure that the parent of the new entry exists.
    DN parentDN = e.getName().getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(e.getName());
    if (parentDN == null || !entryMap.containsKey(parentDN))
    {
      throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
@@ -556,7 +556,7 @@
    Entry baseEntry = entryMap.get(baseDN);
    if (baseEntry == null && handlesEntry(baseDN))
    {
      DN matchedDN = baseDN.getParentDNInSuffix();
      DN matchedDN = DirectoryServer.getParentDNInSuffix(baseDN);
      while (matchedDN != null)
      {
        if (entryMap.containsKey(matchedDN))
@@ -564,7 +564,7 @@
          break;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
        matchedDN = DirectoryServer.getParentDNInSuffix(matchedDN);
      }
      LocalizableMessage message =
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -416,7 +416,7 @@
    // See if the requested entry was one level below the backend base entry.
    // If so, then it must point to a trust store entry.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN != null && parentDN.equals(baseDN))
    {
      try
@@ -517,7 +517,7 @@
      throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, message);
    }
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      LocalizableMessage message = ERR_TRUSTSTORE_INVALID_BASE.get(entryDN);
@@ -546,7 +546,7 @@
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
    }
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null || !parentDN.equals(baseDN))
    {
      LocalizableMessage message = ERR_TRUSTSTORE_INVALID_BASE.get(entryDN);
@@ -638,7 +638,7 @@
        }
      }
    }
    else if (this.baseDN.equals(baseDN.getParentDNInSuffix()))
    else if (this.baseDN.equals(DirectoryServer.getParentDNInSuffix(baseDN)))
    {
      Entry certEntry = getCertEntry(baseDN);
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -2478,14 +2478,14 @@
   */
  private DN getMatchedDN(ReadableTransaction txn, DN targetDN) throws DirectoryException
  {
    DN parentDN  = targetDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(targetDN);
    while (parentDN != null && parentDN.isSubordinateOrEqualTo(baseDN))
    {
      if (entryExists(txn, parentDN))
      {
        return parentDN;
      }
      parentDN = parentDN.getParentDNInSuffix();
      parentDN = DirectoryServer.getParentDNInSuffix(parentDN);
    }
    return null;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java
@@ -38,10 +38,11 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Reject;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeBuilder;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.LDIFImportConfig;
@@ -314,7 +315,7 @@
      {
        return entryContainer;
      }
      nodeDN = nodeDN.getParentDNInSuffix();
      nodeDN = DirectoryServer.getParentDNInSuffix(nodeDN);
    }
    return null;
  }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/RootContainer.java
@@ -54,6 +54,7 @@
import org.opends.server.backends.pluggable.spi.StorageStatus;
import org.opends.server.backends.pluggable.spi.WriteOperation;
import org.opends.server.backends.pluggable.spi.WriteableTransaction;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.types.DN;
@@ -386,7 +387,7 @@
      ec = entryContainers.get(nodeDN);
      if (ec == null)
      {
        nodeDN = nodeDN.getParentDNInSuffix();
        nodeDN = DirectoryServer.getParentDNInSuffix(nodeDN);
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java
@@ -978,7 +978,7 @@
    {
      return null;
    }
    return dn.getParentDNInSuffix();
    return DirectoryServer.getParentDNInSuffix(dn);
  }
  /** This class maintain the number of children for a given dn. */
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskBackend.java
@@ -51,16 +51,36 @@
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Reject;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.server.TaskBackendCfg;
import org.opends.server.api.Backend;
import org.opends.server.api.Backupable;
import org.opends.server.config.ConfigEntry;
import org.opends.server.core.*;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.types.Attribute;
import org.opends.server.types.BackupConfig;
import org.opends.server.types.BackupDirectory;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.IndexType;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LDIFImportResult;
import org.opends.server.types.LockManager.DNLock;
import org.opends.server.types.Modification;
import org.opends.server.types.RestoreConfig;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.BackupManager;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
@@ -393,7 +413,7 @@
      return taskScheduler.getRecurringTaskCount();
    }
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      return -1;
@@ -443,7 +463,7 @@
        return taskScheduler.getRecurringTaskParentEntry();
      }
      DN parentDN = entryDN.getParentDNInSuffix();
      DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
      if (parentDN == null)
      {
        return null;
@@ -481,7 +501,7 @@
    // Get the DN for the entry and then get its parent.
    DN entryDN = e.getName();
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
@@ -523,7 +543,7 @@
  {
    // Get the parent for the provided entry DN.  It must be either the
    // scheduled or recurring task parent DN.
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      LocalizableMessage message = ERR_TASKBE_DELETE_INVALID_ENTRY.get(entryDN);
@@ -612,7 +632,7 @@
    {
      // Get the parent for the provided entry DN.  It must be either the
      // scheduled or recurring task parent DN.
      DN parentDN = entryDN.getParentDNInSuffix();
      DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
      if (parentDN == null)
      {
        LocalizableMessage message = ERR_TASKBE_MODIFY_INVALID_ENTRY.get(entryDN);
@@ -865,7 +885,7 @@
    }
    else
    {
      DN parentDN = baseDN.getParentDNInSuffix();
      DN parentDN = DirectoryServer.getParentDNInSuffix(baseDN);
      if (parentDN == null)
      {
        LocalizableMessage message = ERR_TASKBE_SEARCH_INVALID_BASE.get(baseDN);
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -34,7 +34,14 @@
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;
@@ -48,8 +55,18 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.SearchOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.Attributes;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.ExistingFileBehavior;
import org.opends.server.types.InitializationException;
import org.opends.server.types.LDIFExportConfig;
import org.opends.server.types.LDIFImportConfig;
import org.opends.server.types.LockManager.DNLock;
import org.opends.server.types.Operation;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
@@ -1068,7 +1085,7 @@
        }
        else
        {
          DN parentDN = entryDN.getParentDNInSuffix();
          DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
          if (parentDN == null)
          {
            logger.error(ERR_TASKSCHED_ENTRY_HAS_NO_PARENT, entryDN, taskBackend.getTaskRootDN());
opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
@@ -601,7 +601,7 @@
  public void updateOperationErrMsgAndResCode()
  {
    DN entryDN = getEntryDN();
    DN parentDN = entryDN.getParentDNInSuffix();
    DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    if (parentDN == null)
    {
      // Either this entry is a suffix or doesn't belong in the directory.
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -4667,6 +4667,26 @@
  }
  /**
   * Retrieves the DN that is the immediate parent for this DN. This method does take the server's
   * naming context configuration into account, so if the current DN is a naming context for the
   * server, then it will not be considered to have a parent.
   *
   * @param dn
   *          the
   * @return The DN that is the immediate parent for this DN, or {@code null} if this DN does not
   *         have a parent (either because there is only a single RDN component or because this DN
   *         is a suffix defined in the server).
   */
  public static DN getParentDNInSuffix(DN dn)
  {
    if (dn.size() <= 1 || DirectoryServer.isNamingContext(dn))
    {
      return null;
    }
    return dn.parent();
  }
  /**
   * Retrieves the root DSE entry for the Directory Server.
   *
   * @return  The root DSE entry for the Directory Server.
opendj-server-legacy/src/main/java/org/opends/server/core/ModifyDNOperationBasis.java
@@ -22,10 +22,9 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2015 ForgeRock AS.
 *      Portions Copyright 2011-2016 ForgeRock AS.
 */
package org.opends.server.core;
import java.util.ArrayList;
import java.util.List;
@@ -33,7 +32,17 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
import org.opends.server.api.ClientConnection;
import org.opends.server.types.*;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.CancelResult;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import org.opends.server.types.Operation;
import org.opends.server.types.OperationType;
import org.opends.server.types.RDN;
import org.opends.server.types.operation.PostResponseModifyDNOperation;
import org.opends.server.types.operation.PreParseModifyDNOperation;
import org.opends.server.workflowelement.localbackend.LocalBackendModifyDNOperation;
@@ -565,7 +574,7 @@
      {
        if (getEntryDN() != null)
        {
          parentDN = entryDN.getParentDNInSuffix();
          parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
        }
      }
      else
opendj-server-legacy/src/main/java/org/opends/server/core/PersistentSearch.java
@@ -267,7 +267,7 @@
    case BASE_OBJECT:
      return baseDN.equals(dn);
    case SINGLE_LEVEL:
      return baseDN.equals(dn.getParentDNInSuffix());
      return baseDN.equals(DirectoryServer.getParentDNInSuffix(dn));
    case WHOLE_SUBTREE:
      return baseDN.isSuperiorOrEqualTo(dn);
    case SUBORDINATES:
opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
@@ -911,7 +911,7 @@
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      DN matchedDN = DirectoryServer.getParentDNInSuffix(entryDN);
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
@@ -919,7 +919,7 @@
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
        matchedDN = DirectoryServer.getParentDNInSuffix(matchedDN);
      }
    }
    catch (Exception e)
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeAddOperation.java
@@ -22,10 +22,11 @@
 *
 *
 *      Copyright 2008-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS
 *      Portions Copyright 2012-2016 ForgeRock AS
 */
package org.opends.server.replication.plugin;
import org.opends.server.core.DirectoryServer;
import org.opends.server.replication.common.CSN;
import org.opends.server.replication.protocol.AddMsg;
import org.opends.server.types.Entry;
@@ -54,14 +55,13 @@
    this.entry = entry;
  }
  /** {@inheritDoc} */
  @Override
  public AddMsg generateMessage()
  {
    return new AddMsg(getCSN(), entry.getName(),
               EntryHistorical.getEntryUUID(entry),
               LDAPReplicationDomain.findEntryUUID(
                   entry.getName().getParentDNInSuffix()),
                   DirectoryServer.getParentDNInSuffix(entry.getName())),
               entry.getObjectClasses(),
               entry.getUserAttributes(), entry.getOperationalAttributes());
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -1677,7 +1677,7 @@
        }
        DN entryDN = addOperation.getEntryDN();
        DN parentDnFromEntryDn = entryDN.getParentDNInSuffix();
        DN parentDnFromEntryDn = DirectoryServer.getParentDNInSuffix(entryDN);
        if (parentDnFromEntryDn != null
            && !parentDnFromCtx.equals(parentDnFromEntryDn))
        {
@@ -1968,7 +1968,7 @@
    final CSN csn = generateCSN(addOperation);
    final String entryUUID = getEntryUUID(addOperation);
    final AddContext ctx = new AddContext(csn, entryUUID,
        findEntryUUID(addOperation.getEntryDN().getParentDNInSuffix()));
        findEntryUUID(DirectoryServer.getParentDNInSuffix(addOperation.getEntryDN())));
    addOperation.setAttachment(SYNCHROCONTEXT, ctx);
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java
@@ -180,7 +180,7 @@
    while (domain == null && temp != null)
    {
      domain = domains.get(temp);
      temp = temp.getParentDNInSuffix();
      temp = DirectoryServer.getParentDNInSuffix(temp);
    }
    return domain;
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -325,33 +325,6 @@
  /**
   * Retrieves the DN of the entry that is the immediate parent for
   * this entry.  This method does take the server's naming context
   * configuration into account, so if the current DN is a naming
   * context for the server, then it will not be considered to have a
   * parent.
   *
   * @return  The DN of the entry that is the immediate parent for
   *          this entry, or <CODE>null</CODE> if the entry with this
   *          DN does not have a parent (either because there is only
   *          a single RDN component or because this DN is a suffix
   *          defined in the server).
   */
  public DN getParentDNInSuffix()
  {
    if (numComponents <= 1 || DirectoryServer.isNamingContext(this))
    {
      return null;
    }
    RDN[] parentComponents = new RDN[numComponents-1];
    System.arraycopy(rdnComponents, 1, parentComponents, 0, numComponents-1);
    return new DN(parentComponents);
  }
  /**
   * Creates a new DN that is a child of this DN, using the specified
   * RDN.
   *
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -45,8 +45,8 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.AVA;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteSequenceReader;
import org.forgerock.opendj.ldap.ByteString;
@@ -2046,7 +2046,7 @@
      else
      {
        // Get the DN of the parent entry if possible.
        DN parentDN = dn.getParentDNInSuffix();
        DN parentDN = DirectoryServer.getParentDNInSuffix(dn);
        if (parentDN != null)
        {
          try
@@ -2117,7 +2117,7 @@
      }
      else if (! parentProvided)
      {
        DN parentDN = getName().getParentDNInSuffix();
        DN parentDN = DirectoryServer.getParentDNInSuffix(getName());
        if (parentDN != null)
        {
          try
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -78,11 +78,12 @@
import static org.opends.messages.CoreMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.types.AbstractOperation.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.types.AbstractOperation.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/**
 * This class defines an operation used to add an entry in a local backend
@@ -242,7 +243,7 @@
        return;
      }
      DN parentDN = entryDN.getParentDNInSuffix();
      DN parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
      if (parentDN == null && !DirectoryServer.isNamingContext(entryDN))
      {
        if (entryDN.isRootDN())
@@ -518,28 +519,6 @@
    }
  }
  private DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  private boolean checkHasReadOnlyAttributes(
      Map<AttributeType, List<Attribute>> attributes) throws DirectoryException
  {
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
@@ -59,6 +59,7 @@
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.types.AbstractOperation.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/**
 * This class defines an operation that may be used to determine whether a
@@ -291,28 +292,6 @@
        ERR_COMPARE_NO_SUCH_ENTRY.get(entryDN));
  }
  private DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  /**
   * Performs any processing required for the controls included in the request.
   *
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendDeleteOperation.java
@@ -60,6 +60,7 @@
import static org.opends.server.types.AbstractOperation.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/**
 * This class defines an operation used to delete an entry in a local backend
@@ -356,28 +357,6 @@
        ERR_DELETE_NO_SUCH_ENTRY.get(entryDN));
  }
  private DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  /**
   * Performs any request control processing needed for this operation.
   *
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyDNOperation.java
@@ -72,6 +72,7 @@
import static org.opends.server.types.AbstractOperation.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/**
 * This class defines an operation used to move an entry in a local backend
@@ -247,7 +248,7 @@
    DN parentDN;
    if (newSuperior == null)
    {
      parentDN = entryDN.getParentDNInSuffix();
      parentDN = DirectoryServer.getParentDNInSuffix(entryDN);
    }
    else
    {
@@ -495,28 +496,6 @@
        ERR_MODDN_NO_CURRENT_ENTRY.get(entryDN));
  }
  private DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  /**
   * Processes the set of controls included in the request.
   *
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -95,6 +95,7 @@
import static org.opends.server.types.AccountStatusNotificationType.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/** This class defines an operation used to modify an entry in a local backend of the Directory Server. */
public class LocalBackendModifyOperation
@@ -598,28 +599,6 @@
        ERR_MODIFY_NO_SUCH_ENTRY.get(entryDN));
  }
  private DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = entryDN.getParentDNInSuffix();
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = matchedDN.getParentDNInSuffix();
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  /**
   * Processes any controls contained in the modify request.
   *
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -47,8 +47,27 @@
import org.opends.server.controls.LDAPPreReadResponseControl;
import org.opends.server.controls.ProxiedAuthV1Control;
import org.opends.server.controls.ProxiedAuthV2Control;
import org.opends.server.core.*;
import org.opends.server.types.*;
import org.opends.server.core.AccessControlConfigManager;
import org.opends.server.core.AddOperation;
import org.opends.server.core.BindOperation;
import org.opends.server.core.CompareOperation;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.types.AbstractOperation;
import org.opends.server.types.AdditionalLogItem;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.Operation;
import org.opends.server.types.OperationType;
import org.opends.server.types.Privilege;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.WritabilityMode;
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.ProtocolMessages.ERR_PROXYAUTH_AUTHZ_NOT_PERMITTED;
@@ -1137,7 +1156,28 @@
    }
  }
  /** {@inheritDoc} */
  static DN findMatchedDN(DN entryDN)
  {
    try
    {
      DN matchedDN = DirectoryServer.getParentDNInSuffix(entryDN);
      while (matchedDN != null)
      {
        if (DirectoryServer.entryExists(matchedDN))
        {
          return matchedDN;
        }
        matchedDN = DirectoryServer.getParentDNInSuffix(matchedDN);
      }
    }
    catch (Exception e)
    {
      logger.traceException(e);
    }
    return null;
  }
  @Override
  public String toString()
  {
opendj-server-legacy/src/test/java/org/opends/server/types/TestDN.java
@@ -558,11 +558,11 @@
   */
  @Test(dataProvider = "namingContexts")
  public void testGetParentDNInSuffix(DN namingContext) throws Exception {
    assertNull(namingContext.getParentDNInSuffix());
    assertNull(DirectoryServer.getParentDNInSuffix(namingContext));
    DN childDN = namingContext.child(RDN.decode("ou=People"));
    assertNotNull(childDN.getParentDNInSuffix());
    assertEquals(childDN.getParentDNInSuffix(), namingContext);
    assertNotNull(DirectoryServer.getParentDNInSuffix(childDN));
    assertEquals(DirectoryServer.getParentDNInSuffix(childDN), namingContext);
  }