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

Jean-Noël Rouvignac
07.03.2016 3d4c0acccda6e62b23f248d75c1cc6721fc20bdf
opendj-server-legacy/src/main/java/org/opends/server/admin/AdministrationDataSync.java
@@ -98,8 +98,8 @@
      return;
    }
    AttributeType attrType1 = DirectoryServer.getAttributeType("adminport");
    AttributeType attrType2 = DirectoryServer.getAttributeType("adminEnabled");
    AttributeType attrType1 = DirectoryServer.getSchema().getAttributeType("adminport");
    AttributeType attrType2 = DirectoryServer.getSchema().getAttributeType("adminEnabled");
    LinkedList<Modification> mods = new LinkedList<>();
    mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType1, adminPort)));
@@ -222,7 +222,7 @@
    if (!result.isEmpty())
    {
      SearchResultEntry adminConnectorEntry = result.getFirst();
      AttributeType attrType = DirectoryServer.getAttributeType(attrName);
      AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
      List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType);
      if (!attrs.isEmpty())
      {
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
@@ -69,7 +69,7 @@
  {
    // First check to see if the ds-pwp-password-policy-dn is present.
    String userDNString = userEntry.getName().toString();
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN);
    for (Attribute a : userEntry.getAttribute(type))
    {
      if (a.isEmpty())
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
@@ -267,7 +267,7 @@
   */
  public boolean isDisabled()
  {
    final AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_DISABLED);
    final AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_ACCOUNT_DISABLED);
    try
    {
      isDisabled = getBoolean(userEntry, type);
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
@@ -1056,7 +1056,7 @@
      newPrivileges.addAll(DirectoryServer.getRootPrivileges());
    }
    AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME);
    AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME);
    for (Attribute a : entry.getAttribute(privType))
    {
      for (ByteString v : a)
opendj-server-legacy/src/main/java/org/opends/server/api/CompressedSchema.java
@@ -513,7 +513,7 @@
  private AttributeDescription loadAttributeToMaps(final int id, final String attributeName,
      final Iterable<String> attributeOptions, final Mappings mappings)
  {
    final AttributeType type = DirectoryServer.getAttributeType(attributeName);
    final AttributeType type = DirectoryServer.getSchema().getAttributeType(attributeName);
    final Set<String> options = getOptions(attributeOptions);
    final AttributeDescription ad = AttributeDescription.create(type, options);
    exclusiveLock.lock();
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -204,15 +204,15 @@
  {
    if (aclRights == null)
    {
      aclRights = DirectoryServer.getAttributeType(aclRightsAttrStr);
      aclRights = DirectoryServer.getSchema().getAttributeType(aclRightsAttrStr);
    }
    if (aclRightsInfo == null)
    {
      aclRightsInfo = DirectoryServer.getAttributeType(aclRightsInfoAttrStr);
      aclRightsInfo = DirectoryServer.getSchema().getAttributeType(aclRightsInfoAttrStr);
    }
    if (dnAttributeType == null)
    {
      dnAttributeType = DirectoryServer.getAttributeType(dnAttrStr);
      dnAttributeType = DirectoryServer.getSchema().getAttributeType(dnAttrStr);
    }
    // Check if the attributes aclRights and aclRightsInfo were requested and
@@ -244,7 +244,7 @@
        }
        else
        {
          nonRightsAttrs.add(DirectoryServer.getAttributeType(a));
          nonRightsAttrs.add(DirectoryServer.getSchema().getAttributeType(a));
        }
      }
    }
@@ -374,7 +374,7 @@
      // Only add the aclRights information if the aclRights attribute type was seen.
      if(hasAttrMask(mask, ACL_RIGHTS))  {
        String typeStr = aclRightsAttributeLevelStr + ";" + a.getNameOrOID();
        AttributeType attributeType = DirectoryServer.getAttributeType(typeStr);
        AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(typeStr);
        Attribute attr = Attributes.create(attributeType, evalInfo.toString());
        //It is possible that the user might have specified the same attributes
        //in both the search and the specific attribute part of the control.
@@ -604,7 +604,7 @@
    if(hasAttrMask(mask,ACL_RIGHTS_INFO)) {
      //Build the attribute type.
      String typeStr = aclRightsInfoAttrLogsStr + ";" + rightStr + ";" + aType.getNameOrOID();
      AttributeType attributeType = DirectoryServer.getAttributeType(typeStr);
      AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(typeStr);
      Attribute attr = Attributes.create(attributeType, container.getEvalSummary());
      // The attribute type might have already been added, probably
      // not but it is possible.
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -123,10 +123,10 @@
   */
  private static void initStatics()
  {
    aciType = getAttributeType("aci");
    globalAciType = getAttributeType(ATTR_AUTHZ_GLOBAL_ACI);
    debugSearchIndex = getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX);
    refAttrType = getAttributeType(ATTR_REFERRAL_URL);
    aciType = getSchema().getAttributeType("aci");
    globalAciType = getSchema().getAttributeType(ATTR_AUTHZ_GLOBAL_ACI);
    debugSearchIndex = getSchema().getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX);
    refAttrType = getSchema().getAttributeType(ATTR_REFERRAL_URL);
    try
    {
@@ -299,7 +299,7 @@
      baseName = toLowerCase(rawAttributeType);
    }
    container.setCurrentAttributeType(getAttributeType(baseName));
    container.setCurrentAttributeType(getSchema().getAttributeType(baseName));
    container.setCurrentAttributeValue(operation.getAssertionValue());
    return isAllowed(container, operation);
  }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -342,7 +342,7 @@
    // Check to make sure that the backend has a presence index defined
    // for the ACI attribute. If it does not, then log a warning message
    // because this processing could be very expensive.
    AttributeType aciType = DirectoryServer.getAttributeType("aci");
    AttributeType aciType = DirectoryServer.getSchema().getAttributeType("aci");
    if (backend.getEntryCount() > 0
        && !backend.isIndexed(aciType, IndexType.PRESENCE))
    {
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -209,7 +209,7 @@
     * @return The attribute type.
     */
    public AttributeType getAttributeType() {
      return DirectoryServer.getAttributeType(attrTypeStr);
      return DirectoryServer.getSchema().getAttributeType(attrTypeStr);
    }
    /**
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java
@@ -160,7 +160,7 @@
      AVA ava = rdn.getFirstAVA();
      if (!typePatterns[0].equals("*"))
      {
        AttributeType thisType = DirectoryServer.getAttributeType(typePatterns[0]);
        AttributeType thisType = DirectoryServer.getSchema().getAttributeType(typePatterns[0]);
        if (thisType.isPlaceHolder() || !thisType.equals(ava.getAttributeType()))
        {
          return false;
@@ -179,7 +179,7 @@
    TreeMap<String, List<ByteString>> patternMap = new TreeMap<>();
    for (int i = 0; i < typePatterns.length; i++)
    {
      AttributeType type = DirectoryServer.getAttributeType(typePatterns[i]);
      AttributeType type = DirectoryServer.getSchema().getAttributeType(typePatterns[i]);
      if (type.isPlaceHolder())
      {
        return false;
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
@@ -108,7 +108,7 @@
              attributeName=attributeName.substring(0, semicolon);
            }
            String filterString=matcher.group(filterPos);
            AttributeType attrType = DirectoryServer.getAttributeType(attributeName);
            AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attributeName);
            SearchFilter filter;
            //Check if it is a valid filter and add it to the list map if ok.
            try {
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -122,7 +122,7 @@
                    throw new AciException(message);
                }
            } else {
                AttributeType attrType = DirectoryServer.getAttributeType(attribute);
                AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attribute);
                if(attrType.isOperational())
                {
                  opAttributes.add(attrType);
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserAttr.java
@@ -186,7 +186,7 @@
    private EnumEvalResult evalVAL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        boolean undefined=false;
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrStr);
        final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT);
        InternalSearchOperation op = getRootConnection().processSearch(request);
        LinkedList<SearchResultEntry> result = op.getSearchEntries();
@@ -213,7 +213,7 @@
     */
    private EnumEvalResult evalURL(AciEvalContext evalCtx) {
        EnumEvalResult matched= EnumEvalResult.FALSE;
        AttributeType attrType = DirectoryServer.getAttributeType(attrStr);
        AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrStr);
        List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType);
        for(Attribute a : attrs) {
            for(ByteString v : a) {
opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -19,6 +19,7 @@
import static org.forgerock.util.Reject.*;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.schema.BooleanSyntax.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -213,7 +214,7 @@
    // Construct the backup base entry.
    LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(2);
    objectClasses.put(CoreSchema.getTopObjectClass(), OC_TOP);
    objectClasses.put(DirectoryServer.getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT);
    objectClasses.put(getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT);
    LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0);
    LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(1);
@@ -269,8 +270,7 @@
  {
    int numEntries = 1;
    AttributeType backupPathType =
         DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    for (File dir : backupDirectories.keySet())
    {
@@ -378,7 +378,7 @@
      long count = 0;
      Entry backupDirEntry = getBackupDirectoryEntry(entryDN);
      AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
      AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
      List<Attribute> attrList = backupDirEntry.getAttribute(t);
      for (ByteString v : attrList.get(0))
      {
@@ -465,7 +465,7 @@
         throws DirectoryException
  {
    // Make sure that the DN specifies a backup directory.
    AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    ByteString v = entryDN.rdn().getAttributeValue(t);
    if (v == null)
    {
@@ -503,13 +503,13 @@
    // Construct the backup directory entry to return.
    LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2);
    ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP);
    ocMap.put(DirectoryServer.getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY);
    ocMap.put(getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY);
    LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0);
    LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(3);
    userAttrs.put(t, asList(t, v));
    t = DirectoryServer.getAttributeType(ATTR_BACKUP_BACKEND_DN);
    t = getSchema().getAttributeType(ATTR_BACKUP_BACKEND_DN);
    userAttrs.put(t, asList(t, ByteString.valueOfUtf8(backupDirectory.getConfigEntryDN().toString())));
    Entry e = new Entry(entryDN, ocMap, userAttrs, opAttrs);
@@ -533,7 +533,7 @@
          throws DirectoryException
  {
    // First, get the backup ID from the entry DN.
    AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID);
    AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID);
    ByteString idValue = entryDN.rdn().getAttributeValue(idType);
    if (idValue == null) {
      throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(entryDN));
@@ -546,7 +546,7 @@
      throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN));
    }
    AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    ByteString v = parentDN.rdn().getAttributeValue(t);
    if (v == null) {
      throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(entryDN));
@@ -579,7 +579,7 @@
    // Construct the backup entry to return.
    LinkedHashMap<ObjectClass, String> ocMap = new LinkedHashMap<>(3);
    ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP);
    ocMap.put(DirectoryServer.getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO);
    ocMap.put(getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO);
    ocMap.put(CoreSchema.getExtensibleObjectObjectClass(), OC_EXTENSIBLE_OBJECT);
    LinkedHashMap<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<>(0);
@@ -591,7 +591,7 @@
    Date backupDate = backupInfo.getBackupDate();
    if (backupDate != null) {
      t = DirectoryServer.getAttributeType(ATTR_BACKUP_DATE);
      t = getSchema().getAttributeType(ATTR_BACKUP_DATE);
      userAttrs.put(t,
          asList(t, ByteString.valueOfUtf8(GeneralizedTimeSyntax.format(backupDate))));
    }
