From ebf357c00c505d1406f65ab9438e4fecfc1a2200 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Thu, 18 Sep 2008 10:14:53 +0000
Subject: [PATCH] These changes are separating the current delivery into  an "Install Layout" (the binaries) and an "Instance Layout" (the user data).

---
 opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
index 01020ba..6a14302 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -174,9 +174,12 @@
   // The path to the configuration file.
   private String configFile;
 
-  // The instance root directory for the Directory Server.
+  // The install root directory for the Directory Server.
   private String serverRoot;
 
+  // The instance root directory for the Directory Server.
+  private String instanceRoot;
+
 
 
   /**
@@ -694,7 +697,7 @@
         if (serverRoot == null)
         {
           Message message = ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(
-              ENV_VAR_INSTANCE_ROOT);
+              ENV_VAR_INSTALL_ROOT);
           throw new InitializationException(message);
         }
       }
@@ -715,7 +718,7 @@
         }
 
         Message message =
-            ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTANCE_ROOT);
+            ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTALL_ROOT);
         throw new InitializationException(message);
       }
     }
@@ -724,6 +727,23 @@
       serverRoot = rootFile.getAbsolutePath();
     }
 
+    // Determine the appropriate server root.  If it's not defined in the
+    // environment config, then try to figure it out from the location of the
+    // configuration file.
+    File instanceFile = envConfig.getInstanceRootFromServerRoot(new File(
+        serverRoot));
+    if (instanceFile == null)
+    {
+      Message message =
+        ERR_CONFIG_CANNOT_DETERMINE_SERVER_ROOT.get(ENV_VAR_INSTALL_ROOT);
+        throw new InitializationException(message);
+    }
+    else
+    {
+      instanceRoot = instanceFile.getAbsolutePath();
+    }
+
+
 
     // Register with the Directory Server as an alert generator.
     DirectoryServer.registerAlertGenerator(this);
@@ -1083,6 +1103,15 @@
     return serverRoot;
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  @Override()
+  public String getInstanceRoot()
+  {
+    return instanceRoot;
+  }
+
 
 
   /**

--
Gitblit v1.10.0