mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

neil_a_wilson
01.51.2007 4e6c2e385283bfa2444d5a5b31e8054d6f3c2537
Add two new server properties:

- org.opends.server.LockDirectory -- Specifies the path to the directory that
should hold the server lock files

- org.opends.server.SchemaDirectory -- Specifies the path to the directory that
should hold the server schema files

These properties can help make it easier for applications to embed OpenDS and
use a filesystem layout that is different from the default layout used by the
server. If either of these properties is not provided, then the default
location will be used (locks for the lock directory, and config/schema for the
schema directory).

OpenDS Issue Number: 649
4 files modified
89 ■■■■ changed files
opends/src/server/org/opends/server/backends/SchemaBackend.java 10 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/LockFileManager.java 31 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/SchemaConfigManager.java 24 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/ServerConstants.java 24 ●●●●● patch | view | raw | blame | history
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;
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());
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;
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 =