You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/01/05 12:56:18 UTC

svn commit: r1649508 [2/2] - in /directory/apacheds/trunk/installers-maven-plugin/src/main: java/org/apache/directory/server/installers/ java/org/apache/directory/server/installers/archive/ java/org/apache/directory/server/installers/bin/ java/org/apac...

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/macosxpkg/MacOsXPkgInstallerCommand.java Mon Jan  5 11:56:17 2015
@@ -23,6 +23,7 @@ package org.apache.directory.server.inst
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.directory.server.core.api.InstanceLayout;
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.server.installers.AbstractMojoCommand;
 import org.apache.directory.server.installers.GenerateMojo;
@@ -34,23 +35,151 @@ import org.apache.tools.ant.taskdefs.Exe
 
 
 /**
- * PKG Installer command for creating Mac OS X packages.
+ * PKG Installer command for creating Mac OS X packages. It creates the following directory :
+ * 
+ * <pre>
+ * apacheds-macosx-[32/64]bit/
+ *  |
+ *  +-- scripts/
+ *  |    |
+ *  |    +-- preflight*
+ *  |    |
+ *  |    +-- postflight*
+ *  |
+ *  +-- root/
+ *  |    |
+ *  |    +-- usr/
+ *  |    |    |
+ *  |    |    +-- bin/
+ *  |    |    |    |
+ *  |    |    |    +-- apacheds*
+ *  |    |    |
+ *  |    |    +-- local/
+ *  |    |         |
+ *  |    |         +-- apacheds-&lt;version&gt;/
+ *  |    |              |
+ *  |    |              +-- lib/
+ *  |    |              |    |
+ *  |    |              |    +-- wrapper-3.2.3.jar
+ *  |    |              |    |
+ *  |    |              |    +-- libwrapper.jnilib
+ *  |    |              |    |
+ *  |    |              |    +-- apacheds-wrapper-2.0.0-M20-SNAPSHOT.jar
+ *  |    |              |    |
+ *  |    |              |    +-- apacheds-service-2.0.0-M20-SNAPSHOT.jar
+ *  |    |              |
+ *  |    |              +-- instances/
+ *  |    |              |    |
+ *  |    |              |    +-- default/
+ *  |    |              |         |
+ *  |    |              |         +-- run
+ *  |    |              |         |
+ *  |    |              |         +-- partitions
+ *  |    |              |         |
+ *  |    |              |         +-- log
+ *  |    |              |         |
+ *  |    |              |         +-- conf
+ *  |    |              |         |    |
+ *  |    |              |         |    +-- wrapper-instance.conf
+ *  |    |              |         |    |
+ *  |    |              |         |    +-- log4j.properties
+ *  |    |              |         |    |
+ *  |    |              |         |    +-- config.ldif
+ *  |    |              |         |    
+ *  |    |              |         +-- cache
+ *  |    |              |
+ *  |    |              +-- conf/
+ *  |    |              |    |
+ *  |    |              |    +-- wrapper.conf
+ *  |    |              |
+ *  |    |              +-- bin/
+ *  |    |              |    |
+ *  |    |              |    +-- wrapper*
+ *  |    |              |    |
+ *  |    |              |    +-- apacheds*
+ *  |    |              |
+ *  |    |              +-- NOTICE
+ *  |    |              |
+ *  |    |              +-- LICENSE
+ *  |    +-- Library
+ *  |         |
+ *  |         +-- LaunchDaemons/
+ *  |              |
+ *  |              +-- org.apache.directory.server.plist
+ *  |
+ *  +-- Resources/
+ *  |    |
+ *  |    +-- en.lproj/
+ *  |         |
+ *  |         +-- background.tiff
+ *  |         |
+ *  |         +-- License.rtf
+ *  |
+ *  +-- Info.plist
+ * </pre>
+ *  
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class MacOsXPkgInstallerCommand extends AbstractMojoCommand<MacOsXPkgTarget>
 {
+    /** The place the binary will be installed */
+    private static final String USR_BIN = "usr/bin";
+
+    /** The disk image tool */
+    private static final String USR_BIN_HDIUTIL = "/" + USR_BIN + "/hdiutil";
+
+    /** The ApacheDS prefix */
+    private static final String USR_LOCAL_APACHEDS = "usr/local" + "/" + APACHEDS_DASH;
+
+    /** The root */
+    private static final String ROOT = "root";
+
+    /** Instances is where we will store all the instances */
+    private static final String INSTANCES = "instances";
+
+    /** The wrapper used to launch ApacheDS */
+    private static final String WRAPPER = "wrapper";
+
+    /** The launcher daemon */
+    private static final String LAUNCH_DAEMONS = "Library/LaunchDaemons";
+
+    /** The name of the ApacheDS plist */
+    private static final String ORG_APACHE_DIRECTORY_SERVER_PLIST = "org.apache.directory.server.plist";
+
+    /** The name of the shell script that launch ApacheDS */
+    private static final String APACHEDS_USR_BIN_SH = "apacheds-usr-bin.sh";
+
+    /** The english resources */
+    private static final String RESOURCES_EN_LPROJ = "Resources/en.lproj";
+
+    /** The dmg directory */
+    private static final String DMG_DIR = "dmg/";
+
+    /** The dmg background */
+    private static final String DMG_DOT_BACKGROUND = DMG_DIR + ".background";
+
+    /** The package extension */
+    private static final String DASH_DMG = "-dmg";
+
+    /** files used to build the package */
+    private static final String SCRIPTS = "scripts";
+    private static final String PKG_BACKGROUND_TIFF = "pkg-background.tiff";
+    private static final String BACKGROUND_TIFF = "background.tiff";
+    private static final String LICENSE_RTF = "License.rtf";
+    private static final String INFO_PLIST = "Info.plist";
+    private static final String PREFLIGHT = "preflight";
+    private static final String POSTFLIGHT = "postflight";
+
     /** The hdiutil utility executable */
-    private File hdiutilUtility = new File( "/usr/bin/hdiutil" );
+    private File hdiutilUtility = new File( USR_BIN_HDIUTIL );
 
 
     /**
      * Creates a new instance of MacOsXPkgInstallerCommand.
      *
-     * @param mojo
-     *      the Server Installers Mojo
-     * @param target
-     *      the PKG target
+     * @param mojo the Server Installers Mojo
+     * @param target the PKG target
      */
     public MacOsXPkgInstallerCommand( GenerateMojo mojo, MacOsXPkgTarget target )
     {
@@ -79,6 +208,7 @@ public class MacOsXPkgInstallerCommand e
 
         // Creating the target directory
         File targetDirectory = getTargetDirectory();
+
         if ( !targetDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, targetDirectory ) );
