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

Nicolas Capponi
25.39.2016 cd144ffe68d0d75c8f7c7b5e4026ce80dceececa
OPENDJ-2797 Remove SchemaFileElement interface in favor of SDK SchemaElement interface
1 files deleted
10 files modified
137 ■■■■■ changed files
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java 2 ●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java 6 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/SomeSchemaElement.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.java 16 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/DITStructureRule.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/LDAPSyntaxDescription.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/NameForm.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java 4 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SchemaFileElement.java 59 ●●●●● patch | view | raw | blame | history
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2009 Sun Microsystems, Inc.
 * Portions Copyright 2015 ForgeRock AS.
 * Portions Copyright 2015-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java
@@ -11,7 +11,7 @@
 * Header, with the fields enclosed by brackets [] replaced by your own identifying
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2015 ForgeRock AS.
 * Copyright 2015-2016 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.schema;
@@ -184,7 +184,8 @@
        }
    }
    private boolean assertSchemaElementsContains(final Set<? extends AbstractSchemaElement> elements, final String nameOrOID) {
    private boolean assertSchemaElementsContains(final Set<? extends AbstractSchemaElement> elements,
            final String nameOrOID) {
        for (final AbstractSchemaElement element : elements) {
            final String oid = element instanceof AttributeType ? ((AttributeType) element).getNameOrOID()
                                                            : ((ObjectClass) element).getNameOrOID();
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -66,6 +66,7 @@
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.MatchingRuleUse;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import org.forgerock.opendj.server.config.server.SchemaBackendCfg;
import org.opends.server.api.AlertGenerator;
import org.opends.server.api.Backend;
@@ -110,7 +111,6 @@
import org.opends.server.types.Privilege;
import org.opends.server.types.RestoreConfig;
import org.opends.server.types.Schema;
import org.opends.server.types.SchemaFileElement;
import org.opends.server.types.SearchFilter;
import org.opends.server.util.BackupManager;
import org.opends.server.util.BuildVersion;
@@ -1213,7 +1213,7 @@
    }
  }
  private void addNewSchemaElement(Set<String> modifiedSchemaFiles, SchemaFileElement elem)
  private void addNewSchemaElement(Set<String> modifiedSchemaFiles, SchemaElement elem)
  {
    String schemaFile = getSchemaFile(elem);
    if (schemaFile == null || schemaFile.length() == 0)
@@ -1245,7 +1245,7 @@
    return schemaFile == null ? finalFile : null;
  }
  private <T extends SchemaFileElement> void replaceExistingSchemaElement(
  private <T extends SchemaElement> void replaceExistingSchemaElement(
      Set<String> modifiedSchemaFiles, T newElem, T existingElem)
  {
    String newSchemaFile = getSchemaFile(newElem);
opendj-server-legacy/src/main/java/org/opends/server/schema/SomeSchemaElement.java
@@ -24,11 +24,11 @@
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.Schema;
import org.forgerock.opendj.ldap.schema.SchemaBuilder;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import org.opends.server.config.ConfigConstants;
import org.opends.server.core.ServerContext;
import org.opends.server.types.CommonSchemaElements;
import org.opends.server.types.ObjectClass;
import org.opends.server.types.SchemaFileElement;
import org.opends.server.util.RemoveOnceSDKSchemaIsUsed;
import org.opends.server.util.ServerConstants;
@@ -41,7 +41,7 @@
 */
@RemoveOnceSDKSchemaIsUsed("This class is a temporary mechanism"
    + " to manage in the same way SDK and server schema element classes")
public class SomeSchemaElement implements SchemaFileElement
public class SomeSchemaElement implements SchemaElement
{
  private final ObjectClass objectClass;
  private AttributeType attributeType;
@@ -294,4 +294,10 @@
      .toSchema();
    return schema.getAttributeType(attributeType.getNameOrOID());
  }
  @Override
  public String getDescription()
  {
    return attributeType != null ? attributeType.getDescription() : objectClass.getDescription();
  }
}
opendj-server-legacy/src/main/java/org/opends/server/types/CommonSchemaElements.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.types;
@@ -26,6 +26,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import static org.forgerock.util.Reject.*;
import static org.opends.messages.SchemaMessages.*;
@@ -62,7 +63,7 @@
     mayInstantiate=false,
     mayExtend=false,
     mayInvoke=true)
public abstract class CommonSchemaElements implements SchemaFileElement {
public abstract class CommonSchemaElements implements SchemaElement {
  /** Indicates whether this definition is declared "obsolete". */
  private final boolean isObsolete;
@@ -301,7 +302,7 @@
   *         for this schema definition, or <code>null</code> if it
   *         is not known or if it is not stored in any schema file.
   */
  public static String getSchemaFile(SchemaFileElement elem)
  public static String getSchemaFile(SchemaElement elem)
  {
    return getSingleValueProperty(elem, SCHEMA_PROPERTY_FILENAME);
  }
@@ -314,7 +315,7 @@
   * @return The single value for this property, or <code>null</code> if it
   *         is this property is not set.
   */
  public static String getSingleValueProperty(SchemaFileElement elem,
  public static String getSingleValueProperty(SchemaElement elem,
      String propertyName)
  {
    List<String> values = elem.getExtraProperties().get(propertyName);
@@ -335,7 +336,7 @@
   * @param  schemaFile  The name of the schema file that contains the
   *                     definition for this schema element.
   */
  public static void setSchemaFile(SchemaFileElement elem, String schemaFile)
  public static void setSchemaFile(SchemaElement elem, String schemaFile)
  {
    setExtraProperty(elem, SCHEMA_PROPERTY_FILENAME, schemaFile);
  }
@@ -346,6 +347,7 @@
   * @return The description for this schema definition, or
   *         <code>null</code> if there is no description.
   */
  @Override
  public final String getDescription() {
    return description;
  }
@@ -378,7 +380,7 @@
   * @param  value  The value for the "extra" property.  If it is
   *                {@code null}, then any existing definition will be removed.
   */
  public static void setExtraProperty(SchemaFileElement elem,
  public static void setExtraProperty(SchemaElement elem,
      String name, String value)
  {
    ifNull(name);
@@ -463,7 +465,7 @@
   * @return  The definition string used to create this attribute
   *          type including the X-SCHEMA-FILE extension.
   */
  public static String getDefinitionWithFileName(SchemaFileElement elem)
  public static String getDefinitionWithFileName(SchemaElement elem)
  {
    final String schemaFile = getSchemaFile(elem);
    final String definition = elem.toString();
opendj-server-legacy/src/main/java/org/opends/server/types/DITContentRule.java
@@ -17,6 +17,7 @@
package org.opends.server.types;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -41,8 +42,7 @@
     mayInstantiate=false,
     mayExtend=false,
     mayInvoke=true)
public final class DITContentRule
       implements SchemaFileElement
public final class DITContentRule implements SchemaElement
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -498,4 +498,12 @@
    return definition;
  }
  @Override
  public String getDescription()
  {
    return description;
  }
}
opendj-server-legacy/src/main/java/org/opends/server/types/DITStructureRule.java
@@ -12,7 +12,7 @@
 * information: "Portions Copyright [year] [name of copyright owner]".
 *
 * Copyright 2006-2008 Sun Microsystems, Inc.
 * Portions Copyright 2013-2015 ForgeRock AS.
 * Portions Copyright 2013-2016 ForgeRock AS.
 */
package org.opends.server.types;
@@ -23,6 +23,7 @@
import java.util.Set;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import static org.forgerock.util.Reject.*;
import static org.opends.server.util.ServerConstants.*;
@@ -36,8 +37,7 @@
     mayInstantiate=false,
     mayExtend=false,
     mayInvoke=true)
public final class DITStructureRule
       implements SchemaFileElement
public final class DITStructureRule implements SchemaElement
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -234,6 +234,7 @@
   *
   * @return  The description for this DIT structure rule.
   */
  @Override
  public String getDescription()
  {
    return description;
opendj-server-legacy/src/main/java/org/opends/server/types/LDAPSyntaxDescription.java
@@ -24,6 +24,8 @@
import java.util.List;
import java.util.Map;
import org.forgerock.opendj.ldap.schema.SchemaElement;
/**
 * This class defines a data structure for storing and interacting
 * with an ldap syntax, which defines the custom ldap syntaxes.
@@ -34,8 +36,7 @@
     mayExtend=false,
     mayInvoke=true)
public final class LDAPSyntaxDescription
       implements SchemaFileElement
public final class LDAPSyntaxDescription implements SchemaElement
{
  /**
   * The set of additional name-value pairs associated with this ldap
@@ -231,4 +232,10 @@
    return definition;
  }
  @Override
  public String getDescription()
  {
    return "";
  }
}
opendj-server-legacy/src/main/java/org/opends/server/types/NameForm.java
@@ -17,6 +17,7 @@
package org.opends.server.types;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.SchemaElement;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -40,8 +41,7 @@
     mayInstantiate=false,
     mayExtend=false,
     mayInvoke=true)
public final class NameForm
       implements SchemaFileElement
public final class NameForm implements SchemaElement
{
  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -275,6 +275,7 @@
   * @return  The description for this name form, or {@code true} if
   *          there is none.
   */
  @Override
  public String getDescription()
  {
    return description;
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -1861,7 +1861,7 @@
   * @throws  DirectoryException  If a problem occurs while rebuilding
   *                              any of the schema elements.
   */
  public void rebuildDependentElements(SchemaFileElement element) throws DirectoryException
  public void rebuildDependentElements(SchemaElement element) throws DirectoryException
  {
    try
    {
@@ -1907,7 +1907,7 @@
    }
  }
  private void circularityCheck(int depth, SchemaFileElement element) throws DirectoryException
  private void circularityCheck(int depth, SchemaElement element) throws DirectoryException
  {
    if (depth > 20)
    {
opendj-server-legacy/src/main/java/org/opends/server/types/SchemaFileElement.java
File was deleted