You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2021/05/13 07:52:02 UTC

[directory-server] 01/01: DIRSERVER-2322: Move tmp directory into instance layout

This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch DIRSERVER-2322-fix-windows-installer
in repository https://gitbox.apache.org/repos/asf/directory-server.git

commit bc5e4f46f8e850c0bb1b3d5f10e35b7c6069b933
Author: Stefan Seelmann <ma...@stefan-seelmann.de>
AuthorDate: Thu May 13 09:51:37 2021 +0200

    DIRSERVER-2322: Move tmp directory into instance layout
---
 .../directory/server/core/api/InstanceLayout.java  | 37 ++++++++++++++++++++--
 .../server/installers/wrapper-installation.conf    |  1 +
 2 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/core-api/src/main/java/org/apache/directory/server/core/api/InstanceLayout.java b/core-api/src/main/java/org/apache/directory/server/core/api/InstanceLayout.java
index d29f4bb..9116baa 100644
--- a/core-api/src/main/java/org/apache/directory/server/core/api/InstanceLayout.java
+++ b/core-api/src/main/java/org/apache/directory/server/core/api/InstanceLayout.java
@@ -89,6 +89,7 @@ public class InstanceLayout extends AbstractLayout
     public static final String PARTITIONS_NAME = "partitions";
     private static final String REPL_NAME = "syncrepl-data";
     private static final String CACHE_NAME = "cache";
+    private static final String TMP_NAME = "tmp";
 
     /** Static file names */
     private static final String LOG4J_PROPERTIES = "log4j.properties";
@@ -114,6 +115,9 @@ public class InstanceLayout extends AbstractLayout
     /** The cache directory */
     private File cacheDir;
 
+    /** The tmp directory */
+    private File tmpDir;
+
 
     /**
      * Creates a new instance of InstanceLayout.
@@ -152,7 +156,8 @@ public class InstanceLayout extends AbstractLayout
                 getLogDirectory(),
                 getPartitionsDirectory(),
                 getRunDirectory(),
-                getCacheDirectory()
+                getCacheDirectory(),
+                getTmpDirectory()
         };
 
         setRequiredDirectories( requiredDirectories );
@@ -211,7 +216,7 @@ public class InstanceLayout extends AbstractLayout
 
 
     /**
-     * @param cacheDir the confDir to set
+     * @param cacheDir the cacheDir to set
      */
     public void setCacheDir( File cacheDir )
     {
@@ -220,6 +225,31 @@ public class InstanceLayout extends AbstractLayout
 
 
     /**
+     * Gets the 'tmp' directory ('&lt;instance&gt;/tmp').
+     *
+     * @return the 'tmp' directory
+     */
+    public File getTmpDirectory()
+    {
+        if ( tmpDir == null )
+        {
+            tmpDir = new File( getInstanceDirectory(), TMP_NAME );
+        }
+
+        return tmpDir;
+    }
+
+
+    /**
+     * @param tmpDir the tmpDir to set
+     */
+    public void setTmpDir( File tmpDir )
+    {
+        this.tmpDir = tmpDir;
+    }
+
+
+    /**
      * Gets the 'log' directory ('&lt;instance&gt;/log').
      *
      * @return the 'log' directory
@@ -407,6 +437,7 @@ public class InstanceLayout extends AbstractLayout
             + "  Instance run dir              : " + getRunDirectory() + "\n"
             + "  Instance partitions dir       : " + getPartitionsDirectory() + "\n"
             + "  Instance replication data dir : " + getReplDirectory() + "\n"
-            + "  Instance cache dir            : " + getCacheDirectory() + "\n";
+            + "  Instance cache dir            : " + getCacheDirectory() + "\n"
+            + "  Instance tmp dir              : " + getTmpDirectory() + "\n";
     }
 }
diff --git a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper-installation.conf b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper-installation.conf
index 51f3264..3c53ab5 100644
--- a/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper-installation.conf
+++ b/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/wrapper-installation.conf
@@ -35,6 +35,7 @@ wrapper.java.additional.2=-Dapacheds.var.dir=${double.quote}%INSTANCE_DIRECTORY%
 wrapper.java.additional.3=-Dapacheds.log.dir=${double.quote}%INSTANCE_DIRECTORY%/log${double.quote}
 wrapper.java.additional.4=-Dapacheds.run.dir=${double.quote}%INSTANCE_DIRECTORY%/run${double.quote}
 wrapper.java.additional.5=-Dapacheds.instance=${double.quote}%INSTANCE%${double.quote}
+wrapper.java.additional.6=-Djava.io.tmpdir=${double.quote}%INSTANCE_DIRECTORY%/tmp${double.quote}
 
 # Initial Java Heap Size (in MB)
 #wrapper.java.initmemory=1024