@@ -89,22 +219,27 @@ public class MacOsXPkgInstallerCommand e
         log.info( "    Copying PKG installer files" );
 
         // Creating the root directories hierarchy
-        File pkgRootDirectory = new File( targetDirectory, "root" );
+        File pkgRootDirectory = new File( targetDirectory, ROOT );
+
         if ( !pkgRootDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootDirectory ) );
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootUsrBinDirectory = new File( pkgRootDirectory, "usr/bin" );
+
+        File pkgRootUsrBinDirectory = new File( pkgRootDirectory, USR_BIN );
+
         if ( !pkgRootUsrBinDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootUsrBinDirectory ) );
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, "usr/local/apacheds-"
+
+        File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, USR_LOCAL_APACHEDS
             + mojo.getProject().getVersion() );
+
         if ( !pkgRootUsrLocalApachedsDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -112,14 +247,18 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDirectory = new File( pkgRootUsrLocalApachedsDirectory, "instances" );
+
+        File pkgRootInstancesDirectory = new File( pkgRootUsrLocalApachedsDirectory, INSTANCES );
+
         if ( !pkgRootInstancesDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgRootInstancesDirectory ) );
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDefaultDirectory = new File( pkgRootInstancesDirectory, "default" );
+
+        File pkgRootInstancesDefaultDirectory = new File( pkgRootInstancesDirectory, DEFAULT );
+
         if ( !pkgRootInstancesDefaultDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -127,7 +266,10 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDefaultConfDirectory = new File( pkgRootInstancesDefaultDirectory, "conf" );
+
+        File pkgRootInstancesDefaultConfDirectory = new File( pkgRootInstancesDefaultDirectory,
+            InstanceLayout.CONF_NAME );
+
         if ( !pkgRootInstancesDefaultConfDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -135,7 +277,9 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDefaultDirectoryLog = new File( pkgRootInstancesDefaultDirectory, "log" );
+
+        File pkgRootInstancesDefaultDirectoryLog = new File( pkgRootInstancesDefaultDirectory, InstanceLayout.LOG_NAME );
+
         if ( !pkgRootInstancesDefaultDirectoryLog.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -143,7 +287,10 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDefaultDirectoryPartitions = new File( pkgRootInstancesDefaultDirectory, "partitions" );
+
+        File pkgRootInstancesDefaultDirectoryPartitions = new File( pkgRootInstancesDefaultDirectory,
+            InstanceLayout.PARTITIONS_NAME );
+
         if ( !pkgRootInstancesDefaultDirectoryPartitions.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -151,7 +298,9 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootInstancesDefaultDirectoryRun = new File( pkgRootInstancesDefaultDirectory, "run" );
+
+        File pkgRootInstancesDefaultDirectoryRun = new File( pkgRootInstancesDefaultDirectory, InstanceLayout.RUN_NAME );
+
         if ( !pkgRootInstancesDefaultDirectoryRun.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -159,7 +308,9 @@ public class MacOsXPkgInstallerCommand e
             log.error( e.getLocalizedMessage() );
             throw new MojoFailureException( e.getMessage() );
         }
-        File pkgRootLibraryLaunchDaemons = new File( pkgRootDirectory, "Library/LaunchDaemons" );
+
+        File pkgRootLibraryLaunchDaemons = new File( pkgRootDirectory, LAUNCH_DAEMONS );
+
         if ( !pkgRootLibraryLaunchDaemons.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -175,18 +326,20 @@ public class MacOsXPkgInstallerCommand e
             createLayouts();
 
             // Copying the apacheds command to /usr/bin
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-                "apacheds-usr-bin.sh" ), new File( pkgRootUsrBinDirectory, "apacheds" ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, APACHEDS_USR_BIN_SH,
+                getClass().getResourceAsStream( APACHEDS_USR_BIN_SH ),
+                new File( pkgRootUsrBinDirectory, APACHEDS ), true );
 
             // Copying the org.apache.directory.server.plist file to /Library/LaunchDaemons/
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-                "org.apache.directory.server.plist" ), new File( pkgRootLibraryLaunchDaemons,
-                "org.apache.directory.server.plist" ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, ORG_APACHE_DIRECTORY_SERVER_PLIST,
+                getClass().getResourceAsStream( ORG_APACHE_DIRECTORY_SERVER_PLIST ),
+                new File( pkgRootLibraryLaunchDaemons, ORG_APACHE_DIRECTORY_SERVER_PLIST ), true );
 
             // Create Resources folder and sub-folder
             // Copying the resources files and Info.plist file needed for the 
             // generation of the PKG
-            File pkgResourcesEnglishDirectory = new File( targetDirectory, "Resources/en.lproj" );
+            File pkgResourcesEnglishDirectory = new File( targetDirectory, RESOURCES_EN_LPROJ );
+
             if ( !pkgResourcesEnglishDirectory.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY,
@@ -194,7 +347,9 @@ public class MacOsXPkgInstallerCommand e
                 log.error( e.getLocalizedMessage() );
                 throw new MojoFailureException( e.getMessage() );
             }
-            File pkgScriptsDirectory = new File( targetDirectory, "scripts" );
+
+            File pkgScriptsDirectory = new File( targetDirectory, SCRIPTS );
+
             if ( !pkgScriptsDirectory.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, pkgScriptsDirectory ) );
@@ -202,20 +357,22 @@ public class MacOsXPkgInstallerCommand e
                 throw new MojoFailureException( e.getMessage() );
             }
 
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "pkg-background.tiff" ), new File(
-                pkgResourcesEnglishDirectory, "background.tiff" ) );
-
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "License.rtf" ), new File(
-                pkgResourcesEnglishDirectory, "License.rtf" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, PKG_BACKGROUND_TIFF,
+                getClass().getResourceAsStream( PKG_BACKGROUND_TIFF ),
+                new File( pkgResourcesEnglishDirectory, BACKGROUND_TIFF ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, LICENSE_RTF,
+                getClass().getResourceAsStream( LICENSE_RTF ),
+                new File( pkgResourcesEnglishDirectory, LICENSE_RTF ) );
 
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "Info.plist" ), new File( targetDirectory,
-                "Info.plist" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, INFO_PLIST,
+                getClass().getResourceAsStream( INFO_PLIST ), new File( targetDirectory, INFO_PLIST ) );
 
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "preflight" ), new File(
-                pkgScriptsDirectory, "preflight" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, PREFLIGHT,
+                getClass().getResourceAsStream( PREFLIGHT ), new File( pkgScriptsDirectory, PREFLIGHT ) );
 
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "postflight" ), new File(
-                pkgScriptsDirectory, "postflight" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, POSTFLIGHT,
+                getClass().getResourceAsStream( POSTFLIGHT ), new File( pkgScriptsDirectory, POSTFLIGHT ) );
         }
         catch ( Exception e )
         {
@@ -227,12 +384,20 @@ public class MacOsXPkgInstallerCommand e
         log.info( "    Generating Mac OS X PKG Installer" );
         Execute createPkgTask = new Execute();
         String[] cmd = new String[]
-            { mojo.getPackageMakerUtility().getAbsolutePath(), "--root", "root/", "--resources", "Resources/",
-                "--info", "Info.plist", "--title", "Apache Directory Server " + mojo.getProject().getVersion(),
-                "--version", mojo.getProject().getVersion(), "--scripts", "scripts", "--out",
-                "Apache Directory Server Installer.pkg" };
+            {
+                mojo.getPackageMakerUtility().getAbsolutePath(),
+                "--root", ROOT + "/",
+                "--resources", "Resources/",
+                "--info", INFO_PLIST,
+                "--title", "Apache Directory Server " + mojo.getProject().getVersion(),
+                "--version", mojo.getProject().getVersion(),
+                "--scripts", SCRIPTS,
+                "--out", "Apache Directory Server Installer.pkg"
+        };
+
         createPkgTask.setCommandline( cmd );
         createPkgTask.setWorkingDirectory( targetDirectory );
+
         try
         {
             createPkgTask.execute();
@@ -246,7 +411,8 @@ public class MacOsXPkgInstallerCommand e
         log.info( "  Creating Mac OS X DMG..." );
 
         // Creating the disc image directory
-        File dmgDirectory = new File( mojo.getOutputDirectory(), target.getId() + "-dmg" );
+        File dmgDirectory = new File( mojo.getOutputDirectory(), target.getId() + DASH_DMG );
+
         if ( !dmgDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dmgDirectory ) );
@@ -257,7 +423,8 @@ public class MacOsXPkgInstallerCommand e
         log.info( "    Copying DMG files" );
 
         // Create dmg directory and its sub-directory
-        File dmgDmgBackgroundDirectory = new File( dmgDirectory, "dmg/.background" );
+        File dmgDmgBackgroundDirectory = new File( dmgDirectory, DMG_DOT_BACKGROUND );
+
         if ( !dmgDmgBackgroundDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, dmgDmgBackgroundDirectory ) );
