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

Jean-Noel Rouvignac
03.31.2014 73fb5702321f67764e325edfd4e44cebf78786e7
OPENDJ-1308 Migrate schema support

DITStructureRule.java, NameForm.java, CommonSchemaElements.java:
Brought these classes closer to the relevant SDK types: used UCDetector to change visibility / remove methods that are not on the SDK types.

MatchingRuleUse.java
Brought this class closer to the relevant SDK types: used UCDetector to change visibility / remove methods that are not on the SDK types.
Renamed getName() to getNameOrOID().

ConfigureWindowsService.java, MatchingRuleConfigManager.java, SchemaBackend.java, Schema.java, SearchFilter.java:
Consequence of renaming MatchingRuleUse.getName().
9 files modified
234 ■■■■ changed files
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java 20 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java 4 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java 21 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java 5 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java 61 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java 61 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/NameForm.java 56 ●●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/Schema.java 4 ●●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java 2 ●●● patch | view | raw | blame | history
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -1920,7 +1920,7 @@
      if (mru.getAttributes().contains(removeType))
      {
        LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_AT_IN_MR_USE.get(
            removeType.getNameOrOID(), mru.getName());
            removeType.getNameOrOID(), mru.getNameOrOID());
        throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
      }
    }
@@ -3090,9 +3090,9 @@
          {
            LocalizableMessage message =
                    ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_MR_USE.get(
                            matchingRuleUse.getName(),
                            existingMRU.getName(),
                            mru.getName());
                            matchingRuleUse.getNameOrOID(),
                            existingMRU.getNameOrOID(),
                            mru.getNameOrOID());
            throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
                                         message);
          }
@@ -3112,15 +3112,15 @@
    if ((existingMRUForRule != null) && (existingMRUForRule != existingMRU))
    {
      LocalizableMessage message = ERR_SCHEMA_MODIFY_MR_CONFLICT_FOR_ADD_MR_USE.
          get(matchingRuleUse.getName(), matchingRule.getNameOrOID(),
              existingMRUForRule.getName());
          get(matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID(),
              existingMRUForRule.getNameOrOID());
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
    }
    if (matchingRule.isObsolete())
    {
      LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_OBSOLETE_MR.get(
          matchingRuleUse.getName(), matchingRule.getNameOrOID());
          matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID());
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }
@@ -3132,13 +3132,13 @@
      if (! schema.hasAttributeType(at.getOID()))
      {
        LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_UNDEFINED_ATTR.get(
            matchingRuleUse.getName(), at.getNameOrOID());
            matchingRuleUse.getNameOrOID(), at.getNameOrOID());
        throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
      }
      else if (at.isObsolete())
      {
        LocalizableMessage message = ERR_SCHEMA_MODIFY_MRU_OBSOLETE_ATTR.get(
            matchingRuleUse.getName(), matchingRule.getNameOrOID());
            matchingRuleUse.getNameOrOID(), matchingRule.getNameOrOID());
        throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
      }
    }
@@ -3236,7 +3236,7 @@
    if ((removeMRU == null) || (! removeMRU.equals(matchingRuleUse)))
    {
      LocalizableMessage message = ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_MR_USE.get(
          matchingRuleUse.getName());
          matchingRuleUse.getNameOrOID());
      throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, message);
    }
opendj3-server-dev/src/server/org/opends/server/core/MatchingRuleConfigManager.java
@@ -321,7 +321,7 @@
          {
            LocalizableMessage message =
                    WARN_CONFIG_SCHEMA_CANNOT_DELETE_MR_IN_USE_BY_MRU.get(
                            matchingRule.getNameOrOID(), mru.getName());
                            matchingRule.getNameOrOID(), mru.getNameOrOID());
            unacceptableReasons.add(message);
            configAcceptable = false;
@@ -458,7 +458,7 @@
            {
              LocalizableMessage message =
                      WARN_CONFIG_SCHEMA_CANNOT_DISABLE_MR_IN_USE_BY_MRU.get(
                              matchingRule.getNameOrOID(), mru.getName());
                              matchingRule.getNameOrOID(), mru.getNameOrOID());
              unacceptableReasons.add(message);
              configAcceptable = false;
opendj3-server-dev/src/server/org/opends/server/tools/ConfigureWindowsService.java
@@ -26,16 +26,10 @@
 */