@@ -602,7 +602,7 @@
    Set<String> dependencies = backupInfo.getDependencies();
    if (dependencies != null && !dependencies.isEmpty()) {
      t = DirectoryServer.getAttributeType(ATTR_BACKUP_DEPENDENCY);
      t = getSchema().getAttributeType(ATTR_BACKUP_DEPENDENCY);
      AttributeBuilder builder = new AttributeBuilder(t);
      builder.addAllStrings(dependencies);
      userAttrs.put(t, builder.toAttributeList());
@@ -621,7 +621,7 @@
    Map<String, String> properties = backupInfo.getBackupProperties();
    if (properties != null && !properties.isEmpty()) {
      for (Map.Entry<String, String> e : properties.entrySet()) {
        t = DirectoryServer.getAttributeType(toLowerCase(e.getKey()));
        t = getSchema().getAttributeType(toLowerCase(e.getKey()));
        userAttrs.put(t, asList(t, ByteString.valueOfUtf8(e.getValue())));
      }
    }
@@ -633,13 +633,13 @@
  private void putByteString(LinkedHashMap<AttributeType, List<Attribute>> userAttrs, String attrName, byte[] value)
  {
    AttributeType t = DirectoryServer.getAttributeType(attrName);
    AttributeType t = getSchema().getAttributeType(attrName);
    userAttrs.put(t, asList(t, ByteString.wrap(value)));
  }
  private void putBoolean(LinkedHashMap<AttributeType, List<Attribute>> attrsMap, String attrName, boolean value)
  {
    AttributeType t = DirectoryServer.getAttributeType(attrName);
    AttributeType t = getSchema().getAttributeType(attrName);
    attrsMap.put(t, asList(t, createBooleanValue(value)));
  }
@@ -710,8 +710,7 @@
      if (scope != SearchScope.BASE_OBJECT && !backupDirectories.isEmpty())
      {
        AttributeType backupPathType =
             DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
        AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
        for (File dir : backupDirectories.keySet())
        {
          // Check to see if the descriptor file exists.  If not, then skip this
@@ -762,8 +761,7 @@
      if (scope != SearchScope.BASE_OBJECT)
      {
        AttributeType t =
             DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
        AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
        List<Attribute> attrList = backupDirEntry.getAttribute(t);
        returnEntries(searchOperation, baseDN, filter, attrList);
      }
@@ -803,7 +801,7 @@
      {
        File dir = new File(v.toString());
        BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory();
        AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID);
        AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID);
        for (String backupID : backupDirectory.getBackups().keySet())
        {
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -15,6 +15,7 @@
 */
package org.opends.server.backends;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -56,7 +57,6 @@
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.opends.server.api.Backend;
import org.opends.server.config.ConfigConstants;
import org.opends.server.controls.EntryChangelogNotificationControl;
import org.opends.server.controls.ExternalChangelogRequestControl;
import org.opends.server.core.AddOperation;
@@ -190,11 +190,6 @@
    CHANGELOG_ENTRY_OBJECT_CLASSES.put(getSchema().getObjectClass(OC_CHANGELOG_ENTRY), OC_CHANGELOG_ENTRY);
  }
  /** The attribute type for the "creatorsName" attribute. */
  private static final AttributeType CREATORS_NAME_TYPE = getAttributeType(OP_ATTR_CREATORS_NAME);
  /** The attribute type for the "modifiersName" attribute. */
  private static final AttributeType MODIFIERS_NAME_TYPE = getAttributeType(OP_ATTR_MODIFIERS_NAME);
  /** The base DN for the external change log. */
  public static final DN CHANGELOG_BASE_DN = DN.valueOf(DN_EXTERNAL_CHANGELOG_ROOT);
@@ -698,7 +693,7 @@
  private SearchFilter buildSearchFilterFrom(final DN baseDN, final String attrName)
  {
    final RDN rdn = baseDN.rdn();
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    final ByteString attrValue = rdn.getAttributeValue(attrType);
    if (attrValue != null)
    {
@@ -1174,7 +1169,8 @@
      final StringBuilder builder = new StringBuilder(256);
      for (Attribute attr : addMsg.getAttributes())
      {
        if (attr.getAttributeDescription().getAttributeType().equals(CREATORS_NAME_TYPE) && !attr.isEmpty())
        if (!attr.isEmpty()
            && attr.getAttributeDescription().getAttributeType().equals(getCreatorsNameAttributeType()))
        {
          // This attribute is not multi-valued.
          changeInitiatorsName = attr.iterator().next().toString();
@@ -1216,8 +1212,8 @@
      {
        final Attribute attr = mod.getAttribute();
        if (mod.getModificationType() == ModificationType.REPLACE
            && attr.getAttributeDescription().getAttributeType().equals(MODIFIERS_NAME_TYPE)
            && !attr.isEmpty())
            && !attr.isEmpty()
            && attr.getAttributeDescription().getAttributeType().equals(getModifiersNameAttributeType()))
        {
          // This attribute is not multi-valued.
          changeInitiatorsName = attr.iterator().next().toString();
@@ -1310,45 +1306,43 @@
    final Map<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<>();
    // Operational standard attributes
    addAttributeByType(ATTR_SUBSCHEMA_SUBENTRY_LC, ATTR_SUBSCHEMA_SUBENTRY_LC,
        ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, userAttrs, opAttrs);
    addAttributeByType("numsubordinates", "numSubordinates", "0", userAttrs, opAttrs);
    addAttributeByType("hassubordinates", "hasSubordinates", "false", userAttrs, opAttrs);
    addAttributeByType("entrydn", "entryDN", dnString, userAttrs, opAttrs);
    addAttributeByType(ATTR_SUBSCHEMA_SUBENTRY_LC, DN_DEFAULT_SCHEMA_ROOT, userAttrs, opAttrs);
    addAttributeByType("numSubordinates", "0", userAttrs, opAttrs);
    addAttributeByType("hasSubordinates", "false", userAttrs, opAttrs);
    addAttributeByType("entryDN", dnString, userAttrs, opAttrs);
    // REQUIRED attributes
    if (changeNumber > 0)
    {
      addAttributeByType("changenumber", "changeNumber", String.valueOf(changeNumber), userAttrs, opAttrs);
      addAttributeByType("changeNumber", String.valueOf(changeNumber), userAttrs, opAttrs);
    }
    SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME);
    dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); // ??
    final String format = dateFormat.format(new Date(csn.getTime()));
    addAttributeByType("changetime", "changeTime", format, userAttrs, opAttrs);
    addAttributeByType("changetype", "changeType", changeType, userAttrs, opAttrs);
    addAttributeByType("targetdn", "targetDN", msg.getDN().toString(), userAttrs, opAttrs);
    addAttributeByType("changeTime", format, userAttrs, opAttrs);
    addAttributeByType("changeType", changeType, userAttrs, opAttrs);
    addAttributeByType("targetDN", msg.getDN().toString(), userAttrs, opAttrs);
    // NON REQUESTED attributes
    addAttributeByType("replicationcsn", "replicationCSN", csn.toString(), userAttrs, opAttrs);
    addAttributeByType("replicaidentifier", "replicaIdentifier", Integer.toString(csn.getServerId()),
        userAttrs, opAttrs);
    addAttributeByType("replicationCSN", csn.toString(), userAttrs, opAttrs);
    addAttributeByType("replicaIdentifier", Integer.toString(csn.getServerId()), userAttrs, opAttrs);
    if (ldifChanges != null)
    {
      addAttributeByType("changes", "changes", ldifChanges, userAttrs, opAttrs);
      addAttributeByType("changes", ldifChanges, userAttrs, opAttrs);
    }
    if (changeInitiatorsName != null)
    {
      addAttributeByType("changeinitiatorsname", "changeInitiatorsName", changeInitiatorsName, userAttrs, opAttrs);
      addAttributeByType("changeInitiatorsName", changeInitiatorsName, userAttrs, opAttrs);
    }
    final String targetUUID = msg.getEntryUUID();
    if (targetUUID != null)
    {
      addAttributeByType("targetentryuuid", "targetEntryUUID", targetUUID, userAttrs, opAttrs);
      addAttributeByType("targetEntryUUID", targetUUID, userAttrs, opAttrs);
    }
    final String cookie2 = cookie != null ? cookie : "";
    addAttributeByType("changelogcookie", "changeLogCookie", cookie2, userAttrs, opAttrs);
    addAttributeByType("changeLogCookie", cookie2, userAttrs, opAttrs);
    final List<RawAttribute> includedAttributes = msg.getEclIncludes();
    if (includedAttributes != null && !includedAttributes.isEmpty())
@@ -1365,7 +1359,7 @@
        }
      }
      final String includedAttributesLDIF = builder.toString();
      addAttributeByType("includedattributes", "includedAttributes", includedAttributesLDIF, userAttrs, opAttrs);
      addAttributeByType("includedAttributes", includedAttributesLDIF, userAttrs, opAttrs);
    }
    return new Entry(DN.valueOf(dnString), CHANGELOG_ENTRY_OBJECT_CLASSES, userAttrs, opAttrs);
@@ -1445,11 +1439,10 @@
    // --   or we risk returning less entries if purge kicks in      after we computed numSubordinates
    // - Or we accumulate all the entries that must be returned before sending them => OutOfMemoryError
    addAttributeByUppercaseName(ATTR_COMMON_NAME, ATTR_COMMON_NAME, BACKEND_ID, userAttrs, operationalAttrs);
    addAttributeByUppercaseName(ATTR_SUBSCHEMA_SUBENTRY_LC, ATTR_SUBSCHEMA_SUBENTRY,
        ConfigConstants.DN_DEFAULT_SCHEMA_ROOT, userAttrs, operationalAttrs);
    addAttributeByUppercaseName("hassubordinates", "hasSubordinates", hasSubordinatesStr, userAttrs, operationalAttrs);
    addAttributeByUppercaseName("entrydn", "entryDN", DN_EXTERNAL_CHANGELOG_ROOT, userAttrs, operationalAttrs);
    addAttributeByName(ATTR_COMMON_NAME, BACKEND_ID, userAttrs, operationalAttrs);
    addAttributeByName(ATTR_SUBSCHEMA_SUBENTRY, DN_DEFAULT_SCHEMA_ROOT, userAttrs, operationalAttrs);
    addAttributeByName("hasSubordinates", hasSubordinatesStr, userAttrs, operationalAttrs);
    addAttributeByName("entryDN", DN_EXTERNAL_CHANGELOG_ROOT, userAttrs, operationalAttrs);
    return new Entry(CHANGELOG_BASE_DN, CHANGELOG_ROOT_OBJECT_CLASSES, userAttrs, operationalAttrs);
  }
@@ -1458,31 +1451,28 @@
    e.addAttribute(Attributes.create(attrType, attrValue), null);
  }
  private static void addAttributeByType(String attrNameLowercase,
      String attrNameUppercase, String attrValue,
  private static void addAttributeByType(String attrName, String attrValue,
      Map<AttributeType, List<Attribute>> userAttrs,
      Map<AttributeType, List<Attribute>> operationalAttrs)
  {
    addAttribute(attrNameLowercase, attrNameUppercase, attrValue, userAttrs, operationalAttrs, true);
    addAttribute(attrName, attrValue, userAttrs, operationalAttrs, true);
  }
  private static void addAttributeByUppercaseName(String attrNameLowercase,
      String attrNameUppercase,  String attrValue,
  private static void addAttributeByName(String attrName, String attrValue,
      Map<AttributeType, List<Attribute>> userAttrs,
      Map<AttributeType, List<Attribute>> operationalAttrs)
  {
    addAttribute(attrNameLowercase, attrNameUppercase, attrValue, userAttrs, operationalAttrs, false);
    addAttribute(attrName, attrValue, userAttrs, operationalAttrs, false);
  }
  private static void addAttribute(final String attrNameLowercase,
      final String attrNameUppercase, final String attrValue,
  private static void addAttribute(final String attrName, final String attrValue,
      final Map<AttributeType, List<Attribute>> userAttrs,
      final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(attrNameUppercase);
    final Attribute a = addByType
        ? Attributes.create(attrType, attrValue)
        : Attributes.create(attrNameUppercase, attrValue);
        ? Attributes.create(getSchema().getAttributeType(attrName), attrValue)
        : Attributes.create(attrName, attrValue);
    final AttributeType attrType = a.getAttributeDescription().getAttributeType();
    final List<Attribute> attrList = Collections.singletonList(a);
    if (attrType.isOperational())
    {
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -22,7 +22,6 @@
import static org.opends.messages.ConfigMessages.*;
import static org.opends.messages.SchemaMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.types.CommonSchemaElements.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.opends.server.util.ServerConstants.*;
@@ -128,34 +127,18 @@
  private static final String CONFIG_SCHEMA_ELEMENTS_FILE = "02-config.ldif";
  private static final String CORE_SCHEMA_ELEMENTS_FILE = "00-core.ldif";
  private static final AttributeType attributeTypesType = getAttributeTypesAttributeType();
  private static final AttributeType ditStructureRulesType = getDITStructureRulesAttributeType();
  private static final AttributeType ditContentRulesType = getDITContentRulesAttributeType();
  private static final AttributeType ldapSyntaxesType = getLDAPSyntaxesAttributeType();
  private static final AttributeType matchingRulesType = getMatchingRulesAttributeType();
  private static final AttributeType matchingRuleUsesType = getMatchingRuleUseAttributeType();
  private static final AttributeType nameFormsType = getNameFormsAttributeType();
  private static final AttributeType objectClassesType = getObjectClassesAttributeType();
  /** The set of user-defined attributes that will be included in the schema entry. */
  private ArrayList<Attribute> userDefinedAttributes;
  /** The attribute type that will be used to include the defined attribute types. */
  private AttributeType attributeTypesType;
  /** The attribute type that will be used to hold the schema creation timestamp. */
  private AttributeType createTimestampType;
  /** The attribute type that will be used to hold the schema creator's name. */
  private AttributeType creatorsNameType;
  /** The attribute type that will be used to include the defined DIT content rules. */
  private AttributeType ditContentRulesType;
  /** The attribute type that will be used to include the defined DIT structure rules. */
  private AttributeType ditStructureRulesType;
  /** The attribute type that will be used to include the defined attribute syntaxes. */
  private AttributeType ldapSyntaxesType;
  /** The attribute type that will be used to include the defined matching rules. */
  private AttributeType matchingRulesType;
  /** The attribute type that will be used to include the defined matching rule uses. */
  private AttributeType matchingRuleUsesType;
  /** The attribute that will be used to hold the schema modifier's name. */
  private AttributeType modifiersNameType;
  /** The attribute type that will be used to hold the schema modification timestamp. */
  private AttributeType modifyTimestampType;
  /** The attribute type that will be used to include the defined object classes. */
  private AttributeType objectClassesType;
  /** The attribute type that will be used to include the defined name forms. */
  private AttributeType nameFormsType;
  /** The value containing DN of the user we'll say created the configuration. */
  private ByteString creatorsName;
  /** The value containing the DN of the last user to modify the configuration. */
@@ -222,22 +205,6 @@
    configEntryDN = configEntry.getName();
    // Get all of the attribute types that we will use for schema elements.
    attributeTypesType = getAttributeType(ATTR_ATTRIBUTE_TYPES_LC);
    objectClassesType = getAttributeType(ATTR_OBJECTCLASSES_LC);
    matchingRulesType = getAttributeType(ATTR_MATCHING_RULES_LC);
    ldapSyntaxesType = getAttributeType(ATTR_LDAP_SYNTAXES_LC);
    ditContentRulesType = getAttributeType(ATTR_DIT_CONTENT_RULES_LC);
    ditStructureRulesType = getAttributeType(ATTR_DIT_STRUCTURE_RULES_LC);
    matchingRuleUsesType = getAttributeType(ATTR_MATCHING_RULE_USE_LC);
    nameFormsType = getAttributeType(ATTR_NAME_FORMS_LC);
    // Initialize the lastmod attributes.
    creatorsNameType = getAttributeType(OP_ATTR_CREATORS_NAME_LC);
    createTimestampType = getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC);
    modifiersNameType = getAttributeType(OP_ATTR_MODIFIERS_NAME_LC);
    modifyTimestampType = getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC);
    // Construct the set of objectclasses to include in the schema entry.
    schemaObjectClasses = new LinkedHashMap<>(3);
    schemaObjectClasses.put(CoreSchema.getTopObjectClass(), OC_TOP);
@@ -595,13 +562,13 @@
      }
    }
    addAttributeToSchemaEntry(
        Attributes.create(creatorsNameType, creatorsName), userAttrs, operationalAttrs);
        Attributes.create(getCreatorsNameAttributeType(), creatorsName), userAttrs, operationalAttrs);
    addAttributeToSchemaEntry(
        Attributes.create(createTimestampType, createTimestamp), userAttrs, operationalAttrs);
        Attributes.create(getCreateTimestampAttributeType(), createTimestamp), userAttrs, operationalAttrs);
    addAttributeToSchemaEntry(
        Attributes.create(modifiersNameType, modifiersName), userAttrs, operationalAttrs);
        Attributes.create(getModifiersNameAttributeType(), modifiersName), userAttrs, operationalAttrs);
    addAttributeToSchemaEntry(
        Attributes.create(modifyTimestampType, modifyTimestamp), userAttrs, operationalAttrs);
        Attributes.create(getModifyTimestampAttributeType(), modifyTimestamp), userAttrs, operationalAttrs);
    // Add the extra attributes.
    for (Attribute attribute : DirectoryServer.getSchema().getExtraAttributes().values())
