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

coulbeck
13.23.2006 6cff6e50e589ff91df76fafac8e0f72918b5ce5c
The backends should interpret relative pathnames in the configuration file as relative to the server root rather than the current working directory.
6 files modified
73 ■■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java 24 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/BackupManager.java 7 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/Config.java 14 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/ImportJob.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/VerifyJob.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/task/TaskBackend.java 15 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -116,10 +116,9 @@
  private Config config;
  /**
   * The pathname of the directory containing persistent storage for the
   * backend.
   * The directory containing persistent storage for the backend.
   */
  private String backendDirectory;
  private File backendDirectory;
  /**
   * The base DNs contained in this backend.
@@ -367,12 +366,10 @@
    // Get the backend database directory.
    backendDirectory = config.getBackendDirectory();
    File dir = new File(backendDirectory);
    if (!dir.isDirectory())
    if (!backendDirectory.isDirectory())
    {
      String message = getMessage(MSGID_JEB_DIRECTORY_INVALID,
                                  backendDirectory);
                                  backendDirectory.getPath());
      throw new InitializationException(MSGID_JEB_DIRECTORY_INVALID,
                                        message);
    }
@@ -394,7 +391,7 @@
    // Open the database environment
    try
    {
      dbEnv = new Environment(new File(backendDirectory),
      dbEnv = new Environment(backendDirectory,
                              config.getEnvironmentConfig());
      Debug.debugMessage(DebugLogCategory.BACKEND, DebugLogSeverity.INFO,
@@ -511,11 +508,10 @@
      }
    };
    File f = new File(backendDirectory);
    int beforeLogfileCount = f.list(filenameFilter).length;
    int beforeLogfileCount = backendDirectory.list(filenameFilter).length;
    msgID = MSGID_JEB_CLEAN_DATABASE_START;
    message = getMessage(msgID, beforeLogfileCount, backendDirectory);
    message = getMessage(msgID, beforeLogfileCount, backendDirectory.getPath());
    logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, message,
             msgID);
@@ -538,7 +534,7 @@
      dbEnv.checkpoint(force);
    }
    int afterLogfileCount = f.list(filenameFilter).length;
    int afterLogfileCount = backendDirectory.list(filenameFilter).length;
    msgID = MSGID_JEB_CLEAN_DATABASE_FINISH;
    message = getMessage(msgID, afterLogfileCount);
@@ -1164,8 +1160,8 @@
      }
      // Open a new environment handle.
      String backendDirectory = config.getBackendDirectory();
      env = new Environment(new File(backendDirectory), envConfig);
      File backendDirectory = config.getBackendDirectory();
      env = new Environment(backendDirectory, envConfig);
      Debug.debugMessage(DebugLogCategory.BACKEND, DebugLogSeverity.INFO,
                         CLASS_NAME, "exportLDIF",
opends/src/server/org/opends/server/backends/jeb/BackupManager.java
@@ -236,7 +236,7 @@
    // If this is an incremental, determine the base backup for this backup.
    HashSet<String> dependencies = new HashSet<String>();
    BackupInfo baseBackup = null;
    File backendDir = new File(config.getBackendDirectory());
    File backendDir = config.getBackendDirectory();
/*
    FilenameFilter backupTagFilter = new FilenameFilter()
    {
@@ -717,9 +717,8 @@
    // Create a restore directory with a different name to the backend
    // directory.
    String backendDirectory = config.getBackendDirectory();
    File currentDir = new File(backendDirectory);
    File restoreDir = new File(backendDirectory + "-restore-" + backupID);
    File currentDir = config.getBackendDirectory();
    File restoreDir = new File(currentDir.getPath() + "-restore-" + backupID);
    if (!verifyOnly)
    {
      File[] files = restoreDir.listFiles();
opends/src/server/org/opends/server/backends/jeb/Config.java
@@ -57,6 +57,7 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import java.io.File;
import static org.opends.server.loggers.Debug.debugException;
@@ -223,7 +224,7 @@
  /**
   * The backend directory (file system pathname).
   */
  private String backendDirectory = null;
  private File backendDirectory = null;
  /**
   * Number of times we should retry database transactions that get aborted
@@ -327,7 +328,12 @@
      String message = getMessage(msgID, configEntry.getDN().toString());
      throw new ConfigException(msgID, message);
    }
    backendDirectory = backendDirectoryAttr.activeValue();
    backendDirectory = new File(backendDirectoryAttr.activeValue());
    if (!backendDirectory.isAbsolute())
    {
      backendDirectory = new File(DirectoryServer.getServerRoot(),
                                  backendDirectoryAttr.activeValue());
    }
    // ds-cfg-backendIndexEntryLimit
    // Optional, single-valued config attribute requiring admin action on change
@@ -701,9 +707,9 @@
  /**
   * Get the backend directory.
   *
   * @return A string containing the pathname to the backend directory
   * @return A file representing the backend directory
   */
  public String getBackendDirectory()
  public File getBackendDirectory()
  {
    return backendDirectory;
  }