@@ -268,11 +435,13 @@ public class MacOsXPkgInstallerCommand e
         // Copying the files
         try
         {
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "dmg-background.png" ), new File(
-                dmgDirectory, "dmg/.background/background.png" ) );
-
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "DS_Store" ), new File( dmgDirectory,
-                "dmg/.DS_Store" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, "dmg-background.png",
+                getClass().getResourceAsStream( "dmg-background.png" ),
+                new File( dmgDirectory, "dmg/.background/background.png" ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, "DS_Store",
+                getClass().getResourceAsStream( "DS_Store" ),
+                new File( dmgDirectory, "dmg/.DS_Store" ) );
 
             MojoHelperUtils.copyFiles( new File( targetDirectory, "Apache Directory Server Installer.pkg" ), new File(
                 dmgDirectory, "dmg/Apache Directory Server Installer.pkg" ) );
@@ -288,21 +457,24 @@ public class MacOsXPkgInstallerCommand e
         // (unfortunately, the execution permission has been lost after the 
         // copy of the PKG to the dmg folder)
         MojoHelperUtils.exec( new String[]
-            { "chmod", "755",
+            { CHMOD, RWX_RX_RX,
                 new File( dmgDirectory, "dmg/Apache Directory Server Installer.pkg/Contents/Resources/preflight" )
                     .toString() }, dmgDirectory, false );
+
         MojoHelperUtils.exec( new String[]
-            { "chmod", "755",
+            { CHMOD, RWX_RX_RX,
                 new File( dmgDirectory, "dmg/Apache Directory Server Installer.pkg/Contents/Resources/postflight" )
                     .toString() }, dmgDirectory, false );
 
         // Generating the DMG
         log.info( "    Generating Mac OS X DMG Installer" );
         String finalName = target.getFinalName();
+
         if ( !finalName.endsWith( ".dmg" ) )
         {
             finalName = finalName + ".dmg";
         }
+
         try
         {
             Execute createDmgTask = new Execute();
@@ -353,7 +525,7 @@ public class MacOsXPkgInstallerCommand e
         }
 
         // Verifying the currently used OS is Mac OS X
-        if ( !Target.OS_NAME_MAC_OS_X.equalsIgnoreCase( System.getProperty( "os.name" ) ) )
+        if ( !Target.OS_NAME_MAC_OS_X.equalsIgnoreCase( System.getProperty( OS_NAME ) ) )
         {
             log.warn( "Mac OS X PKG installer can only be built on a machine running Mac OS X!" );
             log.warn( "The build will continue, generation of this target is skipped." );
@@ -387,13 +559,13 @@ public class MacOsXPkgInstallerCommand e
     {
         super.initializeFilterProperties();
 
-        filterProperties.put( "installation.directory", "/usr/local/apacheds-"
+        filterProperties.put( INSTALLATION_DIRECTORY_PROP, "/" + USR_LOCAL_APACHEDS
             + mojo.getProject().getVersion() );
-        filterProperties.put( "instances.directory", "/usr/local/apacheds-"
-            + mojo.getProject().getVersion() + "/instances" );
-        filterProperties.put( "user", "root" );
-        filterProperties.put( "wrapper.java.command", "# wrapper.java.command=<path-to-java-executable>" );
-        filterProperties.put( "double.quote", "" );
+        filterProperties.put( INSTANCES_DIRECTORY_PROP, "/" + USR_LOCAL_APACHEDS
+            + mojo.getProject().getVersion() + "/" + INSTANCES );
+        filterProperties.put( USER_PROP, ROOT );
+        filterProperties.put( WRAPPER_JAVA_COMMAND_PROP, WRAPPER_JAVA_COMMAND );
+        filterProperties.put( DOUBLE_QUOTE_PROP, "" );
     }
 
 
@@ -402,7 +574,7 @@ public class MacOsXPkgInstallerCommand e
      */
     public File getInstallationDirectory()
     {
-        return new File( getTargetDirectory(), "root/usr/local/apacheds-"
+        return new File( getTargetDirectory(), ROOT + "/" + USR_LOCAL_APACHEDS
             + mojo.getProject().getVersion() );
     }
 
@@ -412,7 +584,53 @@ public class MacOsXPkgInstallerCommand e
      */
     public File getInstanceDirectory()
     {
-        return new File( getInstallationDirectory(), "instances/default" );
+        return new File( getInstallationDirectory(), INSTANCE_DEFAULT_DIR );
     }
 
+
+    /**
+     * Copies wrapper files to the installation layout.
+     *
+     * @param mojo The maven plugin Mojo
+     * @throws MojoFailureException If the copy failed
+     */
+    public void copyWrapperFiles( GenerateMojo mojo ) throws MojoFailureException
+    {
+        try
+        {
+            // Mac OS X x86
+            if ( target.isOsArchx86() )
+            {
+                MojoHelperUtils.copyBinaryFile( mojo, INSTALLERS_PATH + "wrapper/bin/wrapper-macosx-universal-32",
+                    getClass().getResourceAsStream( INSTALLERS_PATH + "wrapper/bin/wrapper-macosx-universal-32" ),
+                    new File( getInstallationLayout().getBinDirectory(), WRAPPER ) );
+
+                MojoHelperUtils.copyBinaryFile(
+                    mojo,
+                    INSTALLERS_PATH + "wrapper/lib/libwrapper-macosx-universal-32.jnilib",
+                    getClass().getResourceAsStream(
+                        INSTALLERS_PATH + "wrapper/lib/libwrapper-macosx-universal-32.jnilib" ),
+                    new File( getInstallationLayout().getLibDirectory(), "libwrapper.jnilib" ) );
+            }
+
+            // Mac OS X x86_64
+            if ( target.isOsArchX86_64() )
+            {
+                MojoHelperUtils.copyBinaryFile( mojo, INSTALLERS_PATH + "wrapper/bin/wrapper-macosx-universal-64",
+                    getClass().getResourceAsStream( INSTALLERS_PATH + "wrapper/bin/wrapper-macosx-universal-64" ),
+                    new File( getInstallationLayout().getBinDirectory(), WRAPPER ) );
+
+                MojoHelperUtils.copyBinaryFile(
+                    mojo,
+                    INSTALLERS_PATH + "wrapper/lib/libwrapper-macosx-universal-64.jnilib",
+                    getClass().getResourceAsStream(
+                        INSTALLERS_PATH + "wrapper/lib/libwrapper-macosx-universal-64.jnilib" ),
+                    new File( getInstallationLayout().getLibDirectory(), "libwrapper.jnilib" ) );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories" );
+        }
+    }
 }

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/nsis/NsisInstallerCommand.java Mon Jan  5 11:56:17 2015
@@ -34,22 +34,99 @@ import org.apache.tools.ant.taskdefs.Exe
 
 
 /**
- * Nullsoft INstaller System (NSIS) Installer command for Windows installers
+ * Nullsoft INstaller System (NSIS) Installer command for Windows installers. It creates this layout :
+ * 
+ * <pre>
+ * installers/
+ *  |
+ *  +-- target/
+ *       |
+ *       +-- installers/
+ *            |
+ *            +-- apacheds-win32/
+ *                 |
+ *                 +-- instancesFiles/
+ *                 |    |
+ *                 |    +-- default/
+ *                 |         |
+ *                 |         +-- run/
+ *                 |         |
+ *                 |         +-- partitions/
+ *                 |         |
+ *                 |         +-- log/
+ *                 |         |
+ *                 |         +-- cache/
+ *                 |         |
+ *                 |         +-- conf/
+ *                 |              |
+ *                 |              +-- wrapper-instance.conf
+ *                 |              |
+ *                 |              +-- log4j.properties
+ *                 |              |
+ *                 |              +-- config.ldif
+ *                 |
+ *                 +-- installationFiles/
+ *                 |    |
+ *                 |    +-- lib/
+ *                 |    |    |
+ *                 |    |    +-- wrapper.dll
+ *                 |    |    |
+ *                 |    |    +-- wrapper-3.2.3.jar
+ *                 |    |    |
+ *                 |    |    +-- apacheds-wrapper-2.0.0-M20-SNAPSHOT.jar
+ *                 |    |    |
+ *                 |    |    +-- apacheds-service-2.0.0-M20-SNAPSHOT.jar
+ *                 |    |
+ *                 |    +-- conf/
+ *                 |    |    |
+ *                 |    |    +-- wrapper.conf
+ *                 |    |
+ *                 |    +-- bin/
+ *                 |    |    |
+ *                 |    |    +-- wrapper.exe
+ *                 |    |
+ *                 |    +-- NOTICE
+ *                 |    |
+ *                 |    +-- LICENSE
+ *                 |    |
+ *                 |    +-- Manage ApacheDS.ex
+ *                 |   
+ *                 +-- header.bmp
+ *                 |
+ *                 +-- welcome.bmp
+ *                 |
+ *                 +-- installer.ico
+ *                 |
+ *                 +-- uninstaller.ico
+ *                 |
+ *                 +-- installer.nsi
+ * </pre>
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class NsisInstallerCommand extends AbstractMojoCommand<NsisTarget>
 {
+    /** The list of windows files */
+    private static final String WRAPPER_EXE_RESOURCE = INSTALLERS_PATH + "wrapper/bin/wrapper-windows-x86-32.exe";
+    private static final String WRAPPER_EXE_FILE = "wrapper.exe";
+    private static final String WRAPPER_DLL_RESOURCE = INSTALLERS_PATH + "wrapper/lib/wrapper-windows-x86-32.dll";
+    private static final String WRAPPER_DLL_FILE = "wrapper.dll";
+    private static final String MANAGE_APACHEDS_EXE = "Manage ApacheDS.exe";
+    private static final String HEADER_BMP = "header.bmp";
+    private static final String WELCOME_BMP = "welcome.bmp";
+    private static final String INSTALLER_ICO = "installer.ico";
+    private static final String UNINSTALLER_ICO = "uninstaller.ico";
+    private static final String INSTALLER_NSI = "installer.nsi";
+    private static final String EXE_EXTENSION = ".exe";
     private static final String INSTALLATION_FILES = "installationFiles";
+    private static final String INSTANCES_FILES = "instancesFiles";
 
 
     /**
      * Creates a new instance of NsisInstallerCommand.
      *
-     * @param mojo
-     *      the Server Installers Mojo
-     * @param target
-     *      the NSIS target
+     * @param mojo the Server Installers Mojo
+     * @param target the NSIS target
      */
     public NsisInstallerCommand( GenerateMojo mojo, NsisTarget target )
     {
@@ -77,6 +154,7 @@ public class NsisInstallerCommand extend
 
         // Creating the target directory
         File targetDirectory = getTargetDirectory();
+
         if ( !targetDirectory.mkdirs() )
         {
             Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, targetDirectory ) );
@@ -86,7 +164,7 @@ public class NsisInstallerCommand extend
 
         log.info( "    Copying NSIS installer files" );
 
-        File installerFile = new File( targetDirectory, "installer.nsi" );
+        File installerFile = new File( targetDirectory, INSTALLER_NSI );
 
         try
         {
@@ -94,22 +172,29 @@ public class NsisInstallerCommand extend
             createLayouts();
 
             // Copying the 'Manage ApacheDS' utility
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "Manage ApacheDS.exe" ), new File(
-                getInstallationDirectory(), "Manage ApacheDS.exe" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, MANAGE_APACHEDS_EXE,
+                getClass().getResourceAsStream( MANAGE_APACHEDS_EXE ), new File( getInstallationDirectory(),
+                    MANAGE_APACHEDS_EXE ) );
 
             // Copying the images and icons
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "header.bmp" ), new File(
-                targetDirectory, "header.bmp" ) );
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "welcome.bmp" ), new File(
-                targetDirectory, "welcome.bmp" ) );
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "installer.ico" ), new File(
-                targetDirectory, "installer.ico" ) );
-            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "uninstaller.ico" ), new File(
-                targetDirectory, "uninstaller.ico" ) );
+            MojoHelperUtils.copyBinaryFile( mojo, HEADER_BMP, getClass().getResourceAsStream( HEADER_BMP ),
+                new File(
+                    targetDirectory, HEADER_BMP ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, WELCOME_BMP, getClass().getResourceAsStream( WELCOME_BMP ),
+                new File(
+                    targetDirectory, WELCOME_BMP ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, INSTALLER_ICO, getClass().getResourceAsStream( INSTALLER_ICO ),
+                new File(
+                    targetDirectory, INSTALLER_ICO ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, UNINSTALLER_ICO,
+                getClass().getResourceAsStream( UNINSTALLER_ICO ), new File( targetDirectory, UNINSTALLER_ICO ) );
 
             // Copying the 'installer.nsi' file
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-                "installer.nsi" ), installerFile, true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, INSTALLER_NSI, getClass().getResourceAsStream(
+                INSTALLER_NSI ), installerFile, true );
         }
         catch ( Exception e )
         {
@@ -127,6 +212,7 @@ public class NsisInstallerCommand extend
                 installerFile.getAbsolutePath() };
         createPkgTask.setCommandline( cmd );
         createPkgTask.setWorkingDirectory( targetDirectory );
