From 51b5fb4e99e41679e1be34a86f4448554fcb938f Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Mon, 01 Jan 2007 20:51:56 +0000
Subject: [PATCH] Add two new server properties:
---
opendj-sdk/opends/src/server/org/opends/server/core/LockFileManager.java | 31 ++++++++++++---
opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java | 24 +++++++++++-
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java | 24 ++++++++++++
opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java | 10 ++---
4 files changed, 75 insertions(+), 14 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
index 8faf757..59956c5 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -64,6 +64,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
import org.opends.server.core.ModifyDNOperation;
+import org.opends.server.core.SchemaConfigManager;
import org.opends.server.core.SearchOperation;
import org.opends.server.schema.AttributeTypeSyntax;
import org.opends.server.schema.ObjectClassSyntax;
@@ -1023,8 +1024,7 @@
// If we've gotten here, then everything looks OK. Add the new schema
// elements to the 99-user.ldif file and swing the new schema into place.
- String schemaDirPath = DirectoryServer.getServerRoot() + File.separator +
- PATH_SCHEMA_DIR;
+ String schemaDirPath = SchemaConfigManager.getSchemaDirectoryPath();
File userSchemaFile = new File(schemaDirPath, FILE_USER_SCHEMA_ELEMENTS);
Entry userSchemaEntry = null;
@@ -1701,8 +1701,7 @@
// Get the path to the directory in which the schema files reside and
// then get a list of all the files in that directory.
- String schemaDirPath = DirectoryServer.getServerRoot() + File.separator +
- PATH_SCHEMA_DIR;
+ String schemaDirPath = SchemaConfigManager.getSchemaDirectoryPath();
File[] schemaFiles;
try
{
@@ -2104,8 +2103,7 @@
// try to verify the archive. If we are not going to verify only, then
// move the current schema directory out of the way so we can keep it around
// to restore if a problem occurs.
- String schemaDirPath = DirectoryServer.getServerRoot() + File.separator +
- PATH_SCHEMA_DIR;
+ String schemaDirPath = SchemaConfigManager.getSchemaDirectoryPath();
File schemaDir = new File(schemaDirPath);
String backupDirPath = null;
File schemaBackupDir = null;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/LockFileManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/LockFileManager.java
index 7822661..9fcde7e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/LockFileManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/LockFileManager.java
@@ -440,6 +440,29 @@
/**
+ * Retrieves the path to the directory that should be used to hold the lock
+ * files.
+ *
+ * @return The path to the directory that should be used to hold the lock
+ * files.
+ */
+ public static String getLockDirectoryPath()
+ {
+ assert debugEnter(CLASS_NAME, "getLockFileDirectory");
+
+ String lockDirectory = System.getProperty(PROPERTY_LOCK_DIRECTORY);
+ if ((lockDirectory == null) || (lockDirectory.length() == 0))
+ {
+ lockDirectory = DirectoryServer.getServerRoot() + File.separator +
+ LOCKS_DIRECTORY;
+ }
+
+ return lockDirectory;
+ }
+
+
+
+ /**
* Retrieves the filename that should be used for the lock file for the
* Directory Server instance.
*
@@ -451,9 +474,7 @@
assert debugEnter(CLASS_NAME, "getServerLockFileName");
StringBuilder buffer = new StringBuilder();
- buffer.append(DirectoryServer.getServerRoot());
- buffer.append(File.separator);
- buffer.append(LOCKS_DIRECTORY);
+ buffer.append(getLockDirectoryPath());
buffer.append(File.separator);
buffer.append(SERVER_LOCK_FILE_NAME);
buffer.append(LOCK_FILE_SUFFIX);
@@ -479,9 +500,7 @@
String.valueOf(backend));
StringBuilder buffer = new StringBuilder();
- buffer.append(DirectoryServer.getServerRoot());
- buffer.append(File.separator);
- buffer.append(LOCKS_DIRECTORY);
+ buffer.append(getLockDirectoryPath());
buffer.append(File.separator);
buffer.append(BACKEND_LOCK_FILE_PREFIX);
buffer.append(backend.getBackendID());
diff --git a/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java b/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
index 6aed6a0..81ceeaa 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -122,6 +122,27 @@
/**
+ * Retrieves the path to the directory containing the server schema files.
+ *
+ * @return The path to the directory containing the server schema files.
+ */
+ public static String getSchemaDirectoryPath()
+ {
+ assert debugEnter(CLASS_NAME, "getSchemaDirectoryPath");
+
+ String schemaDirPath = System.getProperty(PROPERTY_SCHEMA_DIRECTORY);
+ if ((schemaDirPath == null) || (schemaDirPath.length() == 0))
+ {
+ schemaDirPath = DirectoryServer.getServerRoot() + File.separator +
+ PATH_SCHEMA_DIR;
+ }
+
+ return schemaDirPath;
+ }
+
+
+
+ /**
* Retrieves a reference to the schema information that has been read from the
* server configuration. Note that this information will not be complete
* until the <CODE>initializeMatchingRules</CODE>,
@@ -625,8 +646,7 @@
// 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 = DirectoryServer.getServerRoot() + File.separator +
- PATH_SCHEMA_DIR;
+ String schemaDirPath = getSchemaDirectoryPath();
File schemaDir = new File(schemaDirPath);
String[] fileNames;
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
index 3010a9b..d3035d1 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2131,6 +2131,30 @@
/**
+ * The name of the system property that can be used to specify the path to the
+ * directory in which the server lock files should be written. If this is not
+ * set, then the server will use a directory named "locks" below the server
+ * root. Note that if the server is ever started with a different lock file
+ * directory than was used for the previous startup, then the server
+ * administrator must ensure that the instance is not already running.
+ */
+ public static final String PROPERTY_LOCK_DIRECTORY =
+ "org.opends.server.LockDirectory";
+
+
+
+ /**
+ * The name of the system property that can be used to specify the path to the
+ * directory in which the schema configuration files may be found. If this is
+ * not set, then the server wiill use a directory named "schema" below the
+ * server root.
+ */
+ public static final String PROPERTY_SCHEMA_DIRECTORY =
+ "org.opends.server.SchemaDirectory";
+
+
+
+ /**
* The name of a command-line script used to launch an administrative tool.
*/
public static final String PROPERTY_SCRIPT_NAME =
--
Gitblit v1.10.0