@@ -2283,7 +2250,8 @@
    // Add all of the appropriate matching rule uses to the schema entry.  Since
    // there is no hierarchical relationship between matching rule uses, we
    // don't need to worry about ordering.
    addAttribute(schemaEntry, matchingRuleUsesType, getValuesForSchemaFile(schema.getMatchingRuleUses(), schemaFile));
    values = getValuesForSchemaFile(schema.getMatchingRuleUses(), schemaFile);
    addAttribute(schemaEntry, matchingRuleUsesType, values);
    if (FILE_USER_SCHEMA_ELEMENTS.equals(schemaFile))
    {
@@ -2963,7 +2931,7 @@
    // loop on the attribute types in the entry just received
    // and add them in the existing schema.
    Set<String> oidList = new HashSet<>(1000);
    for (Attribute a : newSchemaEntry.getAttribute(getAttributeTypesAttributeType()))
    for (Attribute a : newSchemaEntry.getAttribute(attributeTypesType))
    {
      // Look for attribute types that could have been added to the schema
      // or modified in the schema
@@ -3014,7 +2982,7 @@
    // loop on the objectClasses from the entry, search if they are
    // already in the current schema, add them if not.
    oidList.clear();
    for (Attribute a : newSchemaEntry.getAttribute(getObjectClassesAttributeType()))
    for (Attribute a : newSchemaEntry.getAttribute(objectClassesType))
    {
      for (ByteString v : a)
      {
opendj-server-legacy/src/main/java/org/opends/server/backends/TrustStoreBackend.java
@@ -383,7 +383,7 @@
         throws DirectoryException
  {
    // Make sure that the DN specifies a certificate alias.
    AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
    AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
    ByteString v = entryDN.rdn().getAttributeValue(t);
    if (v == null)
    {
@@ -422,7 +422,7 @@
    userAttrs.put(t, Attributes.createAsList(t, v));
    t = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
    t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
    AttributeBuilder builder = new AttributeBuilder(t);
    builder.setOption("binary");
    builder.add(certValue);
@@ -538,7 +538,7 @@
      if (scope != SearchScope.BASE_OBJECT && aliases.length != 0)
      {
        AttributeType certAliasType = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
        AttributeType certAliasType = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
        for (String alias : aliases)
        {
          DN certDN = makeChildDN(getBaseDN(), certAliasType, alias);
@@ -1039,7 +1039,7 @@
    DN entryDN = entry.getName();
    // Make sure that the DN specifies a certificate alias.
    AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
    AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
    ByteString v = entryDN.rdn().getAttributeValue(t);
    if (v == null)
    {
@@ -1156,7 +1156,7 @@
       throws DirectoryException
  {
    // Make sure that the DN specifies a certificate alias.
    AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
    AttributeType t = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
    ByteString v = entryDN.rdn().getAttributeValue(t);
    if (v == null)
    {
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -77,7 +77,7 @@
   * The standard attribute type that is used to specify the set of referral
   * URLs in a referral entry.
   */
  private final AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
  private final AttributeType referralType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL);
  /**
   * A flag that indicates whether there are any referrals contained in this
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java
@@ -210,7 +210,7 @@
          }
          else
          {
            AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
            AttributeType attrType = DirectoryServer.getSchema().getAttributeType(lowerName);
            if (attrType.isPlaceHolder())
            {
              throw new StorageRuntimeException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index).toString());
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -233,7 +233,7 @@
  private Attribute getSingleAttribute(Entry taskEntry, String attrName, Arg1<Object> noEntryErrorMsg,
      Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException
  {
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList.isEmpty())
    {
@@ -341,7 +341,7 @@
      String nextTaskIDName = NAME_PREFIX_TASK + "id";
      nextTaskEntry.replaceAttribute(Attributes.create(nextTaskIDName, nextTaskID));
      RDN nextTaskRDN = new RDN(DirectoryServer.getAttributeType(nextTaskIDName), nextTaskID);
      RDN nextTaskRDN = new RDN(DirectoryServer.getSchema().getAttributeType(nextTaskIDName), nextTaskID);
      DN nextTaskDN = taskScheduler.getTaskBackend().getScheduledTasksParentDN().child(nextTaskRDN);
      nextTaskEntry.setDN(nextTaskDN);
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -823,7 +823,7 @@
      String messageString = buildLogMessage(severity, message, exception);
      logMessages.add(messageString);
      final AttributeType type = DirectoryServer.getAttributeType(ATTR_TASK_LOG_MESSAGES);
      final AttributeType type = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_LOG_MESSAGES);
      final Attribute attr = taskEntry.getExactAttribute(AttributeDescription.create(type));
      final AttributeBuilder builder = attr != null ? new AttributeBuilder(attr) : new AttributeBuilder(type);
      builder.add(messageString);
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -1808,7 +1808,7 @@
         throws DirectoryException
  {
    // Get the name of the class that implements the task logic.
    AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_CLASS);
    List<Attribute> attrList = entry.getAttribute(attrType);
    if (attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -329,7 +329,7 @@
  {
    // It's possible that this is a monitor attribute rather than a configurable
    // one. Check all of those.
    AttributeType attrType = DirectoryServer.getAttributeType(name);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(name);
    for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders)
    {
      for (org.opends.server.types.Attribute a : monitor.getMonitorData())
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
@@ -110,7 +110,7 @@
            reader.readStartSequence();
            while(reader.hasNextElement()) {
              String attrStr = reader.readOctetStringAsString();
              attrs.add(DirectoryServer.getAttributeType(attrStr));
              attrs.add(DirectoryServer.getSchema().getAttributeType(attrStr));
            }
            reader.readEndSequence();
          }
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
@@ -830,7 +830,7 @@
  {
    if (attributeType == null && rawAttributeType != null)
    {
      attributeType = DirectoryServer.getAttributeType(rawAttributeType);
      attributeType = DirectoryServer.getSchema().getAttributeType(rawAttributeType);
    }
    return attributeType;
  }
opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
@@ -98,7 +98,7 @@
        {
          reader.readStartSequence();
          String attrName = reader.readOctetStringAsString();
          AttributeType attrType = DirectoryServer.getAttributeType(attrName);
          AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
          if (attrType.isPlaceHolder())
          {
            //This attribute is not defined in the schema. There is no point
@@ -421,7 +421,7 @@
    List<SortKey> sortKeys = new ArrayList<>();
    for(String[] decodedKey : decodedKeyList)
    {
      AttributeType attrType = DirectoryServer.getAttributeType(decodedKey[0]);
      AttributeType attrType = DirectoryServer.getSchema().getAttributeType(decodedKey[0]);
      if (attrType.isPlaceHolder())
      {
        //This attribute is not defined in the schema. There is no point
opendj-server-legacy/src/main/java/org/opends/server/core/CompareOperationBasis.java
@@ -232,7 +232,7 @@
      baseName = toLowerCase(rawAttributeType);
      attributeOptions  = null;
    }
    return AttributeDescription.create(DirectoryServer.getAttributeType(baseName), attributeOptions);
    return AttributeDescription.create(DirectoryServer.getSchema().getAttributeType(baseName), attributeOptions);
  }
  @Override
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -69,7 +69,6 @@
import org.forgerock.opendj.config.server.ServerManagementContext;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.server.AlertHandlerCfg;
import org.forgerock.opendj.server.config.server.ConnectionHandlerCfg;
import org.forgerock.opendj.server.config.server.CryptoManagerCfg;
@@ -2275,20 +2274,6 @@
  }
  /**
   * Retrieves the attribute type for the provided name or OID. It can optionally return a generated
   * placeholder version if the requested attribute type is not defined in the schema.
   *
   * @param nameOrOid
   *          The name or OID for the attribute type to retrieve.
   * @return The requested attribute type, or a generated placeholder version if there is no
   *         attribute with the specified nameOrOid defined in the server schema
   */
  public static AttributeType getAttributeType(String nameOrOid)
  {
    return getSchema().getAttributeType(nameOrOid, getSchema().getDefaultSyntax());
  }
  /**
   * Retrieves the set of virtual attribute rules registered with the Directory
   * Server.
   *
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
@@ -321,7 +321,7 @@
  private long getGeneralizedTime0(Entry userEntry, String attrName) throws DirectoryException
  {
    return getGeneralizedTime(userEntry, DirectoryServer.getAttributeType(attrName));
    return getGeneralizedTime(userEntry, DirectoryServer.getSchema().getAttributeType(attrName));
  }
  /**
@@ -551,7 +551,7 @@
      return authFailureTimes;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    try
    {
      authFailureTimes = getGeneralizedTimes(type);
@@ -642,7 +642,7 @@
    failureTimes.add(highestFailureTime);
    // And the attribute in the user entry
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME);
    Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime));
    modifications.add(new Modification(ModificationType.ADD, addAttr, true));
@@ -723,7 +723,7 @@
      return failureLockedTime;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME);
    try
    {
      failureLockedTime = getGeneralizedTime(userEntry, type);
@@ -1174,7 +1174,7 @@
      return false;
    }
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED);
    try
    {
      mustChangePassword = getBoolean(userEntry, type);
@@ -1234,7 +1234,7 @@
  private void clearAttribute(String attrName)
  {
    clearAttribute(DirectoryServer.getAttributeType(attrName));
    clearAttribute(DirectoryServer.getSchema().getAttributeType(attrName));
  }
  private void clearAttribute(AttributeType type)
@@ -1734,7 +1734,7 @@
    }
    this.warnedTime = warnedTime;
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME);
    replaceAttribute(Attributes.create(type, GeneralizedTimeSyntax.createGeneralizedTimeValue(currentTime)));
    if (logger.isTraceEnabled())
@@ -1766,7 +1766,7 @@
  {
    if (graceLoginTimes == null)
    {
      AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
      AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
      try
      {
        graceLoginTimes = getGeneralizedTimes(type);
@@ -1813,7 +1813,7 @@
    long highestGraceTime = computeHighestTime(graceTimes);
    graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes
    AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
    Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime));
    modifications.add(new Modification(ModificationType.ADD, addAttr, true));
  }
@@ -2347,7 +2347,7 @@
  private TreeMap<Long,ByteString> getSortedHistoryValues(List<Attribute> removeAttrs)
  {
    TreeMap<Long, ByteString> historyMap = new TreeMap<>();
    AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    for (Attribute a : userEntry.getAttribute(historyType))
    {
      for (ByteString v : a)
@@ -2561,7 +2561,7 @@
    // If there is a maximum number of values to retain and we would be over the limit with the new value,
    // then get rid of enough values (oldest first) to satisfy the count.
    AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    int historyCount = passwordPolicy.getPasswordHistoryCount();
    if  (historyCount > 0 && historyMap.size() >= historyCount)
    {
@@ -2659,7 +2659,7 @@
  public String[] getPasswordHistoryValues()
  {
    ArrayList<String> historyValues = new ArrayList<>();
    AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC);
    for (Attribute a : userEntry.getAttribute(historyType))
    {
      for (ByteString v : a)
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
@@ -177,7 +177,7 @@
    String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE);
    if (value != null && value.length() > 0)
    {
      this.pPasswordAttribute = DirectoryServer.getAttributeType(value);
      this.pPasswordAttribute = DirectoryServer.getSchema().getAttributeType(value);
      if (this.pPasswordAttribute.isPlaceHolder())
      {
        throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
@@ -250,7 +250,7 @@
        objectClasses.containsKey(pwdValidatorPolicyOC))
    {
      AttributeType pwdAttrType =
          DirectoryServer.getAttributeType(PWD_ATTR_VALIDATOR);
          DirectoryServer.getSchema().getAttributeType(PWD_ATTR_VALIDATOR);
      for (Attribute attr : entry.getAttribute(pwdAttrType))
      {
        for (ByteString val : attr)
@@ -369,7 +369,7 @@
   */
  private String getAttrValue(Entry entry, String pwdAttrName)
  {
    AttributeType pwdAttrType = DirectoryServer.getAttributeType(pwdAttrName);
    AttributeType pwdAttrType = DirectoryServer.getSchema().getAttributeType(pwdAttrName);
    for (Attribute attr : entry.getAttribute(pwdAttrType))
    {
      for (ByteString value : attr)
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
@@ -287,14 +287,14 @@
    this.serverContext = serverContext;
    if (!schemaInitDone) {
      // Initialize various schema references.
      attrKeyID = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID);
      attrPublicKeyCertificate = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
      attrTransformation = DirectoryServer.getAttributeType(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME);
      attrMacAlgorithm = DirectoryServer.getAttributeType(ATTR_CRYPTO_MAC_ALGORITHM_NAME);
      attrSymmetricKey = DirectoryServer.getAttributeType(ATTR_CRYPTO_SYMMETRIC_KEY);
      attrInitVectorLength = DirectoryServer.getAttributeType(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS);
      attrKeyLength = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_LENGTH_BITS);
      attrCompromisedTime = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
      attrKeyID = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
      attrPublicKeyCertificate = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
      attrTransformation = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME);
      attrMacAlgorithm = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_MAC_ALGORITHM_NAME);
      attrSymmetricKey = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_SYMMETRIC_KEY);
      attrInitVectorLength = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS);
      attrKeyLength = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_LENGTH_BITS);
      attrCompromisedTime = DirectoryServer.getSchema().getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
      // TODO: ConfigConstants
      ocCertRequest = DirectoryServer.getSchema().getObjectClass("ds-cfg-self-signed-cert-request");
      ocInstanceKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_INSTANCE_KEY);
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -159,9 +159,9 @@
    ocCipherKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_CIPHER_KEY);
    ocMacKey = DirectoryServer.getSchema().getObjectClass(OC_CRYPTO_MAC_KEY);
    attrCert = getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
    attrAlias = getAttributeType(ATTR_CRYPTO_KEY_ID);
    attrCompromisedTime = getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
    attrCert = getSchema().getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
    attrAlias = getSchema().getAttributeType(ATTR_CRYPTO_KEY_ID);
    attrCompromisedTime = getSchema().getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
    if (DirectoryServer.getBackendWithBaseDN(adminSuffixDN) != null)
    {
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
@@ -111,7 +111,7 @@
    // Get the memberURL attribute from the entry, if there is one, and parse
    // out the LDAP URLs that it contains.
    LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>();
    AttributeType memberURLType = DirectoryServer.getAttributeType(ATTR_MEMBER_URL_LC);
    AttributeType memberURLType = DirectoryServer.getSchema().getAttributeType(ATTR_MEMBER_URL_LC);
    for (Attribute a : groupEntry.getAttribute(memberURLType))
    {
      for (ByteString v : a)
opendj-server-legacy/src/main/java/org/opends/server/extensions/ExternalSASLMechanismHandler.java
@@ -107,8 +107,7 @@
    certificateAttributeType = configuration.getCertificateAttribute();
    if (certificateAttributeType == null)
    {
      certificateAttributeType =
           DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
      certificateAttributeType = DirectoryServer.getSchema().getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
    }
@@ -347,8 +346,7 @@
    AttributeType newCertificateType = configuration.getCertificateAttribute();
    if (newCertificateType == null)
    {
      newCertificateType =
           DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
      newCertificateType = DirectoryServer.getSchema().getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE);
    }
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -57,6 +57,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
@@ -66,7 +67,6 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.LDAPPassThroughAuthenticationPolicyCfgDefn.MappingPolicy;
import org.forgerock.opendj.server.config.server.LDAPPassThroughAuthenticationPolicyCfg;
import org.opends.server.api.AuthenticationPolicy;
@@ -105,6 +105,7 @@
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.ldap.LDAPConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -1363,8 +1364,8 @@
      {
        super(userEntry);
        this.cachedPasswordAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD);
        this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME);
        this.cachedPasswordAttribute = getSchema().getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD);
        this.cachedPasswordTimeAttribute = getSchema().getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME);
      }
      @Override
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -366,7 +366,7 @@
              else if (lowerTokenStr.startsWith("notification-user-attr:"))
              {
                String attrName = lowerTokenStr.substring(23);
                AttributeType attrType = DirectoryServer.getAttributeType(attrName);
                AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
                if (attrType.isPlaceHolder())
                {
                  throw new ConfigException(
opendj-server-legacy/src/main/java/org/opends/server/extensions/StaticGroup.java
@@ -35,9 +35,9 @@
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.forgerock.opendj.server.config.server.GroupImplementationCfg;
import org.forgerock.opendj.server.config.server.StaticGroupImplementationCfg;
import org.forgerock.util.Reject;
import org.opends.server.api.Group;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
@@ -56,6 +56,7 @@
import org.opends.server.types.Modification;
import org.opends.server.types.SearchFilter;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.ExtensionMessages.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
@@ -164,7 +165,7 @@
        throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
      }
      someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER);
      someMemberAttributeType = getMemberAttributeType();
    }
    else if (hasGroupOfNamesClass)
    {
@@ -175,11 +176,11 @@
        throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
      }
      someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER);
      someMemberAttributeType = getMemberAttributeType();
    }
    else if (hasGroupOfUniqueNamesClass)
    {
      someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_UNIQUE_MEMBER_LC);
      someMemberAttributeType = getUniqueMemberAttributeType();
    }
    else
    {
opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
@@ -364,7 +364,7 @@
        return null;
      }
      AttributeType userAttrType = DirectoryServer.getAttributeType(userAttrName);
      AttributeType userAttrType = DirectoryServer.getSchema().getAttributeType(userAttrName);
      if (userAttrType.isPlaceHolder())
      {
        ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
@@ -385,6 +385,6 @@
  private static String normalizeAttributeName(String attrName)
  {
    return toLowerCase(DirectoryServer.getAttributeType(attrName).getNameOrOID());
    return toLowerCase(DirectoryServer.getSchema().getAttributeType(attrName).getNameOrOID());
  }
}
opendj-server-legacy/src/main/java/org/opends/server/extensions/VirtualStaticGroup.java
@@ -107,7 +107,7 @@
    // Get the target group DN attribute from the entry, if there is one.
    DN targetDN = null;
    AttributeType targetType = DirectoryServer.getAttributeType(ATTR_TARGET_GROUP_DN);
    AttributeType targetType = DirectoryServer.getSchema().getAttributeType(ATTR_TARGET_GROUP_DN);
    for (Attribute a : groupEntry.getAttribute(targetType))
    {
      for (ByteString v : a)
opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java
@@ -277,7 +277,7 @@
          ? toAttr
          : toAttr.substring(semicolonPos + 1);
      if (DirectoryServer.getAttributeType(toAttrType).isPlaceHolder())
      if (DirectoryServer.getSchema().getAttributeType(toAttrType).isPlaceHolder())
      {
        messages.add(ERR_PLUGIN_ATTR_CLEANUP_ATTRIBUTE_MISSING.get(toAttr));
        isValid = false;
opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
@@ -16,25 +16,24 @@
 */
package org.opends.server.plugins;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.PluginMessages.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.meta.PluginCfgDefn;
import org.forgerock.opendj.server.config.server.EntryUUIDPluginCfg;
import org.forgerock.opendj.server.config.server.PluginCfg;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.Attributes;
import org.opends.server.types.Entry;
@@ -54,18 +53,15 @@
       extends DirectoryServerPlugin<EntryUUIDPluginCfg>
       implements ConfigurationChangeListener<EntryUUIDPluginCfg>
{
  /** The name of the entryUUID attribute type. */
  private static final String ENTRYUUID = "entryuuid";
  /** The attribute type for the "entryUUID" attribute. */
  private final AttributeType entryUUIDType;
  private static final AttributeType entryUUIDType = getEntryUUIDAttributeType();
  /** The current configuration for this plugin. */
  private EntryUUIDPluginCfg currentConfig;
  /** Mandatory default constructor of this Directory Server plugin. */
  public EntryUUIDPlugin()
  {
    entryUUIDType = DirectoryServer.getAttributeType(ENTRYUUID);
    super();
  }
  @Override
@@ -113,9 +109,7 @@
    // Construct a new UUID.  In order to make sure that UUIDs are consistent
    // when the same LDIF is generated on multiple servers, we'll base the UUID
    // on the byte representation of the normalized DN.
    UUID uuid = entry.getName().toUUID();
    uuidList = Attributes.createAsList(entryUUIDType, uuid.toString());
    entry.putAttribute(entryUUIDType, uuidList);
    entry.putAttribute(entryUUIDType, toAttributeList(entry.getName().toUUID()));
    // We shouldn't ever need to return a non-success result.
    return PluginResult.ImportLDIF.continueEntryProcessing();
@@ -128,23 +122,22 @@
    // See if the entry being added already contains an entryUUID attribute.
    // It shouldn't, since it's NO-USER-MODIFICATION, but if it does then leave
    // it alone.
    Map<AttributeType,List<Attribute>> operationalAttributes =
         addOperation.getOperationalAttributes();
    List<Attribute> uuidList = operationalAttributes.get(entryUUIDType);
    List<Attribute> uuidList = addOperation.getOperationalAttributes().get(entryUUIDType);
    if (uuidList != null)
    {
      return PluginResult.PreOperation.continueOperationProcessing();
    }
    // Construct a new random UUID.
    UUID uuid = UUID.randomUUID();
    uuidList = Attributes.createAsList(entryUUIDType, uuid.toString());
    // Add the attribute to the entry and return.
    addOperation.setAttribute(entryUUIDType, uuidList);
    addOperation.setAttribute(entryUUIDType, toAttributeList(UUID.randomUUID()));
    return PluginResult.PreOperation.continueOperationProcessing();
  }
  private List<Attribute> toAttributeList(UUID uuid)
  {
    return Attributes.createAsList(entryUUIDType, uuid.toString());
  }
  @Override
  public boolean isConfigurationAcceptable(PluginCfg configuration,
                                           List<LocalizableMessage> unacceptableReasons)
opendj-server-legacy/src/main/java/org/opends/server/plugins/LastModPlugin.java
@@ -16,6 +16,11 @@
 */
package org.opends.server.plugins;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.PluginMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.TimeThread.*;
import java.util.List;
import java.util.Set;
@@ -23,18 +28,16 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.PluginCfgDefn;
import org.forgerock.opendj.server.config.server.LastModPluginCfg;
import org.forgerock.opendj.server.config.server.PluginCfg;
import org.opends.server.api.plugin.DirectoryServerPlugin;
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.api.plugin.PluginType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
@@ -45,10 +48,6 @@
import org.opends.server.types.operation.PreOperationModifyDNOperation;
import org.opends.server.types.operation.PreOperationModifyOperation;
import static org.opends.messages.PluginMessages.*;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.util.TimeThread.*;
/**
 * This class implements a Directory Server plugin that will add the
 * creatorsName and createTimestamp attributes to an entry whenever it is added
@@ -61,14 +60,6 @@
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
  /** The attribute type for the "createTimestamp" attribute. */
  private final AttributeType createTimestampType;
  /** The attribute type for the "creatorsName" attribute. */
  private final AttributeType creatorsNameType;
  /** The attribute type for the "modifiersName" attribute. */
  private final AttributeType modifiersNameType;
  /** The attribute type for the "modifyTimestamp" attribute. */
  private final AttributeType modifyTimestampType;
  /** The current configuration for this plugin. */
  private LastModPluginCfg currentConfig;
@@ -82,14 +73,6 @@
  public LastModPlugin()
  {
    super();
    // Get the attribute types for the attributes that we will use.  This needs
    // to be done in the constructor in order to make the associated variables "final".
    createTimestampType = DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC);
    creatorsNameType = DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC);
    modifiersNameType = DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC);
    modifyTimestampType = DirectoryServer.getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC);
  }