+
         try
         {
             createPkgTask.execute();
@@ -138,7 +224,7 @@ public class NsisInstallerCommand extend
         }
 
         log.info( "=> NSIS installer generated at "
-            + new File( mojo.getOutputDirectory(), filterProperties.getProperty( "finalname" ) ) );
+            + new File( mojo.getOutputDirectory(), filterProperties.getProperty( FINAL_NAME_PROP ) ) );
     }
 
 
@@ -179,15 +265,17 @@ public class NsisInstallerCommand extend
         super.initializeFilterProperties();
 
         String finalName = target.getFinalName();
-        if ( !finalName.endsWith( ".exe" ) )
+
+        if ( !finalName.endsWith( EXE_EXTENSION ) )
         {
-            finalName = finalName + ".exe";
+            finalName = finalName + EXE_EXTENSION;
         }
-        filterProperties.put( "finalname", target.getFinalName() );
-        filterProperties.put( "installationFiles", INSTALLATION_FILES );
-        filterProperties.put( "instancesFiles", "instancesFiles" );
-        filterProperties.put( "wrapper.java.command", "wrapper.java.command=@java.home@\\bin\\java.exe" );
-        filterProperties.put( "double.quote", "\"" );
+
+        filterProperties.put( FINAL_NAME_PROP, target.getFinalName() );
+        filterProperties.put( INSTALLATION_FILES, INSTALLATION_FILES );
+        filterProperties.put( INSTANCES_FILES, INSTANCES_FILES );
+        filterProperties.put( WRAPPER_JAVA_COMMAND_PROP, "wrapper.java.command=@java.home@\\bin\\java.exe" );
+        filterProperties.put( DOUBLE_QUOTE_PROP, "\"" );
     }
 
 
