From dd0aa3d6f2295686b10d2e11c972687a225c103f Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 19 Jan 2007 22:57:49 +0000
Subject: [PATCH] Update the schema backend so that the creatorsName, createTimestamp, modifiersName, and modifyTimestamp attributes are included in the subschema subentry as recommended in RFC 4512 section 4.2.  The create timestamp will be set to the oldest modification time of all the schema configuration files.  The modify timestamp will be initially set to the youngest modification time of all the schema configuration files, but if the schema is updated with the server online then the modifiersName and modifyTimestamp will be updated accordingly.

---
 opends/src/server/org/opends/server/core/SchemaConfigManager.java |   35 +++++++++++++++++++++++++++++++++--
 1 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/SchemaConfigManager.java b/opends/src/server/org/opends/server/core/SchemaConfigManager.java
index 2a50f69..fbaf2be 100644
--- a/opends/src/server/org/opends/server/core/SchemaConfigManager.java
+++ b/opends/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -646,8 +646,10 @@
     // Construct the path to the directory that should contain the schema files
     // and make sure that it exists and is a directory.  Get a list of the files
     // in that directory sorted in alphabetic order.
-    String schemaDirPath = getSchemaDirectoryPath();
-    File schemaDir = new File(schemaDirPath);
+    String schemaDirPath          = getSchemaDirectoryPath();
+    File schemaDir                = new File(schemaDirPath);
+    long oldestModificationTime   = -1L;
+    long youngestModificationTime = -1L;
     String[] fileNames;
 
     try
@@ -673,6 +675,19 @@
         {
           fileList.add(f.getAbsolutePath());
         }
+
+        long modificationTime = f.lastModified();
+        if ((oldestModificationTime <= 0L) ||
+            (modificationTime < oldestModificationTime))
+        {
+          oldestModificationTime = modificationTime;
+        }
+
+        if ((youngestModificationTime <= 0) ||
+            (modificationTime > youngestModificationTime))
+        {
+          youngestModificationTime = modificationTime;
+        }
       }
 
       fileNames = new String[fileList.size()];
@@ -696,6 +711,22 @@
     }
 
 
+    // If the oldest and youngest modification timestamps didn't get set for
+    // some reason, then set them to the current time.
+    if (oldestModificationTime <= 0)
+    {
+      oldestModificationTime = System.currentTimeMillis();
+    }
+
+    if (youngestModificationTime <= 0)
+    {
+      youngestModificationTime = oldestModificationTime;
+    }
+
+    schema.setOldestModificationTime(oldestModificationTime);
+    schema.setYoungestModificationTime(youngestModificationTime);
+
+
     // Iterate through the schema files and read them as an LDIF file containing
     // a single entry.  Then get the attributeTypes and objectClasses attributes
     // from that entry and parse them to initialize the server schema.

--
Gitblit v1.10.0