@@ -134,7 +117,7 @@
               doPreOperation(PreOperationAddOperation addOperation)
  {
    // Create the attribute list for the creatorsName attribute, if appropriate.
    AttributeBuilder builder = new AttributeBuilder(creatorsNameType);
    AttributeBuilder builder = new AttributeBuilder(getCreatorsNameAttributeType());
    DN creatorDN = addOperation.getAuthorizationDN();
    if (creatorDN == null)
    {
@@ -146,13 +129,13 @@
    {
      builder.add(creatorDN.toString());
    }
    addOperation.setAttribute(creatorsNameType, builder.toAttributeList());
    addOperation.setAttribute(getCreatorsNameAttributeType(), builder.toAttributeList());
    //  Create the attribute list for the createTimestamp attribute.
    List<Attribute> timeList = Attributes.createAsList(
        createTimestampType, OP_ATTR_CREATE_TIMESTAMP, getGMTTime());
    addOperation.setAttribute(createTimestampType, timeList);
        getCreateTimestampAttributeType(), OP_ATTR_CREATE_TIMESTAMP, getGMTTime());
    addOperation.setAttribute(getCreateTimestampAttributeType(), timeList);
    // We shouldn't ever need to return a non-success result.
    return PluginResult.PreOperation.continueOperationProcessing();
@@ -165,7 +148,7 @@
       doPreOperation(PreOperationModifyOperation modifyOperation)
  {
    // Create the modifiersName attribute.
    AttributeBuilder builder = new AttributeBuilder(modifiersNameType);
    AttributeBuilder builder = new AttributeBuilder(getModifiersNameAttributeType());
    DN modifierDN = modifyOperation.getAuthorizationDN();
    if (modifierDN == null)
    {
@@ -194,7 +177,7 @@
    //  Create the modifyTimestamp attribute.
    Attribute timeAttr = Attributes.create(modifyTimestampType,
    Attribute timeAttr = Attributes.create(getModifyTimestampAttributeType(),
        OP_ATTR_MODIFY_TIMESTAMP, getGMTTime());
    try
    {
@@ -222,7 +205,7 @@
       doPreOperation(PreOperationModifyDNOperation modifyDNOperation)
  {
    // Create the modifiersName attribute.
    AttributeBuilder builder = new AttributeBuilder(modifiersNameType);
    AttributeBuilder builder = new AttributeBuilder(getModifiersNameAttributeType());
    DN modifierDN = modifyDNOperation.getAuthorizationDN();
    if (modifierDN == null)
    {
@@ -240,7 +223,7 @@
    // Create the modifyTimestamp attribute.
    Attribute timeAttr = Attributes.create(modifyTimestampType,
    Attribute timeAttr = Attributes.create(getModifyTimestampAttributeType(),
        OP_ATTR_MODIFY_TIMESTAMP, getGMTTime());
    modifyDNOperation.addModification(new Modification(
        ModificationType.REPLACE, timeAttr, true));
opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -106,7 +106,7 @@
  {
    configuration.addPasswordPolicyImportChangeListener(this);
    customPolicyAttribute = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN);
    customPolicyAttribute = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN);
    // Make sure that the plugin has been enabled for the appropriate types.
    for (PluginType t : pluginTypes)
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -206,7 +206,7 @@
      String attr = attrFilt.substring(0, sepInd);
      String filtStr = attrFilt.substring(sepInd + 1);
      AttributeType attrType = DirectoryServer.getAttributeType(attr);
      AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attr);
      try
      {
        newAttrFiltMap.put(attrType, SearchFilter.createFilterFromString(filtStr));
@@ -324,7 +324,7 @@
       * type has to be present in the attributeType list.
       */
      AttributeType attrType = DirectoryServer.getAttributeType(attr);
      AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attr);
      if (attrType.isPlaceHolder() || !theAttributeTypes.contains(attrType))
      {
        isAcceptable = false;
opendj-server-legacy/src/main/java/org/opends/server/protocols/internal/InternalClientConnection.java
@@ -162,7 +162,7 @@
      put(userAttrs, ATTR_SN, commonName);
      put(userAttrs, ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString);
      AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME);
      AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME);
      AttributeBuilder builder = new AttributeBuilder(privType);
      for (Privilege p : Privilege.getDefaultRootPrivileges())
      {
@@ -201,7 +201,7 @@
  private void put(Map<AttributeType, List<Attribute>> Attrs, String attrName, String value)
  {
    List<Attribute> attrs = newLinkedList(Attributes.create(attrName, value));
    Attrs.put(DirectoryServer.getAttributeType(attrName), attrs);
    Attrs.put(DirectoryServer.getSchema().getAttributeType(attrName), attrs);
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
@@ -16,6 +16,7 @@
 */
package org.opends.server.replication.plugin;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.replication.plugin.HistAttrModificationKey.*;
@@ -28,6 +29,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.DirectoryServer;
@@ -36,7 +38,6 @@
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import org.opends.server.types.operation.PreOperationAddOperation;
@@ -257,7 +258,7 @@
   */
  public static void setHistoricalAttrToOperation(PreOperationAddOperation addOperation)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
    String attrValue = encodeHistorical(OperationContext.getCSN(addOperation), "add");
    List<Attribute> attrs = Attributes.createAsList(attrType, attrValue);
    addOperation.setAttribute(attrType, attrs);
@@ -672,8 +673,7 @@
   */
  public static String getEntryUUID(Entry entry)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
    List<Attribute> uuidAttrs = entry.getOperationalAttribute(attrType);
    List<Attribute> uuidAttrs = entry.getOperationalAttribute(getEntryUUIDAttributeType());
    return extractEntryUUID(uuidAttrs, entry.getName());
  }
@@ -687,8 +687,7 @@
   */
  public static String getEntryUUID(PreOperationAddOperation op)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
    List<Attribute> uuidAttrs = op.getOperationalAttributes().get(attrType);
    List<Attribute> uuidAttrs = op.getOperationalAttributes().get(getEntryUUIDAttributeType());
    return extractEntryUUID(uuidAttrs, op.getEntryDN());
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
@@ -401,7 +401,7 @@
  private Attribute getAttribute(String attributeName, Entry entry)
  {
    List<Attribute> attrs = entry.getAttribute(DirectoryServer.getAttributeType(attributeName));
    List<Attribute> attrs = entry.getAttribute(DirectoryServer.getSchema().getAttributeType(attributeName));
    return !attrs.isEmpty() ? attrs.get(0) : null;
  }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -765,7 +765,7 @@
    final SearchResultEntry resultEntry = getFirstResult(searchOperation);
    if (resultEntry != null)
    {
      AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
      AttributeType synchronizationGenIDType = DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID);
      List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
      if (!attrs.isEmpty())
      {
@@ -786,7 +786,7 @@
  private Iterator<ByteString> getAttributeValueIterator(SearchResultEntry resultEntry, String attrName)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    List<Attribute> exclAttrs = resultEntry.getAttribute(attrType);
    if (!exclAttrs.isEmpty())
    {
@@ -1365,7 +1365,7 @@
    Set<AttributeType> results = new HashSet<>();
    for (String attrName : fractionalConcernedAttributes)
    {
      results.add(DirectoryServer.getAttributeType(attrName));
      results.add(DirectoryServer.getSchema().getAttributeType(attrName));
    }
    return results;
  }
@@ -3289,8 +3289,7 @@
      SearchResultEntry resultEntry = result.get(0);
      if (resultEntry != null)
      {
        AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
        List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
        List<Attribute> attrs = resultEntry.getAttribute(REPLICATION_GENERATION_ID);
        if (!attrs.isEmpty())
        {
          Attribute attr = attrs.get(0);
@@ -3442,7 +3441,7 @@
      Set<AttributeType> includeAttributes = new HashSet<>();
      for (String attrName : includeAttributeStrings)
      {
        includeAttributes.add(DirectoryServer.getAttributeType(attrName));
        includeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName));
      }
      exportConfig.setIncludeAttributes(includeAttributes);
    }
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java
@@ -211,7 +211,7 @@
   */
  private void updateStateFromEntry(SearchResultEntry resultEntry)
  {
    AttributeType synchronizationStateType = DirectoryServer.getAttributeType(REPLICATION_STATE);
    AttributeType synchronizationStateType = DirectoryServer.getSchema().getAttributeType(REPLICATION_STATE);
    List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType);
    if (!attrs.isEmpty())
    {
@@ -310,7 +310,7 @@
   */
  private final void checkAndUpdateServerState()
  {
    final AttributeType histType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
    final AttributeType histType = DirectoryServer.getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
    // Retrieves the entries that have changed since the
    // maxCsn stored in the serverState
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
@@ -553,7 +553,7 @@
      // create a rule and register it into the DirectoryServer
      provider.initializeVirtualAttributeProvider(null);
      AttributeType attributeType = DirectoryServer.getAttributeType(attrName);
      AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(attrName);
      return new VirtualAttributeRule(attributeType, provider,
            baseDNs, SearchScope.BASE_OBJECT,
            groupDNs, filters, conflictBehavior);
opendj-server-legacy/src/main/java/org/opends/server/tasks/AddSchemaFileTask.java
@@ -87,7 +87,7 @@
    // Get the attribute that specifies which schema file(s) to add.
    Entry taskEntry = getTaskEntry();
    AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
@@ -137,16 +137,16 @@
    Entry taskEntry = getTaskEntry();
    AttributeType typeBackupAll = getAttributeType(ATTR_TASK_BACKUP_ALL);
    AttributeType typeCompress = getAttributeType(ATTR_TASK_BACKUP_COMPRESS);
    AttributeType typeEncrypt = getAttributeType(ATTR_TASK_BACKUP_ENCRYPT);
    AttributeType typeHash = getAttributeType(ATTR_TASK_BACKUP_HASH);
    AttributeType typeIncremental = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL);
    AttributeType typeSignHash = getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH);
    AttributeType typeBackendID = getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID);
    AttributeType typeBackupID = getAttributeType(ATTR_BACKUP_ID);
    AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType typeIncrementalBaseID = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID);
    AttributeType typeBackupAll = getSchema().getAttributeType(ATTR_TASK_BACKUP_ALL);
    AttributeType typeCompress = getSchema().getAttributeType(ATTR_TASK_BACKUP_COMPRESS);
    AttributeType typeEncrypt = getSchema().getAttributeType(ATTR_TASK_BACKUP_ENCRYPT);
    AttributeType typeHash = getSchema().getAttributeType(ATTR_TASK_BACKUP_HASH);
    AttributeType typeIncremental = getSchema().getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL);
    AttributeType typeSignHash = getSchema().getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH);
    AttributeType typeBackendID = getSchema().getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID);
    AttributeType typeBackupID = getSchema().getAttributeType(ATTR_BACKUP_ID);
    AttributeType typeBackupDirectory = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType typeIncrementalBaseID = getSchema().getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID);
    backUpAll = TaskUtils.getBoolean(taskEntry.getAttribute(typeBackupAll), false);
    compress = TaskUtils.getBoolean(taskEntry.getAttribute(typeCompress), false);
opendj-server-legacy/src/main/java/org/opends/server/tasks/DisconnectClientTask.java
@@ -93,7 +93,7 @@
  private long getConnectionID(Entry taskEntry) throws DirectoryException
  {
    final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID);
    final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID);
    for (Attribute a : taskEntry.getAttribute(attrType))
    {
      for (ByteString v : a)
@@ -114,7 +114,7 @@
  private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException
  {
    final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT);
    final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT);
    for (Attribute a : taskEntry.getAttribute(attrType))
    {
      for (ByteString v : a)
@@ -140,7 +140,7 @@
  private LocalizableMessage getDisconnectMessage(Entry taskEntry)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE);
    for (Attribute a : taskEntry.getAttribute(attrType))
    {
      for (ByteString v : a)
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -123,7 +123,7 @@
    }
    Entry taskEntry = getTaskEntry();
    AttributeType typeWrapColumn = getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN);
    AttributeType typeWrapColumn = getSchema().getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN);
    ldifFile = toString(taskEntry, ATTR_TASK_EXPORT_LDIF_FILE);
    File f = new File (ldifFile);
@@ -160,21 +160,21 @@
  private boolean toBoolean(Entry entry, boolean defaultValue, String attrName)
  {
    final AttributeType attrType = getAttributeType(attrName);
    final AttributeType attrType = getSchema().getAttributeType(attrName);
    final List<Attribute> attrs = entry.getAttribute(attrType);
    return TaskUtils.getBoolean(attrs, defaultValue);
  }
  private ArrayList<String> toListOfString(Entry entry, String attrName)
  {
    final AttributeType attrType = getAttributeType(attrName);
    final AttributeType attrType = getSchema().getAttributeType(attrName);
    final List<Attribute> attrs = entry.getAttribute(attrType);
    return TaskUtils.getMultiValueString(attrs);
  }
  private String toString(Entry entry, String attrName)
  {
    final AttributeType attrType = getAttributeType(attrName);
    final AttributeType attrType = getSchema().getAttributeType(attrName);
    final List<Attribute> attrs = entry.getAttribute(attrType);
    return TaskUtils.getSingleValueString(attrs);
  }
@@ -456,7 +456,7 @@
    HashSet<AttributeType> attributes = new HashSet<>();
    for (String attrName : attributeStrings)
    {
      attributes.add(DirectoryServer.getAttributeType(attrName));
      attributes.add(DirectoryServer.getSchema().getAttributeType(attrName));
    }
    return attributes;
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -135,27 +135,27 @@
    Entry taskEntry = getTaskEntry();
    AttributeType typeLdifFile = getAttributeType(ATTR_IMPORT_LDIF_FILE);
    AttributeType typeTemplateFile = getAttributeType(ATTR_IMPORT_TEMPLATE_FILE);
    AttributeType typeBackendID = getAttributeType(ATTR_IMPORT_BACKEND_ID);
    AttributeType typeIncludeBranch = getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH);
    AttributeType typeExcludeBranch = getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH);
    AttributeType typeIncludeAttribute = getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE);
    AttributeType typeExcludeAttribute = getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE);
    AttributeType typeIncludeFilter = getAttributeType(ATTR_IMPORT_INCLUDE_FILTER);
    AttributeType typeExcludeFilter = getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER);
    AttributeType typeRejectFile = getAttributeType(ATTR_IMPORT_REJECT_FILE);
    AttributeType typeSkipFile = getAttributeType(ATTR_IMPORT_SKIP_FILE);
    AttributeType typeOverwrite = getAttributeType(ATTR_IMPORT_OVERWRITE);
    AttributeType typeSkipSchemaValidation = getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION);
    AttributeType typeIsCompressed = getAttributeType(ATTR_IMPORT_IS_COMPRESSED);
    AttributeType typeIsEncrypted = getAttributeType(ATTR_IMPORT_IS_ENCRYPTED);
    AttributeType typeClearBackend = getAttributeType(ATTR_IMPORT_CLEAR_BACKEND);
    AttributeType typeRandomSeed = getAttributeType(ATTR_IMPORT_RANDOM_SEED);
    AttributeType typeThreadCount = getAttributeType(ATTR_IMPORT_THREAD_COUNT);
    AttributeType typeOffHeapSize = getAttributeType(ATTR_IMPORT_OFFHEAP_SIZE);
    AttributeType typeTmpDirectory = getAttributeType(ATTR_IMPORT_TMP_DIRECTORY);
    AttributeType typeDNCheckPhase2 = getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION);
    AttributeType typeLdifFile = getSchema().getAttributeType(ATTR_IMPORT_LDIF_FILE);
    AttributeType typeTemplateFile = getSchema().getAttributeType(ATTR_IMPORT_TEMPLATE_FILE);
    AttributeType typeBackendID = getSchema().getAttributeType(ATTR_IMPORT_BACKEND_ID);
    AttributeType typeIncludeBranch = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH);
    AttributeType typeExcludeBranch = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH);
    AttributeType typeIncludeAttribute = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE);
    AttributeType typeExcludeAttribute = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE);
    AttributeType typeIncludeFilter = getSchema().getAttributeType(ATTR_IMPORT_INCLUDE_FILTER);
    AttributeType typeExcludeFilter = getSchema().getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER);
    AttributeType typeRejectFile = getSchema().getAttributeType(ATTR_IMPORT_REJECT_FILE);
    AttributeType typeSkipFile = getSchema().getAttributeType(ATTR_IMPORT_SKIP_FILE);
    AttributeType typeOverwrite = getSchema().getAttributeType(ATTR_IMPORT_OVERWRITE);
    AttributeType typeSkipSchemaValidation = getSchema().getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION);
    AttributeType typeIsCompressed = getSchema().getAttributeType(ATTR_IMPORT_IS_COMPRESSED);
    AttributeType typeIsEncrypted = getSchema().getAttributeType(ATTR_IMPORT_IS_ENCRYPTED);
    AttributeType typeClearBackend = getSchema().getAttributeType(ATTR_IMPORT_CLEAR_BACKEND);
    AttributeType typeRandomSeed = getSchema().getAttributeType(ATTR_IMPORT_RANDOM_SEED);
    AttributeType typeThreadCount = getSchema().getAttributeType(ATTR_IMPORT_THREAD_COUNT);
    AttributeType typeOffHeapSize = getSchema().getAttributeType(ATTR_IMPORT_OFFHEAP_SIZE);
    AttributeType typeTmpDirectory = getSchema().getAttributeType(ATTR_IMPORT_TMP_DIRECTORY);
    AttributeType typeDNCheckPhase2 = getSchema().getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION);
    ArrayList<String> ldifFilestmp = asListOfStrings(taskEntry, typeLdifFile);
    ldifFiles = new ArrayList<>(ldifFilestmp.size());
@@ -746,7 +746,7 @@
    final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size());
    for (String attrName : attrNames)
    {
      attrTypes.add(DirectoryServer.getAttributeType(attrName));
      attrTypes.add(DirectoryServer.getSchema().getAttributeType(attrName));
    }
    return attrTypes;
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTargetTask.java
@@ -69,8 +69,8 @@
    // FIXME -- Do we need any special authorization here?
    Entry taskEntry = getTaskEntry();
    AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN);
    AttributeType typeScope = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE);
    AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN);
    AttributeType typeScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE);
    List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase);
    domainString = TaskUtils.getSingleValueString(attrList);
opendj-server-legacy/src/main/java/org/opends/server/tasks/InitializeTask.java
@@ -72,8 +72,8 @@
    // FIXME -- Do we need any special authorization here?
    Entry taskEntry = getTaskEntry();
    AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN);
    AttributeType typeSourceScope = getAttributeType(ATTR_TASK_INITIALIZE_SOURCE);
    AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN);
    AttributeType typeSourceScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_SOURCE);
    List<Attribute> attrList;
    attrList = taskEntry.getAttribute(typeDomainBase);
opendj-server-legacy/src/main/java/org/opends/server/tasks/PurgeConflictsHistoricalTask.java
@@ -86,7 +86,7 @@
    // FIXME -- Do we need any special authorization here?
    Entry taskEntry = getTaskEntry();
    AttributeType typeDomainBase = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN);
    AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN);
    List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase);
    domainString = TaskUtils.getSingleValueString(attrList);