@@ -205,6 +293,31 @@ public class NsisInstallerCommand extend
      */
     public File getInstanceDirectory()
     {
-        return new File( getTargetDirectory(), "instancesFiles/default" );
+        return new File( getTargetDirectory(), INSTANCES_FILES + "/" + DEFAULT );
+    }
+
+
+    /**
+     * Copies wrapper files to the installation layout.
+     *
+     * @param mojo The maven plugin Mojo
+     * @throws MojoFailureException If the copy failed
+     */
+    public void copyWrapperFiles( GenerateMojo mojo ) throws MojoFailureException
+    {
+        try
+        {
+            MojoHelperUtils.copyBinaryFile( mojo, WRAPPER_EXE_RESOURCE,
+                getClass().getResourceAsStream( WRAPPER_EXE_RESOURCE ),
+                new File( getInstallationLayout().getBinDirectory(), WRAPPER_EXE_FILE ) );
+
+            MojoHelperUtils.copyBinaryFile( mojo, WRAPPER_DLL_RESOURCE,
+                getClass().getResourceAsStream( WRAPPER_DLL_RESOURCE ), new File( getInstallationLayout()
+                    .getLibDirectory(), WRAPPER_DLL_FILE ) );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and bin directories" );
+        }
     }
 }

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmInstallerCommand.java Mon Jan  5 11:56:17 2015
@@ -25,8 +25,8 @@ import java.io.IOException;
 import java.util.Properties;
 
 import org.apache.directory.server.i18n.I18n;
