From 33047cc2802d7174ad06bc62e972bc9a876abe99 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 25 Nov 2016 09:17:03 +0000
Subject: [PATCH] Inlined DirectoryServer.getSchema()

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
index 199416a..da8f6ce 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/BackupBackend.java
@@ -218,7 +218,7 @@
     // Construct the backup base entry.
     LinkedHashMap<ObjectClass,String> objectClasses = new LinkedHashMap<>(2);
     objectClasses.put(CoreSchema.getTopObjectClass(), OC_TOP);
-    objectClasses.put(getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT);
+    objectClasses.put(getInstance().getServerContext().getSchema().getObjectClass(OC_UNTYPED_OBJECT_LC), OC_UNTYPED_OBJECT);
 
     LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0);
     LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(1);
@@ -274,7 +274,7 @@
   {
     int numEntries = 1;
 
-    AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+    AttributeType backupPathType = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
 
     for (File dir : backupDirectories.keySet())
     {
@@ -383,7 +383,7 @@
       long count = 0;
       Entry backupDirEntry = getBackupDirectoryEntry(entryDN);
 
-      AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+      AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
       List<Attribute> attrList = backupDirEntry.getAllAttributes(t);
       for (ByteString v : attrList.get(0))
       {
@@ -470,7 +470,7 @@
          throws DirectoryException
   {
     // Make sure that the DN specifies a backup directory.
-    AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+    AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
     ByteString v = entryDN.rdn().getAttributeValue(t);
     if (v == null)
     {
@@ -508,13 +508,13 @@
     // Construct the backup directory entry to return.
     LinkedHashMap<ObjectClass,String> ocMap = new LinkedHashMap<>(2);
     ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP);
-    ocMap.put(getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY);
+    ocMap.put(getInstance().getServerContext().getSchema().getObjectClass(OC_BACKUP_DIRECTORY), OC_BACKUP_DIRECTORY);
 
     LinkedHashMap<AttributeType,List<Attribute>> opAttrs = new LinkedHashMap<>(0);
     LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(3);
     userAttrs.put(t, asList(t, v));
 
-    t = getSchema().getAttributeType(ATTR_BACKUP_BACKEND_DN);
+    t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_BACKEND_DN);
     userAttrs.put(t, asList(t, ByteString.valueOfUtf8(backupDirectory.getConfigEntryDN().toString())));
 
     Entry e = new Entry(entryDN, ocMap, userAttrs, opAttrs);
@@ -538,7 +538,7 @@
           throws DirectoryException
   {
     // First, get the backup ID from the entry DN.
-    AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID);
+    AttributeType idType = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_ID);
     ByteString idValue = entryDN.rdn().getAttributeValue(idType);
     if (idValue == null) {
       throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(entryDN));
@@ -551,7 +551,7 @@
       throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN));
     }
 
-    AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+    AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
     ByteString v = parentDN.rdn().getAttributeValue(t);
     if (v == null) {
       throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(entryDN));
@@ -584,7 +584,7 @@
     // Construct the backup entry to return.
     LinkedHashMap<ObjectClass, String> ocMap = new LinkedHashMap<>(3);
     ocMap.put(CoreSchema.getTopObjectClass(), OC_TOP);
-    ocMap.put(getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO);
+    ocMap.put(getInstance().getServerContext().getSchema().getObjectClass(OC_BACKUP_INFO), OC_BACKUP_INFO);
     ocMap.put(CoreSchema.getExtensibleObjectObjectClass(), OC_EXTENSIBLE_OBJECT);
 
     LinkedHashMap<AttributeType, List<Attribute>> opAttrs = new LinkedHashMap<>(0);
@@ -596,7 +596,7 @@
 
     Date backupDate = backupInfo.getBackupDate();
     if (backupDate != null) {
-      t = getSchema().getAttributeType(ATTR_BACKUP_DATE);
+      t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DATE);
       userAttrs.put(t,
           asList(t, ByteString.valueOfUtf8(GeneralizedTimeSyntax.format(backupDate))));
     }
@@ -607,7 +607,7 @@
 
     Set<String> dependencies = backupInfo.getDependencies();
     if (dependencies != null && !dependencies.isEmpty()) {
-      t = getSchema().getAttributeType(ATTR_BACKUP_DEPENDENCY);
+      t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DEPENDENCY);
       AttributeBuilder builder = new AttributeBuilder(t);
       builder.addAllStrings(dependencies);
       userAttrs.put(t, builder.toAttributeList());
@@ -626,7 +626,7 @@
     Map<String, String> properties = backupInfo.getBackupProperties();
     if (properties != null && !properties.isEmpty()) {
       for (Map.Entry<String, String> e : properties.entrySet()) {
-        t = getSchema().getAttributeType(toLowerCase(e.getKey()));
+        t = getInstance().getServerContext().getSchema().getAttributeType(toLowerCase(e.getKey()));
         userAttrs.put(t, asList(t, ByteString.valueOfUtf8(e.getValue())));
       }
     }
@@ -638,13 +638,13 @@
 
   private void putByteString(LinkedHashMap<AttributeType, List<Attribute>> userAttrs, String attrName, byte[] value)
   {
-    AttributeType t = getSchema().getAttributeType(attrName);
+    AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(attrName);
     userAttrs.put(t, asList(t, ByteString.wrap(value)));
   }
 
   private void putBoolean(LinkedHashMap<AttributeType, List<Attribute>> attrsMap, String attrName, boolean value)
   {
-    AttributeType t = getSchema().getAttributeType(attrName);
+    AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(attrName);
     attrsMap.put(t, asList(t, SchemaUtils.createBooleanValue(value)));
   }
 
@@ -715,7 +715,7 @@
 
       if (scope != SearchScope.BASE_OBJECT && !backupDirectories.isEmpty())
       {
-        AttributeType backupPathType = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+        AttributeType backupPathType = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
         for (File dir : backupDirectories.keySet())
         {
           // Check to see if the descriptor file exists.  If not, then skip this
@@ -766,7 +766,7 @@
 
       if (scope != SearchScope.BASE_OBJECT)
       {
-        AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
+        AttributeType t = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH);
         List<Attribute> attrList = backupDirEntry.getAllAttributes(t);
         returnEntries(searchOperation, baseDN, filter, attrList);
       }
@@ -806,7 +806,7 @@
       {
         File dir = new File(v.toString());
         BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory();
-        AttributeType idType = getSchema().getAttributeType(ATTR_BACKUP_ID);
+        AttributeType idType = getInstance().getServerContext().getSchema().getAttributeType(ATTR_BACKUP_ID);
 
         for (String backupID : backupDirectory.getBackups().keySet())
         {

--
Gitblit v1.10.0