@@ -104,7 +104,7 @@
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, mb.toMessage());
    }
    AttributeType typeMaxDuration = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION);
    AttributeType typeMaxDuration = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION);
    attrList = taskEntry.getAttribute(typeMaxDuration);
    String maxDurationStringInSec = TaskUtils.getSingleValueString(attrList);
opendj-server-legacy/src/main/java/org/opends/server/tasks/RebuildTask.java
@@ -95,7 +95,7 @@
    final String val = asString(taskEntry, ATTR_REBUILD_INDEX_CLEARDEGRADEDSTATE);
    isClearDegradedState = Boolean.parseBoolean(val);
    AttributeType typeIndex = getAttributeType(ATTR_REBUILD_INDEX);
    AttributeType typeIndex = getSchema().getAttributeType(ATTR_REBUILD_INDEX);
    List<Attribute> attrList = taskEntry.getAttribute(typeIndex);
    indexes = TaskUtils.getMultiValueString(attrList);
@@ -113,7 +113,7 @@
  private String asString(Entry taskEntry, String attrName)
  {
    final AttributeType attrType = getAttributeType(attrName);
    final AttributeType attrType = getSchema().getAttributeType(attrName);
    final List<Attribute> attrList = taskEntry.getAttribute(attrType);
    return TaskUtils.getSingleValueString(attrList);
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/ResetChangeNumberTask.java
@@ -34,7 +34,7 @@
import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_BASE_DN;
import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_CSN;
import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_TO;
import static org.opends.server.core.DirectoryServer.getAttributeType;
import static org.opends.server.core.DirectoryServer.getSchema;
import static org.opends.messages.TaskMessages.*;
/**
@@ -96,7 +96,7 @@
  private List<Attribute> getTaskParameter(Entry taskEntry, String attrTaskResetChangeNumberTo)
  {
    AttributeType taskAttr = getAttributeType(attrTaskResetChangeNumberTo);
    AttributeType taskAttr = getSchema().getAttributeType(attrTaskResetChangeNumberTo);
    return taskEntry.getAttribute(taskAttr);
  }
opendj-server-legacy/src/main/java/org/opends/server/tasks/RestoreTask.java
@@ -108,9 +108,9 @@
    Entry taskEntry = getTaskEntry();
    AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType typebackupID = getAttributeType(ATTR_BACKUP_ID);
    AttributeType typeVerifyOnly = getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY);
    AttributeType typeBackupDirectory = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
    AttributeType typebackupID = getSchema().getAttributeType(ATTR_BACKUP_ID);
    AttributeType typeVerifyOnly = getSchema().getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY);
    List<Attribute> attrList;
opendj-server-legacy/src/main/java/org/opends/server/tasks/SetGenerationIdTask.java
@@ -67,7 +67,7 @@
    Entry taskEntry = getTaskEntry();
    // Retrieves the eventual generation-ID
    AttributeType typeNewValue = getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE);
    AttributeType typeNewValue = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE);
    List<Attribute> attrList = taskEntry.getAttribute(typeNewValue);
    if (!attrList.isEmpty())
    {
@@ -85,7 +85,7 @@
    }
    // Retrieves the replication domain
    AttributeType typeDomainBase = getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN);
    AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN);
    attrList = taskEntry.getAttribute(typeDomainBase);
    domainString = TaskUtils.getSingleValueString(attrList);
opendj-server-legacy/src/main/java/org/opends/server/tasks/ShutdownTask.java
@@ -74,7 +74,7 @@
    restart         = false;
    shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(taskEntry.getName());
    AttributeType attrType = DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_SHUTDOWN_MESSAGE);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (!attrList.isEmpty())
    {
@@ -86,7 +86,7 @@
      }
    }
    attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER);
    attrType = DirectoryServer.getSchema().getAttributeType(ATTR_RESTART_SERVER);
    attrList = taskEntry.getAttribute(attrType);
    if (!attrList.isEmpty())
    {
opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -647,7 +647,7 @@
    Set<AttributeType> results = new HashSet<>();
    for (String attrName : attributeArg.getValues())
    {
      results.add(DirectoryServer.getAttributeType(attrName));
      results.add(DirectoryServer.getSchema().getAttributeType(attrName));
    }
    return results;
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -510,7 +510,7 @@
        }
        else
        {
          excludeAttributes.add(DirectoryServer.getAttributeType(attrName));
          excludeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName));
        }
      }
    }
@@ -538,7 +538,7 @@
        }
        else
        {
          includeAttributes.add(DirectoryServer.getAttributeType(attrName));
          includeAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName));
        }
      }
    }
opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
@@ -472,7 +472,7 @@
    LinkedHashSet<AttributeType> operationalAttributeTypes = new LinkedHashSet<>();
    for (String attributeName : attributeNames)
    {
      AttributeType t = DirectoryServer.getAttributeType(attributeName);
      AttributeType t = DirectoryServer.getSchema().getAttributeType(attributeName);
      if (t.isOperational())
      {
        operationalAttributeTypes.add(t);
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/AttributeValueTag.java
@@ -72,7 +72,7 @@
      throw new InitializationException(message);
    }
    attributeType = DirectoryServer.getAttributeType(arguments[0]);
    attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! branch.hasAttribute(attributeType))
    {
      LocalizableMessage message =
@@ -118,7 +118,7 @@
      throw new InitializationException(message);
    }
    attributeType = DirectoryServer.getAttributeType(arguments[0]);
    attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! template.hasAttribute(attributeType))
    {
      LocalizableMessage message =
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfAbsentTag.java
@@ -72,7 +72,7 @@
      throw new InitializationException(message);
    }
    AttributeType t = DirectoryServer.getAttributeType(arguments[0]);
    AttributeType t = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! branch.hasAttribute(t))
    {
      LocalizableMessage message =
@@ -103,7 +103,7 @@
      throw new InitializationException(message);
    }
    attributeType = DirectoryServer.getAttributeType(arguments[0]);
    attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! template.hasAttribute(attributeType))
    {
      LocalizableMessage message =
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/IfPresentTag.java
@@ -105,7 +105,7 @@
      throw new InitializationException(message);
    }
    AttributeType t = DirectoryServer.getAttributeType(arguments[0]);
    AttributeType t = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! branch.hasAttribute(t))
    {
      LocalizableMessage message =
@@ -153,7 +153,7 @@
      throw new InitializationException(message);
    }
    attributeType = DirectoryServer.getAttributeType(arguments[0]);
    attributeType = DirectoryServer.getSchema().getAttributeType(arguments[0]);
    if (! template.hasAttribute(attributeType))
    {
      LocalizableMessage message =
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateFile.java
@@ -833,7 +833,7 @@
        StringTokenizer tokenizer = new StringTokenizer(rdnAttrNames, "+");
        while (tokenizer.hasMoreTokens())
        {
          attrList.add(DirectoryServer.getAttributeType(tokenizer.nextToken()));
          attrList.add(DirectoryServer.getSchema().getAttributeType(tokenizer.nextToken()));
        }
        rdnAttributes = new AttributeType[attrList.size()];
@@ -995,7 +995,7 @@
      }
    }
    AttributeType attributeType = DirectoryServer.getAttributeType(lowerLine.substring(0, colonPos));
    AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(lowerLine.substring(0, colonPos));
    // First, check whether the value is an URL value: <attrName>:< <url>
    int length = line.length();
opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
@@ -176,7 +176,7 @@
   */
  public static Attribute create(String attributeName, String valueString)
  {
    return create(getAttributeType(attributeName), attributeName, valueString);
    return create(getSchema().getAttributeType(attributeName), attributeName, valueString);
  }
  /**
@@ -278,7 +278,7 @@
   */
  public static Attribute empty(String attributeName)
  {
    return empty(getAttributeType(attributeName), attributeName);
    return empty(getSchema().getAttributeType(attributeName), attributeName);
  }
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -2418,7 +2418,7 @@
      return false;
    }
    AttributeType attrType = DirectoryServer.getAttributeType(attrTypeName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrTypeName);
    if (attrType.isPlaceHolder())
    {
      // This should not happen
@@ -2461,7 +2461,7 @@
   */
  public Set<String> getReferralURLs()
  {
    AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
    AttributeType referralType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL);
    if (referralType.isPlaceHolder())
    {
      // This should not happen -- The server doesn't have a ref attribute type defined.
@@ -2522,7 +2522,7 @@
   */
  public DN getAliasedDN() throws DirectoryException
  {
    AttributeType aliasType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
    AttributeType aliasType = DirectoryServer.getSchema().getAttributeType(ATTR_REFERRAL_URL);
    if (aliasType.isPlaceHolder())
    {
      // This should not happen -- The server doesn't have an aliasedObjectName attribute type defined.
@@ -2741,7 +2741,7 @@
    }
    // Get collective attribute exclusions.
    AttributeType exclusionsType = DirectoryServer.getAttributeType(ATTR_COLLECTIVE_EXCLUSIONS_LC);
    AttributeType exclusionsType = DirectoryServer.getSchema().getAttributeType(ATTR_COLLECTIVE_EXCLUSIONS_LC);
    List<Attribute> exclusionsAttrList = operationalAttributes.get(exclusionsType);
    List<String> excludedAttrNames = new ArrayList<>();
    if (exclusionsAttrList != null && !exclusionsAttrList.isEmpty())
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -53,7 +53,6 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.ConflictingSchemaElementException;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.ldap.schema.DITContentRule;
import org.forgerock.opendj.ldap.schema.DITStructureRule;
import org.forgerock.opendj.ldap.schema.MatchingRule;
@@ -806,18 +805,6 @@
  }
  /**
   * Retrieves the default syntax that should be used for attributes that are not defined in the
   * server schema.
   *
   * @return The default syntax that should be used for attributes that are not defined in the
   *         server schema.
   */
  public Syntax getDefaultSyntax()
  {
    return schemaNG.getSyntax(CoreSchema.getDirectoryStringSyntax().getOID());
  }
  /**
   * Registers the provided syntax definition with this schema.
   *
   * @param syntax
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -194,7 +194,7 @@
        {
          for (ByteString value : attr)
          {
            this.inheritFromDNType = DirectoryServer.getAttributeType(value.toString());
            this.inheritFromDNType = DirectoryServer.getSchema().getAttributeType(value.toString());
            this.inheritFromDNAttrValue = value;
            break;
          }
@@ -207,7 +207,7 @@
        {
          for (ByteString value : attr)
          {
            this.inheritFromRDNAttrType = DirectoryServer.getAttributeType(value.toString());
            this.inheritFromRDNAttrType = DirectoryServer.getSchema().getAttributeType(value.toString());
            this.inheritFromRDNAttrValue = value;
            break;
          }
@@ -216,7 +216,7 @@
        {
          for (ByteString value : attr)
          {
            this.inheritFromRDNType = DirectoryServer.getAttributeType(value.toString());
            this.inheritFromRDNType = DirectoryServer.getSchema().getAttributeType(value.toString());
            break;
          }
        }
@@ -266,7 +266,7 @@
  {
    String specString = null;
    boolean isValidSpec = true;
    AttributeType specAttrType = DirectoryServer.getAttributeType(ATTR_SUBTREE_SPEC_LC);
    AttributeType specAttrType = DirectoryServer.getSchema().getAttributeType(ATTR_SUBTREE_SPEC_LC);
    for (Attribute attr : entry.getAttribute(specAttrType))
    {
      for (ByteString value : attr)
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -350,7 +350,7 @@
      // Check to see if the entry includes a privilege specification. If so,
      // then the requester must have the PRIVILEGE_CHANGE privilege.
      AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME);
      AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME);
      if (entry.hasAttribute(privType)
          && !clientConnection.hasPrivilege(Privilege.PRIVILEGE_CHANGE, this))
      {
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
@@ -1007,7 +1007,7 @@
      Arg1<Object> nonUniqueAttributeMessage,
      Arg2<Object, Object> cannotProcessAttributeMessage)
  {
    AttributeType attrType = DirectoryServer.getAttributeType(attributeTypeName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attributeTypeName);
    List<Attribute> attrList = userEntry.getAttribute(attrType);
    if (attrList.size() == 1)
    {
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -800,7 +800,7 @@
        processModification(m);
      }
      else if (!isInternalOrSynchro(m)
          && t.equals(getAttributeType(OP_ATTR_ACCOUNT_DISABLED)))
          && t.equals(getSchema().getAttributeType(OP_ATTR_ACCOUNT_DISABLED)))
      {
        enabledStateChanged = true;
        isEnabled = !pwPolicyState.isDisabled();
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -17,7 +17,9 @@
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.adapter.server3x.Converters.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.mockito.Mockito.*;
import static org.opends.server.core.DirectoryServer.*;
import java.net.InetAddress;
import java.util.ArrayList;
@@ -50,12 +52,12 @@
import org.forgerock.opendj.ldap.responses.PasswordModifyExtendedResult;
import org.forgerock.opendj.ldap.responses.Responses;
import org.forgerock.opendj.ldap.responses.Result;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope;
import org.opends.server.core.BindOperation;
import org.opends.server.core.CompareOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ExtendedOperation;
import org.opends.server.core.SearchOperation;
import org.opends.server.protocols.ldap.LDAPControl;
@@ -65,7 +67,6 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.types.FilterType;
import org.opends.server.types.LDAPException;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.opends.server.types.Operation;
import org.opends.server.types.SearchResultEntry;
import org.opends.server.types.SearchResultReference;
@@ -146,7 +147,7 @@
        assertThat(result.getName().toString()).isEqualTo(entry.getName().toString());
        List<ObjectClass> ocs = new ArrayList<>(result.getObjectClasses().keySet());
        assertThat(ocs).hasSize(2);
        assertThat(ocs.get(0).getOID()).isEqualTo(DirectoryServer.getSchema().getObjectClass("ds-cfg-backend").getOID());
        assertThat(ocs.get(0).getOID()).isEqualTo(getSchema().getObjectClass("ds-cfg-backend").getOID());
        assertThat(ocs.get(1).getOID()).as("This should be a placeholder").endsWith("-oid");
    }
@@ -419,7 +420,7 @@
        byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff };
        ByteString attrValue = ByteString.wrap(data);
        Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue);
        Attribute attribute = Attributes.create(getCNAttributeType(), attrValue);
        assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data);
    }
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/TargetAttrTestCase.java
@@ -486,7 +486,7 @@
  {
    EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator);
    TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString);
    AttributeType attrType = DirectoryServer.getAttributeType(attribute);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attribute);
    assertEquals(TargetAttr.isApplicable(attrType, targetAttr), expectedResult);
  }
}
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -17,6 +17,7 @@
package org.opends.server.backends;
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
@@ -138,10 +139,10 @@
    assertNotNull(schemaEntry);
    assertEquals(schemaEntry.getName(), schemaDN);
    assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules")));
    assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType()));
  }
  /**
@@ -178,20 +179,20 @@
    assertNotNull(schemaEntry);
    assertEquals(schemaEntry.getName(), schemaDN);
    assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules")));
    assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType()));
    schemaDN    = DN.valueOf("cn=subschema");
    schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false);
    assertNotNull(schemaEntry);
    assertEquals(schemaEntry.getName(), schemaDN);
    assertTrue(schemaEntry.hasAttribute(getAttributeType("attributetypes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("objectclasses")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("ldapsyntaxes")));
    assertTrue(schemaEntry.hasAttribute(getAttributeType("matchingrules")));
    assertTrue(schemaEntry.hasAttribute(getAttributeTypesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getObjectClassesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getLDAPSyntaxesAttributeType()));
    assertTrue(schemaEntry.hasAttribute(getMatchingRulesAttributeType()));
  }
  /**
@@ -370,10 +371,10 @@
         throws Exception
  {
    DN schemaDN = DN.valueOf("cn=schema");
    AttributeType a = DirectoryServer.getAttributeType("attributetypes");
    AttributeType o = DirectoryServer.getAttributeType("objectclasses");
    AttributeType m = DirectoryServer.getAttributeType("matchingrules");
    AttributeType s = DirectoryServer.getAttributeType("ldapsyntaxes");
    AttributeType a = getAttributeTypesAttributeType();
    AttributeType o = getObjectClassesAttributeType();
    AttributeType m = getMatchingRulesAttributeType();
    AttributeType s = getLDAPSyntaxesAttributeType();
    assertFalse(schemaBackend.showAllAttributes());
    Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false);
@@ -4478,10 +4479,10 @@
    Entry schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema"));
    assertNotNull(schemaEntry);
    AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
    AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
    AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
    AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
    AttributeType cnType = getCreatorsNameAttributeType();
    AttributeType ctType = getCreateTimestampAttributeType();
    AttributeType mnType = getModifiersNameAttributeType();
    AttributeType mtType = getModifyTimestampAttributeType();
    assertTrue(schemaEntry.hasAttribute(cnType));
    assertTrue(schemaEntry.hasAttribute(ctType));
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
@@ -16,8 +16,8 @@
package org.opends.server.backends.pluggable;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.forgerock.opendj.config.ConfigurationMock.*;
import static org.mockito.Mockito.*;
import static org.opends.server.util.CollectionUtils.*;
import java.util.ArrayList;
@@ -26,13 +26,15 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;
import org.forgerock.opendj.server.config.server.BackendIndexCfg;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.forgerock.util.promise.NeverThrowsException;
import org.forgerock.util.promise.PromiseImpl;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;
import org.forgerock.opendj.server.config.server.BackendIndexCfg;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.opends.server.backends.pdb.PDBStorage;
import org.opends.server.backends.pluggable.spi.AccessMode;
import org.opends.server.backends.pluggable.spi.Cursor;
@@ -42,11 +44,9 @@
import org.opends.server.backends.pluggable.spi.TreeName;
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.MemoryQuota;
import org.opends.server.core.ServerContext;
import org.opends.server.extensions.DiskSpaceMonitor;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -323,7 +323,7 @@
    BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class);
    when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
    when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
    when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType());
    when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
    return backendCfg;
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2ChildrenCountTest.java
@@ -16,8 +16,8 @@
package org.opends.server.backends.pluggable;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.forgerock.opendj.config.ConfigurationMock.*;
import static org.mockito.Mockito.*;
import static org.opends.server.util.CollectionUtils.*;
import java.util.Random;
@@ -27,13 +27,15 @@
import java.util.concurrent.TimeUnit;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;
import org.forgerock.opendj.server.config.server.BackendIndexCfg;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.forgerock.util.promise.NeverThrowsException;
import org.forgerock.util.promise.PromiseImpl;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;
import org.forgerock.opendj.server.config.server.BackendIndexCfg;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.opends.server.backends.pdb.PDBStorage;
import org.opends.server.backends.pluggable.spi.AccessMode;
import org.opends.server.backends.pluggable.spi.ReadOperation;
@@ -41,11 +43,9 @@
import org.opends.server.backends.pluggable.spi.TreeName;
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.MemoryQuota;
import org.opends.server.core.ServerContext;
import org.opends.server.extensions.DiskSpaceMonitor;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -239,7 +239,7 @@
    BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class);
    when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
    when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
    when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType());
    when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
    return backendCfg;
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -41,6 +41,7 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.util.Reject;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
@@ -158,7 +159,7 @@
    for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet())
    {
      final String attributeName = index.getKey();
      final AttributeType attribute = DirectoryServer.getAttributeType(attributeName);
      final AttributeType attribute = DirectoryServer.getSchema().getAttributeType(attributeName);
      Reject.ifNull(attribute, "Attribute type '" + attributeName + "' doesn't exists.");
      BackendIndexCfg indexCfg = mock(BackendIndexCfg.class);
@@ -620,7 +621,7 @@
    {
      for (IndexType type : index.getValue())
      {
        final AttributeType attributeType = DirectoryServer.getAttributeType(index.getKey());
        final AttributeType attributeType = DirectoryServer.getSchema().getAttributeType(index.getKey());
        assertTrue(backend.isIndexed(attributeType,
            org.opends.server.types.IndexType.valueOf(type.toString().toUpperCase())));
      }
@@ -671,7 +672,7 @@
    Entry oldEntry = workEntries.get(0);
    Entry newEntry = oldEntry.duplicate(false);
    modifyAttribute = DirectoryServer.getAttributeType("jpegphoto");
    modifyAttribute = DirectoryServer.getSchema().getAttributeType("jpegphoto");
    List<Modification> mods = Arrays.asList(
        // unindexed
        new Modification(ADD, create(modifyAttribute, modifyValue)),
@@ -917,8 +918,8 @@
      Entry actual = new Entry(dbEntry.getName(), dbEntry.getObjectClasses(), dbEntry.getUserAttributes(), null);
      // Remove the userPassword because it will have been encoded.
      expected.removeAttribute(DirectoryServer.getAttributeType("userpassword"));
      actual.removeAttribute(DirectoryServer.getAttributeType("userpassword"));
      expected.removeAttribute(CoreSchema.getUserPasswordAttributeType());
      actual.removeAttribute(CoreSchema.getUserPasswordAttributeType());
      assertThat(actual).isEqualTo(expected);
    }
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
@@ -16,19 +16,21 @@
package org.opends.server.backends.pluggable;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.forgerock.opendj.config.ConfigurationMock.*;
import static org.mockito.Mockito.*;
import static org.opends.server.backends.pluggable.State.IndexFlag.*;
import static org.opends.server.util.CollectionUtils.*;
import java.util.UUID;
import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.BackendIndexCfgDefn.IndexType;
import org.forgerock.opendj.server.config.server.BackendIndexCfg;
import org.forgerock.opendj.server.config.server.PDBBackendCfg;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.backends.pdb.PDBStorage;
import org.opends.server.backends.pluggable.State.IndexFlag;
import org.opends.server.backends.pluggable.spi.AccessMode;
@@ -37,11 +39,9 @@
import org.opends.server.backends.pluggable.spi.TreeName;
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.MemoryQuota;
import org.opends.server.core.ServerContext;
import org.opends.server.extensions.DiskSpaceMonitor;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -185,7 +185,7 @@
    BackendIndexCfg indexCfg = mockCfg(BackendIndexCfg.class);
    when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
    when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
    when(indexCfg.getAttribute()).thenReturn(CoreSchema.getSNAttributeType());
    when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
    return backendCfg;
opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
@@ -110,7 +110,7 @@
    }
    AttributeType attType = DirectoryServer.getAttributeType(type);
    AttributeType attType = DirectoryServer.getSchema().getAttributeType(type);
    ByteString attVal = null;
    if (attType != null)
    {
@@ -189,7 +189,7 @@
    // input parameter
    String             rawAttTypeTest = type;
    AttributeType         attTypeTest = DirectoryServer.getAttributeType(type);
    AttributeType         attTypeTest = DirectoryServer.getSchema().getAttributeType(type);
    ByteString            subInitialTest = ByteString.valueOfUtf8(subInitial);
    List<ByteString> subAnyTest = new ArrayList<>(subAny.size());
    for (String s : subAny)
@@ -367,7 +367,7 @@
    }
    // ( AttributeType attributeType, ByteString assertionValue
    AttributeType attType = DirectoryServer.getAttributeType(type);
    AttributeType attType = DirectoryServer.getSchema().getAttributeType(type);
    ByteString attVal = null;
    if (attType != null)
    {
@@ -463,7 +463,7 @@
    }
    AttributeType attType = DirectoryServer.getAttributeType(type);
    AttributeType attType = DirectoryServer.getSchema().getAttributeType(type);
    ByteString attVal = null ;
    if (attType != null)
    {
@@ -539,7 +539,7 @@
    assertEquals(mvf.getMatchType(), MatchedValuesFilter.PRESENT_TYPE);
    // ( AttributeType attributeType
    AttributeType attType = DirectoryServer.getAttributeType(type);
    AttributeType attType = DirectoryServer.getSchema().getAttributeType(type);
    try
    {
@@ -608,7 +608,7 @@
    }
    // ( AttributeType attributeType, ByteString assertionValue
    AttributeType attType = DirectoryServer.getAttributeType(type);
    AttributeType attType = DirectoryServer.getSchema().getAttributeType(type);
    ByteString attVal = null ;
    if (attType != null)
    {
@@ -680,7 +680,7 @@
    // input value
    String          rawAttTypeTest = type ;
    AttributeType      attTypeTest = DirectoryServer.getAttributeType(type) ;
    AttributeType      attTypeTest = DirectoryServer.getSchema().getAttributeType(type) ;
    String             matchingRuleIdTest = matchingRule.getOID() ;
    ByteString    attValueTest = (attTypeTest == null) ? null : ByteString.valueOfUtf8(value);
    // parameter used for the test.
@@ -790,7 +790,7 @@
  public void testDifferentNormalization(String type, ByteString value,
                                         String assertion)
  {
    AttributeType attrType = DirectoryServer.getAttributeType("usercertificate");
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType("usercertificate");
    MatchedValuesFilter mvf = MatchedValuesFilter.createEqualityFilter(type, ByteString.valueOfUtf8(assertion));
    assertTrue(mvf.valueMatches(attrType, value));
  }
opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
@@ -29,13 +29,14 @@
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.types.Control;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchResultEntry;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -51,11 +52,6 @@
public class VLVControlTestCase
    extends ControlsTestCase
{
  /** The givenName attribute type. */
  private AttributeType givenNameType;
  /** The sn attribute type. */
  private AttributeType snType;
  /** The DN for "Aaccf Johnson". */
  private DN aaccfJohnsonDN;
  /** The DN for "Aaron Zimmerman". */
@@ -88,12 +84,6 @@
  {
    TestCaseUtils.startServer();
    givenNameType = DirectoryServer.getAttributeType("givenname");
    assertNotNull(givenNameType);
    snType = DirectoryServer.getAttributeType("sn");
    assertNotNull(snType);
    aaccfJohnsonDN    = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com");
    aaronZimmermanDN  = DN.valueOf("uid=aaron.zimmerman,dc=example,dc=com");
    albertSmithDN     = DN.valueOf("uid=albert.smith,dc=example,dc=com");
opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
@@ -433,7 +433,7 @@
    UpdatePreOpPlugin.reset();
    AttributeType attrType = DirectoryServer.getAttributeType("description");
    AttributeType attrType = getDescriptionAttributeType();
    UpdatePreOpPlugin.addAttributeToRemove(attrType);
    AddOperation addOperation = getRootConnection().processAdd(entry);
@@ -1076,7 +1076,7 @@
         "objectClass: organization",
         "o: test");
    AttributeType attrType = DirectoryServer.getAttributeType("description");
    AttributeType attrType = getDescriptionAttributeType();
    Map<AttributeType,List<Attribute>> userAttrs = entry.getUserAttributes();
    userAttrs.put(attrType, newArrayList(Attributes.empty(attrType)));
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
@@ -41,6 +41,7 @@
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.requests.Requests;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.Backend;
import org.opends.server.plugins.DisconnectClientPlugin;
@@ -406,7 +407,7 @@
  public void testGetAndAddModifications() throws Exception
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty();
    assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty();
    UpdatePreOpPlugin.reset();
    UpdatePreOpPlugin.addModification(
@@ -421,7 +422,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty();
    assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty();
    UpdatePreOpPlugin.reset();
  }
@@ -518,7 +519,7 @@
  public void testSuccessAddAttribute() throws Exception
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty();
    assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty();
    RawModification mod = newRawModification(REPLACE, "description", "foo");
    ModifyOperation modifyOperation = processModify("o=test", mod);
@@ -526,7 +527,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty();
    assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty();
  }
@@ -542,7 +543,7 @@
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o"));
    List<Attribute> attrList = e.getAttribute(getOAttributeType());
    assertEquals(countValues(attrList), 1);
    ModifyOperation modifyOperation = processModify("o=test", newRawModification(ADD, "o", "test2"));
@@ -550,7 +551,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf("o=test"));
    attrList = e.getAttribute(DirectoryServer.getAttributeType("o"));
    attrList = e.getAttribute(getOAttributeType());
    assertEquals(countValues(attrList), 2);
  }