-import org.apache.directory.server.installers.AbstractMojoCommand;
 import org.apache.directory.server.installers.GenerateMojo;
+import org.apache.directory.server.installers.LinuxInstallerCommand;
 import org.apache.directory.server.installers.MojoHelperUtils;
 import org.apache.directory.server.installers.Target;
 import org.apache.maven.plugin.MojoExecutionException;
@@ -39,16 +39,27 @@ import org.codehaus.plexus.util.FileUtil
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class RpmInstallerCommand extends AbstractMojoCommand<RpmTarget>
+public class RpmInstallerCommand extends LinuxInstallerCommand<RpmTarget>
 {
+    /** The rpm extension */
+    private static final String DOT_RPM = ".rpm";
+
+    /** The RPM specification file */
+    private static final String APACHEDS_SPEC_FILE = "apacheds.spec";
+
+    /** The names used inside the rpm file */
+    private static final String RPMS = "RPMS";
+    private static final String SOURCES = "SOURCES";
+    private static final String SPECS = "SPECS";
+    private static final String BUILD = "BUILD";
+    private static final String SRPMS = "SRPMS";
+
 
     /**
      * Creates a new instance of RpmInstallerCommand.
      *
-     * @param mojo
-     *      the Server Installers Mojo
-     * @param target
-     *      the RPM target
+     * @param mojo the Server Installers Mojo
+     * @param target the RPM target
      */
     public RpmInstallerCommand( GenerateMojo mojo, RpmTarget target )
     {
@@ -90,35 +101,44 @@ public class RpmInstallerCommand extends
         try
         {
             // Create Rpm directories (BUILD, RPMS, SOURCES, SPECS & SRPMS)
-            File rpmBuild = new File( getTargetDirectory(), "BUILD" );
+            File rpmBuild = new File( getTargetDirectory(), BUILD );
+
             if ( !rpmBuild.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmBuild ) );
                 log.error( e.getLocalizedMessage() );
                 throw new MojoFailureException( e.getMessage() );
             }
-            File rpmRpms = new File( getTargetDirectory(), "RPMS" );
+
+            File rpmRpms = new File( getTargetDirectory(), RPMS );
+
             if ( !rpmRpms.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmRpms ) );
                 log.error( e.getLocalizedMessage() );
                 throw new MojoFailureException( e.getMessage() );
             }
-            File rpmSources = new File( getTargetDirectory(), "SOURCES" );
+
+            File rpmSources = new File( getTargetDirectory(), SOURCES );
+
             if ( !rpmSources.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSources ) );
                 log.error( e.getLocalizedMessage() );
                 throw new MojoFailureException( e.getMessage() );
             }
-            File rpmSpecs = new File( getTargetDirectory(), "SPECS" );
+
+            File rpmSpecs = new File( getTargetDirectory(), SPECS );
+
             if ( !rpmSpecs.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSpecs ) );
                 log.error( e.getLocalizedMessage() );
                 throw new MojoFailureException( e.getMessage() );
             }
-            File rpmSrpms = new File( getTargetDirectory(), "SRPMS" );
+
+            File rpmSrpms = new File( getTargetDirectory(), SRPMS );
+
             if ( !rpmSrpms.mkdirs() )
             {
                 Exception e = new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, rpmSrpms ) );
@@ -130,9 +150,9 @@ public class RpmInstallerCommand extends
             createLayouts();
 
             // Copying the init script for /etc/init.d/
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
-                getClass().getResourceAsStream( "/org/apache/directory/server/installers/etc-initd-script" ),
-                new File( getAdsSourcesDirectory(), "etc-initd-script" ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, INSTALLERS_PATH + ETC_INITD_SCRIPT,
+                getClass().getResourceAsStream( INSTALLERS_PATH + ETC_INITD_SCRIPT ),
+                new File( getAdsSourcesDirectory(), ETC_INITD_SCRIPT ), true );
 
             // Creating the spec file
             createSpecFile();
@@ -140,12 +160,12 @@ public class RpmInstallerCommand extends
             // Generating tar.gz file
             MojoHelperUtils.exec( new String[]
                 {
-                    "tar",
+                    TAR,
                     "-zcf",
-                    "apacheds-" + getVersion() + ".tar.gz",
-                    "apacheds-" + getVersion()
+                    APACHEDS_DASH + getVersion() + ".tar.gz",
+                    APACHEDS_DASH + getVersion()
             },
-                new File( getTargetDirectory(), "/SOURCES" ),
+                new File( getTargetDirectory(), "/" + SOURCES ),
                 false );
         }
         catch ( Exception e )
@@ -168,7 +188,7 @@ public class RpmInstallerCommand extends
                 "_topdir " + getTargetDirectory(),
                 "--define",
                 "_tmppath /tmp",
-                "SPECS/apacheds.spec"
+                SPECS + "/" + APACHEDS_SPEC_FILE
         },
             getTargetDirectory(),
             false );
@@ -176,16 +196,17 @@ public class RpmInstallerCommand extends
         // Copying the rpm at the final destination
         try
         {
-            String rpmName = "apacheds-" + getVersion() + "-1." + target.getOsArch() + ".rpm";
+            String rpmName = APACHEDS_DASH + getVersion() + "-1." + target.getOsArch() + DOT_RPM;
             String finalName = target.getFinalName();
-            if ( !finalName.endsWith( ".rpm" ) )
+
+            if ( !finalName.endsWith( DOT_RPM ) )
             {
-                finalName = finalName + ".rpm";
+                finalName = finalName + DOT_RPM;
             }
 
             File finalFile = new File( mojo.getOutputDirectory(), finalName );
 
-            FileUtils.copyFile( new File( getTargetDirectory(), "RPMS/" + target.getOsArch() + "/" + rpmName ),
+            FileUtils.copyFile( new File( getTargetDirectory(), RPMS + "/" + target.getOsArch() + "/" + rpmName ),
                 finalFile );
 
             log.info( "=> RPM generated at " + finalFile );
@@ -194,7 +215,6 @@ public class RpmInstallerCommand extends
         {
             throw new MojoFailureException( "Failed to copy generated Rpm installer file." );
         }
-
     }
 
 
@@ -216,8 +236,9 @@ public class RpmInstallerCommand extends
         }
 
         // Verifying the currently used OS to build the installer is Linux or Mac OS X
