From b07c0abd6d12c7f9ca9321ca0d01205b37b11d07 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 03 Jun 2016 06:45:18 +0000
Subject: [PATCH] OPENDJ-3037 Inlined DirectoryServer.getNameForm(), getDITContentRule(), getAttributeTypes()

---
 opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java  |    4 ++--
 opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java               |   42 ------------------------------------------
 opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java |    2 +-
 opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java                        |    6 +++---
 opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java     |    4 ++--
 5 files changed, 8 insertions(+), 50 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java
index 4c4ca33..c262e8e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/AttributeSyntaxConfigManager.java
@@ -215,7 +215,7 @@
     if (syntax != null)
     {
       String oid = syntax.getOID();
-      for (AttributeType at : DirectoryServer.getAttributeTypes())
+      for (AttributeType at : DirectoryServer.getSchema().getAttributeTypes())
       {
         if (oid.equals(at.getSyntax().getOID()))
         {
@@ -284,7 +284,7 @@
       if (syntax != null)
       {
         String oid = syntax.getOID();
-        for (AttributeType at : DirectoryServer.getAttributeTypes())
+        for (AttributeType at : DirectoryServer.getSchema().getAttributeTypes())
         {
           if (oid.equals(at.getSyntax().getOID()))
           {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index 9db8ff4..7258fa2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -71,8 +71,6 @@
 import org.forgerock.opendj.ldap.DN;
 import org.forgerock.opendj.ldap.ResultCode;
 import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.forgerock.opendj.ldap.schema.DITContentRule;
-import org.forgerock.opendj.ldap.schema.NameForm;
 import org.forgerock.opendj.ldap.schema.ObjectClass;
 import org.forgerock.opendj.ldap.schema.Syntax;
 import org.forgerock.opendj.server.config.server.AlertHandlerCfg;
@@ -2306,18 +2304,6 @@
   }
 
   /**
-   * Retrieves the set of attribute type definitions that have been
-   * defined in the Directory Server.
-   *
-   * @return The set of attribute type definitions that have been
-   *         defined in the Directory Server.
-   */
-  public static Collection<AttributeType> getAttributeTypes()
-  {
-    return directoryServer.schema.getAttributeTypes();
-  }
-
-  /**
    * Retrieves the attribute type for the provided name or OID. It can optionally return a generated
    * placeholder version if the requested attribute type is not defined in the schema.
    *
@@ -2359,34 +2345,6 @@
   }
 
   /**
-   * Retrieves the DIT content rule associated with the specified objectclass.
-   *
-   * @param  objectClass  The objectclass for which to retrieve the associated
-   *                      DIT content rule.
-   *
-   * @return  The requested DIT content rule, or {@code null} if no such
-   *          rule is defined in the schema.
-   */
-  public static DITContentRule getDITContentRule(ObjectClass objectClass)
-  {
-    return directoryServer.schema.getDITContentRule(objectClass);
-  }
-
-  /**
-   * Retrieves the name forms associated with the specified objectclass.
-   *
-   * @param  objectClass  The objectclass for which to retrieve the associated
-   *                      name form.
-   *
-   * @return  The requested name forms, or {@code null} if no such name
-   *           form is defined in the schema.
-   */
-  public static Collection<NameForm> getNameForm(ObjectClass objectClass)
-  {
-    return directoryServer.schema.getNameForm(objectClass);
-  }
-
-  /**
    * Retrieves the set of virtual attribute rules registered with the Directory
    * Server.
    *
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
index ffb45b8..b2f52a6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/MatchingRuleConfigManager.java
@@ -206,7 +206,7 @@
     {
       if (matchingRule != null)
       {
-        for (AttributeType at : DirectoryServer.getAttributeTypes())
+        for (AttributeType at : DirectoryServer.getSchema().getAttributeTypes())
         {
           final String attr = at.getNameOrOID();
           if (!isDeleteAcceptable(at.getApproximateMatchingRule(), matchingRule, attr, unacceptableReasons)
@@ -299,7 +299,7 @@
       {
         if (matchingRule != null)
         {
-          for (AttributeType at : DirectoryServer.getAttributeTypes())
+          for (AttributeType at : DirectoryServer.getSchema().getAttributeTypes())
           {
             final String attr = at.getNameOrOID();
             if (!isDisableAcceptable(at.getApproximateMatchingRule(), matchingRule, attr, unacceptableReasons)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
index 9987aee..0a9001b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -227,7 +227,7 @@
     // syntax defined in the schema.
     HashSet<AttributeType> authPWTypes = new HashSet<>();
     HashSet<AttributeType> userPWTypes = new HashSet<>();
-    for (AttributeType t : DirectoryServer.getAttributeTypes())
+    for (AttributeType t : DirectoryServer.getSchema().getAttributeTypes())
     {
       switch (SchemaUtils.checkPasswordType(t))
       {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
index 7850eb3..48f4055 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -1594,7 +1594,7 @@
     }
     else
     {
-      ditContentRule = DirectoryServer.getDITContentRule(structuralClass);
+      ditContentRule = DirectoryServer.getSchema().getDITContentRule(structuralClass);
       if (ditContentRule != null && ditContentRule.isObsolete())
       {
         ditContentRule = null;
@@ -1617,7 +1617,7 @@
          * DITStructureRules corresponding to other non-acceptable
          * nameforms are not applied.
          */
-        Collection<NameForm> forms = DirectoryServer.getNameForm(structuralClass);
+        Collection<NameForm> forms = DirectoryServer.getSchema().getNameForm(structuralClass);
         if (forms != null)
         {
           List<NameForm> listForms = new ArrayList<NameForm>(forms);
@@ -2165,7 +2165,7 @@
         }
         else
         {
-          Collection<NameForm> allNFs = DirectoryServer.getNameForm(parentStructuralClass);
+          Collection<NameForm> allNFs = DirectoryServer.getSchema().getNameForm(parentStructuralClass);
           if(allNFs != null)
           {
             for(NameForm parentNF : allNFs)

--
Gitblit v1.10.0