From d42b15e420478dc45785fff6e00b863cc1f8a0f9 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).
---
opends/src/server/org/opends/server/core/DirectoryServer.java | 58 ++++++++++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index 4d108ef..2db04b8 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -75,7 +75,7 @@
import org.opends.server.api.plugin.PluginResult;
import org.opends.server.backends.RootDSEBackend;
import static org.opends.server.config.ConfigConstants.DN_MONITOR_ROOT;
-import static org.opends.server.config.ConfigConstants.ENV_VAR_INSTANCE_ROOT;
+import static org.opends.server.config.ConfigConstants.ENV_VAR_INSTALL_ROOT;
import org.opends.server.config.ConfigEntry;
import org.opends.server.config.ConfigException;
import org.opends.server.config.JMXMBean;
@@ -1482,7 +1482,7 @@
// If a server.starting file exists, then remove it.
File serverStartingFile =
- new File(configHandler.getServerRoot() + File.separator +
+ new File(configHandler.getInstanceRoot() + File.separator +
"logs" + File.separator + "server.starting");
if (serverStartingFile.exists())
{
@@ -3239,6 +3239,39 @@
}
/**
+ * Retrieves the path to the instance directory for this instance of the
+ * Directory Server.
+ *
+ * @return The path to the instance directory for this instance of
+ * the Directory Server.
+ */
+ public static String getInstanceRoot()
+ {
+ if (directoryServer.configHandler == null)
+ {
+ File serverRoot = directoryServer.environmentConfig.getServerRoot();
+ if (serverRoot != null)
+ {
+ File instanceRoot =
+ directoryServer.environmentConfig.getInstanceRootFromServerRoot(
+ serverRoot);
+ if (instanceRoot != null)
+ {
+ return instanceRoot.getAbsolutePath();
+ }
+ }
+
+ // We don't know where the server root is, so we'll have to assume it's
+ // the current working directory.
+ return System.getProperty("user.dir");
+ }
+ else
+ {
+ return directoryServer.configHandler.getInstanceRoot();
+ }
+ }
+
+ /**
* Retrieves the time that the Directory Server was started, in milliseconds
* since the epoch.
*
@@ -9458,18 +9491,20 @@
{
String pidFilePath;
String startingFilePath;
- String serverRoot = System.getenv(ENV_VAR_INSTANCE_ROOT);
- if (serverRoot == null)
+ String serverRoot = System.getenv(ENV_VAR_INSTALL_ROOT);
+ File instanceRoot = DirectoryEnvironmentConfig
+ .getInstanceRootFromServerRoot(new File(serverRoot));
+ if (instanceRoot == null)
{
pidFilePath = "logs/server.pid";
startingFilePath = "logs/server.starting";
}
else
{
- pidFilePath = serverRoot + File.separator + "logs" +
- File.separator + "server.pid";
- startingFilePath = serverRoot + File.separator + "logs" +
- File.separator + "server.starting";
+ pidFilePath = instanceRoot.getAbsolutePath() + File.separator + "logs"
+ + File.separator + "server.pid";
+ startingFilePath = instanceRoot.getAbsolutePath() + File.separator
+ + "logs" + File.separator + "server.starting";
}
File pidFile = new File(pidFilePath);
@@ -9498,7 +9533,7 @@
// We need to figure out where to put the file. See if the server root
// is available as an environment variable and if so then use it.
// Otherwise, try to figure it out from the location of the config file.
- String serverRoot = System.getenv(ENV_VAR_INSTANCE_ROOT);
+ String serverRoot = System.getenv(ENV_VAR_INSTALL_ROOT);
if (serverRoot == null)
{
serverRoot = new File(configFile.getValue()).getParentFile().
@@ -9513,7 +9548,10 @@
}
else
{
- File logDir = new File(serverRoot + File.separator + "logs");
+ File instanceRoot = DirectoryEnvironmentConfig
+ .getInstanceRootFromServerRoot(new File(serverRoot));
+ File logDir = new File(instanceRoot.getAbsolutePath() + File.separator
+ + "logs");
if (logDir.exists())
{
FileOutputStream fos =
--
Gitblit v1.10.0