From a1ede5cb3f26233c8eebc603305c95d00e0b9305 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 04 Mar 2014 10:36:04 +0000
Subject: [PATCH] OPENDJ-1308 Migrate schema support

---
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java         |   40 
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java                        |   77 +--
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/SchemaFileElement.java                                |   55 -
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java                                         |   85 ---
 opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java |   41 -
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/Schema.java                                           |   87 +++
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java                                  |   88 ---
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java            |  139 ++--
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java            |   14 
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java                                      |   44 -
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java           |   34 
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java                                 |  159 +++---
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java                                   |   87 ---
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java                               |   22 
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java                                 |   88 ---
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java                            |   90 ---
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java             |  106 +--
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java                             |   94 ++-
 opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java               |  101 +--
 opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java                                    |   41 -
 20 files changed, 482 insertions(+), 1,010 deletions(-)

diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
index 7a3827e..ed5af94 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/datamodel/ServerDescriptor.java
@@ -22,8 +22,8 @@
  *
  *
  *      Copyright 2008-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2014 ForgeRock AS
  */
-
 package org.opends.guitools.controlpanel.datamodel;
 
 import java.io.File;
@@ -49,6 +49,8 @@
 import org.opends.server.types.OperatingSystem;
 import org.opends.server.types.Schema;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * This is just a class used to provide a data model describing what the
  * StatusPanelDialog will show to the user.