-        if ( !( Target.OS_NAME_LINUX.equalsIgnoreCase( System.getProperty( "os.name" ) ) || Target.OS_NAME_MAC_OS_X
-            .equalsIgnoreCase( System.getProperty( "os.name" ) ) ) )
+        String osName = System.getProperty( OS_NAME );
+
+        if ( !( Target.OS_NAME_LINUX.equalsIgnoreCase( osName ) || Target.OS_NAME_MAC_OS_X.equalsIgnoreCase( osName ) ) )
         {
             log.warn( "Rpm package installer can only be built on a machine running Linux or Mac OS X!" );
             log.warn( "The build will continue, generation of this target is skipped." );
@@ -243,13 +264,14 @@ public class RpmInstallerCommand extends
     {
         super.initializeFilterProperties();
 
-        filterProperties.put( "installation.directory", "/opt/apacheds-" + getVersion() );
-        filterProperties.put( "instances.directory", "/var/lib/apacheds-" + getVersion() );
-        filterProperties.put( "default.instance.name", "default" );
-        filterProperties.put( "user", "apacheds" );
-        filterProperties.put( "wrapper.java.command", "# wrapper.java.command=<path-to-java-executable>" );
-        filterProperties.put( "double.quote", "" );
-        filterProperties.put( "version", getVersion() );
+        filterProperties.put( INSTALLATION_DIRECTORY_PROP, OPT_APACHEDS_DIR + getVersion() );
+        filterProperties.put( INSTANCES_DIRECTORY_PROP, VAR_LIB_APACHEDS_DIR + getVersion() );
+        filterProperties.put( DEFAULT_INSTANCE_NAME_PROP, DEFAULT );
+        filterProperties.put( USER_PROP, APACHEDS );
+        filterProperties.put( GROUP_PROP, APACHEDS );
+        filterProperties.put( WRAPPER_JAVA_COMMAND_PROP, WRAPPER_JAVA_COMMAND );
+        filterProperties.put( DOUBLE_QUOTE_PROP, "" );
+        filterProperties.put( VERSION_PROP, getVersion() );
     }
 
 
@@ -266,6 +288,7 @@ public class RpmInstallerCommand extends
 
         // Getting the lib directory
         File libDirectory = getInstallationLayout().getLibDirectory();
+
         if ( libDirectory.exists() )
         {
             // Iterating on each file in the lib directory
@@ -282,28 +305,26 @@ public class RpmInstallerCommand extends
 
         // Creating properties based on these values
         Properties properties = new Properties();
-        properties.put( "version", getVersion() );
+        properties.put( VERSION_PROP, getVersion() );
         properties.put( "build.dir", getBuidDirectory() );
         properties.put( "install.libs", installLibs.toString() );
         properties.put( "files.libs", filesLibs.toString() );
 
         // Copying and filtering the spec file
-        MojoHelperUtils.copyAsciiFile( mojo, properties,
-            getClass().getResourceAsStream( "apacheds.spec" ),
-            new File( getTargetDirectory(), "SPECS/apacheds.spec" ), true );
-
+        MojoHelperUtils.copyAsciiFile( mojo, properties, APACHEDS_SPEC_FILE,
+            getClass().getResourceAsStream( APACHEDS_SPEC_FILE ),
+            new File( getTargetDirectory(), SPECS + "/" + APACHEDS_SPEC_FILE ), true );
     }
 
 
     /**
      * Gets the 'apacheds-${version}' directory inside 'SOURCES'.
      *
-     * @return
-     *      the 'apacheds-${version}' directory inside 'SOURCES'
+     * @return the 'apacheds-${version}' directory inside 'SOURCES'
      */
     private File getAdsSourcesDirectory()
     {
-        return new File( getTargetDirectory(), "SOURCES/apacheds-" + getVersion() );
+        return new File( getTargetDirectory(), SOURCES + "/" + APACHEDS_DASH + getVersion() );
     }
 
 
@@ -321,15 +342,14 @@ public class RpmInstallerCommand extends
      */
     public File getInstanceDirectory()
     {
-        return new File( getAdsSourcesDirectory(), "instances/default" );
+        return new File( getAdsSourcesDirectory(), INSTANCE_DEFAULT_DIR );
     }
 
 
     /**
      * Gets the version number.
      *
-     * @return
-     *      the version number
+     * @return the version number
      */
     private String getVersion()
     {
@@ -340,11 +360,10 @@ public class RpmInstallerCommand extends
     /**
      * Gets the BUILD directory path.
      *
-     * @return
-     *      the BUILD directory path
+     * @return the BUILD directory path
      */
     private String getBuidDirectory()
     {
-        return getTargetDirectory().getAbsolutePath() + "/BUILD";
+        return getTargetDirectory().getAbsolutePath() + "/" + BUILD;
     }
 }

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmTarget.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmTarget.java?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmTarget.java (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/java/org/apache/directory/server/installers/rpm/RpmTarget.java Mon Jan  5 11:56:17 2015
@@ -24,7 +24,7 @@ import org.apache.directory.server.insta
 
 
 /**
- * An Rpm package target.
+ * An Rpm package target. The default OsName parameter is Linux.
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/apacheds
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/apacheds?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/apacheds (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/apacheds Mon Jan  5 11:56:17 2015
@@ -37,7 +37,7 @@ APP_LONG_NAME="ApacheDS - $INSTANCE"
 
 # Wrapper
 WRAPPER_CMD="$INSTALLATION_DIRECTORY/bin/wrapper"
-WRAPPER_CONF="$INSTANCE_DIRECTORY/conf/wrapper.conf"
+WRAPPER_CONF="$INSTANCE_DIRECTORY/conf/wrapper-instance.conf"
 
 # Priority at which to run the wrapper.  See "man nice" for valid priorities.
 #  nice is only used if a priority is specified.

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/archive/apacheds.sh Mon Jan  5 11:56:17 2015
@@ -173,7 +173,7 @@ elif [ "$ADS_ACTION" = "stop" ]; then
     # Printing instance information
     if [ -f $ADS_PID ]; then
         PID=`cat $ADS_PID`
-        [ $HAVE_TTY -eq 1 ] && echo "Stoping ApacheDS instance '$ADS_INSTANCE_NAME' running as $PID"
+        [ $HAVE_TTY -eq 1 ] && echo "Stopping ApacheDS instance '$ADS_INSTANCE_NAME' running as $PID"
 
         kill -15 $PID > /dev/null 2>&1
 

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/bin/install.sh
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/bin/install.sh?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/bin/install.sh (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/bin/install.sh Mon Jan  5 11:56:17 2015
@@ -80,6 +80,10 @@ verifyExitCode
 mkdir -p $INSTANCES_HOME_DIRECTORY
 verifyExitCode
 
+# Creating initd directory if needed
+mkdir -p $STARTUP_SCRIPT_DIRECTORY
+verifyExitCode
+
 # Creating the default instance home directory
 DEFAULT_INSTANCE_HOME_DIRECTORY=$INSTANCES_HOME_DIRECTORY/$DEFAULT_INSTANCE_NAME
 verifyExitCode
@@ -95,9 +99,9 @@ mkdir -p $DEFAULT_INSTANCE_HOME_DIRECTOR
 verifyExitCode
 
 # Filtering default instance wrapper.conf file
-sed -e "s;@installation.directory@;${APACHEDS_HOME_DIRECTORY};" ../instance/wrapper.conf > ../instance/wrapper.conf.tmp
+sed -e "s;@installation.directory@;${APACHEDS_HOME_DIRECTORY};" ../instance/wrapper-instance.conf > ../instance/wrapper-instance.conf.tmp
 verifyExitCode
-mv ../instance/wrapper.conf.tmp ../instance/wrapper.conf
+mv ../instance/wrapper-instance.conf.tmp ../instance/wrapper-instance.conf
 verifyExitCode
 
 # Copying the default instance files
@@ -105,7 +109,7 @@ cp ../instance/config.ldif $DEFAULT_INST
 verifyExitCode
 cp ../instance/log4j.properties $DEFAULT_INSTANCE_HOME_DIRECTORY/conf/
 verifyExitCode
-cp ../instance/wrapper.conf $DEFAULT_INSTANCE_HOME_DIRECTORY/conf/
+cp ../instance/wrapper-instance.conf $DEFAULT_INSTANCE_HOME_DIRECTORY/conf/
 verifyExitCode
 
 # Filtering and copying the init.d script

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/nsis/installer.nsi
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/nsis/installer.nsi?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/nsis/installer.nsi (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/nsis/installer.nsi Mon Jan  5 11:56:17 2015
@@ -26,7 +26,7 @@
     !define UninstallerIcon "uninstaller.ico"
     !define WelcomeImage "welcome.bmp"
     !define HeaderImage "header.bmp"
-    !define OutFile "${finalname}"
+    !define OutFile "${finalName}"
     !define InstallationFiles "${installationFiles}"
     !define InstancesFiles "${instancesFiles}"
     !define JREVersion "1.5.0"
@@ -215,7 +215,7 @@
         # Replacing installation directory in config file
         GetFunctionAddress $R0 ReplaceInstallationDirectory # handle to callback fn
         Push $R0
-        Push "$INSTANCES_HOME_DIR\default\conf\wrapper.conf" # file to replace in
+        Push "$INSTANCES_HOME_DIR\default\conf\wrapper-instance.conf" # file to replace in
         Call ReplaceInFile
         
         # Registering the server instance
@@ -285,7 +285,7 @@
     #
 
     Function RegisterInstance
-        nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -i "$INSTANCES_HOME_DIR\default\conf\wrapper.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
+        nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -i "$INSTANCES_HOME_DIR\default\conf\wrapper-instance.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
     FunctionEnd
     
     #
@@ -297,7 +297,7 @@
     #
 
     Function un.RegisterInstance
-        nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -r "$INSTANCES_HOME_DIR\default\conf\wrapper.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
+        nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -r "$INSTANCES_HOME_DIR\default\conf\wrapper-instance.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
     FunctionEnd
     
     #
@@ -312,7 +312,7 @@
         # Start the server
         MessageBox MB_YESNO|MB_ICONQUESTION "Do you want to start the default server instance?" IDYES startService IDNO End
         startService:  
-            nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -t "$INSTANCES_HOME_DIR\default\conf\wrapper.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
+            nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\wrapper.exe" -t "$INSTANCES_HOME_DIR\default\conf\wrapper-instance.conf" set.INSTANCE_DIRECTORY="$INSTANCES_HOME_DIR\default" set.INSTANCE="default"'
   
         End:
     FunctionEnd

Modified: directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/rpm/apacheds.spec
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/rpm/apacheds.spec?rev=1649508&r1=1649507&r2=1649508&view=diff
==============================================================================
--- directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/rpm/apacheds.spec (original)
+++ directory/apacheds/trunk/installers-maven-plugin/src/main/resources/org/apache/directory/server/installers/rpm/apacheds.spec Mon Jan  5 11:56:17 2015
@@ -26,6 +26,7 @@ Group: System Environment/Daemons
 URL: http://directory.apache.org
 Source: apacheds-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+%define debug_package %{nil}
 
 %description
 ApacheDS ${version}
@@ -60,7 +61,7 @@ ${install.libs}
 # Instance files
 install -m 644 ${build.dir}/%{name}-%{version}/instances/default/conf/config.ldif $RPM_BUILD_ROOT%{adsdata}/default/conf/config.ldif
 install -m 644 ${build.dir}/%{name}-%{version}/instances/default/conf/log4j.properties $RPM_BUILD_ROOT%{adsdata}/default/conf/log4j.properties
-install -m 644 ${build.dir}/%{name}-%{version}/instances/default/conf/wrapper.conf $RPM_BUILD_ROOT%{adsdata}/default/conf/wrapper.conf
+install -m 644 ${build.dir}/%{name}-%{version}/instances/default/conf/wrapper-instance.conf $RPM_BUILD_ROOT%{adsdata}/default/conf/wrapper-instance.conf
 
 # Init script
 install -m 755 ${build.dir}/%{name}-%{version}/etc-initd-script $RPM_BUILD_ROOT/etc/init.d/apacheds-%{version}-default
@@ -96,4 +97,4 @@ ${files.libs}
 %{adsdata}/default/run
 %config %{adsdata}/default/conf/config.ldif
 %config %{adsdata}/default/conf/log4j.properties
-%config %{adsdata}/default/conf/wrapper.conf
+%config %{adsdata}/default/conf/wrapper-instance.conf