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

Jean-Noël Rouvignac
25.47.2016 250c9bdd3c13d06682fd9f06f11ff2e426ac353a
Prep work for OPENDJ-2803 Migrate Attribute

Inline server Attribute methods that do not exist on the SDK Attribute type:
- getNameWithOptions(): replaced with getAttributeDescription().toString()
- hasOptions(): replaced with getAttributeDescription().hasOptions()
- hasOption(String): replaced with getAttributeDescription().hasOption(String)
36 files modified
478 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java 8 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java 8 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java 6 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java 33 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java 63 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java 52 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/SevenBitCleanPlugin.java 43 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPAttribute.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultEntryProtocolOp.java 17 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java 46 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java 27 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java 20 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java 18 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFWriter.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java 3 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java 24 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/forgerock/opendj/adapter/server3x/Converters.java
@@ -448,7 +448,7 @@
     */
    public static org.forgerock.opendj.ldap.Attribute from(
            final org.opends.server.types.Attribute attribute) {
        Attribute sdkAttribute = new LinkedAttribute(attribute.getNameWithOptions());
        Attribute sdkAttribute = new LinkedAttribute(attribute.getAttributeDescription());
        for (ByteString value : attribute) {
            sdkAttribute.add(value);
        }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -613,7 +613,7 @@
  {
    for (org.opends.server.types.Attribute attr : attrs)
    {
      if (attr.getNameWithOptions().equalsIgnoreCase(attrName))
      if (attr.getAttributeDescription().toString().equalsIgnoreCase(attrName))
      {
        return true;
      }
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java
@@ -179,14 +179,13 @@
      attrs.put(objectclass);
      for (org.opends.server.types.Attribute attr : newEntry.getAttributes())
      {
        String attrName = attr.getNameWithOptions();
        Set<ByteString> values = new LinkedHashSet<>();
        Iterator<ByteString> it = attr.iterator();
        while (it.hasNext())
        {
          values.add(it.next());
        }
        BasicAttribute a = new BasicAttribute(attrName);
        BasicAttribute a = new BasicAttribute(attr.getAttributeDescription().toString());
        for (ByteString value : values)
        {
          a.add(value.toByteArray());
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -291,7 +291,7 @@
      boolean done = false;
      for (org.opends.server.types.Attribute attr : entry.getAttribute(attrName.toLowerCase()))
      {
        if (attr.getNameWithOptions().equals(attrName))
        if (attr.getAttributeDescription().toString().equals(attrName))
        {
          List<ByteString> newValues = getValues(attr);
          newValues.add(value);
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -43,6 +43,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ConditionResult;
import org.forgerock.opendj.ldap.DN;
@@ -1177,10 +1178,9 @@
          // This attribute is not multi-valued.
          changeInitiatorsName = attr.iterator().next().toString();
        }
        final String attrName = attr.getNameWithOptions();
        for (ByteString value : attr)
        {
          builder.append(attrName);
          builder.append(attr.getAttributeDescription());
          appendLDIFSeparatorAndValue(builder, value);
          builder.append('\n');
        }
@@ -1221,15 +1221,15 @@
          // This attribute is not multi-valued.
          changeInitiatorsName = attr.iterator().next().toString();
        }
        final String attrName = attr.getNameWithOptions();
        final AttributeDescription attrDesc = attr.getAttributeDescription();
        builder.append(mod.getModificationType());
        builder.append(": ");
        builder.append(attrName);
        builder.append(attrDesc);
        builder.append('\n');
        for (ByteString value : attr)
        {
          builder.append(attrName);
          builder.append(attrDesc);
          appendLDIFSeparatorAndValue(builder, value);
          builder.append('\n');
        }
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -1101,7 +1101,7 @@
          }
          else  if (SchemaConfigManager.isSchemaAttribute(a))
          {
            logger.error(ERR_SCHEMA_INVALID_REPLACE_MODIFICATION, a.getNameWithOptions());
          logger.error(ERR_SCHEMA_INVALID_REPLACE_MODIFICATION, a.getAttributeDescription());
          }
          else
          {
opendj-server-legacy/src/main/java/org/opends/server/config/BooleanConfigAttribute.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.config;
@@ -25,6 +25,7 @@
import javax.management.MBeanParameterInfo;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -394,10 +395,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      final AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (a.hasOption(OPTION_PENDING_VALUES))
        if (attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          if (pendingValueSet)
          {
opendj-server-legacy/src/main/java/org/opends/server/config/DNConfigAttribute.java
@@ -31,6 +31,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -700,10 +701,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (a.hasOption(OPTION_PENDING_VALUES))
        if (attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          if (pendingValues != null)
          {
opendj-server-legacy/src/main/java/org/opends/server/config/IntegerConfigAttribute.java
@@ -27,6 +27,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -894,10 +895,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (a.hasOption(OPTION_PENDING_VALUES))
        if (attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          if (pendingValues != null)
          {
opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2014-2015 ForgeRock AS.
 * Portions Copyright 2014-2016 ForgeRock AS.
 */
package org.opends.server.config;
@@ -31,6 +31,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -866,10 +867,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (!a.hasOption(OPTION_PENDING_VALUES))
        if (!attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          // This is illegal -- only the pending option is allowed for configuration attributes.
          throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(a.getName()));
opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
@@ -28,6 +28,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -694,10 +695,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (a.hasOption(OPTION_PENDING_VALUES))
        if (attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          if (pendingValues != null)
          {
opendj-server-legacy/src/main/java/org/opends/server/config/StringConfigAttribute.java
@@ -31,6 +31,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.Syntax;
import org.opends.server.core.DirectoryServer;
@@ -624,10 +625,11 @@
    for (Attribute a : attributeList)
    {
      if (a.hasOptions())
      AttributeDescription attrDesc = a.getAttributeDescription();
      if (attrDesc.hasOptions())
      {
        // This must be the pending value.
        if (a.hasOption(OPTION_PENDING_VALUES))
        if (attrDesc.hasOption(OPTION_PENDING_VALUES))
        {
          if (pendingValues != null)
          {
opendj-server-legacy/src/main/java/org/opends/server/core/AddOperationBasis.java
@@ -302,9 +302,10 @@
                ERR_ADD_ATTR_IS_NO_USER_MOD.get(entryDN, attr.getName()));
          }
          boolean hasBinaryOption = attr.getAttributeDescription().hasOption("binary");
          if(attrType.getSyntax().isBEREncodingRequired())
          {
            if(!attr.hasOption("binary"))
            if (!hasBinaryOption)
            {
              //A binary option wasn't provided by the client so add it.
              AttributeBuilder builder = new AttributeBuilder(attr);
@@ -312,7 +313,7 @@
              attr = builder.toAttribute();
            }
          }
          else if (attr.hasOption("binary"))
          else if (hasBinaryOption)
          {
            // binary option is not honored for non-BER-encodable attributes.
            throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
opendj-server-legacy/src/main/java/org/opends/server/core/ModifyOperationBasis.java
@@ -39,10 +39,7 @@
import static org.opends.server.loggers.AccessLogger.*;
import static org.opends.server.workflowelement.localbackend.LocalBackendWorkflowElement.*;
/**
 * This class defines an operation that may be used to modify an entry in the
 * Directory Server.
 */
/** This class defines an operation that may be used to modify an entry in the Directory Server. */
public class ModifyOperationBasis
       extends AbstractOperation implements ModifyOperation,
       PreParseModifyOperation,
@@ -91,7 +88,6 @@
  {
    super(clientConnection, operationID, messageID, requestControls);
    this.rawEntryDN       = rawEntryDN;
    this.rawModifications = rawModifications;
@@ -121,7 +117,6 @@
  {
    super(clientConnection, operationID, messageID, requestControls);
    this.entryDN       = entryDN;
    this.modifications = modifications;
@@ -138,14 +133,12 @@
    cancelRequest    = null;
  }
  /** {@inheritDoc} */
  @Override
  public final ByteString getRawEntryDN()
  {
    return rawEntryDN;
  }
  /** {@inheritDoc} */
  @Override
  public final void setRawEntryDN(ByteString rawEntryDN)
  {
@@ -177,7 +170,6 @@
    return rawModifications;
  }
  /** {@inheritDoc} */
  @Override
  public final void addRawModification(RawModification rawModification)
  {
@@ -186,7 +178,6 @@
    modifications = null;
  }
  /** {@inheritDoc} */
  @Override
  public final void setRawModifications(List<RawModification> rawModifications)
  {
@@ -195,7 +186,6 @@
    modifications = null;
  }
  /** {@inheritDoc} */
  @Override
  public final List<Modification> getModifications()
  {
@@ -209,9 +199,10 @@
           Attribute attr = mod.getAttribute();
           AttributeType type = attr.getAttributeDescription().getAttributeType();
           if(type.getSyntax().isBEREncodingRequired())
           boolean hasBinaryOption = attr.getAttributeDescription().hasOption("binary");
           if (type.getSyntax().isBEREncodingRequired())
           {
             if(!attr.hasOption("binary"))
             if (!hasBinaryOption)
             {
               //A binary option wasn't provided by the client so add it.
               AttributeBuilder builder = new AttributeBuilder(attr);
@@ -220,7 +211,7 @@
               mod.setAttribute(attr);
             }
           }
           else if (attr.hasOption("binary"))
           else if (hasBinaryOption)
           {
             // binary option is not honored for non-BER-encodable attributes.
             throw new LDAPException(LDAPResultCode.UNDEFINED_ATTRIBUTE_TYPE,
@@ -241,7 +232,6 @@
    return modifications;
  }
  /** {@inheritDoc} */
  @Override
  public final void addModification(Modification modification)
  throws DirectoryException
@@ -249,7 +239,6 @@
    modifications.add(modification);
  }
  /** {@inheritDoc} */
  @Override
  public final OperationType getOperationType()
  {
@@ -259,35 +248,30 @@
    return OperationType.MODIFY;
  }
  /** {@inheritDoc} */
  @Override
  public DN getProxiedAuthorizationDN()
  {
    return proxiedAuthorizationDN;
  }
  /** {@inheritDoc} */
  @Override
  public final List<Control> getResponseControls()
  {
    return responseControls;
  }
  /** {@inheritDoc} */
  @Override
  public final void addResponseControl(Control control)
  {
    responseControls.add(control);
  }
  /** {@inheritDoc} */
  @Override
  public final void removeResponseControl(Control control)
  {
    responseControls.remove(control);
  }
  /** {@inheritDoc} */
  @Override
  public final void toString(StringBuilder buffer)
  {
@@ -300,14 +284,12 @@
    buffer.append(")");
  }
  /** {@inheritDoc} */
  @Override
  public void setProxiedAuthorizationDN(DN proxiedAuthorizationDN)
  {
    this.proxiedAuthorizationDN = proxiedAuthorizationDN;
  }
  /** {@inheritDoc} */
  @Override
  public final void run()
  {
@@ -334,7 +316,6 @@
      // Check for and handle a request to cancel this operation.
      checkIfCanceled(false);
      // Process the entry DN to convert it from the raw form to the form
      // required for the rest of the modify processing.
      DN entryDN = getEntryDN();
@@ -385,7 +366,6 @@
    }
  }
  /**
   * Invokes the post response plugins. If a workflow has been executed
   * then invoke the post response plugins provided by the workflow
@@ -421,7 +401,6 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public void updateOperationErrMsgAndResCode()
  {
@@ -472,6 +451,4 @@
  {
    return null;
  }
}
opendj-server-legacy/src/main/java/org/opends/server/extensions/EntityTagVirtualAttributeProvider.java
@@ -33,7 +33,11 @@
import org.opends.server.admin.std.server.EntityTagVirtualAttributeCfg;
import org.opends.server.api.VirtualAttributeProvider;
import org.opends.server.core.SearchOperation;
import org.opends.server.types.*;
import org.opends.server.types.Attribute;
import org.opends.server.types.Attributes;
import org.opends.server.types.Entry;
import org.opends.server.types.InitializationException;
import org.opends.server.types.VirtualAttributeRule;
import org.opends.server.util.StaticUtils;
import static org.opends.messages.ExtensionMessages.*;
@@ -54,30 +58,22 @@
  private static final Comparator<Attribute> ATTRIBUTE_COMPARATOR =
      new Comparator<Attribute>()
  {
    /** {@inheritDoc} */
    @Override
    public int compare(final Attribute a1, final Attribute a2)
    {
      return a1.getNameWithOptions().compareTo(a2.getNameWithOptions());
      return a1.getAttributeDescription().compareTo(a2.getAttributeDescription());
    }
  };
  /** Current configuration. */
  private volatile EntityTagVirtualAttributeCfg config;
  /**
   * Default constructor invoked by reflection.
   */
  /** Default constructor invoked by reflection. */
  public EntityTagVirtualAttributeProvider()
  {
    // Initialization performed by initializeVirtualAttributeProvider.
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
      final EntityTagVirtualAttributeCfg configuration)
@@ -86,9 +82,6 @@
    return new ConfigChangeResult();
  }
  /** {@inheritDoc} */
  @Override
  public ConditionResult approximatelyEqualTo(final Entry entry,
      final VirtualAttributeRule rule, final ByteString value)
@@ -97,18 +90,12 @@
    return ConditionResult.UNDEFINED;
  }
  /** {@inheritDoc} */
  @Override
  public void finalizeVirtualAttributeProvider()
  {
    config.removeEntityTagChangeListener(this);
  }
  /** {@inheritDoc} */
  @Override
  public Attribute getValues(final Entry entry, final VirtualAttributeRule rule)
  {
@@ -131,9 +118,6 @@
    return Attributes.create(rule.getAttributeType(), etag);
  }
  /** {@inheritDoc} */
  @Override
  public ConditionResult greaterThanOrEqualTo(final Entry entry,
      final VirtualAttributeRule rule, final ByteString value)
@@ -142,9 +126,6 @@
    return ConditionResult.UNDEFINED;
  }
  /** {@inheritDoc} */
  @Override
  public boolean hasValue(final Entry entry, final VirtualAttributeRule rule)
  {
@@ -152,9 +133,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public void initializeVirtualAttributeProvider(
      final EntityTagVirtualAttributeCfg configuration) throws ConfigException,
@@ -164,9 +142,6 @@
    configuration.addEntityTagChangeListener(this);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
      final EntityTagVirtualAttributeCfg configuration,
@@ -176,9 +151,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isMultiValued()
  {
@@ -186,9 +158,6 @@
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isSearchable(final VirtualAttributeRule rule,
                              final SearchOperation searchOperation,
@@ -199,9 +168,6 @@
    return false;
  }
  /** {@inheritDoc} */
  @Override
  public ConditionResult lessThanOrEqualTo(final Entry entry,
      final VirtualAttributeRule rule, final ByteString value)
@@ -210,9 +176,6 @@
    return ConditionResult.UNDEFINED;
  }
  /** {@inheritDoc} */
  @Override
  public ConditionResult matchesSubstring(final Entry entry,
      final VirtualAttributeRule rule, final ByteString subInitial,
@@ -222,9 +185,6 @@
    return ConditionResult.UNDEFINED;
  }
  /** {@inheritDoc} */
  @Override
  public void processSearch(final VirtualAttributeRule rule,
      final SearchOperation searchOperation)
@@ -235,8 +195,6 @@
    searchOperation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
  }
  private void checksumAttribute(final EntityTagVirtualAttributeCfg cfg,
      final Checksum checksummer, final Attribute attribute)
  {
@@ -259,8 +217,7 @@
    }
    // Checksum the attribute description.
    final String atd = attribute.getNameWithOptions();
    final byte[] bytes = StaticUtils.getBytes(atd);
    final byte[] bytes = StaticUtils.getBytes(attribute.getAttributeDescription().toString());
    checksummer.update(bytes, 0, bytes.length);
    // Checksum the attribute values. The value order may vary between
@@ -297,8 +254,6 @@
    }
  }
  private ByteString checksumEntry(final EntityTagVirtualAttributeCfg cfg,
      final Checksum checksummer, final Entry entry)
  {
@@ -334,8 +289,6 @@
    return ByteString.wrap(bytes);
  }
  private void checksumValue(final Checksum checksummer, final ByteString value)
  {
    final int size = value.length();
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -15,16 +15,42 @@
 */
package org.opends.server.extensions;
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.concurrent.*;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.ConnectException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.Semaphore;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
import javax.net.ssl.*;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
@@ -32,6 +58,7 @@
import org.forgerock.opendj.config.server.ConfigChangeResult;
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.DereferenceAliasesPolicy;
import org.forgerock.opendj.ldap.GeneralizedTime;
@@ -51,13 +78,20 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ServerContext;
import org.opends.server.protocols.ldap.*;
import org.opends.server.protocols.ldap.BindRequestProtocolOp;
import org.opends.server.protocols.ldap.BindResponseProtocolOp;
import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
import org.opends.server.protocols.ldap.ProtocolOp;
import org.opends.server.protocols.ldap.SearchRequestProtocolOp;
import org.opends.server.protocols.ldap.SearchResultDoneProtocolOp;
import org.opends.server.protocols.ldap.SearchResultEntryProtocolOp;
import org.opends.server.protocols.ldap.UnbindRequestProtocolOp;
import org.opends.server.schema.SchemaConstants;
import org.opends.server.schema.UserPasswordSyntax;
import org.opends.server.tools.LDAPReader;
import org.opends.server.tools.LDAPWriter;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
import org.opends.server.types.HostPort;
@@ -1765,7 +1799,7 @@
        for (Attribute attribute : userEntry.getAttribute(cachedPasswordTimeAttribute))
        {
          // Ignore any attributes with options.
          if (!attribute.hasOptions())
          if (!attribute.getAttributeDescription().hasOptions())
          {
            for (ByteString value : attribute)
            {
@@ -1799,7 +1833,7 @@
        for (Attribute attribute : userEntry.getAttribute(cachedPasswordAttribute))
        {
          // Ignore any attributes with options.
          if (!attribute.hasOptions())
          if (!attribute.getAttributeDescription().hasOptions())
          {
            for (ByteString value : attribute)
            {
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -518,7 +518,7 @@
        {
          for (ByteString v : a)
          {
            logger.trace("Adding end user recipient %s from attr %s", v, a.getNameWithOptions());
            logger.trace("Adding end user recipient %s from attr %s", v, a.getAttributeDescription());
            recipients.add(v.toString());
          }
opendj-server-legacy/src/main/java/org/opends/server/plugins/SevenBitCleanPlugin.java
@@ -77,9 +77,6 @@
    super();
  }
  /** {@inheritDoc} */
  @Override
  public final void initializePlugin(Set<PluginType> pluginTypes,
                                     SevenBitCleanPluginCfg configuration)
@@ -106,18 +103,12 @@
    }
  }
  /** {@inheritDoc} */
  @Override
  public final void finalizePlugin()
  {
    currentConfig.removeSevenBitCleanChangeListener(this);
  }
  /** {@inheritDoc} */
  @Override
  public final PluginResult.ImportLDIF
               doLDIFImport(LDIFImportConfig importConfig, Entry entry)
@@ -125,7 +116,6 @@
    // Get the current configuration for this plugin.
    SevenBitCleanPluginCfg config = currentConfig;
    // Make sure that the entry is within the scope of this plugin.  While
    // processing an LDIF import, we don't have access to the set of public
    // naming contexts defined in the server, so if no explicit set of base DNs
@@ -136,7 +126,6 @@
      return PluginResult.ImportLDIF.continueEntryProcessing();
    }
    // Make sure all configured attributes have clean values.
    for (AttributeType t : config.getAttributeType())
    {
@@ -147,21 +136,17 @@
          if (!is7BitClean(v))
          {
            LocalizableMessage rejectMessage =
                 ERR_PLUGIN_7BIT_IMPORT_ATTR_NOT_CLEAN.get(a.getNameWithOptions());
                 ERR_PLUGIN_7BIT_IMPORT_ATTR_NOT_CLEAN.get(a.getAttributeDescription());
            return PluginResult.ImportLDIF.stopEntryProcessing(rejectMessage);
          }
        }
      }
    }
    // If we've gotten here, then everything is acceptable.
    return PluginResult.ImportLDIF.continueEntryProcessing();
  }
  /** {@inheritDoc} */
  @Override
  public final PluginResult.PreParse
               doPreParse(PreParseAddOperation addOperation)
@@ -169,7 +154,6 @@
    // Get the current configuration for this plugin.
    SevenBitCleanPluginCfg config = currentConfig;
    // If the entry is within the scope of this plugin, then make sure all
    // configured attributes have clean values.
    DN entryDN;
@@ -218,14 +202,10 @@
      }
    }
    // If we've gotten here, then everything is acceptable.
    return PluginResult.PreParse.continueOperationProcessing();
  }
  /** {@inheritDoc} */
  @Override
  public final PluginResult.PreParse
                    doPreParse(PreParseModifyOperation modifyOperation)
@@ -233,7 +213,6 @@
    // Get the current configuration for this plugin.
    SevenBitCleanPluginCfg config = currentConfig;
    // If the target entry is within the scope of this plugin, then make sure
    // all values that will be added during the modification will be acceptable.
    DN entryDN;
@@ -294,14 +273,10 @@
      }
    }
    // If we've gotten here, then everything is acceptable.
    return PluginResult.PreParse.continueOperationProcessing();
  }
  /** {@inheritDoc} */
  @Override
  public final PluginResult.PreParse
                    doPreParse(PreParseModifyDNOperation modifyDNOperation)
@@ -309,7 +284,6 @@
    // Get the current configuration for this plugin.
    SevenBitCleanPluginCfg config = currentConfig;
    // If the target entry is within the scope of this plugin, then make sure
    // all values that will be added during the modification will be acceptable.
    DN entryDN;
@@ -354,13 +328,10 @@
      }
    }
    // If we've gotten here, then everything is acceptable.
    return PluginResult.PreParse.continueOperationProcessing();
  }
  /**
   * Indicates whether the provided DN is within the scope of this plugin.
   *
@@ -395,8 +366,6 @@
    return false;
  }
  /**
   * Indicates whether the provided value is 7-bit clean.
   *
@@ -418,9 +387,6 @@
    return true;
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationAcceptable(PluginCfg configuration,
                                           List<LocalizableMessage> unacceptableReasons)
@@ -429,9 +395,6 @@
    return isConfigurationChangeAcceptable(cfg, unacceptableReasons);
  }
  /** {@inheritDoc} */
  @Override
  public boolean isConfigurationChangeAcceptable(
                      SevenBitCleanPluginCfg configuration,
@@ -451,7 +414,6 @@
          // These are acceptable.
          break;
        default:
          unacceptableReasons.add(ERR_PLUGIN_7BIT_INVALID_PLUGIN_TYPE.get(pluginType));
          configAcceptable = false;
@@ -461,9 +423,6 @@
    return configAcceptable;
  }
  /** {@inheritDoc} */
  @Override
  public ConfigChangeResult applyConfigurationChange(
                                 SevenBitCleanPluginCfg configuration)
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPAttribute.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2009 Sun Microsystems, Inc.
 * Portions Copyright 2013-2015 ForgeRock AS.
 * Portions Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.protocols.ldap;
@@ -146,7 +146,7 @@
   */
  public LDAPAttribute(Attribute attribute)
  {
    this.attributeType = attribute.getNameWithOptions();
    this.attributeType = attribute.getAttributeDescription().toString();
    if (attribute.isVirtual())
    {
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/SearchResultEntryProtocolOp.java
@@ -32,11 +32,11 @@
import org.forgerock.opendj.io.ASN1Writer;
import org.forgerock.opendj.ldap.AttributeDescription;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.Attribute;
import org.opends.server.types.AttributeBuilder;
import org.forgerock.opendj.ldap.DN;
import org.opends.server.types.Entry;
import org.opends.server.types.LDAPException;
import org.opends.server.types.ObjectClass;
@@ -176,7 +176,7 @@
            if (attrList != null && attrList.getValue().size() == 1)
            {
              Attribute a = attrList.getValue().get(0);
              if (!a.hasOptions())
              if (!a.getAttributeDescription().hasOptions())
              {
                needsMerge = false;
                tmp.add(new LDAPAttribute(a));
@@ -204,7 +204,7 @@
            if (attrList != null && attrList.getValue().size() == 1)
            {
              Attribute a = attrList.getValue().get(0);
              if (!a.hasOptions())
              if (!a.getAttributeDescription().hasOptions())
              {
                needsMerge = false;
                tmp.add(new LDAPAttribute(a));
@@ -213,8 +213,7 @@
            if (needsMerge)
            {
              AttributeBuilder builder =
                  new AttributeBuilder(attrList.getKey());
              AttributeBuilder builder = new AttributeBuilder(attrList.getKey());
              for (Attribute a : attrList.getValue())
              {
                builder.addAll(a);
@@ -226,8 +225,7 @@
        else
        {
          // LDAPv3
          for (List<Attribute> attrList : entry.getUserAttributes()
              .values())
          for (List<Attribute> attrList : entry.getUserAttributes().values())
          {
            for (Attribute a : attrList)
            {
@@ -235,8 +233,7 @@
            }
          }
          for (List<Attribute> attrList : entry
              .getOperationalAttributes().values())
          for (List<Attribute> attrList : entry.getOperationalAttributes().values())
          {
            for (Attribute a : attrList)
            {
@@ -614,7 +611,7 @@
      throws IOException
  {
    stream.writeStartSequence();
    stream.writeOctetString(a.getNameWithOptions());
    stream.writeOctetString(a.getAttributeDescription().toString());
    stream.writeStartSet();
    for (ByteString value : a)
    {
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/TemplateEntry.java
@@ -363,7 +363,7 @@
            continue;
          }
          String attrName = a.getNameWithOptions();
          String attrName = a.getAttributeDescription().toString();
          if (typesOnly)
          {
            StringBuilder attrLine = new StringBuilder(attrName);
@@ -407,7 +407,7 @@
              continue;
            }
            String attrName = a.getNameWithOptions();
            String attrName = a.getAttributeDescription().toString();
            if (typesOnly)
            {
              StringBuilder attrLine = new StringBuilder(attrName);
opendj-server-legacy/src/main/java/org/opends/server/types/AbstractAttribute.java
@@ -93,33 +93,7 @@
  @Override
  public String getName()
  {
    return getAttributeDescription().getAttributeType().getNameOrOID();
  }
  /**
   * {@inheritDoc}
   * <p>
   * This implementation returns this attribute's name if there are no
   * attribute options, otherwise it constructs a string comprising of
   * this attribute's name followed by a semi-colon and a semi-colon
   * separated list of its attribute options.
   */
  @Override
  public String getNameWithOptions()
  {
    if (!hasOptions())
    {
      return getName();
    }
    StringBuilder buffer = new StringBuilder();
    buffer.append(getName());
    for (String option : getAttributeDescription().getOptions())
    {
      buffer.append(';');
      buffer.append(option);
    }
    return buffer.toString();
    return getAttributeDescription().getNameOrOID();
  }
  @Override
@@ -142,24 +116,6 @@
    return hashCode;
  }
  @Override
  public boolean hasOption(String option)
  {
    return getAttributeDescription().hasOption(option);
  }
  /**
   * {@inheritDoc}
   * <p>
   * This implementation retrieves the set of options associated with
   * this attribute and tests to see if it is empty.
   */
  @Override
  public boolean hasOptions()
  {
    return getAttributeDescription().hasOptions();
  }
  /**
   * {@inheritDoc}
   * <p>
opendj-server-legacy/src/main/java/org/opends/server/types/Attribute.java
@@ -126,15 +126,6 @@
  String getName();
  /**
   * Retrieves the user-provided name of this attribute, along with
   * any options that might have been provided.
   *
   * @return The user-provided name of this attribute, along with any
   *         options that might have been provided.
   */
  String getNameWithOptions();
  /**
   * Indicates whether this attribute has any value(s) that are
   * greater than or equal to the provided value.
   *
@@ -157,24 +148,6 @@
  int hashCode();
  /**
   * Indicates whether this attribute has the specified option.
   *
   * @param option
   *          The option for which to make the determination.
   * @return {@code true} if this attribute has the specified option,
   *         or {@code false} if not.
   */
  boolean hasOption(String option);
  /**
   * Indicates whether this attribute has any options at all.
   *
   * @return {@code true} if this attribute has at least one
   *         option, or {@code false} if not.
   */
  boolean hasOptions();
  /**
   * Returns {@code true} if this attribute contains no
   * attribute values.
   *
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -206,24 +206,6 @@
    }
    @Override
    public boolean hasOption(String option)
    {
      return attributeDescription.hasOption(option);
    }
    @Override
    public boolean hasOptions()
    {
      return attributeDescription.hasOptions();
    }
    @Override
    public final String getName()
    {
      return attributeDescription.getNameOrOID();
    }
    @Override
    public final ConditionResult greaterThanOrEqualTo(ByteString assertionValue)
    {
      MatchingRule matchingRule = getAttributeType().getOrderingMatchingRule();
@@ -390,7 +372,7 @@
    public final void toString(StringBuilder buffer)
    {
      buffer.append("Attribute(");
      buffer.append(getNameWithOptions());
      buffer.append(attributeDescription);
      buffer.append(", {");
      Utils.joinAsString(buffer, ", ", values);
      buffer.append("})");
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -1313,7 +1313,7 @@
  {
    for (Attribute a : getAttribute(attributeType))
    {
      if (!a.hasOptions() && a.contains(value))
      if (!a.getAttributeDescription().hasOptions() && a.contains(value))
      {
        return true;
      }
@@ -3273,8 +3273,7 @@
      {
        for (Attribute a : attrList)
        {
          byte[] nameBytes = getBytes(a.getNameWithOptions());
          buffer.appendBytes(nameBytes);
          buffer.appendBytes(getBytes(a.getAttributeDescription().toString()));
          buffer.appendByte(0x00);
          buffer.appendBERLength(a.size());
@@ -3643,7 +3642,7 @@
    {
      for (Attribute a : attrList)
      {
        String attrName = a.getNameWithOptions();
        String attrName = a.getAttributeDescription().toString();
        for (ByteString v : a)
        {
          StringBuilder attrLine = new StringBuilder(attrName);
@@ -3872,7 +3871,7 @@
      BufferedWriter writer, boolean wrapLines, int wrapColumn)
      throws IOException
  {
    String attrName = attribute.getNameWithOptions();
    String attrName = attribute.getAttributeDescription().toString();
    if (typesOnly)
    {
      StringBuilder attrLine = new StringBuilder(attrName);
@@ -4149,7 +4148,7 @@
          buffer.append(",");
        }
        buffer.append(a.getNameWithOptions());
        buffer.append(a.getAttributeDescription());
        buffer.append("={");
        Iterator<ByteString> valueIterator = a.iterator();
opendj-server-legacy/src/main/java/org/opends/server/types/SubEntry.java
@@ -164,7 +164,7 @@
        {
          this.collectiveAttributes.add(new CollectiveVirtualAttribute(subAttr));
        }
        else if (subAttr.hasOption(ATTR_OPTION_COLLECTIVE))
        else if (subAttr.getAttributeDescription().hasOption(ATTR_OPTION_COLLECTIVE))
        {
          AttributeBuilder builder = new AttributeBuilder(subAttr.getAttributeDescription().getAttributeType());
          builder.addAll(subAttr);
opendj-server-legacy/src/main/java/org/opends/server/types/VirtualAttribute.java
@@ -96,12 +96,6 @@
  }
  @Override
  public String getNameWithOptions()
  {
    return getName();
  }
  @Override
  public AttributeDescription getAttributeDescription()
  {
    return attributeDescription;
@@ -126,18 +120,6 @@
  }
  @Override
  public boolean hasOption(String option)
  {
    return false;
  }
  @Override
  public boolean hasOptions()
  {
    return false;
  }
  @Override
  public boolean isEmpty()
  {
    return !provider.hasValue(entry, rule);
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -824,9 +824,9 @@
      }
       //The attribute is not being ignored so check for binary option.
      if(checkSchema
      if (checkSchema
          && !attrType.getSyntax().isBEREncodingRequired()
          && attribute.hasOption("binary"))
          && attribute.getAttributeDescription().hasOption("binary"))
      {
        LocalizableMessage message = ERR_LDIF_INVALID_ATTR_OPTION.get(
          entryDN, lastEntryLineNumber, attrName);
@@ -1663,7 +1663,7 @@
    for (int j = 0; j < attrList.size(); j++)
    {
      Attribute a = attrList.get(j);
      if (a.hasOptions())
      if (a.getAttributeDescription().hasOptions())
      {
        continue;
      }
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFWriter.java
@@ -297,7 +297,7 @@
      {
        for (ByteString v : a)
        {
          final String attrName = a.getNameWithOptions();
          final String attrName = a.getAttributeDescription().toString();
          writeAttribute(attrName, v, writer, wrapLines, wrapColumn);
        }
      }
@@ -431,7 +431,7 @@
    {
      for (Attribute a : entry.getUserAttribute(attrType))
      {
        StringBuilder attrName = new StringBuilder(a.getNameWithOptions());
        String attrName = a.getAttributeDescription().toString();
        for (ByteString v : a)
        {
          writeAttribute(attrName, v, writer, wrapLines, wrapColumn);
@@ -495,9 +495,10 @@
      {
        for (Attribute a : entry.getUserAttribute(attrType))
        {
          StringBuilder attrName = new StringBuilder();
          final String attrDesc = a.getAttributeDescription().toString();
          final StringBuilder attrName = new StringBuilder(2 + attrDesc.length());
          attrName.append("# ");
          attrName.append(a.getNameWithOptions());
          attrName.append(attrDesc);
          for (ByteString v : a)
          {
@@ -557,7 +558,7 @@
      Modification m    = iterator.next();
      Attribute    a    = m.getAttribute();
      String name = a.getNameWithOptions();
      String name = a.getAttributeDescription().toString();
      StringBuilder modTypeLine = new StringBuilder();
      modTypeLine.append(m.getModificationType());
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendAddOperation.java
@@ -585,7 +585,7 @@
    for (int j = 0; j < attrList.size(); j++) {
      Attribute a = attrList.get(j);
      if (a.hasOptions())
      if (a.getAttributeDescription().hasOptions())
      {
        continue;
      }
@@ -678,7 +678,7 @@
    }
    Attribute passwordAttr = attrList.get(0);
    if (passwordAttr.hasOptions())
    if (passwordAttr.getAttributeDescription().hasOptions())
    {
      LocalizableMessage message = ERR_PWPOLICY_ATTRIBUTE_OPTIONS_NOT_ALLOWED.get(
          passwordAttribute.getNameOrOID());
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -27,7 +27,9 @@
import org.forgerock.i18n.LocalizableMessageDescriptor.Arg4;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.RDN;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
@@ -63,14 +65,12 @@
import org.opends.server.types.AuthenticationInfo;
import org.opends.server.types.CanceledOperationException;
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.LockManager.DNLock;
import org.opends.server.types.Modification;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.Privilege;
import org.forgerock.opendj.ldap.RDN;
import org.opends.server.types.SearchFilter;
import org.opends.server.types.SynchronizationProviderResult;
import org.opends.server.types.operation.PostOperationModifyOperation;
@@ -849,7 +849,7 @@
  private void validatePasswordModification(Modification m, PasswordPolicy authPolicy) throws DirectoryException
  {
    Attribute a = m.getAttribute();
    if (a.hasOptions())
    if (a.getAttributeDescription().hasOptions())
    {
      switch (m.getModificationType().asEnum())
      {
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/TestDnKeyFormat.java
@@ -326,8 +326,7 @@
    {
      for (Attribute a : attrList)
      {
        byte[] nameBytes = getBytes(a.getNameWithOptions());
        buffer.appendBytes(nameBytes);
        buffer.appendBytes(getBytes(a.getAttributeDescription().toString()));
        buffer.appendByte(0x00);
        buffer.appendBERLength(a.size());
opendj-server-legacy/src/test/java/org/opends/server/core/ModifyOperationTestCase.java
@@ -22,6 +22,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
@@ -46,7 +47,6 @@
import org.opends.server.types.CancelRequest;
import org.opends.server.types.CancelResult;
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.LockManager.DNLock;
@@ -3245,7 +3245,7 @@
    e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertThat(attrList).hasSize(1);
    assertFalse(attrList.get(0).hasOptions());
    assertFalse(attrList.get(0).getAttributeDescription().hasOptions());
    assertThat(attrList.get(0)).hasSize(1);
  }
@@ -3285,7 +3285,7 @@
    e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertThat(attrList).hasSize(1);
    assertFalse(attrList.get(0).hasOptions());
    assertFalse(attrList.get(0).getAttributeDescription().hasOptions());
    assertThat(attrList.get(0)).hasSize(1);
  }
@@ -3321,7 +3321,7 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertThat(attrList).hasSize(1);
    assertFalse(attrList.get(0).hasOptions());
    assertFalse(attrList.get(0).getAttributeDescription().hasOptions());
    assertThat(attrList.get(0)).hasSize(1);
  }
@@ -3357,7 +3357,7 @@
    Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test"));
    List<Attribute> attrList = e.getAttribute("userpassword");
    assertThat(attrList).hasSize(1);
    assertFalse(attrList.get(0).hasOptions());
    assertFalse(attrList.get(0).getAttributeDescription().hasOptions());
    assertThat(attrList.get(0)).hasSize(1);
  }
@@ -3413,7 +3413,7 @@
    List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("usercertificate"));
    assertThat(attrList).hasSize(1);
    Attribute a = attrList.get(0);
    assertTrue(a.hasOption("binary"));
    assertTrue(a.getAttributeDescription().hasOption("binary"));
    assertEquals(a.size(), 1);
    assertEquals(Base64.encode(a.iterator().next()), certificateValue);
  }
opendj-server-legacy/src/test/java/org/opends/server/core/SearchOperationTestCase.java
@@ -1162,7 +1162,7 @@
    Set<String> actualNames = new HashSet<>();
    for (Attribute attribute : entry.getAttributes())
    {
      actualNames.add(attribute.getNameWithOptions());
      actualNames.add(attribute.getAttributeDescription().toString());
    }
    return actualNames;
  }
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
@@ -236,7 +236,7 @@
      assertThat(description).hasSize(1);
      Attribute attribute = description.get(0);
      assertEquals(attribute.size(), 1);
      assertFalse(attribute.hasOptions());
      assertFalse(attribute.getAttributeDescription().hasOptions());
      assertTrue(attribute.contains(ByteString.valueOfUtf8("inherited description")));
    }
    finally
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -1328,12 +1328,11 @@
      throws Exception
  {
    // Check name and options.
    String[] elements = a.getNameWithOptions().split(";");
    String[] elements = a.getAttributeDescription().toString().split(";");
    switch (elements.length)
    {
    case 0:
      Assert.fail("Name and options could not be split: "
          + a.getNameWithOptions());
      Assert.fail("Name and options could not be split: " + a.getAttributeDescription());
      break;
    case 1:
      Assert.assertEquals(elements[0], name);
@@ -1473,15 +1472,16 @@
      throws Exception
  {
    // Check hasOption().
    AttributeDescription attrDesc = a.getAttributeDescription();
    for (String option : options)
    {
      Assert.assertTrue(a.hasOption(option));
      Assert.assertTrue(attrDesc.hasOption(option));
      // Assumes internal normalization to lower-case.
      Assert.assertTrue(a.hasOption(option.toUpperCase()));
      Assert.assertTrue(attrDesc.hasOption(option.toUpperCase()));
    }
    Assert.assertFalse(a.hasOption("xxxx"));
    Assert.assertFalse(attrDesc.hasOption("xxxx"));
  }
@@ -1507,7 +1507,7 @@
      AttributeType type, String name, String[] options, String[] values)
      throws Exception
  {
    Assert.assertEquals(options.length != 0, a.hasOptions());
    Assert.assertEquals(options.length != 0, a.getAttributeDescription().hasOptions());
  }
@@ -1770,14 +1770,8 @@
      String[] options, String[] values)
  {
    AttributeBuilder builder = new AttributeBuilder(type, name);
    for (String option : options)
    {
      builder.setOption(option);
    }
    for (String value : values)
    {
      builder.add(value);
    }
    builder.setOptions(Arrays.asList(options));
    builder.addAllStrings(Arrays.asList(values));
    return builder.toAttribute();
  }
}