@@ -779,7 +781,7 @@
     {
       Object[] compareWithEqual = {attr1.getApproximateMatchingRule(),
           attr2.getApproximateMatchingRule(),
-          attr1.getDefinitionWithFileName(), attr2.getDefinitionWithFileName(),
+          getDefinitionWithFileName(attr1), getDefinitionWithFileName(attr2),
           attr1.getDescription(), attr2.getDescription(),
           attr1.getEqualityMatchingRule(), attr2.getEqualityMatchingRule(),
           attr1.getOrderingMatchingRule(), attr2.getOrderingMatchingRule(),
@@ -798,8 +800,8 @@
 
       if (areEqual)
       {
-        Iterable<?>[] iterables = {attr1.getExtraPropertyNames(),
-            attr2.getExtraPropertyNames(),
+        Iterable<?>[] iterables = {attr1.getExtraProperties().keySet(),
+            attr2.getExtraProperties().keySet(),
             attr1.getNormalizedNames(), attr2.getNormalizedNames(),
             attr1.getUserDefinedNames(), attr2.getUserDefinedNames()};
         for (int i=0; i<iterables.length && areEqual; i++)
@@ -840,7 +842,7 @@
     if (areEqual)
     {
       Object[] compareWithEqual = {
-          oc1.getDefinitionWithFileName(), oc2.getDefinitionWithFileName(),
+          getDefinitionWithFileName(oc1), getDefinitionWithFileName(oc2),
           oc1.getDescription(), oc2.getDescription(),
           oc1.getObjectClassType(), oc2.getObjectClassType(),
           oc1.getOptionalAttributes(), oc2.getOptionalAttributes(),
@@ -858,7 +860,7 @@
     if (areEqual)
     {
       Iterable<?>[] iterables = {
-          oc1.getExtraPropertyNames(), oc2.getExtraPropertyNames(),
+          oc1.getExtraProperties().keySet(), oc2.getExtraProperties().keySet(),
           oc1.getNormalizedNames(), oc2.getNormalizedNames(),
           oc1.getUserDefinedNames(), oc2.getUserDefinedNames()};
       for (int i=0; i<iterables.length && areEqual; i++)
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java
index 357f72b..b8222ff 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/DeleteSchemaElementsTask.java
@@ -76,22 +76,25 @@
 public class DeleteSchemaElementsTask extends Task
 {
   // The list of object classes that the user asked to delete.
-  LinkedHashSet<ObjectClass> providedOcsToDelete =
+  private LinkedHashSet<ObjectClass> providedOcsToDelete =
     new LinkedHashSet<ObjectClass>();
   // The list of attributes that the user asked to delete.
-  LinkedHashSet<AttributeType> providedAttrsToDelete =
+  private LinkedHashSet<AttributeType> providedAttrsToDelete =
     new LinkedHashSet<AttributeType>();
   // The list of object classes that will be actually deleted (some might be
   // recreated).
-  LinkedHashSet<ObjectClass> ocsToDelete = new LinkedHashSet<ObjectClass>();
+  private LinkedHashSet<ObjectClass> ocsToDelete =
+      new LinkedHashSet<ObjectClass>();
   // The list of attributes that will be actually deleted (some might be
   // recreated).
-  LinkedHashSet<AttributeType> attrsToDelete =
+  private LinkedHashSet<AttributeType> attrsToDelete =
     new LinkedHashSet<AttributeType>();
   // The list of object classes that will be recreated.
-  LinkedHashSet<ObjectClass> ocsToAdd = new LinkedHashSet<ObjectClass>();
+  private LinkedHashSet<ObjectClass> ocsToAdd =
+      new LinkedHashSet<ObjectClass>();
   // The list of attributes that will be recreated.
-  LinkedHashSet<AttributeType> attrsToAdd = new LinkedHashSet<AttributeType>();
+  private LinkedHashSet<AttributeType> attrsToAdd =
+      new LinkedHashSet<AttributeType>();
 
   /**
    * Constructor of the task.
@@ -403,7 +406,7 @@
   private void updateSchemaFile(CommonSchemaElements schemaElement)
   throws OpenDsException
   {
-    String schemaFile = getSchemaFile((SchemaFileElement)schemaElement);
+    String schemaFile = getSchemaFile(schemaElement);
     LDIFExportConfig exportConfig =
       new LDIFExportConfig(schemaFile,
           ExistingFileBehavior.OVERWRITE);
@@ -441,7 +444,7 @@
    */
   private String getSchemaFile(SchemaFileElement element)
   {
-    String schemaFile = element.getSchemaFile();
+    String schemaFile = CommonSchemaElements.getSchemaFile(element);
     if (schemaFile == null)
     {
       schemaFile = ConfigConstants.FILE_USER_SCHEMA_ELEMENTS;
@@ -483,14 +486,7 @@
    */
   private String getSchemaFileAttributeValue(CommonSchemaElements element)
   {
-    if (element instanceof AttributeType)
-    {
-      return ((AttributeType)element).getDefinition();
-    }
-    else
-    {
-      return ((ObjectClass)element).getDefinition();
-    }
+    return element.getDefinition();
   }
 
   /**
@@ -500,7 +496,7 @@
    */
   private void printEquivalentCommandToDelete(CommonSchemaElements element)
   {
-    String schemaFile = getSchemaFile((SchemaFileElement)element);
+    String schemaFile = getSchemaFile(element);
     String attrName = getSchemaFileAttributeName(element);
     String attrValue = getSchemaFileAttributeValue(element);
     if (!isServerRunning())
@@ -798,14 +794,10 @@
   {
     Map<String, List<String>> extraProperties =
       new HashMap<String, List<String>>();
-    for (String name : element.getExtraPropertyNames())
+    Map<String, List<String>> props = element.getExtraProperties();
+    for (String name : props.keySet())
     {
-      List<String> values = new ArrayList<String>();
-      Iterable<String> properties = element.getExtraProperty(name);
-      for (String v : properties)
-      {
-        values.add(v);
-      }
+      List<String> values = new ArrayList<String>(props.get(name));
       extraProperties.put(name, values);
     }
     return extraProperties;
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java
index 9c2b1e4..1458124 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/task/NewSchemaElementsTask.java
@@ -37,6 +37,7 @@
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.naming.NamingException;
@@ -63,11 +64,14 @@
 import org.forgerock.opendj.ldap.ModificationType;
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.OpenDsException;
+import org.opends.server.types.SchemaFileElement;
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.LDIFWriter;
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * An abstract class used to re-factor some code between the different tasks
  * that create elements in the schema.
@@ -97,6 +101,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Set<String> getBackends()
   {
     return Collections.emptySet();
@@ -105,6 +110,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean canLaunch(Task taskToBeLaunched,
       Collection<LocalizableMessage> incompatibilityReasons)
   {
@@ -124,6 +130,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void runTask()
   {
     state = State.RUNNING;
@@ -144,6 +151,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Type getType()
   {
     return Type.NEW_SCHEMA_ELEMENT;
@@ -152,6 +160,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public LocalizableMessage getTaskDescription()
   {
     if (attrsToAdd.size() == 1 && ocsToAdd.isEmpty())
@@ -212,6 +221,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   protected String getCommandLinePath()
   {
     return null;
@@ -220,6 +230,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   protected List<String> getCommandLineArguments()
   {
     return Collections.emptyList();
@@ -234,6 +245,7 @@
       addAttributeOnline(attr);
       SwingUtilities.invokeLater(new Runnable()
       {
+        @Override
         public void run()
         {
           getProgressDialog().appendProgressHtml(Utilities.applyFont("<br><br>",
@@ -246,6 +258,7 @@
       addObjectClassOnline(oc);
       SwingUtilities.invokeLater(new Runnable()
       {
+        @Override
         public void run()
         {
           getProgressDialog().appendProgressHtml(Utilities.applyFont("<br><br>",
@@ -258,57 +271,16 @@
   private void updateSchemaOffline() throws OpenDsException
   {
     // Group the changes in the same schema file.
-    LinkedHashMap<String, List<AttributeType>> hmAttrs =
-      new LinkedHashMap<String, List<AttributeType>>();
-    for (AttributeType attr : attrsToAdd)
-    {
-      String fileName = getFileName(attr);
-      if (fileName == null)
-      {
-        fileName = "";
-      }
-      List<AttributeType> attrs = hmAttrs.get(fileName);
-      if (attrs == null)
-      {
-        attrs = new ArrayList<AttributeType>();
-        hmAttrs.put(fileName, attrs);
-      }
-      attrs.add(attr);
-    }
-
-    LinkedHashMap<String, List<ObjectClass>> hmOcs =
-      new LinkedHashMap<String, List<ObjectClass>>();
-    for (ObjectClass oc : ocsToAdd)
-    {
-      String fileName = getFileName(oc);
-      if (fileName == null)
-      {
-        fileName = "";
-      }
-      List<ObjectClass> ocs = hmOcs.get(fileName);
-      if (ocs == null)
-      {
-        ocs = new ArrayList<ObjectClass>();
-        hmOcs.put(fileName, ocs);
-      }
-      ocs.add(oc);
-    }
+    LinkedHashMap<String, List<AttributeType>> hmAttrs = copy(attrsToAdd);
+    LinkedHashMap<String, List<ObjectClass>> hmOcs = copy(ocsToAdd);
 
     LinkedHashSet<String> allFileNames = new LinkedHashSet<String>();
     allFileNames.addAll(hmAttrs.keySet());
     allFileNames.addAll(hmOcs.keySet());
     for (String fileName : allFileNames)
     {
-      List<AttributeType> attrs = hmAttrs.get(fileName);
-      List<ObjectClass> ocs = hmOcs.get(fileName);
-      if (attrs == null)
-      {
-        attrs = Collections.emptyList();
-      }
-      if (ocs == null)
-      {
-        ocs = Collections.emptyList();
-      }
+      List<AttributeType> attrs = get(hmAttrs, fileName);
+      List<ObjectClass> ocs = get(hmOcs, fileName);
 
       if (fileName.equals(""))
       {
@@ -317,6 +289,7 @@
       updateSchemaOffline(fileName, attrs, ocs);
       SwingUtilities.invokeLater(new Runnable()
       {
+        @Override
         public void run()
         {
           getProgressDialog().appendProgressHtml(Utilities.applyFont("<br><br>",
@@ -326,6 +299,40 @@
     }
   }
 
+  private <T extends SchemaFileElement> List<T> get(
+      LinkedHashMap<String, List<T>> hmElems, String fileName)
+  {
+    List<T> elems = hmElems.get(fileName);
+    if (elems != null)
+    {
+      return elems;
+    }
+    return Collections.emptyList();
+  }
+
+  private <T extends SchemaFileElement> LinkedHashMap<String, List<T>> copy(
+      LinkedHashSet<T> elemsToAdd)
+  {
+    LinkedHashMap<String, List<T>> hmElems =
+        new LinkedHashMap<String, List<T>>();
+    for (T elem : elemsToAdd)
+    {
+      String fileName = CommonSchemaElements.getSchemaFile(elem);
+      if (fileName == null)
+      {
+        fileName = "";
+      }
+      List<T> elems = hmElems.get(fileName);
+      if (elems == null)
+      {
+        elems = new ArrayList<T>();
+        hmElems.put(fileName, elems);
+      }
+      elems.add(elem);
+    }
+    return hmElems;
+  }
+
   private void addAttributeOnline(final AttributeType attribute)
   throws OpenDsException
   {
@@ -334,6 +341,7 @@
       /**
        * {@inheritDoc}
        */
+      @Override
       public void run()
       {
         printEquivalentCommandLineToAddOnline(attribute);
@@ -362,6 +370,7 @@
     notifyConfigurationElementCreated(attribute);
     SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         getProgressDialog().appendProgressHtml(
@@ -378,6 +387,7 @@
       /**
        * {@inheritDoc}
        */
+      @Override
       public void run()
       {
         printEquivalentCommandLineToAddOnline(objectClass);
@@ -406,6 +416,7 @@
     notifyConfigurationElementCreated(objectClass);
     SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         getProgressDialog().appendProgressHtml(
@@ -421,23 +432,16 @@
 
   private String getValueOffline(CommonSchemaElements element)
   {
-    Iterable<String> previousValues =
-      element.getExtraProperty(ServerConstants.SCHEMA_PROPERTY_FILENAME);
-    element.setExtraProperty(ServerConstants.SCHEMA_PROPERTY_FILENAME,
-        (String)null);
+    final Map<String, List<String>> props = element.getExtraProperties();
+    List<String> previousValues =
+        props.get(ServerConstants.SCHEMA_PROPERTY_FILENAME);
+    setExtraProperty(element, ServerConstants.SCHEMA_PROPERTY_FILENAME, null);
     String attributeWithoutFileDefinition = element.toString();
 
-    if (previousValues != null)
+    if (previousValues != null && !previousValues.isEmpty())
     {
-      ArrayList<String> vs = new ArrayList<String>();
-      for (String s : previousValues)
-      {
-        vs.add(s);
-      }
-      if (!vs.isEmpty())
-      {
-        element.setExtraProperty(ServerConstants.SCHEMA_PROPERTY_FILENAME, vs);
-      }
+      ArrayList<String> vs = new ArrayList<String>(previousValues);
+      element.setExtraProperty(ServerConstants.SCHEMA_PROPERTY_FILENAME, vs);
     }
     return attributeWithoutFileDefinition;
   }
@@ -491,21 +495,6 @@
     }
   }
 
-  private String getFileName(CommonSchemaElements element)
-  {
-    String value = null;
-    Iterable<String> vs =
-      element.getExtraProperty(ServerConstants.SCHEMA_PROPERTY_FILENAME);
-    if (vs != null)
-    {
-      if (vs.iterator().hasNext())
-      {
-        value = vs.iterator().next();
-      }
-    }
-    return value;
-  }
-
   private void updateSchemaOffline(String file,
       final List<AttributeType> attributes,
       final List<ObjectClass> objectClasses) throws OpenDsException
@@ -528,6 +517,7 @@
       /**
        * {@inheritDoc}
        */
+      @Override
       public void run()
       {
         printEquivalentCommandToAddOffline(fileName, isSchemaFileDefined,
@@ -573,6 +563,7 @@
     }
     SwingUtilities.invokeLater(new Runnable()
     {
+      @Override
       public void run()
       {
         getProgressDialog().appendProgressHtml(
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
index 5a7f34d..9636003 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
@@ -98,6 +98,8 @@
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * The panel that displays a custom attribute definition.
  */
@@ -189,9 +191,8 @@
     createLayout();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public LocalizableMessage getTitle()
   {
     return INFO_CTRL_PANEL_CUSTOM_ATTRIBUTE_TITLE.get();
@@ -231,9 +232,8 @@
     add(delete, gbc);
     delete.addActionListener(new ActionListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         deleteAttribute();
@@ -248,9 +248,8 @@
     add(saveChanges, gbc);
     saveChanges.addActionListener(new ActionListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         ArrayList<LocalizableMessage> errors = new ArrayList<LocalizableMessage>();
@@ -369,9 +368,8 @@
       final BasicExpander expander = expanders[i];
       ChangeListener changeListener = new ChangeListener()
       {
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
+        @Override
         public void stateChanged(ChangeEvent e)
         {
           p.setVisible(expander.isSelected());
@@ -384,9 +382,8 @@
 
     ItemListener itemListener = new ItemListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void itemStateChanged(ItemEvent ev)
       {
         if (ev.getStateChange() == ItemEvent.SELECTED)
@@ -439,9 +436,7 @@
       final JList list = lists[i];
       MouseAdapter clickListener = new MouseAdapter()
       {
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
         @Override
         public void mouseClicked(MouseEvent ev)
         {
@@ -455,9 +450,7 @@
 
       KeyAdapter keyListener = new KeyAdapter()
       {
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
         @Override
         public void keyTyped(KeyEvent ev)
         {
@@ -473,25 +466,22 @@
 
     DocumentListener docListener = new DocumentListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void insertUpdate(DocumentEvent ev)
       {
         checkEnableSaveChanges();
       }
 
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void removeUpdate(DocumentEvent ev)
       {
         checkEnableSaveChanges();
       }
 
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void changedUpdate(DocumentEvent arg0)
       {
         checkEnableSaveChanges();
@@ -505,6 +495,7 @@
 
     ActionListener actionListener = new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         checkEnableSaveChanges();
@@ -526,18 +517,14 @@
     }
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public boolean mustCheckUnsavedChanges()
   {
     return saveChanges.isEnabled();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public UnsavedChangesDialog.Result checkUnsavedChanges()
   {
@@ -564,18 +551,14 @@
     return result;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   @Override
   public boolean requiresScroll()
   {
     return false;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
   public void update(AttributeType attr, Schema schema)
   {
     ignoreChangeEvents = true;
@@ -618,7 +601,7 @@
     }
     origin.setText(sOrigin);
 
-    String sFile = attr.getSchemaFile();
+    String sFile = getSchemaFile(attr);
     if (sFile == null)
     {
       sFile = "";
@@ -693,9 +676,8 @@
     ignoreChangeEvents = false;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void configurationChanged(ConfigurationChangeEvent ev)
   {
     ArrayList<AttributeSyntax<?>> newSyntaxes =
@@ -841,9 +823,8 @@
     }
     SwingUtilities.invokeLater(new Runnable()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void run()
       {
         delete.setEnabled(!authenticationRequired(desc) &&
@@ -857,17 +838,15 @@
     });
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public Component getPreferredFocusComponent()
   {
     return name;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void okClicked()
   {
   }
@@ -1309,21 +1288,17 @@
       {
         DefaultComboBoxModel model = (DefaultComboBoxModel)combos[i].getModel();
         int index = combos[i].getSelectedIndex();
+        if (model.getSize() > 0)
+        {
+          model.removeElementAt(0);
+        }
         if (rules[i] != null)
         {
-          if (model.getSize() > 0)
-          {
-            model.removeElementAt(0);
-          }
           model.insertElementAt(INFO_CTRL_PANEL_DEFAULT_DEFINED_IN_SYNTAX.get(
               rules[i].getNameOrOID()), 0);
         }
         else
         {
-          if (model.getSize() > 0)
-          {
-            model.removeElementAt(0);
-          }
           model.insertElementAt(NO_MATCHING_RULE, 0);
         }
         combos[i].setSelectedIndex(index);
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
index bb8dc36..9b5bc05 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
@@ -95,6 +95,8 @@
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * The panel that displays a custom object class definition.
  *
@@ -166,9 +168,8 @@
     createLayout();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public LocalizableMessage getTitle()
   {
     return INFO_CTRL_PANEL_CUSTOM_OBJECTCLASS_TITLE.get();
@@ -208,9 +209,8 @@
     add(delete, gbc);
     delete.addActionListener(new ActionListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         deleteObjectclass();
@@ -225,9 +225,8 @@
     add(saveChanges, gbc);
     saveChanges.addActionListener(new ActionListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         ArrayList<LocalizableMessage> errors = new ArrayList<LocalizableMessage>();
@@ -246,9 +245,8 @@
     SuperiorObjectClassesChangedListener listener =
       new SuperiorObjectClassesChangedListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void parentObjectClassesChanged(
           SuperiorObjectClassesChangedEvent ev)
       {
@@ -284,9 +282,8 @@
       new DoubleAddRemovePanel<AttributeType>(0, AttributeType.class);
     Comparator<AttributeType> comparator = new Comparator<AttributeType>()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public int compare(AttributeType attr1, AttributeType attr2)
       {
         return attr1.getNameOrOID().toLowerCase().compareTo(
@@ -385,9 +382,8 @@
     add(labels, comps, inlineHelps, p, gbc1);
     ChangeListener changeListener = new ChangeListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void stateChanged(ChangeEvent e)
       {
         p.setVisible(expander.isSelected());
@@ -399,25 +395,22 @@
 
     DocumentListener docListener = new DocumentListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void insertUpdate(DocumentEvent ev)
       {
         checkEnableSaveChanges();
       }
 
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void removeUpdate(DocumentEvent ev)
       {
         checkEnableSaveChanges();
       }
 
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void changedUpdate(DocumentEvent arg0)
       {
         checkEnableSaveChanges();
@@ -431,6 +424,7 @@
 
     ActionListener actionListener = new ActionListener()
     {
+      @Override
       public void actionPerformed(ActionEvent ev)
       {
         checkEnableSaveChanges();
@@ -441,23 +435,20 @@
 
     ListDataListener dataListener = new ListDataListener()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void contentsChanged(ListDataEvent e)
       {
         checkEnableSaveChanges();
       }
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void intervalAdded(ListDataEvent e)
       {
         checkEnableSaveChanges();
       }
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void intervalRemoved(ListDataEvent e)
       {
         checkEnableSaveChanges();
@@ -552,7 +543,7 @@
     }
     origin.setText(sOrigin);
 
-    String sFile = oc.getSchemaFile();
+    String sFile = getSchemaFile(oc);
     if (sFile == null)
     {
       sFile = "";
@@ -573,9 +564,8 @@
     ignoreChangeEvents = false;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void configurationChanged(ConfigurationChangeEvent ev)
   {
     final ServerDescriptor desc = ev.getNewDescriptor();
@@ -616,9 +606,8 @@
     }
     SwingUtilities.invokeLater(new Runnable()
     {
-      /**
-       * {@inheritDoc}
-       */
+      /** {@inheritDoc} */
+      @Override
       public void run()
       {
         delete.setEnabled(!authenticationRequired(desc)
@@ -638,17 +627,15 @@
     });
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public boolean mustCheckUnsavedChanges()
   {
     return saveChanges.isEnabled();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public UnsavedChangesDialog.Result checkUnsavedChanges()
   {
     UnsavedChangesDialog.Result result;
@@ -674,17 +661,15 @@
     return result;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public Component getPreferredFocusComponent()
   {
     return name;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void okClicked()
   {
   }
@@ -1111,11 +1096,11 @@
       if (sel != null)
       {
         ArrayList<Integer> indexes = new ArrayList<Integer>();
-        for (int j=0; j<sel.length; j++)
+        for (int element : sel)
         {
-          if (sel[j] < lists[i].getModel().getSize())
+          if (element < lists[i].getModel().getSize())
           {
-            indexes.add(sel[j]);
+            indexes.add(element);
           }
         }
         int[] newSelection = new int[indexes.size()];
@@ -1210,9 +1195,8 @@
       defaultRenderer = attributes.getAvailableList().getCellRenderer();
     }
 
-    /**
-     * {@inheritDoc}
-     */
+    /** {@inheritDoc} */
+    @Override
     public Component getListCellRendererComponent(JList list, Object value,
         int index, boolean isSelected, boolean cellHasFocus)
     {
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
index 4f1a7e5..f791ee5 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/StandardObjectClassPanel.java
@@ -60,6 +60,8 @@
 import org.opends.server.types.ObjectClass;
 import org.opends.server.types.Schema;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * The panel that displays a standard object class definition.
  *
@@ -103,32 +105,28 @@
     createLayout();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public LocalizableMessage getTitle()
   {
     return INFO_CTRL_PANEL_STANDARD_OBJECTCLASS_TITLE.get();
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public Component getPreferredFocusComponent()
   {
     return requiredAttributes;
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void configurationChanged(ConfigurationChangeEvent ev)
   {
   }
 
-  /**
-   * {@inheritDoc}
-   */
+  /** {@inheritDoc} */
+  @Override
   public void okClicked()
   {
   }
@@ -234,9 +232,8 @@
       final JList list = lists[i];
       MouseAdapter clickListener = new MouseAdapter()
       {
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
+        @Override
         public void mouseClicked(MouseEvent ev)
         {
           if (ev.getClickCount() == 1)
@@ -249,9 +246,8 @@
 
       KeyAdapter keyListener = new KeyAdapter()
       {
-        /**
-         * {@inheritDoc}
-         */
+        /** {@inheritDoc} */
+        @Override
         public void keyTyped(KeyEvent ev)
         {
           if ((ev.getKeyChar() == KeyEvent.VK_SPACE) ||
@@ -273,7 +269,7 @@
   static LocalizableMessage getOrigin(CommonSchemaElements element)
   {
     LocalizableMessageBuilder returnValue = new LocalizableMessageBuilder();
-    String fileName = element.getSchemaFile();
+    String fileName = getSchemaFile(element);
     String xOrigin = Utilities.getOrigin(element);
     if (xOrigin != null)
     {
diff --git a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
index 0d799df..2b83bf0 100644
--- a/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opendj-sdk/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/util/Utilities.java
@@ -48,7 +48,6 @@
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Date;
-import java.util.Iterator;
 import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -126,6 +125,8 @@
 import org.opends.server.util.ServerConstants;
 import org.opends.server.util.StaticUtils;
 
+import static org.opends.server.types.CommonSchemaElements.*;
+
 /**
  * A static class that provides miscellaneous functions.
  */
@@ -2112,17 +2113,10 @@
   public static boolean isStandard(SchemaFileElement fileElement)
   {
     boolean isStandard = false;
-    String fileName = fileElement.getSchemaFile();
+    String fileName = getSchemaFile(fileElement);
     if (fileName != null)
     {
-      for (String name : standardSchemaFileNames)
-      {
-        isStandard = fileName.equals(name);
-        if (isStandard)
-        {
-          break;
-        }
-      }
+      isStandard = contains(standardSchemaFileNames, fileName);
       if (!isStandard)
       {
         isStandard = fileName.toLowerCase().indexOf("-rfc") != -1;
@@ -2130,18 +2124,10 @@
     }
     else if (fileElement instanceof CommonSchemaElements)
     {
-      CommonSchemaElements element = (CommonSchemaElements)fileElement;
-      String xOrigin = getOrigin(element);
+      String xOrigin = getOrigin(fileElement);
       if (xOrigin != null)
       {
-        for (String name : standardSchemaOrigins)
-        {
-          isStandard = xOrigin.equals(name);
-          if (isStandard)
-          {
-            break;
-          }
-        }
+        isStandard = contains(standardSchemaOrigins, xOrigin);
         if (!isStandard)
         {
           isStandard = xOrigin.startsWith("RFC ") ||
@@ -2162,56 +2148,43 @@
   public static boolean isConfiguration(SchemaFileElement fileElement)
   {
     boolean isConfiguration = false;
-    String fileName = fileElement.getSchemaFile();
+    String fileName = getSchemaFile(fileElement);
     if (fileName != null)
     {
-      for (String name : configurationSchemaFileNames)
-      {
-        isConfiguration = fileName.equals(name);
-        if (isConfiguration)
-        {
-          break;
-        }
-      }
+      isConfiguration = contains(configurationSchemaFileNames, fileName);
     }
     else if (fileElement instanceof CommonSchemaElements)
     {
-      CommonSchemaElements element = (CommonSchemaElements)fileElement;
-      String xOrigin = getOrigin(element);
+      String xOrigin = getOrigin(fileElement);
       if (xOrigin != null)
       {
-        for (String name : configurationSchemaOrigins)
-        {
-          isConfiguration = xOrigin.equals(name);
-          if (isConfiguration)
-          {
-            break;
-          }
-        }
+        isConfiguration = contains(configurationSchemaOrigins, xOrigin);
       }
     }
     return isConfiguration;
   }
 
+  private static boolean contains(String[] names, String toFind)
+  {
+    for (String name : names)
+    {
+      if (toFind.equals(name))
+      {
+        return true;
+      }
+    }
+    return false;
+  }
+
   /**
    * Returns the origin of the provided schema element.
    * @param element the schema element.
    * @return the origin of the provided schema element.
    */
-  public static String getOrigin(CommonSchemaElements element)
+  public static String getOrigin(SchemaFileElement element)
   {
-    String xOrigin = null;
-    Iterable<String> it =
-      element.getExtraProperty(ServerConstants.SCHEMA_PROPERTY_ORIGIN);
-    if (it != null)
-    {
-      Iterator<String> iterator = it.iterator();
-      if (iterator.hasNext())
-      {
-        xOrigin = iterator.next();
-      }
-    }
-    return xOrigin;
+    return CommonSchemaElements.getSingleValueProperty(
+        element, ServerConstants.SCHEMA_PROPERTY_ORIGIN);
   }
 
   /**
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
index 8cf2f4a..3a6a2ed 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -97,6 +97,7 @@
 import static org.opends.messages.SchemaMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.schema.SchemaConstants.*;
+import static org.opends.server.types.CommonSchemaElements.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -753,7 +754,7 @@
 
           newValueSet.add(
               AttributeValues.create(attributeTypesType,
-                  attrType.getDefinitionWithFileName()));
+              getDefinitionWithFileName(attrType)));
         }
         catch (DirectoryException e)
         {
@@ -826,7 +827,7 @@
               value.getValue(), schema, false);
           oc = DirectoryServer.getObjectClass(oc.getOID());
           newValueSet.add(AttributeValues.create(
-              objectClassesType, oc.getDefinitionWithFileName()));
+              objectClassesType, getDefinitionWithFileName(oc)));
         }
         catch (DirectoryException e)
         {
@@ -1718,11 +1719,11 @@
     if (existingType == null)
     {
       schema.registerAttributeType(attributeType, false);
-      String schemaFile = attributeType.getSchemaFile();
+      String schemaFile = getSchemaFile(attributeType);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        attributeType.setSchemaFile(schemaFile);
+        setSchemaFile(attributeType, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -1733,22 +1734,22 @@
       schema.registerAttributeType(attributeType, false);
       schema.rebuildDependentElements(existingType);
 
-      if ((attributeType.getSchemaFile() == null) ||
-          (attributeType.getSchemaFile().length() == 0))
+      if ((getSchemaFile(attributeType) == null)
+          || (getSchemaFile(attributeType).length() == 0))
       {
-        String schemaFile = existingType.getSchemaFile();
+        String schemaFile = getSchemaFile(existingType);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        attributeType.setSchemaFile(schemaFile);
+        setSchemaFile(attributeType, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = attributeType.getSchemaFile();
-        String oldSchemaFile = existingType.getSchemaFile();
+        String newSchemaFile = getSchemaFile(attributeType);
+        String oldSchemaFile = getSchemaFile(existingType);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -1929,7 +1930,7 @@
     // If we've gotten here, then it's OK to remove the attribute type from
     // the schema.
     schema.deregisterAttributeType(removeType);
-    String schemaFile = removeType.getSchemaFile();
+    String schemaFile = getSchemaFile(removeType);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -2047,11 +2048,11 @@
     if (existingClass == null)
     {
       schema.registerObjectClass(objectClass, false);
-      String schemaFile = objectClass.getSchemaFile();
+      String schemaFile = getSchemaFile(objectClass);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        objectClass.setSchemaFile(schemaFile);
+        setSchemaFile(objectClass, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -2062,22 +2063,22 @@
       schema.registerObjectClass(objectClass, false);
       schema.rebuildDependentElements(existingClass);
 
-      if ((objectClass.getSchemaFile() == null) ||
-          (objectClass.getSchemaFile().length() == 0))
+      if ((getSchemaFile(objectClass) == null)
+          || (getSchemaFile(objectClass).length() == 0))
       {
-        String schemaFile = existingClass.getSchemaFile();
+        String schemaFile = getSchemaFile(existingClass);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        objectClass.setSchemaFile(schemaFile);
+        setSchemaFile(objectClass, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = objectClass.getSchemaFile();
-        String oldSchemaFile = existingClass.getSchemaFile();
+        String newSchemaFile = getSchemaFile(objectClass);
+        String oldSchemaFile = getSchemaFile(existingClass);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -2229,7 +2230,7 @@
     // If we've gotten here, then it's OK to remove the objectclass from the
     // schema.
     schema.deregisterObjectClass(removeClass);
-    String schemaFile = removeClass.getSchemaFile();
+    String schemaFile = getSchemaFile(removeClass);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -2350,11 +2351,11 @@
     if (existingNF == null)
     {
       schema.registerNameForm(nameForm, false);
-      String schemaFile = nameForm.getSchemaFile();
+      String schemaFile = getSchemaFile(nameForm);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        nameForm.setSchemaFile(schemaFile);
+        setSchemaFile(nameForm, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -2365,22 +2366,22 @@
       schema.registerNameForm(nameForm, false);
       schema.rebuildDependentElements(existingNF);
 
-      if ((nameForm.getSchemaFile() == null) ||
-          (nameForm.getSchemaFile().length() == 0))
+      if ((getSchemaFile(nameForm) == null) ||
+          (getSchemaFile(nameForm).length() == 0))
       {
-        String schemaFile = existingNF.getSchemaFile();
+        String schemaFile = getSchemaFile(existingNF);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        nameForm.setSchemaFile(schemaFile);
+        setSchemaFile(nameForm, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = nameForm.getSchemaFile();
-        String oldSchemaFile = existingNF.getSchemaFile();
+        String newSchemaFile = getSchemaFile(nameForm);
+        String oldSchemaFile = getSchemaFile(existingNF);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -2494,7 +2495,7 @@
     // If we've gotten here, then it's OK to remove the name form from the
     // schema.
     schema.deregisterNameForm(removeNF);
-    String schemaFile = removeNF.getSchemaFile();
+    String schemaFile = getSchemaFile(removeNF);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -2668,11 +2669,11 @@
     if (existingDCR == null)
     {
       schema.registerDITContentRule(ditContentRule, false);
-      String schemaFile = ditContentRule.getSchemaFile();
+      String schemaFile = getSchemaFile(ditContentRule);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        ditContentRule.setSchemaFile(schemaFile);
+        setSchemaFile(ditContentRule, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -2683,22 +2684,22 @@
       schema.registerDITContentRule(ditContentRule, false);
       schema.rebuildDependentElements(existingDCR);
 
-      if ((ditContentRule.getSchemaFile() == null) ||
-          (ditContentRule.getSchemaFile().length() == 0))
+      if ((getSchemaFile(ditContentRule) == null) ||
+          (getSchemaFile(ditContentRule).length() == 0))
       {
-        String schemaFile = existingDCR.getSchemaFile();
+        String schemaFile = getSchemaFile(existingDCR);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        ditContentRule.setSchemaFile(schemaFile);
+        setSchemaFile(ditContentRule, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = ditContentRule.getSchemaFile();
-        String oldSchemaFile = existingDCR.getSchemaFile();
+        String newSchemaFile = getSchemaFile(ditContentRule);
+        String oldSchemaFile = getSchemaFile(existingDCR);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -2764,7 +2765,7 @@
     // just remove the DIT content rule now, and if it is added back later then
     // there still won't be any conflict.
     schema.deregisterDITContentRule(removeDCR);
-    String schemaFile = removeDCR.getSchemaFile();
+    String schemaFile = getSchemaFile(removeDCR);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -2889,11 +2890,11 @@
     if (existingDSR == null)
     {
       schema.registerDITStructureRule(ditStructureRule, false);
-      String schemaFile = ditStructureRule.getSchemaFile();
+      String schemaFile = getSchemaFile(ditStructureRule);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        ditStructureRule.setSchemaFile(schemaFile);
+        setSchemaFile(ditStructureRule, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -2904,22 +2905,22 @@
       schema.registerDITStructureRule(ditStructureRule, false);
       schema.rebuildDependentElements(existingDSR);
 
-      if ((ditStructureRule.getSchemaFile() == null) ||
-          (ditStructureRule.getSchemaFile().length() == 0))
+      if ((getSchemaFile(ditStructureRule) == null) ||
+          (getSchemaFile(ditStructureRule).length() == 0))
       {
-        String schemaFile = existingDSR.getSchemaFile();
+        String schemaFile = getSchemaFile(existingDSR);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        ditStructureRule.setSchemaFile(schemaFile);
+        setSchemaFile(ditStructureRule, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = ditStructureRule.getSchemaFile();
-        String oldSchemaFile = existingDSR.getSchemaFile();
+        String newSchemaFile = getSchemaFile(ditStructureRule);
+        String oldSchemaFile = getSchemaFile(existingDSR);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -3039,7 +3040,7 @@
     // If we've gotten here, then it's OK to remove the DIT structure rule from
     // the schema.
     schema.deregisterDITStructureRule(removeDSR);
-    String schemaFile = removeDSR.getSchemaFile();
+    String schemaFile = getSchemaFile(removeDSR);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -3149,11 +3150,11 @@
     if (existingMRU == null)
     {
       schema.registerMatchingRuleUse(matchingRuleUse, false);
-      String schemaFile = matchingRuleUse.getSchemaFile();
+      String schemaFile = getSchemaFile(matchingRuleUse);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        matchingRuleUse.setSchemaFile(schemaFile);
+        setSchemaFile(matchingRuleUse, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -3164,22 +3165,22 @@
       schema.registerMatchingRuleUse(matchingRuleUse, false);
       schema.rebuildDependentElements(existingMRU);
 
-      if ((matchingRuleUse.getSchemaFile() == null) ||
-          (matchingRuleUse.getSchemaFile().length() == 0))
+      if ((getSchemaFile(matchingRuleUse) == null) ||
+          (getSchemaFile(matchingRuleUse).length() == 0))
       {
-        String schemaFile = existingMRU.getSchemaFile();
+        String schemaFile = getSchemaFile(existingMRU);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        matchingRuleUse.setSchemaFile(schemaFile);
+        setSchemaFile(matchingRuleUse, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = matchingRuleUse.getSchemaFile();
-        String oldSchemaFile = existingMRU.getSchemaFile();
+        String newSchemaFile = getSchemaFile(matchingRuleUse);
+        String oldSchemaFile = getSchemaFile(existingMRU);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -3246,7 +3247,7 @@
     // just remove the DIT content rule now, and if it is added back later then
     // there still won't be any conflict.
     schema.deregisterMatchingRuleUse(removeMRU);
-    String schemaFile = removeMRU.getSchemaFile();
+    String schemaFile = getSchemaFile(removeMRU);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -3298,11 +3299,11 @@
     if (existingLSD == null)
     {
       schema.registerLdapSyntaxDescription(ldapSyntaxDesc, false);
-      String schemaFile = ldapSyntaxDesc.getSchemaFile();
+      String schemaFile = getSchemaFile(ldapSyntaxDesc);
       if ((schemaFile == null) || (schemaFile.length() == 0))
       {
         schemaFile = FILE_USER_SCHEMA_ELEMENTS;
-        ldapSyntaxDesc.setSchemaFile(schemaFile);
+        setSchemaFile(ldapSyntaxDesc, schemaFile);
       }
 
       modifiedSchemaFiles.add(schemaFile);
@@ -3313,22 +3314,22 @@
       schema.registerLdapSyntaxDescription(ldapSyntaxDesc, false);
       schema.rebuildDependentElements(existingLSD);
 
-      if ((ldapSyntaxDesc.getSchemaFile() == null) ||
-          (ldapSyntaxDesc.getSchemaFile().length() == 0))
+      if ((getSchemaFile(ldapSyntaxDesc) == null) ||
+          (getSchemaFile(ldapSyntaxDesc).length() == 0))
       {
-        String schemaFile = ldapSyntaxDesc.getSchemaFile();
+        String schemaFile = getSchemaFile(ldapSyntaxDesc);
         if ((schemaFile == null) || (schemaFile.length() == 0))
         {
           schemaFile = FILE_USER_SCHEMA_ELEMENTS;
         }
 
-        ldapSyntaxDesc.setSchemaFile(schemaFile);
+        setSchemaFile(ldapSyntaxDesc, schemaFile);
         modifiedSchemaFiles.add(schemaFile);
       }
       else
       {
-        String newSchemaFile = ldapSyntaxDesc.getSchemaFile();
-        String oldSchemaFile = existingLSD.getSchemaFile();
+        String newSchemaFile = getSchemaFile(ldapSyntaxDesc);
+        String oldSchemaFile = getSchemaFile(existingLSD);
         if ((oldSchemaFile == null) || oldSchemaFile.equals(newSchemaFile))
         {
           modifiedSchemaFiles.add(newSchemaFile);
@@ -3365,7 +3366,7 @@
     }
 
     schema.deregisterLdapSyntaxDescription(removeLSD);
-    String schemaFile = removeLSD.getSchemaFile();
+    String schemaFile = getSchemaFile(removeLSD);
     if (schemaFile != null)
     {
       modifiedSchemaFiles.add(schemaFile);
@@ -3451,7 +3452,7 @@
     for (LDAPSyntaxDescription ldapSyntax :
                                    schema.getLdapSyntaxDescriptions().values())
     {
-      if(schemaFile.equals(ldapSyntax.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(ldapSyntax)))
       {
         values.add(AttributeValues.create(ldapSyntaxesType,
                 ldapSyntax.getDefinition()));
@@ -3474,7 +3475,7 @@
     values = new LinkedHashSet<AttributeValue>();
     for (AttributeType at : schema.getAttributeTypes().values())
     {
-      if (schemaFile.equals(at.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(at)))
       {
         addAttrTypeToSchemaFile(schema, schemaFile, at, values, addedTypes, 0);
       }
@@ -3497,7 +3498,7 @@
     values = new LinkedHashSet<AttributeValue>();
     for (ObjectClass oc : schema.getObjectClasses().values())
     {
-      if (schemaFile.equals(oc.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(oc)))
       {
         addObjectClassToSchemaFile(schema, schemaFile, oc, values, addedClasses,
                                    0);
@@ -3522,7 +3523,7 @@
     {
       for(NameForm nf : forms)
       {
-        if (schemaFile.equals(nf.getSchemaFile()))
+        if (schemaFile.equals(getSchemaFile(nf)))
         {
           values.add(AttributeValues.create(
               nameFormsType, nf.getDefinition()));
@@ -3546,7 +3547,7 @@
     values = new LinkedHashSet<AttributeValue>();
     for (DITContentRule dcr : schema.getDITContentRules().values())
     {
-      if (schemaFile.equals(dcr.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(dcr)))
       {
         values.add(AttributeValues.create(ditContentRulesType,
                                       dcr.getDefinition()));
@@ -3570,7 +3571,7 @@
     values = new LinkedHashSet<AttributeValue>();
     for (DITStructureRule dsr : schema.getDITStructureRulesByID().values())
     {
-      if (schemaFile.equals(dsr.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(dsr)))
       {
         addDITStructureRuleToSchemaFile(schema, schemaFile, dsr, values,
                                         addedDSRs, 0);
@@ -3593,7 +3594,7 @@
     values = new LinkedHashSet<AttributeValue>();
     for (MatchingRuleUse mru : schema.getMatchingRuleUses().values())
     {
-      if (schemaFile.equals(mru.getSchemaFile()))
+      if (schemaFile.equals(getSchemaFile(mru)))
       {
         values.add(AttributeValues.create(matchingRuleUsesType,
                                       mru.getDefinition()));
@@ -3672,7 +3673,7 @@
 
     AttributeType superiorType = attributeType.getSuperiorType();
     if ((superiorType != null) &&
-        schemaFile.equals(superiorType.getSchemaFile()) &&
+        schemaFile.equals(getSchemaFile(superiorType)) &&
         (! addedTypes.contains(superiorType)))
     {
       addAttrTypeToSchemaFile(schema, schemaFile, superiorType, values,
@@ -3723,7 +3724,7 @@
 
     for(ObjectClass superiorClass : objectClass.getSuperiorClasses())
     {
-      if (schemaFile.equals(superiorClass.getSchemaFile()) &&
+      if (schemaFile.equals(getSchemaFile(superiorClass)) &&
           (! addedClasses.contains(superiorClass)))
       {
         addObjectClassToSchemaFile(schema, schemaFile, superiorClass, values,
@@ -3774,7 +3775,7 @@
 
     for (DITStructureRule dsr : ditStructureRule.getSuperiorRules())
     {
-      if (schemaFile.equals(dsr.getSchemaFile()) && (! addedDSRs.contains(dsr)))
+      if (schemaFile.equals(getSchemaFile(dsr)) && (! addedDSRs.contains(dsr)))
       {
         addDITStructureRuleToSchemaFile(schema, schemaFile, dsr, values,
                                         addedDSRs, depth+1);
@@ -4363,7 +4364,7 @@
           // Parse the attribute type.
           AttributeType attrType = AttributeTypeSyntax.decodeAttributeType(
               v.getValue(), schema, false);
-          String schemaFile = attrType.getSchemaFile();
+          String schemaFile = getSchemaFile(attrType);
           if ((schemaFile != null) &&
               (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
           {
@@ -4410,7 +4411,7 @@
 
     for (AttributeType removeType : currentAttrTypes.values())
     {
-      String schemaFile = removeType.getSchemaFile();
+      String schemaFile = getSchemaFile(removeType);
       if ((schemaFile != null) &&
            ((schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)) ||
             (schemaFile.equals(CORE_SCHEMA_ELEMENTS_FILE))) )
@@ -4471,7 +4472,7 @@
           // appear in the new config schema.
           ObjectClass newObjectClass = ObjectClassSyntax.decodeObjectClass(
               v.getValue(), newSchema, true);
-          String schemaFile = newObjectClass.getSchemaFile();
+          String schemaFile = getSchemaFile(newObjectClass);
           if ((schemaFile != null) &&
               (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
           {
@@ -4523,7 +4524,7 @@
 
     for (ObjectClass removeClass : currentObjectClasses.values())
     {
-      String schemaFile = removeClass.getSchemaFile();
+      String schemaFile = getSchemaFile(removeClass);
       if ((schemaFile != null) &&
           (schemaFile.equals(CONFIG_SCHEMA_ELEMENTS_FILE)))
       {
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java
index 9958ffc..dbffb7f 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -45,6 +45,7 @@
 import static org.opends.messages.ConfigMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.schema.SchemaConstants.*;
+import static org.opends.server.types.CommonSchemaElements.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -754,9 +755,8 @@
           {
             syntaxDescription = LDAPSyntaxDescriptionSyntax.decodeLDAPSyntax(
                     v.getValue(),schema,false);
-            syntaxDescription.setExtraProperty(
-                    SCHEMA_PROPERTY_FILENAME, (String) null);
-            syntaxDescription.setSchemaFile(schemaFile);
+            setExtraProperty(syntaxDescription, SCHEMA_PROPERTY_FILENAME, null);
+            setSchemaFile(syntaxDescription, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -841,8 +841,8 @@
           {
             attrType = AttributeTypeSyntax.decodeAttributeType(v.getValue(),
                                                           schema, false);
-            attrType.setExtraProperty(SCHEMA_PROPERTY_FILENAME, (String) null);
-            attrType.setSchemaFile(schemaFile);
+            setExtraProperty(attrType, SCHEMA_PROPERTY_FILENAME, null);
+            setSchemaFile(attrType, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -923,8 +923,8 @@
           {
             oc =
               ObjectClassSyntax.decodeObjectClass(v.getValue(), schema, false);
-            oc.setExtraProperty(SCHEMA_PROPERTY_FILENAME, (String) null);
-            oc.setSchemaFile(schemaFile);
+            setExtraProperty(oc, SCHEMA_PROPERTY_FILENAME, null);
+            setSchemaFile(oc, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -1008,7 +1008,7 @@
           {
             nf = NameFormSyntax.decodeNameForm(v.getValue(), schema, false);
             nf.getExtraProperties().remove(SCHEMA_PROPERTY_FILENAME);
-            nf.setSchemaFile(schemaFile);
+            setSchemaFile(nf, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -1090,7 +1090,7 @@
             dcr = DITContentRuleSyntax.decodeDITContentRule(
                 v.getValue(), schema, false);
             dcr.getExtraProperties().remove(SCHEMA_PROPERTY_FILENAME);
-            dcr.setSchemaFile(schemaFile);
+            setSchemaFile(dcr, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -1173,7 +1173,7 @@
             dsr = DITStructureRuleSyntax.decodeDITStructureRule(
                 v.getValue(), schema, false);
             dsr.getExtraProperties().remove(SCHEMA_PROPERTY_FILENAME);
-            dsr.setSchemaFile(schemaFile);
+            setSchemaFile(dsr, schemaFile);
           }
           catch (DirectoryException de)
           {
@@ -1256,7 +1256,7 @@
             mru = MatchingRuleUseSyntax.decodeMatchingRuleUse(
                             v.getValue(), schema, false);
             mru.getExtraProperties().remove(SCHEMA_PROPERTY_FILENAME);
-            mru.setSchemaFile(schemaFile);
+            setSchemaFile(mru, schemaFile);
           }
           catch (DirectoryException de)
           {
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
index 8488328..07b2b3a 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
@@ -31,7 +31,6 @@
 import java.util.Map;
 
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.schema.AttributeUsage;
 import org.opends.server.api.ApproximateMatchingRule;
 import org.opends.server.api.AttributeSyntax;
@@ -39,7 +38,6 @@
 import org.opends.server.api.OrderingMatchingRule;
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.schema.AttributeTypeSyntax;
 
 import static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -66,7 +64,7 @@
      mayInvoke=true)
 public final class AttributeType
        extends CommonSchemaElements
-       implements SchemaFileElement, Comparable<AttributeType>
+       implements Comparable<AttributeType>
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
@@ -404,43 +402,6 @@
     return definition;
   }
 
-  /**
-   * Retrieves the definition string used to create this attribute
-   * type and including the X-SCHEMA-FILE extension.
-   *
-   * @return  The definition string used to create this attribute
-   *          type including the X-SCHEMA-FILE extension.
-   */
-  public String getDefinitionWithFileName()
-  {
-    if (getSchemaFile() != null)
-    {
-      int pos = definition.lastIndexOf(')');
-      String defStr = definition.substring(0, pos).trim() + " " +
-                      SCHEMA_PROPERTY_FILENAME + " '" +
-                      getSchemaFile() + "' )";
-      return defStr;
-    }
-    else
-      return definition;
-  }
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public AttributeType recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    AttributeType at =
-         AttributeTypeSyntax.decodeAttributeType(value, schema,
-                                              false);
-    at.setSchemaFile(getSchemaFile());
-    at.mayHaveSubordinateTypes = mayHaveSubordinateTypes;
-    return at;
-  }
-
 
 
   /**
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
index 08d5628..90a6379 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
@@ -71,7 +71,7 @@
      mayInstantiate=false,
      mayExtend=false,
      mayInvoke=true)
-public abstract class CommonSchemaElements {
+public abstract class CommonSchemaElements implements SchemaFileElement {
 
   // Indicates whether this definition is declared "obsolete".
   private final boolean isObsolete;
@@ -361,18 +361,31 @@
    * Retrieves the name of the schema file that contains the
    * definition for this schema definition.
    *
+   * @param elem The element where to get the schema file from
    * @return The name of the schema file that contains the definition
    *         for this schema definition, or <code>null</code> if it
    *         is not known or if it is not stored in any schema file.
    */
-  public final String getSchemaFile() {
+  public static String getSchemaFile(SchemaFileElement elem)
+  {
+    return getSingleValueProperty(elem, SCHEMA_PROPERTY_FILENAME);
+  }
 
-    List<String> values = extraProperties
-        .get(SCHEMA_PROPERTY_FILENAME);
+  /**
+   * Retrieves the name of a single value property for this schema element.
+   *
+   * @param elem The element where to get the single value property from
+   * @param propertyName The name of the property to get
+   * @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,
+      String propertyName)
+  {
+    List<String> values = elem.getExtraProperties().get(propertyName);
     if (values != null && !values.isEmpty()) {
       return values.get(0);
     }
-
     return null;
   }
 
@@ -385,12 +398,13 @@
    * overwritten.  If the provided schema file value is {@code null},
    * then any existing schema file definition will be removed.
    *
+   * @param elem The element where to set the schema file
    * @param  schemaFile  The name of the schema file that contains the
    *                     definition for this schema element.
    */
-  public final void setSchemaFile(String schemaFile) {
-
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
+  public static void setSchemaFile(SchemaFileElement elem, String schemaFile)
+  {
+    setExtraProperty(elem, SCHEMA_PROPERTY_FILENAME, schemaFile);
   }
 
 
@@ -421,34 +435,11 @@
 
 
 
-  /**
-   * Retrieves an iterable over the names of "extra" properties
-   * associated with this schema definition.
-   *
-   * @return Returns an iterable over the names of "extra" properties
-   *         associated with this schema definition.
-   */
-  public final Iterable<String> getExtraPropertyNames() {
-
-    return extraProperties.keySet();
-  }
-
-
-
-  /**
-   * Retrieves an iterable over the value(s) of the specified "extra"
-   * property for this schema definition.
-   *
-   * @param name
-   *          The name of the "extra" property for which to retrieve
-   *          the value(s).
-   * @return Returns an iterable over the value(s) of the specified
-   *         "extra" property for this schema definition, or
-   *         <code>null</code> if no such property is defined.
-   */
-  public final Iterable<String> getExtraProperty(String name) {
-
-    return extraProperties.get(name);
+  /** {@inheritDoc} */
+  @Override
+  public final Map<String, List<String>> getExtraProperties()
+  {
+    return extraProperties;
   }
 
 
@@ -459,26 +450,28 @@
    * will be overwritten.  If the value is {@code null}, then any
    * existing property with the given name will be removed.
    *
+   * @param elem The element where to set the extra property
    * @param  name   The name for the "extra" property.  It must not be
    *                {@code null}.
    * @param  value  The value for the "extra" property.  If it is
    *                {@code null}, then any existing definition will be
    *                removed.
    */
-  public final void setExtraProperty(String name, String value) {
-
+  public static final void setExtraProperty(SchemaFileElement elem,
+      String name, String value)
+  {
     ifNull(name);
 
     if (value == null)
     {
-      extraProperties.remove(name);
+      elem.getExtraProperties().remove(name);
     }
     else
     {
       LinkedList<String> values = new LinkedList<String>();
       values.add(value);
 
-      extraProperties.put(name, values);
+      elem.getExtraProperties().put(name, values);
     }
   }
 
@@ -667,4 +660,25 @@
    *          The buffer to which the information should be appended.
    */
   protected abstract void toStringContent(StringBuilder buffer);
+
+  /**
+   * Retrieves the definition string used to create this attribute
+   * type and including the X-SCHEMA-FILE extension.
+   *
+   * @param elem The element where to get definition from
+   * @return  The definition string used to create this attribute
+   *          type including the X-SCHEMA-FILE extension.
+   */
+  public static String getDefinitionWithFileName(SchemaFileElement elem)
+  {
+    final String schemaFile = getSchemaFile(elem);
+    final String definition = elem.getDefinition();
+    if (schemaFile != null)
+    {
+      int pos = definition.lastIndexOf(')');
+      return definition.substring(0, pos).trim() + " "
+          + SCHEMA_PROPERTY_FILENAME + " '" + schemaFile + "' )";
+    }
+    return definition;
+  }
 }
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
index d8d4cb4..14c15f2 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
@@ -29,14 +29,11 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 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.DITContentRuleSyntax;
 
 import static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -243,23 +240,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  @Override
-  public DITContentRule recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    DITContentRule dcr =
-         DITContentRuleSyntax.decodeDITContentRule(value, schema,
-                                                   false);
-    dcr.setSchemaFile(getSchemaFile());
-    return dcr;
-  }
-
-
-
-  /**
    * Retrieves the structural objectclass for this DIT content rule.
    *
    * @return  The structural objectclass for this DIT content rule.
@@ -327,44 +307,6 @@
 
 
   /**
-   * Retrieves the name of the schema file that contains the
-   * definition for this DIT content rule.
-   *
-   * @return  The name of the schema file that contains the definition
-   *          for this DIT content rule, or {@code null} if it is not
-   *          known or if it is not stored in any schema file.
-   */
-  @Override
-  public String getSchemaFile()
-  {
-    List<String> values =
-         extraProperties.get(SCHEMA_PROPERTY_FILENAME);
-    if ((values == null) || values.isEmpty())
-    {
-      return null;
-    }
-
-    return values.get(0);
-  }
-
-
-
-  /**
-   * Specifies the name of the schema file that contains the
-   * definition for this DIT content rule.
-   *
-   * @param  schemaFile  The name of the schema file that contains the
-   *                     definition for this DIT content rule.
-   */
-  @Override
-  public void setSchemaFile(String schemaFile)
-  {
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
-  }
-
-
-
-  /**
    * Retrieves the set of auxiliary objectclasses that may be used for
    * entries associated with this DIT content rule.
    *
@@ -494,6 +436,7 @@
    *          properties that may be associated with this DIT content
    *          rule and the value for that property.
    */
+  @Override
   public Map<String,List<String>> getExtraProperties()
   {
     return extraProperties;
@@ -502,34 +445,6 @@
 
 
   /**
-   * Specifies the provided "extra" property for this DIT content
-   * rule.
-   *
-   * @param  name   The name for the "extra" property.  It must not be
-   *                {@code null}.
-   * @param  value  The value for the "extra" property, or
-   *                {@code null} if the property is to be removed.
-   */
-  private void setExtraProperty(String name, String value)
-  {
-    ifNull(name);
-
-    if (value == null)
-    {
-      extraProperties.remove(name);
-    }
-    else
-    {
-      LinkedList<String> values = new LinkedList<String>();
-      values.add(value);
-
-      extraProperties.put(name, values);
-    }
-  }
-
-
-
-  /**
    * Indicates whether the provided object is equal to this DIT
    * content rule.  The object will be considered equal if it is a DIT
    * content rule for the same structural objectclass and the same
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
index 745f3bb..c3c5803 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
@@ -29,14 +29,11 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 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 static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -184,6 +181,7 @@
    * @return  The definition string used to create this DIT structure
    *          rule.
    */
+  @Override
   public String getDefinition()
   {
     return definition;
@@ -192,22 +190,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  public DITStructureRule recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    DITStructureRule dsr =
-         DITStructureRuleSyntax.decodeDITStructureRule(value, schema,
-                                                       false);
-    dsr.setSchemaFile(getSchemaFile());
-    return dsr;
-  }
-
-
-
-  /**
    * Retrieves the set of names that may be used to reference this DIT
    * structure rule.  The returned mapping will be between an all
    * lower-case form of the name and a name in the user-defined form
@@ -273,42 +255,6 @@
 
 
   /**
-   * Retrieves the path to the schema file that contains the
-   * definition for this DIT structure rule.
-   *
-   * @return  The path to the schema file that contains the definition
-   *          for this DIT structure rule, or {@code null} if it
-   *          is not known or if it is not stored in any schema file.
-   */
-  public String getSchemaFile()
-  {
-    List<String> values =
-         extraProperties.get(SCHEMA_PROPERTY_FILENAME);
-    if ((values == null) || values.isEmpty())
-    {
-      return null;
-    }
-
-    return values.get(0);
-  }
-
-
-
-  /**
-   * Specifies the path to the schema file that contains the
-   * definition for this DIT structure rule.
-   *
-   * @param  schemaFile  The path to the schema file that contains the
-   *                     definition for this DIT structure rule.
-   */
-  public void setSchemaFile(String schemaFile)
-  {
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
-  }
-
-
-
-  /**
    * Retrieves the description for this DIT structure rule.
    *
    * @return  The description for this DIT structure rule.
@@ -394,6 +340,7 @@
    *          properties that may be associated with this DIT
    *          structure rule and the value for that property.
    */
+  @Override
   public Map<String,List<String>> getExtraProperties()
   {
     return extraProperties;
@@ -402,34 +349,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  value  The value for the "extra" property, or
-   *                {@code null} if the property is to be removed.
-   */
-  private void setExtraProperty(String name, String value)
-  {
-    ifNull(name);
-
-    if (value == null)
-    {
-      extraProperties.remove(name);
-    }
-    else
-    {
-      LinkedList<String> values = new LinkedList<String>();
-      values.add(value);
-
-      extraProperties.put(name, values);
-    }
-  }
-
-
-
-  /**
    * 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.
@@ -439,6 +358,7 @@
    * @return  {@code true} if the provided object is equal to this
    *          attribute, or {@code false} if not.
    */
+  @Override
   public boolean equals(Object o)
   {
     if (this == o)
@@ -462,6 +382,7 @@
    *
    * @return  The hash code for this DIT structure rule.
    */
+  @Override
   public int hashCode()
   {
     return ruleID;
@@ -476,6 +397,7 @@
    * @return  The string representation of this attribute type in the
    *          form specified in RFC 2252.
    */
+  @Override
   public String toString()
   {
     StringBuilder buffer = new StringBuilder();
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
index f3bc646..e246ce1 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
@@ -28,16 +28,15 @@
 
 package org.opends.server.types;
 
-import org.forgerock.opendj.ldap.ByteString;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
-
 import org.opends.server.schema.LDAPSyntaxDescriptionSyntax;
-import static org.opends.server.util.ServerConstants.*;
+
 import static org.forgerock.util.Reject.*;
+import static org.opends.server.util.ServerConstants.*;
 
 
 
@@ -145,6 +144,7 @@
    * @return  The definition string used to create this ldap syntax
      *            description.
    */
+  @Override
   public String getDefinition()
   {
     return definition;
@@ -156,7 +156,7 @@
    * Retrieves the ldap syntax description syntax associated with
     * this ldap syntax.
    *
-   * @return  The description syntax for this defition.
+   * @return  The description syntax for this definition.
    */
   public LDAPSyntaxDescriptionSyntax getLdapSyntaxDescriptionSyntax()
   {
@@ -166,59 +166,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  public LDAPSyntaxDescription recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    LDAPSyntaxDescription ls =
-            LDAPSyntaxDescriptionSyntax.decodeLDAPSyntax(value,
-            schema, false);
-    ls.setSchemaFile(getSchemaFile());
-    return ls;
-  }
-
-
-
-  /**
-   * Retrieves the path to the schema file that contains the
-   * definition for this ldap syntax description.
-   *
-   * @return  The path to the schema file that contains the
-   *           definition for this ldap syntax description, or
-   *           {@code null} if it is not known or if it is not stored
-   *           in any schema file.
-   */
-  public String getSchemaFile()
-  {
-    List<String> values =
-         extraProperties.get(SCHEMA_PROPERTY_FILENAME);
-    if ((values == null) || values.isEmpty())
-    {
-      return null;
-    }
-
-    return values.get(0);
-  }
-
-
-
-  /**
-   * Specifies the path to the schema file that contains the
-   * definition for this ldap syntax description.
-   *
-   * @param  schemaFile  The path to the schema file that contains
-   *                the definition for this ldap syntax description.
-   */
-  public void setSchemaFile(String schemaFile)
-  {
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
-  }
-
-
-
-  /**
    * Retrieves the description for this ldap syntax description.
    *
    * @return  The description for this ldap syntax description, or
@@ -241,6 +188,7 @@
    *          properties that may be associated with this ldap syntax
    *          description and the value for that property.
    */
+  @Override
   public Map<String,List<String>> getExtraProperties()
   {
     return extraProperties;
@@ -270,34 +218,6 @@
    * Specifies the provided "extra" property for this ldap syntax
    * description.
    *
-   * @param  name   The name for the "extra" property.  It must not
-   *                          be {@code null}.
-   * @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)
-  {
-    ifNull(name);
-
-    if (value == null)
-    {
-      extraProperties.remove(name);
-    }
-    else
-    {
-      LinkedList<String> values = new LinkedList<String>();
-      values.add(value);
-
-      extraProperties.put(name, values);
-    }
-  }
-
-
-
-  /**
-   * Specifies the provided "extra" property for this ldap syntax
-   * description.
-   *
    * @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
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
index d965501..c358501 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
@@ -29,15 +29,12 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 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 static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -184,6 +181,7 @@
    * @return  The definition string used to create this matching rule
    *          use.
    */
+  @Override
   public String getDefinition()
   {
     return definition;
@@ -192,22 +190,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  public MatchingRuleUse recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    MatchingRuleUse mru =
-         MatchingRuleUseSyntax.decodeMatchingRuleUse(value, schema,
-                                                     false);
-    mru.setSchemaFile(getSchemaFile());
-    return mru;
-  }
-
-
-
-  /**
    * Retrieves the matching rule for this matching rule use.
    *
    * @return  The matching rule for this matching rule use.
@@ -271,42 +253,6 @@
 
 
   /**
-   * Retrieves the path to the schema file that contains the
-   * definition for this matching rule use.
-   *
-   * @return  The path to the schema file that contains the definition
-   *          for this matching rule use, or {@code null} if it is not
-   *          known or if it is not stored in any schema file.
-   */
-  public String getSchemaFile()
-  {
-    List<String> values =
-         extraProperties.get(SCHEMA_PROPERTY_FILENAME);
-    if ((values == null) || values.isEmpty())
-    {
-      return null;
-    }
-
-    return values.get(0);
-  }
-
-
-
-  /**
-   * Specifies the path to the schema file that contains the
-   * definition for this matching rule use.
-   *
-   * @param  schemaFile  The path to the schema file that contains the
-   *                     definition for this matching rule use.
-   */
-  public void setSchemaFile(String schemaFile)
-  {
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
-  }
-
-
-
-  /**
    * Retrieves the description for this matching rule use.
    *
    * @return  The description for this matching rule use, or
@@ -373,6 +319,7 @@
    *          properties that may be associated with this matching
    *          rule use and the value for that property.
    */
+  @Override
   public Map<String,List<String>> getExtraProperties()
   {
     return extraProperties;
@@ -381,34 +328,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  value  The value for the "extra" property, or
-   *                {@code null} if the property is to be removed.
-   */
-  private void setExtraProperty(String name, String value)
-  {
-    ifNull(name);
-
-    if (value == null)
-    {
-      extraProperties.remove(name);
-    }
-    else
-    {
-      LinkedList<String> values = new LinkedList<String>();
-      values.add(value);
-
-      extraProperties.put(name, values);
-    }
-  }
-
-
-
-  /**
    * 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.
@@ -418,6 +337,7 @@
    * @return  {@code true} if the provided object is equal to this
    *          matching rule use, or {@code false} if not.
    */
+  @Override
   public boolean equals(Object o)
   {
     if (this == o)
@@ -441,6 +361,7 @@
    *
    * @return  The hash code for this matching rule use.
    */
+  @Override
   public int hashCode()
   {
     return matchingRule.hashCode();
@@ -455,6 +376,7 @@
    * @return  The string representation of this matching rule use in
    *          the form specified in RFC 2252.
    */
+  @Override
   public String toString()
   {
     StringBuilder buffer = new StringBuilder();
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
index ecd8b85..8900991 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
@@ -29,14 +29,11 @@
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.LinkedHashSet;
-import java.util.LinkedList;
 import java.util.List;
 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 static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -200,6 +197,7 @@
    *
    * @return  The definition string used to create this name form.
    */
+  @Override
   public String getDefinition()
   {
     return definition;
@@ -208,20 +206,6 @@
 
 
   /**
-   * {@inheritDoc}
-   */
-  public NameForm recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    NameForm nf = NameFormSyntax.decodeNameForm(value, schema, false);
-    nf.setSchemaFile(getSchemaFile());
-    return nf;
-  }
-
-
-
-  /**
    * Retrieves the set of names that may be used to reference this
    * name form.  The returned object will be a mapping between each
    * name in all lowercase characters and that name in a user-defined
@@ -313,42 +297,6 @@
 
 
   /**
-   * Retrieves the path to the schema file that contains the
-   * definition for this name form.
-   *
-   * @return  The path to the schema file that contains the definition
-   *          for this name form, or {@code null} if it is not known
-   *          or if it is not stored in any schema file.
-   */
-  public String getSchemaFile()
-  {
-    List<String> values =
-         extraProperties.get(SCHEMA_PROPERTY_FILENAME);
-    if ((values == null) || values.isEmpty())
-    {
-      return null;
-    }
-
-    return values.get(0);
-  }
-
-
-
-  /**
-   * Specifies the path to the schema file that contains the
-   * definition for this name form.
-   *
-   * @param  schemaFile  The path to the schema file that contains the
-   *                     definition for this name form.
-   */
-  public void setSchemaFile(String schemaFile)
-  {
-    setExtraProperty(SCHEMA_PROPERTY_FILENAME, schemaFile);
-  }
-
-
-
-  /**
    * Retrieves the description for this name form.
    *
    * @return  The description for this name form, or {@code true} if
@@ -474,6 +422,7 @@
    *          properties that may be associated with this name form
    *          and the value for that property.
    */
+  @Override
   public Map<String,List<String>> getExtraProperties()
   {
     return extraProperties;
@@ -482,33 +431,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  value  The value for the "extra" property, or
-   *                {@code null} if the property is to be removed.
-   */
-  private void setExtraProperty(String name, String value)
-  {
-    ifNull(name);
-
-    if (value == null)
-    {
-      extraProperties.remove(name);
-    }
-    else
-    {
-      LinkedList<String> values = new LinkedList<String>();
-      values.add(value);
-
-      extraProperties.put(name, values);
-    }
-  }
-
-
-
-  /**
    * 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.
@@ -518,6 +440,7 @@
    * @return  {@code true} if the provided object is equal to this
    *          name form, or {@code true} if not.
    */
+  @Override
   public boolean equals(Object o)
   {
     if (this == o)
@@ -541,6 +464,7 @@
    *
    * @return  The hash code for this name form.
    */
+  @Override
   public int hashCode()
   {
     int oidLength = oid.length();
@@ -562,6 +486,7 @@
    * @return  The string representation of this name form in the form
    *          specified in RFC 2252.
    */
+  @Override
   public String toString()
   {
     StringBuilder buffer = new StringBuilder();
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
index 8992874..a97967d 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
@@ -36,9 +36,7 @@
 import java.util.Set;
 
 import org.forgerock.i18n.slf4j.LocalizedLogger;
-import org.forgerock.opendj.ldap.ByteString;
 import org.forgerock.opendj.ldap.schema.ObjectClassType;
-import org.opends.server.schema.ObjectClassSyntax;
 
 import static org.forgerock.util.Reject.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -65,7 +63,6 @@
      mayInvoke=true)
 public final class ObjectClass
        extends CommonSchemaElements
-       implements SchemaFileElement
 {
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
@@ -284,50 +281,11 @@
 
 
   /**
-   * Retrieves the definition string used to create this objectclass
-   * including the X-SCHEMA-FILE extension.
-   *
-   * @return  The definition string used to create this objectclass
-   *          including the X-SCHEMA-FILE extension.
-   */
-  public String getDefinitionWithFileName()
-  {
-    if (getSchemaFile() != null)
-    {
-      int pos = definition.lastIndexOf(')');
-      String defStr = definition.substring(0, pos).trim() + " " +
-                      SCHEMA_PROPERTY_FILENAME + " '" +
-                      getSchemaFile() + "' )";
-      return defStr;
-    }
-    else
-      return definition;
-  }
-
-
-
-  /**
-   * {@inheritDoc}
-   */
-  @Override
-  public ObjectClass recreateFromDefinition(Schema schema)
-         throws DirectoryException
-  {
-    ByteString value  = ByteString.valueOf(definition);
-    ObjectClass oc = ObjectClassSyntax.decodeObjectClass(value,
-                                            schema, false);
-    oc.setSchemaFile(getSchemaFile());
-    return oc;
-  }
-
-
-
-  /**
    * Retrieves an unmodifiable view of the set of direct superior
    * classes for this objectclass.
    *
    * @return An unmodifiable view of the set of  direct superior
-   *                classes for this objectlass,
+   *                classes for this objectclass,
    */
   public Set<ObjectClass> getSuperiorClasses() {
     return superiorClasses;
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/Schema.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/Schema.java
index db6ec9c..7b6b4fc 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/Schema.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/Schema.java
@@ -54,12 +54,19 @@
 import org.opends.server.api.SubstringMatchingRule;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.SchemaConfigManager;
+import org.opends.server.schema.AttributeTypeSyntax;
+import org.opends.server.schema.DITContentRuleSyntax;
+import org.opends.server.schema.DITStructureRuleSyntax;
+import org.opends.server.schema.MatchingRuleUseSyntax;
+import org.opends.server.schema.NameFormSyntax;
+import org.opends.server.schema.ObjectClassSyntax;
 import org.opends.server.schema.CaseIgnoreEqualityMatchingRule;
 import org.opends.server.util.StaticUtils;
 
 import static org.opends.messages.BackendMessages.*;
 import static org.opends.messages.CoreMessages.*;
 import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.types.CommonSchemaElements.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 
@@ -3232,7 +3239,7 @@
         if ((at.getSuperiorType() != null) &&
             at.getSuperiorType().equals(t))
         {
-          AttributeType newAT = at.recreateFromDefinition(this);
+          AttributeType newAT = recreateFromDefinition(at);
           deregisterAttributeType(at);
           registerAttributeType(newAT, true);
           rebuildDependentElements(at, depth+1);
@@ -3244,7 +3251,7 @@
         if (oc.getRequiredAttributes().contains(t) ||
             oc.getOptionalAttributes().contains(t))
         {
-          ObjectClass newOC = oc.recreateFromDefinition(this);
+          ObjectClass newOC = recreateFromDefinition(oc);
           deregisterObjectClass(oc);
           registerObjectClass(newOC, true);
           rebuildDependentElements(oc, depth+1);
@@ -3258,7 +3265,7 @@
           if (nf.getRequiredAttributes().contains(t) ||
               nf.getOptionalAttributes().contains(t))
           {
-            NameForm newNF = nf.recreateFromDefinition(this);
+            NameForm newNF = recreateFromDefinition(nf);
             deregisterNameForm(nf);
             registerNameForm(newNF, true);
             rebuildDependentElements(nf, depth+1);
@@ -3272,7 +3279,7 @@
             dcr.getOptionalAttributes().contains(t) ||
             dcr.getProhibitedAttributes().contains(t))
         {
-          DITContentRule newDCR = dcr.recreateFromDefinition(this);
+          DITContentRule newDCR = recreateFromDefinition(dcr);
           deregisterDITContentRule(dcr);
           registerDITContentRule(newDCR, true);
           rebuildDependentElements(dcr, depth+1);
@@ -3283,7 +3290,7 @@
       {
         if (mru.getAttributes().contains(t))
         {
-          MatchingRuleUse newMRU = mru.recreateFromDefinition(this);
+          MatchingRuleUse newMRU = recreateFromDefinition(mru);
           deregisterMatchingRuleUse(mru);
           registerMatchingRuleUse(newMRU, true);
           rebuildDependentElements(mru, depth+1);
@@ -3298,7 +3305,7 @@
       {
         if (oc.getSuperiorClasses().contains(c))
         {
-          ObjectClass newOC = oc.recreateFromDefinition(this);
+          ObjectClass newOC = recreateFromDefinition(oc);
           deregisterObjectClass(oc);
           registerObjectClass(newOC, true);
           rebuildDependentElements(oc, depth+1);
@@ -3312,7 +3319,7 @@
         {
           if (nf != null)
           {
-            NameForm newNF = nf.recreateFromDefinition(this);
+            NameForm newNF = recreateFromDefinition(nf);
             deregisterNameForm(nf);
             registerNameForm(newNF, true);
             rebuildDependentElements(nf, depth+1);
@@ -3325,7 +3332,7 @@
         if (dcr.getStructuralClass().equals(c) ||
             dcr.getAuxiliaryClasses().contains(c))
         {
-          DITContentRule newDCR = dcr.recreateFromDefinition(this);
+          DITContentRule newDCR = recreateFromDefinition(dcr);
           deregisterDITContentRule(dcr);
           registerDITContentRule(newDCR, true);
           rebuildDependentElements(dcr, depth+1);
@@ -3338,7 +3345,7 @@
       DITStructureRule dsr = ditStructureRulesByNameForm.get(n);
       if (dsr != null)
       {
-        DITStructureRule newDSR = dsr.recreateFromDefinition(this);
+        DITStructureRule newDSR = recreateFromDefinition(dsr);
         deregisterDITStructureRule(dsr);
         registerDITStructureRule(newDSR, true);
         rebuildDependentElements(dsr, depth+1);
@@ -3351,7 +3358,7 @@
       {
         if (dsr.getSuperiorRules().contains(d))
         {
-          DITStructureRule newDSR = dsr.recreateFromDefinition(this);
+          DITStructureRule newDSR = recreateFromDefinition(dsr);
           deregisterDITStructureRule(dsr);
           registerDITStructureRule(newDSR, true);
           rebuildDependentElements(dsr, depth+1);
@@ -3360,7 +3367,67 @@
     }
   }
 
+  private AttributeType recreateFromDefinition(AttributeType attrType)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(attrType.getDefinition());
+    AttributeType copy =
+        AttributeTypeSyntax.decodeAttributeType(value, this, false);
+    setSchemaFile(copy, getSchemaFile(attrType));
+    if (attrType.mayHaveSubordinateTypes())
+    {
+      copy.setMayHaveSubordinateTypes();
+    }
+    return copy;
+  }
 
+  private DITContentRule recreateFromDefinition(DITContentRule dcr)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(dcr.getDefinition());
+    DITContentRule copy =
+        DITContentRuleSyntax.decodeDITContentRule(value, this, false);
+    setSchemaFile(copy, getSchemaFile(dcr));
+    return copy;
+  }
+
+  private DITStructureRule recreateFromDefinition(DITStructureRule dsr)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(dsr.getDefinition());
+    DITStructureRule copy =
+        DITStructureRuleSyntax.decodeDITStructureRule(value, this, false);
+    setSchemaFile(copy, getSchemaFile(dsr));
+    return copy;
+  }
+
+  private MatchingRuleUse recreateFromDefinition(MatchingRuleUse mru)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(mru.getDefinition());
+    MatchingRuleUse copy =
+        MatchingRuleUseSyntax.decodeMatchingRuleUse(value, this, false);
+    setSchemaFile(copy, getSchemaFile(mru));
+    return copy;
+  }
+
+  private NameForm recreateFromDefinition(NameForm nf)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(nf.getDefinition());
+    NameForm copy = NameFormSyntax.decodeNameForm(value, this, false);
+    setSchemaFile(copy, getSchemaFile(nf));
+    return copy;
+  }
+
+  private ObjectClass recreateFromDefinition(ObjectClass oc)
+      throws DirectoryException
+  {
+    ByteString value = ByteString.valueOf(oc.getDefinition());
+    ObjectClass copy = ObjectClassSyntax.decodeObjectClass(value, this, false);
+    setSchemaFile(copy, getSchemaFile(oc));
+    return copy;
+  }
 
   /**
    * Creates a new <CODE>Schema</CODE> object that is a duplicate of
diff --git a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/SchemaFileElement.java b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/SchemaFileElement.java
index 840c987..71132c6 100644
--- a/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/SchemaFileElement.java
+++ b/opendj-sdk/opendj3-server-dev/src/server/org/opends/server/types/SchemaFileElement.java
@@ -22,11 +22,12 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
- *      Portions copyright 2013 ForgeRock AS.
+ *      Portions copyright 2013-2014 ForgeRock AS.
  */
 package org.opends.server.types;
 
-
+import java.util.List;
+import java.util.Map;
 
 /**
  * This interface defines a set of methods that must be provided by a
@@ -52,29 +53,18 @@
      mayInvoke=true)
 public interface SchemaFileElement
 {
-  /**
-   * Retrieves the name of the schema file in which this element is
-   * defined.
-   *
-   * @return  The name of the schema file in which this element is
-   *          defined, or {@code null} if it is not known or this
-   *          element is not defined in any schema file.
-   */
-  public String getSchemaFile();
-
-
 
   /**
-   * Specifies the name of the schema file in which this element is
-   * defined.
+   * Retrieves the "extra" properties for this schema definition.
+   * <p>
+   * FIXME Contrary to the SDK, this method returns a modifiable Map.
    *
-   * @param  schemaFile  The name of the schema file in which this
-   *                     element is defined, or {@code null} if it is
-   *                     not defined in any schema file.
+   * @return Returns a Map of the "extra" properties for this schema definition,
+   *         where the key is the property name and the value is a List of
+   *         Strings representing the property values.
+   *         Single valued properties have a List with a single element inside.
    */
-  public void setSchemaFile(String schemaFile);
-
-
+  Map<String, List<String>> getExtraProperties();
 
   /**
    * Retrieves the definition string that is used to represent this
@@ -85,27 +75,4 @@
    */
   public String getDefinition();
 
-
-
-  /**
-   * Creates a new instance of this schema element based on the definition from
-   * the schema file. The new instance should also be created with all
-   * appropriate state information that may not be directly represented in the
-   * schema definition (e.g., the name of the schema file containing the
-   * definition). <BR>
-   * <BR>
-   * Whenever an existing schema file element is modified with the server
-   * online, this method will be invoked to recreate any schema elements that
-   * might have been dependent upon the modified element.
-   *
-   * @param schema
-   *          The schema which should be used for resolving dependencies.
-   * @return A new instance of this schema element based on the definition.
-   * @throws DirectoryException
-   *           If a problem occurs while attempting to create the new instance
-   *           of this schema element.
-   */
-  public SchemaFileElement recreateFromDefinition(Schema schema)
-         throws DirectoryException;
 }
-
diff --git a/opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java b/opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java
index 915d054..d1ee16d 100644
--- a/opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java
+++ b/opendj-sdk/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/types/TestCommonSchemaElements.java
@@ -41,6 +41,7 @@
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
+import static org.opends.server.types.CommonSchemaElements.*;
 
 
 /**
@@ -452,42 +453,34 @@
 
 
   /**
-   * Check that the
-   * {@link CommonSchemaElements#getExtraProperty(String)} method
+   * Check that the {@link CommonSchemaElements#getExtraProperties()} method
    * returns <code>null</code> when there is no property.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
    */
   @Test
   public final void testGetExtraPropertyDefault() throws Exception {
     SchemaDefinitionBuilder builder = getBuilder("test", "1.2.3");
     CommonSchemaElements d = builder.getInstance();
-    Assert.assertNull(d.getExtraProperty("test"));
+    Assert.assertNull(d.getExtraProperties().get("test"));
   }
 
 
 
   /**
-   * Check that the
-   * {@link CommonSchemaElements#getExtraProperty(String)} method
+   * Check that the {@link CommonSchemaElements#getExtraProperties()} method
    * returns values.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
    */
   @Test
-  public final void testGetExtraProperty() throws Exception {
+  public final void testGetExtraProperties() throws Exception {
     SchemaDefinitionBuilder builder = getBuilder("test", "1.2.3");
     String[] expectedValues = new String[] { "one", "two" };
     builder.addExtraProperty("test", expectedValues);
     CommonSchemaElements d = builder.getInstance();
 
-    Assert.assertNotNull(d.getExtraProperty("test"));
-    int i = 0;
-    for (String value : d.getExtraProperty("test")) {
-      Assert.assertEquals(value, expectedValues[i]);
-      i++;
+    List<String> values = d.getExtraProperties().get("test");
+    Assert.assertNotNull(values);
+    for (int i = 0; i < values.size(); i++)
+    {
+      Assert.assertEquals(values.get(i), expectedValues[i]);
     }
   }
 
@@ -495,17 +488,13 @@
 
   /**
    * Check that the
-   * {@link CommonSchemaElements#getExtraPropertyNames()} method.
-   *
-   * @throws Exception
-   *           If the test failed unexpectedly.
+   * {@link CommonSchemaElements#getExtraProperties()} method.
    */
   @Test
   public final void testGetExtraPropertyNames() throws Exception {
     SchemaDefinitionBuilder builder = getBuilder("test", "1.2.3");
     CommonSchemaElements d = builder.getInstance();
-    Assert
-        .assertFalse(d.getExtraPropertyNames().iterator().hasNext());
+    Assert.assertFalse(d.getExtraProperties().keySet().iterator().hasNext());
   }
 
 
@@ -722,8 +711,7 @@
   @Test
   public final void testGetSchemaFileDefault() throws Exception {
     SchemaDefinitionBuilder builder = getBuilder(null, "1.2.3");
-    CommonSchemaElements d = builder.getInstance();
-    Assert.assertNull(d.getSchemaFile());
+    Assert.assertNull(getSchemaFile(builder.getInstance()));
   }
 
 
@@ -740,8 +728,7 @@
     SchemaDefinitionBuilder builder = getBuilder(null, "1.2.3");
     builder.addExtraProperty(
         ServerConstants.SCHEMA_PROPERTY_FILENAME, "/foo/bar");
-    CommonSchemaElements d = builder.getInstance();
-    Assert.assertEquals(d.getSchemaFile(), "/foo/bar");
+    Assert.assertEquals(getSchemaFile(builder.getInstance()), "/foo/bar");
   }
 
 

--
Gitblit v1.10.0