package org.opends.server.tools;
import org.opends.guitools.controlpanel.util.Utilities;
import java.io.*;
import org.forgerock.i18n.LocalizableMessage;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.quicksetup.util.Utils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.JDKLogging;
@@ -43,16 +37,11 @@
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.SetupUtils;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentParser;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.CommonArguments;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.MAX_LINE_WIDTH;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
/**
  * This class is used to configure the Windows service for this instance on
opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
@@ -581,9 +581,8 @@
   *          specifies the path to the schema file from which this
   *          schema definition was loaded.
   */
  public final void toString(StringBuilder buffer,
      boolean includeFileElement) {
  private final void toString(StringBuilder buffer, boolean includeFileElement)
  {
    buffer.append("( ");
    buffer.append(oid);
opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
@@ -26,7 +26,6 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.ByteString;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -35,13 +34,12 @@
import java.util.Map;
import java.util.Set;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.schema.DITStructureRuleSyntax;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
import static org.opends.server.util.ServerConstants.*;
/**
 * This class defines a DIT structure rule, which is used to indicate
@@ -367,9 +365,9 @@
   * @return  {@code true} if this DIT structure rule has one or more
   *          superior rules, or {@code false} if not.
   */
  public boolean hasSuperiorRules()
  boolean hasSuperiorRules()
  {
    return ((superiorRules != null) && (! superiorRules.isEmpty()));
    return superiorRules != null && !superiorRules.isEmpty();
  }
@@ -404,24 +402,6 @@
  /**
   * Retrieves the value of the specified "extra" property for this
   * DIT structure rule.
   *
   * @param  propertyName  The name of the "extra" property for which
   *                       to retrieve the value.
   *
   * @return  The value of the specified "extra" property for this DIT
   *          structure rule, or {@code null} if no such property is
   *          defined.
   */
  public List<String> getExtraProperty(String propertyName)
  {
    return extraProperties.get(propertyName);
  }
  /**
   * Specifies the provided "extra" property for this DIT structure
   * rule.
   *
@@ -430,7 +410,7 @@
   * @param  value  The value for the "extra" property, or
   *                {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, String value)
  private void setExtraProperty(String name, String value)
  {
    ifNull(name);
@@ -450,32 +430,6 @@
  /**
   * Specifies the provided "extra" property for this DIT structure
   * rule.
   *
   * @param  name    The name for the "extra" property.  It must not
   *                 be {@code null}.
   * @param  values  The set of value for the "extra" property, or
   *                 {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, List<String> values)
  {
    ifNull(name);
    if ((values == null) || values.isEmpty())
    {
      extraProperties.remove(name);
    }
    else
    {
      LinkedList<String> valuesCopy = new LinkedList<String>(values);
      extraProperties.put(name, valuesCopy);
    }
  }
  /**
   * Indicates whether the provided object is equal to this DIT
   * structure rule.  The object will be considered equal if it is a
   * DIT structure rule with the same OID as the current type.
@@ -542,8 +496,7 @@
   *                             path to the schema file from which
   *                             this DIT structure rule was loaded.
   */
  public void toString(StringBuilder buffer,
                       boolean includeFileElement)
  private void toString(StringBuilder buffer, boolean includeFileElement)
  {
    buffer.append("( ");
    buffer.append(ruleID);
opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
@@ -26,7 +26,6 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.ByteString;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -35,14 +34,13 @@
import java.util.Map;
import java.util.Set;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.api.MatchingRule;
import org.opends.server.schema.MatchingRuleUseSyntax;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
import static org.opends.server.util.ServerConstants.*;
/**
 * This class defines a data structure for storing and interacting
@@ -242,7 +240,7 @@
   * @return  The primary name to use when referencing this matching
   *          rule use, or {@code null} if there is none.
   */
  public String getName()
  public String getNameOrOID()
  {
    if (names.isEmpty())
    {
@@ -359,7 +357,7 @@
   *          referenced by this matching rule use, or {@code false}
   *          if it is not.
   */
  public boolean appliesToAttribute(AttributeType attributeType)
  boolean appliesToAttribute(AttributeType attributeType)
  {
    return attributes.contains(attributeType);
  }
@@ -383,24 +381,6 @@
  /**
   * Retrieves the value of the specified "extra" property for this
   * matching rule use.
   *
   * @param  propertyName  The name of the "extra" property for which
   *                       to retrieve the value.
   *
   * @return  The value of the specified "extra" property for this
   *          matching rule use, or {@code null} if no such property
   *          is defined.
   */
  public List<String> getExtraProperty(String propertyName)
  {
    return extraProperties.get(propertyName);
  }
  /**
   * Specifies the provided "extra" property for this matching rule
   * use.
   *
@@ -409,7 +389,7 @@
   * @param  value  The value for the "extra" property, or
   *                {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, String value)
  private void setExtraProperty(String name, String value)
  {
    ifNull(name);
@@ -429,32 +409,6 @@
  /**
   * Specifies the provided "extra" property for this matching rule
   * use.
   *
   * @param  name    The name for the "extra" property.  It must not
   *                 be {@code null}.
   * @param  values  The set of value for the "extra" property, or
   *                 {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, List<String> values)
  {
    ifNull(name);
    if ((values == null) || values.isEmpty())
    {
      extraProperties.remove(name);
    }
    else
    {
      LinkedList<String> valuesCopy = new LinkedList<String>(values);
      extraProperties.put(name, valuesCopy);
    }
  }
  /**
   * Indicates whether the provided object is equal to this matching
   * rule use.  The object will be considered equal if it is a
   * matching rule use with the same matching rule.
@@ -521,8 +475,7 @@
   *                             path to the schema file from which
   *                             this matching rule use was loaded.
   */
  public void toString(StringBuilder buffer,
                       boolean includeFileElement)
  private void toString(StringBuilder buffer, boolean includeFileElement)
  {
    buffer.append("( ");
    buffer.append(matchingRule.getOID());
opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
@@ -26,7 +26,6 @@
 */
package org.opends.server.types;
import org.forgerock.opendj.ldap.ByteString;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -35,13 +34,12 @@
import java.util.Map;
import java.util.Set;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.opends.server.schema.NameFormSyntax;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import static org.opends.server.util.ServerConstants.*;
import static org.forgerock.util.Reject.*;
import static org.opends.server.util.ServerConstants.*;
/**
 * This class defines a data structure for storing and interacting
@@ -484,24 +482,6 @@
  /**
   * Retrieves the value of the specified "extra" property for this
   * name form.
   *
   * @param  propertyName  The name of the "extra" property for which
   *                       to retrieve the value.
   *
   * @return  The value of the specified "extra" property for this
   *          name form, or {@code null} if no such property is
   *          defined.
   */
  public List<String> getExtraProperty(String propertyName)
  {
    return extraProperties.get(propertyName);
  }
  /**
   * Specifies the provided "extra" property for this name form.
   *
   * @param  name   The name for the "extra" property.  It must not be
@@ -509,7 +489,7 @@
   * @param  value  The value for the "extra" property, or
   *                {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, String value)
  private void setExtraProperty(String name, String value)
  {
    ifNull(name);
@@ -529,31 +509,6 @@
  /**
   * Specifies the provided "extra" property for this name form.
   *
   * @param  name    The name for the "extra" property.  It must not
   *                 be {@code null}.
   * @param  values  The set of value for the "extra" property, or
   *                 {@code null} if the property is to be removed.
   */
  public void setExtraProperty(String name, List<String> values)
  {
    ifNull(name);
    if ((values == null) || values.isEmpty())
    {
      extraProperties.remove(name);
    }
    else
    {
      LinkedList<String> valuesCopy = new LinkedList<String>(values);
      extraProperties.put(name, valuesCopy);
    }
  }
  /**
   * Indicates whether the provided object is equal to this name form.
   * The object will be considered equal if it is a name form with the
   * same OID as the current name form.
@@ -627,8 +582,7 @@
   *                             path to the schema file from which
   *                             this name form was loaded.
   */
  public void toString(StringBuilder buffer,
                       boolean includeFileElement)
  private void toString(StringBuilder buffer, boolean includeFileElement)
  {
    buffer.append("( ");
    buffer.append(oid);
opendj3-server-dev/src/server/org/opends/server/types/Schema.java
@@ -2348,9 +2348,9 @@
                               matchingRuleUses.get(matchingRule);
          LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE.
              get(matchingRuleUse.getName(),
              get(matchingRuleUse.getNameOrOID(),
                  matchingRule.getNameOrOID(),
                  conflictingUse.getName());
                  conflictingUse.getNameOrOID());
          throw new DirectoryException(
                         ResultCode.CONSTRAINT_VIOLATION, message);
        }
opendj3-server-dev/src/server/org/opends/server/types/SearchFilter.java
@@ -3315,7 +3315,7 @@
                "Attribute type %s is not allowed for use with " +
                "matching rule %s because of matching rule use " +
                "definition %s", attributeType.getNameOrOID(),
                matchingRule.getNameOrOID(), mru.getName());
                matchingRule.getNameOrOID(), mru.getNameOrOID());
          }
          return ConditionResult.UNDEFINED;
        }