@@ -568,7 +569,7 @@
  {
    Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN));
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o"));
    List<Attribute> attrList = e.getAttribute(getOAttributeType());
    assertEquals(countValues(attrList), 1);
    RawModification mod = newRawModification(ADD, "o;lang-en-us", "test");
@@ -577,7 +578,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    e = DirectoryServer.getEntry(DN.valueOf(baseDN));
    attrList = e.getAttribute(DirectoryServer.getAttributeType("o"));
    attrList = e.getAttribute(getOAttributeType());
    assertEquals(countValues(attrList), 2);
  }
@@ -1804,8 +1805,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeType("employeenumber"));
    List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType());
    assertIntegerValueExists(attrList, 2);
  }
@@ -1842,13 +1842,11 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeType("employeenumber"));
    List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType());
    assertIntegerValueExists(attrList, 11);
  }
  /**
   * Tests the ability to perform a modification that increments a single-valued
   * integer attribute by negative one.
@@ -1880,11 +1878,15 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeType("employeenumber"));
    List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType());
    assertIntegerValueExists(attrList, 0);
  }
  private AttributeType getEmployeeNumberAttributeType()
  {
    return DirectoryServer.getSchema().getAttributeType("employeenumber");
  }
  private void assertIntegerValueExists(List<Attribute> attrList, int expectedValue)
  {
    boolean found = false;
@@ -2952,8 +2954,7 @@
    modifyOperation.run();
    assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS);
    assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test")));
    assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute(
                     DirectoryServer.getAttributeType("description")));
    assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute(getDescriptionAttributeType()));
  }
@@ -3172,9 +3173,7 @@
         "displayName: Test User",
         "userPassword: password");
    List<Attribute> attrList =
         e.getAttribute(DirectoryServer.getAttributeType("userpassword"));
    String passwd = firstValue(attrList);
    String passwd = firstValue(e.getAttribute(getUserPasswordAttributeType()));
    assertNotNull(passwd);
    String path = TestCaseUtils.createTempFile(
@@ -3410,7 +3409,7 @@
    retrieveSuccessfulOperationElements(modifyOperation);
    Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN));
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("usercertificate"));
    List<Attribute> attrList = e.getAttribute(getUserCertificateAttributeType());
    assertThat(attrList).hasSize(1);
    Attribute a = attrList.get(0);
    assertTrue(a.getAttributeDescription().hasOption("binary"));
opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java
@@ -24,16 +24,16 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.PasswordPolicyCfgDefn;
import org.forgerock.opendj.server.config.server.PasswordPolicyCfg;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.PasswordStorageScheme;
import org.opends.server.extensions.InitializationUtils;
import org.opends.server.types.Entry;
import org.opends.server.schema.UserPasswordSyntax;
import org.opends.server.tools.LDAPModify;
import org.opends.server.types.Attribute;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.util.TimeThread;
import org.testng.annotations.BeforeClass;
@@ -41,6 +41,7 @@
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.testng.Assert.*;
/**
@@ -2178,7 +2179,7 @@
  {
    PasswordPolicy p = DirectoryServer.getDefaultPasswordPolicy();
    AttributeType  t = p.getPasswordAttribute();
    assertEquals(t, DirectoryServer.getAttributeType("userpassword"));
    assertEquals(t, getUserPasswordAttributeType());
  }
@@ -2197,7 +2198,7 @@
                      "cn=config");
    PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn);
    AttributeType  t = p.getPasswordAttribute();
    assertEquals(t, DirectoryServer.getAttributeType("authpassword"));
    assertEquals(t, getAuthPasswordAttributeType());
  }
@@ -4297,7 +4298,7 @@
  {
    Entry entry = DirectoryServer.getEntry(DN.valueOf(dn));
    assertNotNull(entry);
    AttributeType pwdHistory = DirectoryServer.getAttributeType("pwdhistory");
    AttributeType pwdHistory = DirectoryServer.getSchema().getAttributeType("pwdhistory");
    assertNotNull(pwdHistory);
    Attribute historyAttr = entry.getExactAttribute(AttributeDescription.create(pwdHistory));
    assertNotNull(historyAttr);
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
@@ -318,7 +318,7 @@
  private void hasValues(DN dn, String attrName, String... values) throws DirectoryException
  {
    Entry entry = DirectoryServer.getEntry(dn);
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    assertTrue(entry.hasAttribute(attrType));
    for (String value : values)
    {
@@ -329,7 +329,7 @@
  private void doesNotHaveValues(DN dn, String attrName, String... values) throws DirectoryException
  {
    Entry entry = DirectoryServer.getEntry(dn);
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    assertTrue(entry.hasAttribute(attrType));
    for (String value : values)
    {
@@ -340,7 +340,7 @@
  private void hasNoAttribute(DN dn, String attrName) throws Exception
  {
    Entry entry = DirectoryServer.getEntry(dn);
    AttributeType attrType = DirectoryServer.getAttributeType(attrName);
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    assertFalse(entry.hasAttribute(attrType));
  }
@@ -353,7 +353,7 @@
    assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
    assertEquals(searchOperation.getEntriesSent(), 1);
    AttributeType attrType = DirectoryServer.getAttributeType("collectiveattributesubentries");
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType("collectiveattributesubentries");
    Entry e = searchOperation.getSearchEntries().getFirst();
    assertTrue(e.hasValue(attrType, ByteString.valueOfObject(collectiveSubentry.getName())));
  }
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java
@@ -405,7 +405,7 @@
    Entry testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE));
    assertNotNull(testEntry);
    AttributeType attrType = DirectoryServer.getAttributeType("pwdpolicysubentry");
    AttributeType attrType = DirectoryServer.getSchema().getAttributeType("pwdpolicysubentry");
    // Make sure that default policy is in effect
    // for the user entry.
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
@@ -416,7 +416,7 @@
  private void assertAttrValue(Entry newEntry, String attrName, String expectedAttrValue)
  {
    AttributeType at = DirectoryServer.getAttributeType(attrName);
    AttributeType at = DirectoryServer.getSchema().getAttributeType(attrName);
    List<Attribute> attrList = newEntry.getAttribute(at);
    assertThat(attrList).hasSize(1);
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
@@ -21,8 +21,10 @@
import java.util.TreeSet;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.Filter;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -31,15 +33,14 @@
import org.forgerock.opendj.ldap.controls.PreReadRequestControl;
import org.forgerock.opendj.ldap.requests.ModifyRequest;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.mockito.ArgumentCaptor;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.EntityTagVirtualAttributeCfgDefn.ChecksumAlgorithm;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.Scope;
import org.forgerock.opendj.server.config.server.EntityTagVirtualAttributeCfg;
import org.forgerock.opendj.server.config.server.VirtualAttributeCfg;
import org.mockito.ArgumentCaptor;
import org.opends.server.TestCaseUtils;
import org.opends.server.controls.LDAPPostReadResponseControl;
import org.opends.server.controls.LDAPPreReadResponseControl;
import org.opends.server.core.DirectoryServer;
@@ -51,7 +52,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.types.Attribute;
import org.opends.server.types.Control;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
@@ -62,6 +62,7 @@
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.mockito.Mockito.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.testng.Assert.*;
@@ -207,7 +208,7 @@
    TestCaseUtils.startServer();
    // Initialize the provider.
    config.getExcludedAttribute().add(DirectoryServer.getAttributeType("modifytimestamp"));
    config.getExcludedAttribute().add(getModifyTimestampAttributeType());
    provider.initializeVirtualAttributeProvider(config);
  }
@@ -439,7 +440,7 @@
    final SearchOperation searchOp = mock(SearchOperation.class);
    VirtualAttributeRule rule = new VirtualAttributeRule(
        DirectoryServer.getAttributeType(ETAG), provider,
        DirectoryServer.getSchema().getAttributeType(ETAG), provider,
        Collections.<DN> emptySet(), SearchScope.WHOLE_SUBTREE,
        Collections.<DN> emptySet(), Collections.<SearchFilter> emptySet(),
        VirtualAttributeCfgDefn.ConflictBehavior.REAL_OVERRIDES_VIRTUAL);
@@ -726,7 +727,7 @@
  private VirtualAttributeRule getRule()
  {
    AttributeType type = DirectoryServer.getAttributeType("etag");
    AttributeType type = DirectoryServer.getSchema().getAttributeType(ETAG);
    return new VirtualAttributeRule(type, provider,
        Collections.<DN>emptySet(), SearchScope.WHOLE_SUBTREE,
        Collections.<DN>emptySet(),
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -22,17 +22,17 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.VirtualAttributeProvider;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
@@ -42,6 +42,7 @@
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -54,10 +55,7 @@
public class EntryDNVirtualAttributeProviderTestCase
       extends ExtensionsTestCase
{
  /** The attribute type for the entryDN attribute. */
  private AttributeType entryDNType;
  private static final AttributeType entryDNType = getEntryDNAttributeType();
  /**
   * Ensures that the Directory Server is running.
@@ -71,9 +69,6 @@
    TestCaseUtils.startServer();
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
    entryDNType = DirectoryServer.getAttributeType("entrydn");
    assertNotNull(entryDNType);
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
@@ -20,16 +20,17 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
@@ -49,10 +50,7 @@
public class EntryUUIDVirtualAttributeProviderTestCase
       extends ExtensionsTestCase
{
  /** The attribute type for the entryUUID attribute. */
  private AttributeType entryUUIDType;
  private static final AttributeType entryUUIDType = CoreSchema.getEntryUUIDAttributeType();
  /**
   * Ensures that the Directory Server is running.
@@ -64,9 +62,6 @@
         throws Exception
  {
    TestCaseUtils.startServer();
    entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
    assertNotNull(entryUUIDType);
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
@@ -134,7 +134,7 @@
         "ds-cfg-enabled: true",
         "ds-cfg-match-attribute: uid");
    AttributeType t = DirectoryServer.getAttributeType("ds-cfg-match-base-dn");
    AttributeType t = DirectoryServer.getSchema().getAttributeType("ds-cfg-match-base-dn");
    e.addAttribute(Attributes.empty(t), new ArrayList<ByteString>());
    entries.add(e);
opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
@@ -20,9 +20,11 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.VirtualAttributeProvider;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
@@ -30,8 +32,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
@@ -41,6 +41,7 @@
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -71,8 +72,8 @@
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
    governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule");
    assertNotNull(governingStructureRuleType);
    governingStructureRuleType = getGoverningStructureRuleAttributeType();
    int resultCode = TestCaseUtils.applyModifications(true,
    "dn: cn=schema",
    "changetype: modify",
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -19,7 +19,9 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
@@ -29,8 +31,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -62,8 +62,7 @@
  {
    TestCaseUtils.startServer();
    hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates");
    assertNotNull(hasSubordinatesType);
    hasSubordinatesType = DirectoryServer.getSchema().getAttributeType("hassubordinates");
    entries = TestCaseUtils.makeEntries(
        "dn: dc=example,dc=com",
opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -22,18 +22,18 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.SearchResultEntry;
@@ -70,8 +70,7 @@
  {
    TestCaseUtils.restartServer();
    isMemberOfType = DirectoryServer.getAttributeType("ismemberof");
    assertNotNull(isMemberOfType);
    isMemberOfType = DirectoryServer.getSchema().getAttributeType("ismemberof");
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyTestCase.java
@@ -489,7 +489,7 @@
    MockPolicyCfg withMappedAttribute(final String attrName)
    {
      mappedAttributes.add(DirectoryServer.getAttributeType(attrName));
      mappedAttributes.add(DirectoryServer.getSchema().getAttributeType(attrName));
      return this;
    }
opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
@@ -19,7 +19,9 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.DirectoryServerTestCase;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
@@ -27,8 +29,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -57,8 +57,7 @@
  {
    TestCaseUtils.restartServer();
    numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates");
    assertNotNull(numSubordinatesType);
    numSubordinatesType = DirectoryServer.getSchema().getAttributeType("numsubordinates");
    entries = TestCaseUtils.makeEntries(
        "dn: dc=example,dc=com",
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
@@ -1670,7 +1670,7 @@
    try
    {
      AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time");
      AttributeType lastLoginTimeAttr = DirectoryServer.getSchema().getAttributeType("ds-pwp-last-login-time");
      assertNotNull(lastLoginTimeAttr);
      DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1726,7 +1726,7 @@
    try
    {
      AttributeType authFailureTimesAttr = DirectoryServer.getAttributeType("pwdfailuretime");
      AttributeType authFailureTimesAttr = DirectoryServer.getSchema().getAttributeType("pwdfailuretime");
      assertNotNull(authFailureTimesAttr);
      DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1775,7 +1775,7 @@
    try
    {
      AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory");
      AttributeType pwdHistoryAttr = DirectoryServer.getSchema().getAttributeType("pwdhistory");
      assertNotNull(pwdHistoryAttr);
      DN userDN = DN.valueOf("uid=test.user,o=test");
opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
@@ -20,16 +20,16 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
@@ -38,6 +38,7 @@
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.ServerConstants.*;
@@ -50,10 +51,7 @@
public class StructuralObjectClassVirtualAttributeProviderTestCase
       extends ExtensionsTestCase
{
  /** The attribute type for the structuralobjectclass attribute. */
  private AttributeType structuralObjectClassType;
  private static final AttributeType structuralObjectClassType = getStructuralObjectClassAttributeType();
  /**
   * Ensures that the Directory Server is running.
@@ -67,9 +65,6 @@
    TestCaseUtils.startServer();
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
    structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass");
    assertNotNull(structuralObjectClassType);
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
@@ -20,16 +20,17 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
@@ -67,8 +68,7 @@
    TestCaseUtils.initializeTestBackend(true);
    TestCaseUtils.clearBackend("userRoot", "dc=example,dc=com");
    subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry");
    assertNotNull(subschemaSubentryType);
    subschemaSubentryType = CoreSchema.getSubschemaSubentryAttributeType();
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
@@ -19,8 +19,11 @@
import java.util.List;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DirectoryServer;
@@ -30,8 +33,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.tools.LDAPModify;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.VirtualAttributeRule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -67,14 +68,9 @@
  {
    TestCaseUtils.startServer();
    descriptionType = DirectoryServer.getAttributeType("description");
    assertNotNull(descriptionType);
    pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn");
    assertNotNull(pwPolicyDNType);
    privNameType = DirectoryServer.getAttributeType("ds-privilege-name");
    assertNotNull(privNameType);
    descriptionType = CoreSchema.getDescriptionAttributeType();
    pwPolicyDNType = DirectoryServer.getSchema().getAttributeType("ds-pwp-password-policy-dn");
    privNameType = DirectoryServer.getSchema().getAttributeType("ds-privilege-name");
  }
opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
@@ -25,6 +25,7 @@
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.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.GroupManager;
@@ -32,12 +33,19 @@
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.Attributes;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.MemberList;
import org.opends.server.types.Modification;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.VirtualAttributeRule;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.protocols.internal.Requests.*;
import static org.opends.server.util.CollectionUtils.*;
@@ -244,12 +252,8 @@
  {
    TestCaseUtils.startServer();
    memberType = DirectoryServer.getAttributeType("member");
    assertNotNull(memberType);
    uniqueMemberType = DirectoryServer.getAttributeType("uniquemember");
    assertNotNull(uniqueMemberType);
    memberType = getMemberAttributeType();
    uniqueMemberType = getUniqueMemberAttributeType();
    groupManager = DirectoryServer.getGroupManager();
    u1 = DN.valueOf("uid=test.1,ou=People,o=test");
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -26,6 +26,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.EntryUUIDPluginCfgDefn;
import org.opends.server.TestCaseUtils;
import org.opends.server.api.plugin.PluginType;
@@ -138,7 +139,7 @@
  public void testInitializeWithValidConfigsWithoutSchema(Entry e)
         throws Exception
  {
    AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
    AttributeType entryUUIDType = CoreSchema.getEntryUUIDAttributeType();
    DirectoryServer.getSchema().deregisterAttributeType(entryUUIDType);
    EntryUUIDPlugin plugin = initializePlugin(e);
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
@@ -17,6 +17,7 @@
package org.opends.server.plugins;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.testng.Assert.*;
@@ -158,10 +159,10 @@
  public void testInitializeWithValidConfigsWithoutSchema(Entry e)
         throws Exception
  {
    AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
    AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
    AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
    AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
    AttributeType ctType = getCreateTimestampAttributeType();
    AttributeType cnType = getCreatorsNameAttributeType();
    AttributeType mtType = getModifyTimestampAttributeType();
    AttributeType mnType = getModifiersNameAttributeType();
    DirectoryServer.getSchema().deregisterAttributeType(ctType);
    DirectoryServer.getSchema().deregisterAttributeType(cnType);
opendj-server-legacy/src/test/java/org/opends/server/plugins/ReferentialIntegrityPluginTestCase.java
@@ -1099,7 +1099,7 @@
                                     String attr,
                                     String... dns)
          throws Exception {
    AttributeType type= getAttributeType(attr);
    AttributeType type = getSchema().getAttributeType(attr);
    final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(" + attr + "=*)");
    InternalSearchOperation operation = getRootConnection().processSearch(request);
    for (SearchResultEntry entry : operation.getSearchEntries()) {
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -733,7 +733,7 @@
  }
  private void delAttribute(Entry entry, String attrTypeString) {
    entry.removeAttribute(getAttributeType(attrTypeString));
    entry.removeAttribute(getSchema().getAttributeType(attrTypeString));
  }
  private void addAttribute(Entry entry, String attrName, String... attrValues) {
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/TestLDAPConnectionHandler.java
@@ -229,21 +229,21 @@
        "ds-cfg-trust-manager-provider: cn=JKS,cn=Trust Manager Providers,cn=config");
    LDAPConnectionHandler LDAPConnHandler=getLDAPHandlerInstance(GoodHandlerEntry);
    //Make attrTypes to remove
    AttributeType at0=DirectoryServer.getAttributeType(ATTR_LISTEN_PORT);
    AttributeType at0=DirectoryServer.getSchema().getAttributeType(ATTR_LISTEN_PORT);
//    AttributeType at1=DirectoryServer.getAttributeType(ATTR_LISTEN_ADDRESS, true);
//    Attribute rAttr1=new Attribute(at1);
//    GoodHandlerEntry.removeAttribute(rAttr1, null);
    AttributeType at2=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2);
    AttributeType at3=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2);
    AttributeType at4=DirectoryServer.getAttributeType(ATTR_KEEP_LDAP_STATS);
    AttributeType at5=DirectoryServer.getAttributeType(ATTR_SEND_REJECTION_NOTICE);
    AttributeType at6=DirectoryServer.getAttributeType(ATTR_USE_TCP_KEEPALIVE);
    AttributeType at7=DirectoryServer.getAttributeType(ATTR_USE_TCP_NODELAY);
    AttributeType at8=DirectoryServer.getAttributeType(ATTR_ALLOW_REUSE_ADDRESS);
    AttributeType at9=DirectoryServer.getAttributeType(ATTR_USE_SSL);
    AttributeType at10=DirectoryServer.getAttributeType(ATTR_ALLOW_STARTTLS);
    AttributeType at11=DirectoryServer.getAttributeType(ATTR_MAX_REQUEST_SIZE);
    AttributeType at12=DirectoryServer.getAttributeType(ATTR_ACCEPT_BACKLOG);
    AttributeType at2=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_LDAPV2);
    AttributeType at3=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_LDAPV2);
    AttributeType at4=DirectoryServer.getSchema().getAttributeType(ATTR_KEEP_LDAP_STATS);
    AttributeType at5=DirectoryServer.getSchema().getAttributeType(ATTR_SEND_REJECTION_NOTICE);
    AttributeType at6=DirectoryServer.getSchema().getAttributeType(ATTR_USE_TCP_KEEPALIVE);
    AttributeType at7=DirectoryServer.getSchema().getAttributeType(ATTR_USE_TCP_NODELAY);
    AttributeType at8=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_REUSE_ADDRESS);
    AttributeType at9=DirectoryServer.getSchema().getAttributeType(ATTR_USE_SSL);
    AttributeType at10=DirectoryServer.getSchema().getAttributeType(ATTR_ALLOW_STARTTLS);
    AttributeType at11=DirectoryServer.getSchema().getAttributeType(ATTR_MAX_REQUEST_SIZE);
    AttributeType at12=DirectoryServer.getSchema().getAttributeType(ATTR_ACCEPT_BACKLOG);
    //Remove them
    Attribute rAttr0=Attributes.empty(at0);
    GoodHandlerEntry.removeAttribute(rAttr0, null);
opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
@@ -24,6 +24,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.TestCaseUtils;
import org.opends.server.backends.MemoryBackend;
import org.opends.server.core.DirectoryServer;
@@ -39,14 +40,13 @@
import org.opends.server.replication.server.ReplicationServer;
import org.opends.server.replication.service.ReplicationBroker;
import org.opends.server.types.Attributes;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.Modification;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
@@ -135,7 +135,7 @@
      int sequence;
      for (sequence = 1; sequence<=addSequenceLength; sequence ++)
      {
        entry.removeAttribute(getAttributeType("entryuuid"));
        entry.removeAttribute(getEntryUUIDAttributeType());
        entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
                           new LinkedList<ByteString>());
        addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN);
@@ -262,7 +262,7 @@
          baseDN, brokerId, 1000, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID);
      // add an entry to play with.
      entry.removeAttribute(getAttributeType("entryuuid"));
      entry.removeAttribute(getEntryUUIDAttributeType());
      entry.addAttribute(Attributes.create("entryuuid",
                         stringUID(renamedEntryUuid)),
                         new LinkedList<ByteString>());
@@ -362,7 +362,7 @@
      for (sequence = 1; sequence<=addSequenceLength; sequence ++)
      {
        // add the entry a first time
        entry.removeAttribute(getAttributeType("entryuuid"));
        entry.removeAttribute(getEntryUUIDAttributeType());
        entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
                           new LinkedList<ByteString>());
        DN addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING);
@@ -370,7 +370,7 @@
        broker.publish(delMsg(addDN, sequence + 1, gen));
        // add again the entry with a new entryuuid.
        entry.removeAttribute(getAttributeType("entryuuid"));
        entry.removeAttribute(getEntryUUIDAttributeType());
        entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1025)),
                           new LinkedList<ByteString>());
        broker.publish(addMsg(addDN, entry, sequence + 1025, 1, gen));
@@ -469,7 +469,7 @@
      for (sequence = 1; sequence<=addSequenceLength; sequence ++)
      {
        // add the entry
        entry.removeAttribute(getAttributeType("entryuuid"));
        entry.removeAttribute(getEntryUUIDAttributeType());
        entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
                           new LinkedList<ByteString>());
        addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING);
opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
@@ -469,7 +469,7 @@
    {
      debugInfo("Entry found <" + baseDN + ">");
      AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
      AttributeType synchronizationGenIDType = DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID);
      Attribute attr = resultEntry.getExactAttribute(AttributeDescription.create(synchronizationGenIDType));
      return Long.valueOf(attr.iterator().next().toString());
    }
opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
@@ -64,6 +64,7 @@
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.replication.plugin.LDAPReplicationDomain.*;
@@ -433,8 +434,8 @@
  {
    testSetUp("modifyConflicts");
    final DN dn1 = DN.valueOf("cn=test1," + baseDN);
    final AttributeType attrType = DirectoryServer.getAttributeType("displayname");
    final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid");
    final AttributeType attrType = DirectoryServer.getSchema().getAttributeType("displayname");
    final AttributeType entryuuidType = getEntryUUIDAttributeType();
    String monitorAttr = "resolved-modify-conflicts";
    /*
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java
@@ -152,7 +152,7 @@
    assertEquals(attrInfo4.getValuesHistorical().size(), 1);
    // Check
    AttributeType type = DirectoryServer.getAttributeType(ATTRIBUTE_NAME);
    AttributeType type = DirectoryServer.getSchema().getAttributeType(ATTRIBUTE_NAME);
    attrInfo3.delete(Attributes.create(type, att), updateTime) ;
    assertEquals(attrInfo3.getValuesHistorical().size(), 1);
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -547,7 +547,7 @@
      debugInfo("Entry found <" + rootDn + ">");
      AttributeType synchronizationGenIDType =
          DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
          DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID);
      List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
      if (!attrs.isEmpty())
      {
@@ -670,7 +670,7 @@
          {
            if (!first)
            {
              assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(fracAttr)));
              assertFalse(newEntry.hasAttribute(DirectoryServer.getSchema().getAttributeType(fracAttr)));
            }
            first = false;
          }
@@ -687,7 +687,7 @@
            }
            first = false;
          }
          assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR)));
          assertFalse(newEntry.hasAttribute(DirectoryServer.getSchema().getAttributeType(OPTIONAL_ATTR)));
          break;
        default:
          fail("Unexpected fractional mode.");
@@ -724,7 +724,7 @@
          {
            if (!first)
            {
              assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(fracAttr)));
              assertFalse(entry.hasAttribute(DirectoryServer.getSchema().getAttributeType(fracAttr)));
            }
            first = false;
          }
@@ -741,7 +741,7 @@
            }
            first = false;
          }
          assertFalse(entry.hasAttribute(DirectoryServer.getAttributeType(OPTIONAL_ATTR)));
          assertFalse(entry.hasAttribute(DirectoryServer.getSchema().getAttributeType(OPTIONAL_ATTR)));
          break;
        default:
          fail("Unexpected fractional mode.");
@@ -960,7 +960,7 @@
  private Entry waitTillEntryHasSynchroAttribute(String entryDN)
      throws Exception
  {
    AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR);
    AttributeType synchroAttrType = DirectoryServer.getSchema().getAttributeType(SYNCHRO_OPTIONAL_ATTR);
    DN dn = DN.valueOf(entryDN);
    Entry entry = null;
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -141,7 +141,7 @@
      long startTime = TimeThread.getTime();
      final DN dn1 = DN.valueOf("cn=test1," + baseDN);
    final AttributeType histType =
      DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
      DirectoryServer.getSchema().getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
    logger.error(LocalizableMessage.raw("Starting replication test : changesCmpTest"));
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java
@@ -49,6 +49,7 @@
import static org.forgerock.opendj.ldap.ResultCode.*;
import static org.forgerock.opendj.ldap.SearchScope.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.util.CollectionUtils.*;
import static org.testng.Assert.*;
@@ -229,10 +230,9 @@
    final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING);
    final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING);
    final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING);
    final AttributeType attrType = DirectoryServer.getAttributeType("displayname");
    final AttributeType attrType = DirectoryServer.getSchema().getAttributeType("displayname");
    final AttributeDescription attrDesc = AttributeDescription.create(attrType);
    final AttributeType entryuuidType = DirectoryServer.getAttributeType("entryuuid");
    final AttributeDescription entryuuidDesc = AttributeDescription.create(entryuuidType);
    final AttributeDescription entryuuidDesc = AttributeDescription.create(getEntryUUIDAttributeType());
    /*
     * Open a session to the replicationServer using the broker API.
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -46,6 +46,7 @@
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
@@ -1075,7 +1076,7 @@
    UUID uuid = UUID.randomUUID();
    // Create the att values list
    AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
    AttributeType entryuuidAttrType = getEntryUUIDAttributeType();
    List<Attribute> uuidList = Attributes.createAsList(entryuuidAttrType, uuid.toString());
    // Add the uuid in the entry
@@ -1162,7 +1163,7 @@
   */
  private void assertEntryHistoricalEncodingDecoding(Entry entry, EntryHistorical hist)
  {
    entry.removeAttribute(getAttributeType(HISTORICAL_ATTRIBUTE_NAME));
    entry.removeAttribute(getSchema().getAttributeType(HISTORICAL_ATTRIBUTE_NAME));
    entry.addAttribute(hist.encodeAndPurge(), null);
    EntryHistorical hist2 = EntryHistorical.newInstanceFromEntry(entry);
    assertEquals(hist2.encodeAndPurge(), hist.encodeAndPurge());
@@ -1194,7 +1195,7 @@
  private void assertContainsOnlyValues(Entry entry, String attrName, String... expectedValues)
  {
    Attribute attr = entry.getExactAttribute(AttributeDescription.create(getAttributeType(attrName)));
    Attribute attr = entry.getExactAttribute(AttributeDescription.create(getSchema().getAttributeType(attrName)));
    assertThat(attr).hasSize(expectedValues.length);
    for (String value : expectedValues)
    {
@@ -1215,8 +1216,7 @@
  private String getEntryUUID(Entry entry)
  {
    AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
    List<Attribute> uuidAttrs = entry.getOperationalAttributes().get(entryuuidAttrType);
    List<Attribute> uuidAttrs = entry.getAttribute(getEntryUUIDAttributeType());
    return uuidAttrs.get(0).iterator().next().toString();
  }
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -17,6 +17,7 @@
package org.opends.server.replication.protocol;
import static org.assertj.core.api.Assertions.*;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.messages.ReplicationMessages.*;
import static org.opends.server.replication.common.AssuredMode.*;
@@ -35,7 +36,6 @@
import org.assertj.core.api.Assertions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.AddOperationBasis;
import org.opends.server.core.DirectoryServer;
@@ -433,33 +433,26 @@
    CSN csn1 = new CSN(1, 0, 1);
    CSN csn2 = new CSN(TimeThread.getTime(), 123, 45);
    AttributeType type = DirectoryServer.getAttributeType("description");
    Attribute attr1 = Attributes.create("description", "new value");
    Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
    Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value"));
    List<Modification> mods1 = newArrayList(mod1);
    Attribute attr2 = Attributes.empty("description");
    Modification mod2 = new Modification(ModificationType.DELETE, attr2);
    Modification mod2 = new Modification(DELETE, Attributes.empty("description"));
    List<Modification> mods2 = newArrayList(mod1, mod2);
    AttributeBuilder builder = new AttributeBuilder(type);
    AttributeBuilder builder = new AttributeBuilder(getDescriptionAttributeType());
    builder.add("string");
    builder.add("value");
    builder.add("again");
    Attribute attr3 = builder.toAttribute();
    Modification mod3 = new Modification(ModificationType.ADD, attr3);
    List<Modification> mods3 = newArrayList(mod3);
    List<Modification> mods3 = newArrayList(new Modification(ADD, builder.toAttribute()));
    List<Modification> mods4 = new ArrayList<>();
    for (int i = 0; i < 10; i++)
    {
      Attribute attr = Attributes.create("description", "string" + i);
      mods4.add(new Modification(ModificationType.ADD, attr));
      mods4.add(new Modification(ADD, attr));
    }
    Attribute attr5 = Attributes.create("namingcontexts", "o=test");
    Modification mod5 = new Modification(ModificationType.REPLACE, attr5);
    Modification mod5 = new Modification(REPLACE, Attributes.create("namingcontexts", "o=test"));
    List<Modification> mods5 = newArrayList(mod5);
    // Entry attributes
@@ -611,29 +604,25 @@
  @DataProvider(name = "createModifyDnData")
  public Object[][] createModifyDnData() {
    AttributeType type = DirectoryServer.getAttributeType("description");
    AttributeType type = DirectoryServer.getSchema().getAttributeType("description");
    Attribute attr1 = Attributes.create("description", "new value");
    Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
    Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value"));
    List<Modification> mods1 = newArrayList(mod1);
    Attribute attr2 = Attributes.empty("description");
    Modification mod2 = new Modification(ModificationType.DELETE, attr2);
    Modification mod2 = new Modification(DELETE, Attributes.empty("description"));
    List<Modification> mods2 = newArrayList(mod1, mod2);
    AttributeBuilder builder = new AttributeBuilder(type);
    builder.add("string");
    builder.add("value");
    builder.add("again");
    Attribute attr3 = builder.toAttribute();
    Modification mod3 = new Modification(ModificationType.ADD, attr3);
    Modification mod3 = new Modification(ADD, builder.toAttribute());
    List<Modification> mods3 = newArrayList(mod3);
    List<Modification> mods4 = new ArrayList<>();
    for (int i = 0; i < 10; i++)
    {
      Attribute attr = Attributes.create("description", "string" + i);
      mods4.add(new Modification(ModificationType.ADD, attr));
      mods4.add(new Modification(ADD, Attributes.create("description", "string" + i)));
    }
    // Entry attributes
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -16,6 +16,7 @@
 */
package org.opends.server.replication.protocol;
import static org.forgerock.opendj.ldap.ModificationType.*;
import static org.forgerock.opendj.ldap.requests.Requests.*;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.TestCaseUtils.*;
@@ -38,7 +39,6 @@
import org.assertj.core.api.Assertions;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.ObjectClass;
@@ -47,7 +47,6 @@
import org.opends.server.core.AddOperationBasis;
import org.opends.server.core.DeleteOperation;
import org.opends.server.core.DeleteOperationBasis;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyDNOperation;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ModifyOperationBasis;
@@ -107,33 +106,28 @@
    CSN csn2 = new CSN(TimeThread.getTime(), 123,  45);
    CSN csn3 = new CSN(TimeThread.getTime(), 67894123,  45678);
    AttributeType type = DirectoryServer.getAttributeType("description");
    AttributeType type = getDescriptionAttributeType();
    Attribute attr1 = Attributes.create("description", "new value");
    Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
    Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value"));
    List<Modification> mods1 = newArrayList(mod1);
    Attribute attr2 = Attributes.empty("description");
    Modification mod2 = new Modification(ModificationType.DELETE, attr2);
    Modification mod2 = new Modification(DELETE, Attributes.empty("description"));
    List<Modification> mods2 = newArrayList(mod1, mod2);
    AttributeBuilder builder = new AttributeBuilder(type);
    builder.add("string");
    builder.add("value");
    builder.add("again");
    Attribute attr3 = builder.toAttribute();
    Modification mod3 = new Modification(ModificationType.ADD, attr3);
    Modification mod3 = new Modification(ADD, builder.toAttribute());
    List<Modification> mods3 = newArrayList(mod3);
    List<Modification> mods4 = new ArrayList<>();
    for (int i = 0; i < 10; i++)
    {
      Attribute attr = Attributes.create("description", "string" + i);
      mods4.add(new Modification(ModificationType.ADD, attr));
      mods4.add(new Modification(ADD, Attributes.create("description", "string" + i)));
    }
    Attribute attr5 = Attributes.create("namingcontexts", TEST_ROOT_DN_STRING);
    Modification mod5 = new Modification(ModificationType.REPLACE, attr5);
    Modification mod5 = new Modification(REPLACE, Attributes.create("namingcontexts", TEST_ROOT_DN_STRING));
    List<Modification> mods5 = newArrayList(mod5);
    List<Attribute> eclIncludes = getEntryAttributes();
@@ -339,29 +333,25 @@
  @DataProvider(name = "createModifyDnData")
  public Object[][] createModifyDnData() {
    AttributeType type = DirectoryServer.getAttributeType("description");
    AttributeType type = getDescriptionAttributeType();
    Attribute attr1 = Attributes.create("description", "new value");
    Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
    Modification mod1 = new Modification(REPLACE, Attributes.create("description", "new value"));
    List<Modification> mods1 = newArrayList(mod1);
    Attribute attr2 = Attributes.empty("description");
    Modification mod2 = new Modification(ModificationType.DELETE, attr2);
    Modification mod2 = new Modification(DELETE, Attributes.empty("description"));
    List<Modification> mods2 = newArrayList(mod1, mod2);
    AttributeBuilder builder = new AttributeBuilder(type);
    builder.add("string");
    builder.add("value");
    builder.add("again");
    Attribute attr3 = builder.toAttribute();
    Modification mod3 = new Modification(ModificationType.ADD, attr3);
    Modification mod3 = new Modification(ADD, builder.toAttribute());
    List<Modification> mods3 = newArrayList(mod3);
    List<Modification> mods4 = new ArrayList<>();
    for (int i = 0; i < 10; i++)
    {
      Attribute attr = Attributes.create("description", "string" + i);
      mods4.add(new Modification(ModificationType.ADD, attr));
      mods4.add(new Modification(ADD, Attributes.create("description", "string" + i)));
    }
    List<Attribute> entryAttrList = getEntryAttributes();
opendj-server-legacy/src/test/java/org/opends/server/schema/FakeEntryIndex.java
@@ -52,7 +52,7 @@
  FakeEntryIndex(String attrName) throws DecodeException
  {
    attrType = DirectoryServer.getAttributeType(attrName);
    attrType = DirectoryServer.getSchema().getAttributeType(attrName);
    if (attrType == null)
    {
      throw new IllegalArgumentException("Cannot find attribute with name \"" + attrName + "\"");
opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
@@ -16,6 +16,9 @@
 */
package org.opends.server.schema;
import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.opends.server.util.ServerConstants.*;
import java.io.File;
import java.util.List;
import java.util.StringTokenizer;
@@ -24,8 +27,8 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.ldap.schema.NameForm;
import org.forgerock.opendj.ldap.schema.ObjectClass;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
@@ -37,9 +40,6 @@
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import static org.opends.server.util.ServerConstants.*;
import static org.testng.Assert.*;
/** This class defines a set of generic tests that may be used to examine the server schema. */
public class GenericSchemaTestCase
       extends SchemaTestCase
@@ -163,9 +163,7 @@
        continue;
      }
      AttributeType attrType = DirectoryServer.getAttributeType("attributetypes");
      assertNotNull(attrType);
      List<Attribute> attrList = e.getAttribute(attrType);
      List<Attribute> attrList = e.getAttribute(getAttributeTypesAttributeType());
      if (attrList.isEmpty())
      {
        // No attribute types in the schema file.  This is OK.
@@ -305,9 +303,7 @@
        continue;
      }
      AttributeType attrType = DirectoryServer.getAttributeType("nameforms");
      assertNotNull(attrType);
      List<Attribute> attrList = e.getAttribute(attrType);
      List<Attribute> attrList = e.getAttribute(getNameFormsAttributeType());
      if (attrList.isEmpty())
      {
        // No attribute types in the schema file.  This is OK.
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -31,9 +31,9 @@
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
@@ -527,9 +527,7 @@
    TestCaseUtils.startServer();
    // Initialize the CN attribute type used in all tests.
    cnType = DirectoryServer.getAttributeType("cn");
    Assert.assertNotNull(cnType);
    cnType = CoreSchema.getCNAttributeType();
    cnValue = bs("john doe");
  }
opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java
@@ -24,6 +24,7 @@
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.tools.LDAPModify;
@@ -443,7 +444,7 @@
         "objectClass: domain",
         "dc: example");
    AttributeType creatorsNameType = DirectoryServer.getAttributeType("creatorsname");
    AttributeType creatorsNameType = CoreSchema.getCreatorsNameAttributeType();
    assertTrue(creatorsNameType.isOperational());
    AttributeBuilder builder = new AttributeBuilder(creatorsNameType);
opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java
@@ -566,7 +566,7 @@
    FilterDescription description = new FilterDescription();
    description.filterType = filterType;
    description.attributeType = DirectoryServer.getAttributeType(attributeType);
    description.attributeType = DirectoryServer.getSchema().getAttributeType(attributeType);
    description.assertionValue = ByteString.valueOfUtf8(attributeValue);
    if (filterType == FilterType.EQUALITY) {
@@ -628,7 +628,7 @@
    FilterDescription description = new FilterDescription();
    description.filterType = FilterType.SUBSTRING;
    description.attributeType = DirectoryServer.getAttributeType(attributeType);
    description.attributeType = DirectoryServer.getSchema().getAttributeType(attributeType);
    description.subInitialElement = ByteString.valueOfUtf8(subInitial);
    description.subAnyElements = new ArrayList<>();
opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java
@@ -111,7 +111,7 @@
  @Test
  public void testParseAttributeNotFound() throws Exception {
    AttributeType type1 = getDescriptionAttributeType();
    AttributeType type2 = DirectoryServer.getAttributeType("inheritable");
    AttributeType type2 = DirectoryServer.getSchema().getAttributeType("inheritable");
    Entry entry = createTestEntry(type1, "hello world");
@@ -123,7 +123,7 @@
   */
  @Test
  public void testParseAttributeBooleanTrue() throws Exception {
    AttributeType type = DirectoryServer.getAttributeType("inheritable");
    AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable");
    Entry entry = createTestEntry(type, "true");
@@ -136,7 +136,7 @@
  @Test
  public void testParseAttributeBooleanFalse() throws Exception
  {
    AttributeType type = DirectoryServer.getAttributeType("inheritable");
    AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable");
    Entry entry = createTestEntry(type, "false");
@@ -149,7 +149,7 @@
  @Test(expectedExceptions = LocalizedIllegalArgumentException.class)
  public void testParseAttributeBooleanBad() throws Exception
  {
    AttributeType type = DirectoryServer.getAttributeType("inheritable");
    AttributeType type = DirectoryServer.getSchema().getAttributeType("inheritable");
    Entry entry = createTestEntry(type, "bad-value");
    entry.parseAttribute(type.getNameOrOID()).asBoolean();
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
@@ -24,9 +24,9 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior;
import org.opends.server.core.DirectoryServer;
import org.opends.server.TestCaseUtils;
import org.opends.server.extensions.EntryDNVirtualAttributeProvider;
import org.opends.server.protocols.internal.InternalClientConnection;
import org.testng.annotations.BeforeClass;
@@ -58,8 +58,7 @@
  {
    TestCaseUtils.startServer();
    entryDNType = DirectoryServer.getAttributeType("entrydn");
    assertNotNull(entryDNType);
    entryDNType = CoreSchema.getEntryDNAttributeType();
  }
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
@@ -26,9 +26,9 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.TestCaseUtils;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior;
import org.opends.server.core.DirectoryServer;
import org.opends.server.TestCaseUtils;
import org.opends.server.extensions.EntryDNVirtualAttributeProvider;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -61,8 +61,7 @@
  {
    TestCaseUtils.startServer();
    entryDNType = DirectoryServer.getAttributeType("entrydn");
    assertNotNull(entryDNType);
    entryDNType = CoreSchema.getEntryDNAttributeType();
    EntryDNVirtualAttributeProvider provider =
         new EntryDNVirtualAttributeProvider();
opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java
@@ -31,8 +31,8 @@
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.schema.CoreSchema;
import org.opends.server.TestCaseUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.opends.server.types.Attributes;
@@ -299,7 +299,8 @@
    try (LDIFReader reader = createLDIFReader(ldifString)) {
      Entry entry = reader.readEntry();
      Assert.assertNotNull(entry);
      Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), ByteString.valueOfUtf8("once upon a time in the west")));
      Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(),
                                       ByteString.valueOfUtf8("once upon a time in the west")));
    }
  }
@@ -319,7 +320,8 @@
    try (LDIFReader reader = createLDIFReader(ldifString)) {
      Entry entry = reader.readEntry();
      Assert.assertNotNull(entry);
      Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(), ByteString.valueOfUtf8("once upon a time in the west")));
      Assert.assertTrue(entry.hasValue(getDescriptionAttributeType(),
                                       ByteString.valueOfUtf8("once upon a time in the west")));
    }
  }
@@ -502,7 +504,7 @@
      Assert.assertTrue(i.hasNext());
      mod = i.next().toModification();
      Assert.assertEquals(mod.getModificationType(), ModificationType.REPLACE);
      attr = Attributes.empty(DirectoryServer.getAttributeType("postaladdress"));
      attr = Attributes.empty(CoreSchema.getPostalAddressAttributeType());
      Assert.assertEquals(mod.getAttribute(), attr);
      // Change record #7.