opends/src/server/org/opends/server/backends/jeb/ImportJob.java
@@ -153,7 +153,7 @@
   */
  public void importLDIF() throws DatabaseException, IOException, JebException
  {
    String backendDirectory = config.getBackendDirectory();
    File backendDirectory = config.getBackendDirectory();
    EnvironmentConfig envConfig = config.getEnvironmentConfig();
    envConfig.setConfigParam("je.env.runCheckpointer", "false");
@@ -176,8 +176,7 @@
      envConfig.setConfigParam("je.env.isLocking", "false");
    }
    File envHome = new File(backendDirectory);
    env = new Environment(envHome, envConfig);
    env = new Environment(backendDirectory, envConfig);
    if (!ldifImportConfig.appendToExistingData())
    {
@@ -185,8 +184,8 @@
      // environment and re-open it. Only do this when we are
      // importing to all the base DNs in the backend.
      env.close();
      EnvManager.removeFiles(backendDirectory);
      env = new Environment(envHome, envConfig);
      EnvManager.removeFiles(backendDirectory.getPath());
      env = new Environment(backendDirectory, envConfig);
    }
    // Divide the total buffer size by the number of threads
opends/src/server/org/opends/server/backends/jeb/VerifyJob.java
@@ -216,14 +216,14 @@
   */
  public void verifyBackend() throws DatabaseException, JebException
  {
    String backendDirectory = config.getBackendDirectory();
    File backendDirectory = config.getBackendDirectory();
    // Open the environment read-only.
    EnvironmentConfig envConfig = config.getEnvironmentConfig();
    envConfig.setReadOnly(true);
    envConfig.setAllowCreate(false);
    envConfig.setTransactional(false);
    env = new Environment(new File(backendDirectory), envConfig);
    env = new Environment(backendDirectory, envConfig);
    Debug.debugMessage(DebugLogCategory.BACKEND, DebugLogSeverity.INFO,
                       CLASS_NAME, "verifyBackend",
opends/src/server/org/opends/server/backends/task/TaskBackend.java
@@ -1313,6 +1313,10 @@
        if (! taskBackingFile.equals(tmpBackingFile))
        {
          File f = new File(tmpBackingFile);
          if (!f.isAbsolute())
          {
            f = new File(DirectoryServer.getServerRoot(), tmpBackingFile);
          }
          if (f.exists())
          {
            int msgID = MSGID_TASKBE_BACKING_FILE_EXISTS;
@@ -1441,6 +1445,10 @@
        if (! taskBackingFile.equals(tmpBackingFile))
        {
          File f = new File(tmpBackingFile);
          if (!f.isAbsolute())
          {
            f = new File(DirectoryServer.getServerRoot(), tmpBackingFile);
          }
          if (f.exists())
          {
            int msgID = MSGID_TASKBE_BACKING_FILE_EXISTS;
@@ -1577,7 +1585,12 @@
  {
    assert debugEnter(CLASS_NAME, "getTaskBackingFile");
    return taskBackingFile;
    File f = new File(taskBackingFile);
    if (!f.isAbsolute())
    {
      f = new File(DirectoryServer.getServerRoot(), taskBackingFile);
    }
    return f.getPath();
  }