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

lutoff
27.25.2009 3d94e093e647c30331f5ad701e1251df46ffe5cc
Fix for issue #3765 (Root for relative paths in export-ldif depends on the path where we started the server)

The Root for relative paths in export-ldif and import-ldif is now the INSTANCE_ROOT

Note that this modification is only for the 'on-line' export and import handled with task.
The behavior is not modified the the 'off-line' operations: root for relative paths is the current working directory.

3 files modified
37 ■■■■■ changed files
opends/src/messages/messages/tools.properties 1 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tasks/ExportTask.java 9 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tasks/ImportTask.java 27 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/tools.properties
@@ -2450,6 +2450,7 @@
FATAL_ERR_INSTANCE_ROOT_NOT_SPECIFIED_1660=INSTANCE_ROOT property not specified
FATAL_ERR_CONFIG_LDIF_NOT_FOUND_1661=The "config.ldif" file is not present in \
the instance directory %s.\nInstance directory is referenced by %s
INFO_LDIFEXPORT_PATH_TO_LDIF_FILE_1662=Exporting to %s
opends/src/server/org/opends/server/tasks/ExportTask.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.tasks;
import org.opends.messages.Message;
@@ -227,6 +227,12 @@
    attrList = taskEntry.getAttribute(typeLdifFile);
    ldifFile = TaskUtils.getSingleValueString(attrList);
    File f = new File (ldifFile);
    if (! f.isAbsolute())
    {
      ldifFile = new File(DirectoryServer.getInstanceRoot(), ldifFile)
          .getAbsolutePath();
    }
    attrList = taskEntry.getAttribute(typeBackendID);
    backendID = TaskUtils.getSingleValueString(attrList);
@@ -572,6 +578,7 @@
        try
        {
          DirectoryServer.notifyExportBeginning(backend, exportConfig);
          addLogMessage(INFO_LDIFEXPORT_PATH_TO_LDIF_FILE.get(ldifFile));
          backend.exportLDIF(exportConfig);
          DirectoryServer.notifyExportEnded(backend, exportConfig, true);
        }
opends/src/server/org/opends/server/tasks/ImportTask.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.tasks;
import org.opends.messages.Message;
@@ -283,10 +283,33 @@
    List<Attribute> attrList;
    attrList = taskEntry.getAttribute(typeLdifFile);
    ldifFiles = TaskUtils.getMultiValueString(attrList);
    ArrayList<String> ldifFilestmp = TaskUtils.getMultiValueString(attrList);
    ldifFiles = new ArrayList<String>(ldifFilestmp.size());
    for (String s : ldifFilestmp)
    {
      File f = new File (s);
      if (!f.isAbsolute())
      {
        ldifFiles.add(new File(DirectoryServer.getInstanceRoot(), s)
            .getAbsolutePath());
      }
      else
      {
        ldifFiles.add(s);
      }
    }
    attrList = taskEntry.getAttribute(typeTemplateFile);
    templateFile = TaskUtils.getSingleValueString(attrList);
    if (templateFile != null)
    {
      File f = new File(templateFile);
      if (!f.isAbsolute())
      {
        templateFile = new File(DirectoryServer.getInstanceRoot(), templateFile)
            .getAbsolutePath();
      }
    }
    attrList = taskEntry.getAttribute(typeAppend);
    append = TaskUtils.getBoolean(attrList, false);