directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1000426 - in /directory/apacheds/branches/apacheds-apacheds-2.0: apacheds-installers/ installers-plugin/src/main/java/org/apache/directory/daemon/installers/ installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/...
Date Thu, 23 Sep 2010 12:27:05 GMT
Author: pamarcelot
Date: Thu Sep 23 12:27:05 2010
New Revision: 1000426

URL: http://svn.apache.org/viewvc?rev=1000426&view=rev
Log:
Fixed the generation of the Windows installer (which still needs to be improved though).

Added:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/header.bmp   (with props)
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.ico   (with props)
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/welcome.bmp   (with props)
Modified:
    directory/apacheds/branches/apacheds-apacheds-2.0/apacheds-installers/pom.xml
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgTarget.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/apacheds-installers/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/apacheds-installers/pom.xml?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/apacheds-installers/pom.xml (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/apacheds-installers/pom.xml Thu Sep 23 12:27:05 2010
@@ -57,7 +57,7 @@
             <artifactId>installers-plugin</artifactId>
             <configuration>
               
-              <!-- Targets for Mac OS X .pkg installer package -->
+              <!-- Targets for Mac OS X .pkg installer packages -->
               <macOsXPkgTargets>
                 <macOsXPkgTarget>
                  <id>apacheds-macosx-x86</id>
@@ -73,6 +73,16 @@
                 </macOsXPkgTarget>
               </macOsXPkgTargets>
               
+              <!-- Target for Windows installer package -->
+              <nsisTargets>
+                <nsisTarget>
+                  <id>apacheds-win32</id>
+                  <finalName>apacheds-${version}-setup.exe</finalName>
+                  <osName>Windows</osName>
+                  <osArch>x86</osArch>
+                </nsisTarget>
+              </nsisTargets>
+              
             </configuration>
             <executions>
               <execution>

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java Thu Sep 23 12:27:05 2010
@@ -309,7 +309,7 @@ public abstract class AbstractMojoComman
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "/org/apache/directory/daemon/installers/wrapper/lib/wrapper-windows-x86-32.dll" ), new File(
                         installationLayout.getLibDirectory(),
-                    "libwrapper.so" ) );
+                    "libwrapper.dll" ) );
             }
             catch ( IOException e )
             {

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgInstallerCommand.java Thu Sep 23 12:27:05 2010
@@ -42,7 +42,6 @@ import org.apache.tools.ant.taskdefs.Exe
  */
 public class MacOsXPkgInstallerCommand extends AbstractMojoCommand<MacOsXPkgTarget>
 {
-
     /** The hdiutil utility executable */
     private File hdiutilUtility = new File( "/usr/bin/hdiutil" );
 
@@ -65,38 +64,20 @@ public class MacOsXPkgInstallerCommand e
     /**
      * Performs the following:
      * <ol>
-     *   <li>Bail if target is not for macosx or the PackageMaker or hdiutil utilities coud not be found.</li>
+     *   <li>Bail if target is not for macosx or the PackageMaker or hdiutil utilities can't be found.</li>
      *   <li>Creates the Mac OS X PKG Installer for Apache DS</li>
      *   <li>Package it in a Mac OS X DMG (Disk iMaGe)</li>
      * </ol>
      */
     public void execute() throws MojoExecutionException, MojoFailureException
     {
-        // Verifying the target is Mac OS X
-        if ( !target.getOsName().equalsIgnoreCase( Target.OS_NAME_MAC_OS_X ) )
-        {
-            log.warn( "Mac OS X PKG installer can only be targeted for Mac OS X platform!" );
-            log.warn( "The build will continue, but please check the the platform of this installer target." );
-            return;
-        }
-
-        // Verifying the PackageMaker utility exists
-        if ( !target.getPackageMakerUtility().exists() )
-        {
-            log.warn( "Cannot find 'PackageMaker' utility at this location: " + target.getPackageMakerUtility() );
-            log.warn( "The build will continue, but please check the location of your 'Package Maker' utility." );
-            return;
-        }
-
-        // Verifying the hdiutil utility exists
-        if ( !hdiutilUtility.exists() )
+        // Verifying the target
+        if ( !verifyTarget() )
         {
-            log.warn( "Cannot find 'hdiutil' utility at this location: " + hdiutilUtility );
-            log.warn( "The build will continue, but please check the location of your 'hdiutil' utility." );
             return;
         }
 
-        log.info( "Creating Mac OS X PKG Installer..." );
+        log.info( "Creating Mac OS X PKG installer..." );
 
         // Creating the target directory
         File targetDirectory = getTargetDirectory();
@@ -130,27 +111,6 @@ public class MacOsXPkgInstallerCommand e
             // Creating the installation layout and copying files to it
             copyCommonFiles( mojo );
 
-            //            // Copying the apacheds.init file
-            //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.init" ),
-            //                new File( pkgRootUsrLocalApachedsDirectory, "bin/apacheds.init" ),
-            //                true );
-            //
-            //            // Replacing the apacheds.conf file
-            //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
-            //                new File( pkgRootUsrLocalApachedsDirectory, "conf/apacheds.conf" ), true );
-
-            //            // Copying the apacheds.conf file in the default instance conf directory
-            //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
-            //                "apacheds-default.conf" ), new File( pkgRootInstancesDefaultConfDirectory, "apacheds.conf" ), false );
-
-            // Copying the log4j.properties file in the default instance conf directory
-            //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
-            //                "conf/log4j.properties" ), new File( pkgRootInstancesDefaultConfDirectory, "log4j.properties" ), false );
-
-            //            // Copying the server.xml file in the default instance conf directory
-            //            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
-            //                "conf/server.xml" ), new File( pkgRootInstancesDefaultConfDirectory, "server.xml" ), false );
-
             // Copying the apacheds command to /usr/bin
             MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
                 "apacheds-usr-bin.sh" ), new File( pkgRootUsrBinDirectory, "apacheds" ), true );
@@ -160,30 +120,14 @@ public class MacOsXPkgInstallerCommand e
                 "org.apache.directory.server.plist" ), new File( pkgRootLibraryLaunchDaemons,
                 "org.apache.directory.server.plist" ), true );
 
-            //            // Removing the redundant server.xml file (see DIRSERVER-1112)
-            //            new File( pkgRootUsrLocalApachedsDirectory, "conf/server.xml" ).delete();
-        }
-        catch ( IOException e )
-        {
-            log.error( e.getMessage() );
-            throw new MojoFailureException( "Failed to copy image () to the PKG directory (" + pkgRootDirectory + ")" );
-        }
-        catch ( Exception e )
-        {
-            log.error( e.getMessage() );
-            throw new MojoFailureException( "Failed to copy image () to the PKG directory (" + pkgRootDirectory + ")" );
-        }
-
-        // 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" );
-        pkgResourcesEnglishDirectory.mkdirs();
-        File pkgScriptsDirectory = new File( targetDirectory, "scripts" );
-        pkgScriptsDirectory.mkdirs();
+            // 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" );
+            pkgResourcesEnglishDirectory.mkdirs();
+            File pkgScriptsDirectory = new File( targetDirectory, "scripts" );
+            pkgScriptsDirectory.mkdirs();
 
-        try
-        {
             MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "pkg-background.tiff" ), new File(
                 pkgResourcesEnglishDirectory, "background.tiff" ) );
 
@@ -196,7 +140,7 @@ public class MacOsXPkgInstallerCommand e
             MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "postflight" ), new File(
                 pkgScriptsDirectory, "postflight" ) );
         }
-        catch ( IOException e )
+        catch ( Exception e )
         {
             log.error( e.getMessage() );
             throw new MojoFailureException( "Failed to copy PKG resources files." );
@@ -206,24 +150,11 @@ public class MacOsXPkgInstallerCommand e
         log.info( "  Generating Mac OS X PKG Installer" );
         Execute createPkgTask = new Execute();
         String[] cmd = new String[]
-            {
-                target.getPackageMakerUtility().getAbsolutePath(),
-                "--root",
-                "root/",
-                "--resources",
-                "Resources/",
-                "--info",
-                "Info.plist",
-                "--title",
-                "Apache Directory Server " + mojo.getProject().getVersion(),
-                "--version",
-                mojo.getProject().getVersion(),
-                "--scripts",
-                "scripts",
-                "--out",
+            { target.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.setSpawn( true ); // TODO should we remove this?
         createPkgTask.setWorkingDirectory( targetDirectory );
         try
         {
@@ -292,7 +223,6 @@ public class MacOsXPkgInstallerCommand e
             createDmgTask.setCommandline( new String[]
                 { hdiutilUtility.getAbsolutePath(), "makehybrid", "-quiet", "-hfs", "-hfs-volume-name",
                     "Apache Directory Server Installer", "-hfs-openfolder", "dmg/", "dmg/", "-o", "TMP.dmg" } );
-            createDmgTask.setSpawn( true );
             createDmgTask.setWorkingDirectory( dmgDirectory );
             createDmgTask.execute();
 
@@ -320,6 +250,43 @@ public class MacOsXPkgInstallerCommand e
 
 
     /**
+     * Verifies the target.
+     *
+     * @return
+     *      <code>true</code> if the target is correct, 
+     *      <code>false</code> if not.
+     */
+    private boolean verifyTarget()
+    {
+        // Verifying the target is Mac OS X
+        if ( !target.getOsName().equalsIgnoreCase( Target.OS_NAME_MAC_OS_X ) )
+        {
+            log.warn( "Mac OS X PKG installer can only be targeted for Mac OS X platform!" );
+            log.warn( "The build will continue, but please check the the platform of this installer target." );
+            return false;
+        }
+
+        // Verifying the PackageMaker utility exists
+        if ( !target.getPackageMakerUtility().exists() )
+        {
+            log.warn( "Cannot find 'PackageMaker' utility at this location: " + target.getPackageMakerUtility() );
+            log.warn( "The build will continue, but please check the location of your 'Package Maker' utility." );
+            return false;
+        }
+
+        // Verifying the hdiutil utility exists
+        if ( !hdiutilUtility.exists() )
+        {
+            log.warn( "Cannot find 'hdiutil' utility at this location: " + hdiutilUtility );
+            log.warn( "The build will continue, but please check the location of your 'hdiutil' utility." );
+            return false;
+        }
+
+        return true;
+    }
+
+
+    /**
      * {@inheritDoc}
      */
     protected void initializeFilterProperties()
@@ -334,6 +301,9 @@ public class MacOsXPkgInstallerCommand e
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public File getInstallationDirectory()
     {
         return new File( getTargetDirectory(), "root/usr/local/apacheds-"
@@ -341,6 +311,9 @@ public class MacOsXPkgInstallerCommand e
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public File getInstanceDirectory()
     {
         return new File( getInstallationDirectory(), "instances/default" );

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgTarget.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgTarget.java?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgTarget.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/macosxpkg/MacOsXPkgTarget.java Thu Sep 23 12:27:05 2010
@@ -39,8 +39,6 @@ import org.apache.directory.daemon.insta
  */
 public class MacOsXPkgTarget extends Target
 {
-    /** The wrapper executable path */
-    private String wrapperExecutablePath = "src/main/installers/wrapper/bin/wrapper-windows-x86-32.exe";
     /** The PackageMaker utility executable */
     private File packageMakerUtility = new File(
         "/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker" );
@@ -69,18 +67,6 @@ public class MacOsXPkgTarget extends Tar
 
 
     /**
-     * Gets the Wrapper executable path.
-     *
-     * @return
-     *      the wrapper executable path
-     */
-    public String getWrapperExecutablePath()
-    {
-        return wrapperExecutablePath;
-    }
-
-
-    /**
      * Sets the PackageMaker utility.
      *
      * @param packageMakerUtility
@@ -90,16 +76,4 @@ public class MacOsXPkgTarget extends Tar
     {
         this.packageMakerUtility = packageMakerUtility;
     }
-
-
-    /**
-     * Sets the Wrapper executable path.
-     *
-     * @param wrapperExecutablePath
-     *      the wrapper executable path
-     */
-    public void setWrapperExecutablePath( String wrapperExecutablePath )
-    {
-        this.wrapperExecutablePath = wrapperExecutablePath;
-    }
-}
\ No newline at end of file
+}

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java Thu Sep 23 12:27:05 2010
@@ -22,20 +22,14 @@ package org.apache.directory.daemon.inst
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Properties;
 
 import org.apache.directory.daemon.installers.AbstractMojoCommand;
-import org.apache.directory.daemon.installers.MojoHelperUtils;
 import org.apache.directory.daemon.installers.GenerateMojo;
+import org.apache.directory.daemon.installers.MojoHelperUtils;
+import org.apache.directory.daemon.installers.Target;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
-import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.Touch;
-import org.codehaus.plexus.util.FileUtils;
 
 
 /**
@@ -45,17 +39,17 @@ import org.codehaus.plexus.util.FileUtil
  */
 public class NsisInstallerCommand extends AbstractMojoCommand<NsisTarget>
 {
-    private final File nsisConfigurationFile = new File( "" ); // TODO FIXME
-
-    private File nsisCompiler;
-
-
+    /**
+     * Creates a new instance of NsisInstallerCommand.
+     *
+     * @param mojo
+     *      the Server Installers Mojo
+     * @param target
+     *      the NSIS target
+     */
     public NsisInstallerCommand( GenerateMojo mojo, NsisTarget target )
     {
         super( mojo, target );
-        // TODO FIXME
-        //        File imagesDir = target.getLayout().getInstallationDirectory().getParentFile();
-        //        nsisConfigurationFile = new File( imagesDir, target.getId() + ".nsi" );
         initializeFilterProperties();
     }
 
@@ -63,230 +57,128 @@ public class NsisInstallerCommand extend
     /**
      * Performs the following:
      * <ol>
-     *   <li>Bail if target is not for windows</li>
-     *   <li>Filter and copy project supplied .nsi file into place if it has been specified and exists</li>
-     *   <li>If no .nsi file exists filter and deposite into place bundled nsis template & copy wrapper executables</li>
-     *   <li>Bail if we cannot find the nsis compiler executable</li>
-     *   <li>Execute nsis compiler it on the .nsi file</li>
+     *   <li>Bail if target is not for windows or the NSIS compiler utility can't be found.</li>
+     *   <li>Execute NSIS compiler (makensis) to create the NSIS installer.</li>
      * </ol>
      */
     public void execute() throws MojoExecutionException, MojoFailureException
     {
-        // -------------------------------------------------------------------
-        // Step 1 & 4: do some error checking first for compiler and OS
-        // -------------------------------------------------------------------
-
-        // TODO FIXME
-        //        if ( !target.getOsFamily().equals( "windows" ) )
-        //        {
-        //            log.warn( "NSIS installer can only be targeted for windows platforms!" );
-        //            log.warn( "The build will continue, but please check the the platform" );
-        //            log.warn( "of this installer target" );
-        //            return;
-        //        }
-
-        // @todo this should really be a parameter taken from the user's settings
-        // because the compiler may be installed in different places and is specific
-        if ( !target.getNsisCompiler().exists() )
+        // Verifying the target
+        if ( !verifyTarget() )
         {
-            log.warn( "Cannot find NSIS compiler at this location: " + target.getNsisCompiler() );
-            log.warn( "The build will continue, but please check the location of your makensis executable " );
             return;
         }
-        else
-        {
-            this.nsisCompiler = target.getNsisCompiler();
-        }
 
-        // -------------------------------------------------------------------
-        // Step 2 & 3: copy nsis file and filter
-        // -------------------------------------------------------------------
+        log.info( "Creating NSIS installer..." );
 
-        // check first to see if the default install.iss file is present in src/main/installers
-        if ( target.getNsisConfigurationFile() != null && target.getNsisConfigurationFile().exists() )
-        {
-            try
-            {
-                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, target.getNsisConfigurationFile(),
-                        nsisConfigurationFile, true );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to filter and copy project provided "
-                    + target.getNsisConfigurationFile() + " to " + nsisConfigurationFile );
-            }
-        }
-        else
-        {
-            throw new MojoFailureException( "NSIS configuration file does not exist ("
-                + target.getNsisConfigurationFile() + ")." );
-        }
+        // Creating the target directory
+        File targetDirectory = getTargetDirectory();
+        targetDirectory.mkdirs();
 
-        // -------------------------------------------------------------------
-        // 3: copy native files
-        // -------------------------------------------------------------------
-
-        // TODO FIXME
-        //        // now copy over the Prunsrv and Prunmgr executables renaming them to the mojo.getApplicationName() + w for mgr
-        //        if ( target.getOsFamily().equals( "windows" ) )
-        //        {
-        //            File executableTarget = new File( target.getLayout().getBinDirectory(), "apacheds.exe" );
-        //            File override = new File( mojo.getSourceDirectory(), target.getWrapperExecutablePath() );
-        //            if ( override.exists() )
-        //            {
-        //                mojo.getLog().info( "Using native launcher supplied by project: " + override.getAbsolutePath() );
-        //                try
-        //                {
-        //                    FileUtils.copyFile( override, executableTarget );
-        //                }
-        //                catch ( IOException e )
-        //                {
-        //                    throw new MojoFailureException(
-        //                        "Failed to copy project supplied native launcher executable override "
-        //                            + override.getAbsolutePath() + " into position " + executableTarget.getAbsolutePath() );
-        //                }
-        //            }
-        //            else
-        //            {
-        //                try
-        //                {
-        //                    MojoHelperUtils
-        //                        .copyBinaryFile( getClass().getResourceAsStream( "../wrapper/bin/wrapper-windows-x86-32.exe" ),
-        //                            executableTarget );
-        //                    MojoHelperUtils.copyBinaryFile(
-        //                        getClass().getResourceAsStream( "../wrapper/lib/wrapper-windows-x86-32.dll" ),
-        //                            new File( target.getLayout().getLibDirectory(), "wrapper.dll" )
-        //                        );
-        //                }
-        //                catch ( IOException e )
-        //                {
-        //                    throw new MojoFailureException( "Failed to copy native launcher executable file "
-        //                        + getClass().getResource( "../wrapper/bin/wrapper-windows-x86-32.exe" ) + " into position "
-        //                        + executableTarget.getAbsolutePath() );
-        //                }
-        //            }
-        //
-        //        }
-        //
-        //        processPackagedFiles( target, target.getPackagedFiles() );
-        //
-        //        Execute task = new Execute();
-        //        System.out.println( "nsisCompiler = " + nsisCompiler );
-        //        System.out.println( "nsisConfigurationFile = " + nsisConfigurationFile );
-        //        String[] cmd = new String[]
-        //            { nsisCompiler.getAbsolutePath(), nsisConfigurationFile.getAbsolutePath() };
-        //        task.setCommandline( cmd );
-        //        task.setSpawn( true );
-        //        task.setWorkingDirectory( target.getLayout().getInstallationDirectory() );
-        //        try
-        //        {
-        //            task.execute();
-        //        }
-        //        catch ( IOException e )
-        //        {
-        //            throw new MojoFailureException( "Failed while trying to execute " + nsisCompiler.getAbsolutePath() + ": "
-        //                + e.getMessage() );
-        //        }
-        //
-        //        if ( task.getExitValue() != 0 )
-        //        {
-        //            throw new MojoFailureException( nsisCompiler.getAbsolutePath()
-        //                + " execution resulted in a non-zero exit value: " + task.getExitValue() );
-        //        }
-    }
+        log.info( "  Copying NSIS installer files" );
 
+        File installerFile = new File( targetDirectory, "installer.nsi" );
 
-    /**
-     * {@inheritDoc}
-     */
-    protected void initializeFilterProperties()
-    {
-        super.initializeFilterProperties();
+        try
+        {
+            copyCommonFiles( mojo );
 
-        filterProperties.put( "app.base.dir", mojo.getProject().getBasedir().getAbsolutePath() );
+            // Copying the 'installer.nsi' file
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
+                "installer.nsi" ), installerFile, true );
 
-        filterProperties.put( "app.displayname", "ApacheDS" );
+            // Copying the images and icon
+            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "installer.ico" ), new File(
+                targetDirectory, "installer.ico" ) );
+            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "header.bmp" ), new File(
+                targetDirectory, "header.bmp" ) );
+            MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "welcome.bmp" ), new File(
+                targetDirectory, "welcome.bmp" ) );
+        }
+        catch ( Exception e )
+        {
+            log.error( e.getMessage() );
+            throw new MojoFailureException( "Failed to copy NSIS installer files." );
+        }
 
-        if ( mojo.getProject().getVersion() != null )
+        // Generating the NSIS installer
+        log.info( "  Generating NSIS installer" );
+        Execute createPkgTask = new Execute();
+        String[] cmd = new String[]
+            { target.getNsisCompiler().getAbsolutePath(), installerFile.getAbsolutePath() };
+        createPkgTask.setCommandline( cmd );
+        createPkgTask.setWorkingDirectory( targetDirectory );
+        try
         {
-            filterProperties.put( "app.version", mojo.getProject().getVersion() );
+            createPkgTask.execute();
         }
-        else
+        catch ( IOException e )
         {
-            filterProperties.put( "app.version", "1.0" );
+            log.error( e.getMessage() );
+            throw new MojoFailureException( "Failed while trying to generate the NSIS installer: " + e.getMessage() );
         }
+    }
 
-        // -------------------------------------------------------------------
-        // WARNING: hard code values just to for testing
-        // -------------------------------------------------------------------
 
-        if ( target.getFinalName() != null )
+    /**
+     * Verifies the target.
+     *
+     * @return
+     *      <code>true</code> if the target is correct, 
+     *      <code>false</code> if not.
+     */
+    private boolean verifyTarget()
+    {
+        // Verifying the target is Mac OS X
+        if ( !target.getOsName().equalsIgnoreCase( Target.OS_NAME_WINDOWS ) )
         {
-            filterProperties.put( "app.final.name", target.getFinalName() );
+            log.warn( "NSIS installer can only be targeted for Windows platform!" );
+            log.warn( "The build will continue, but please check the the platform of this installer target." );
+            return false;
         }
-        else
+
+        // Verifying the NSIS compiler utility exists
+        if ( !target.getNsisCompiler().exists() )
         {
-            String finalName = "apacheds-" + mojo.getProject().getVersion()
-                + "-win32-setup.exe";
-            filterProperties.put( "app.final.name", finalName );
+            log.warn( "Cannot find NSIS compiler at this location: " + target.getNsisCompiler() );
+            log.warn( "The build will continue, but please check the location of your makensis executable." );
+            return false;
         }
 
-        // TODO FIXME
-        //        filterProperties.put( "app.email", target.getApplication().getEmail() );
-        //        filterProperties.put( "app.url", target.getApplication().getUrl() );
-        //        filterProperties.put( "app.java.version", "1.5" );
-        //        filterProperties.put( "app.license", target.getLayout().getLicenseFile().getPath() );
-        //        filterProperties.put( "app.license.name", target.getLayout().getLicenseFile().getName() );
-        //        filterProperties.put( "app.company.name", target.getCompanyName() );
-        //        filterProperties.put( "app.description", target.getApplication().getDescription() );
-        //        filterProperties.put( "app.copyright.year", target.getCopyrightYear() );
-
-        // TODO FIXME
-        //        if ( !target.getLayout().getReadmeFile().exists() )
-        //        {
-        //            touchFile( target.getLayout().getReadmeFile() );
-        //        }
-        //        filterProperties.put( "app.readme", target.getLayout().getReadmeFile().getPath() );
-        //        filterProperties.put( "app.readme.name", target.getLayout().getReadmeFile().getName() );
-        //        filterProperties.put( "app.icon", target.getLayout().getLogoIconFile().getPath() );
-        //        filterProperties.put( "app.icon.name", target.getLayout().getLogoIconFile().getName() );
-        //        filterProperties.put( "image.basedir", target.getLayout().getBaseDirectory().getPath() );
-        //        filterProperties.put( "app.lib.jars", getApplicationLibraryJars() );
-        //        filterProperties.put( "installer.output.directory", target.getLayout().getBaseDirectory().getParent() );
-
-        // TODO FIXME
-        //        File noticeFile = new File( target.getLayout().getInstallationDirectory(), "NOTICE.txt" );
-        //        if ( noticeFile.exists() )
-        //        {
-        //            filterProperties.put( "notice.file", "Source: {#SourceBase}\\NOTICE.txt; DestDir: "
-        //                + "{app}\\; Flags: ignoreversion recursesubdirs createallsubdirs" );
-        //        }
-        //        else
-        //        {
-        //            filterProperties.put( "notice.file", "" );
-        //        }
+        return true;
     }
 
 
-    static void touchFile( File file )
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        Touch touch = new Touch();
-        touch.setProject( new Project() );
-        touch.setFile( file );
-        touch.execute();
+        super.initializeFilterProperties();
+
+        String finalName = target.getFinalName();
+        if ( !finalName.endsWith( ".exe" ) )
+        {
+            finalName = finalName + ".exe";
+        }
+        filterProperties.put( "finalname", target.getFinalName() );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public File getInstallationDirectory()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return new File( getTargetDirectory(), "files" );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public File getInstanceDirectory()
     {
-        // TODO Auto-generated method stub
-        return null;
+        return new File( getInstallationDirectory(), "instances/default" );
     }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java?rev=1000426&r1=1000425&r2=1000426&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisTarget.java Thu Sep 23 12:27:05 2010
@@ -20,64 +20,51 @@
 package org.apache.directory.daemon.installers.nsis;
 
 
-import org.apache.directory.daemon.installers.Target;
-
 import java.io.File;
-import java.util.Calendar;
+
+import org.apache.directory.daemon.installers.Target;
 
 
 /**
- * A Nullsoft Installer System (NSIS) installer for the Windows platform
+ * A Nullsoft Installer System (NSIS) installer for the Windows platform.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
 public class NsisTarget extends Target
 {
-    private String wrapperExecutablePath = "src/main/installers/wrapper/bin/wrapper-windows-x86-32.exe";
-    private File nsisCompiler = new File( "/usr/local/share/nsis/makensis" );
-    private File NsisConfigurationFile;
+    private File nsisCompiler = new File( "/usr/bin/makensis" );
 
 
+    /**
+     * Creates a new instance of NsisTarget.
+     */
     public NsisTarget()
     {
-        Calendar cal = Calendar.getInstance();
-        cal.setTimeInMillis( System.currentTimeMillis() );
+        setOsName( Target.OS_NAME_WINDOWS );
+        setOsArch( Target.OS_ARCH_X86 );
     }
 
 
+    /**
+     * Sets the NSIS compiler utility.
+     *
+     * @param nsisCompiler
+     *      the NSIS compiler utility
+     */
     public void setNsisCompiler( File nsisCompiler )
     {
         this.nsisCompiler = nsisCompiler;
     }
 
 
+    /**
+     * Gets the NSIS compiler utility.
+     *
+     * @return
+     *      the NSIS compiler utility
+     */
     public File getNsisCompiler()
     {
         return nsisCompiler;
     }
-
-
-    public void setNsisConfigurationFile( File nsisConfigurationFile )
-    {
-        this.NsisConfigurationFile = nsisConfigurationFile;
-    }
-
-
-    public File getNsisConfigurationFile()
-    {
-        return NsisConfigurationFile;
-    }
-
-
-    public void setWrapperExecutablePath( String wrapperExecutablePath )
-    {
-        this.wrapperExecutablePath = wrapperExecutablePath;
-    }
-
-
-    public String getWrapperExecutablePath()
-    {
-        return wrapperExecutablePath;
-    }
-
 }

Added: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/header.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/header.bmp?rev=1000426&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/header.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.ico
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.ico?rev=1000426&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.ico
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi?rev=1000426&view=auto
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi (added)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/installer.nsi Thu Sep 23 12:27:05 2010
@@ -0,0 +1,655 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+
+!define AppName "ApacheDS"
+!define AppVersion "${version}"
+!define ShortName "${app}"
+!define JRE_VERSION "1.5.0"
+!define Vendor "Apache Software Foundation"
+
+!define JAVA_URL "http://java.sun.com/javase/downloads/index_jdk5.jsp"
+
+!macro CreateInternetShortcut FILENAME URL ;ICONFILE ICONINDEX
+WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
+!macroend
+
+!include "MUI.nsh"
+!include "Sections.nsh"
+
+Var InstallJRE
+Var JREPath
+
+
+
+;--------------------------------
+;Configuration
+
+  ;General
+  Name "${AppName}"
+  OutFile "..\${finalname}"
+
+  ;Folder selection page
+  InstallDir "$PROGRAMFILES\${AppName}"
+
+  ;Get install folder from registry if available
+  InstallDirRegKey HKLM "SOFTWARE\${Vendor}\${ShortName}" ""
+
+; Installation types
+InstType "Full"
+
+BrandingText "${AppName} - ${AppVersion}"
+XPStyle on
+
+!define MUI_HEADERIMAGE
+!define MUI_HEADERIMAGE_BITMAP "header.bmp"
+!define MUI_COMPONENTSPAGE_SMALLDESC
+!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
+!define MUI_ICON "installer.ico"
+!define MUI_UNICON "installer.ico"
+
+;--------------------------------
+;Pages
+
+  ; License page
+  !insertmacro MUI_PAGE_WELCOME
+  !insertmacro MUI_PAGE_LICENSE "files\LICENSE"
+
+  ; This page checks for JRE. It displays a dialog based on JRE.ini if it needs to install JRE
+  ; Otherwise you won't see it.
+  ;Page custom CheckInstalledJRE
+
+  ; Define headers for the 'Java installation successfully' page
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Java installation complete"
+  #!define MUI_PAGE_HEADER_TEXT "Installing Java runtime"
+  #!define MUI_PAGE_HEADER_SUBTEXT "Please wait while we install the Java runtime"
+  #!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "Java runtime installed successfully."
+  #!insertmacro MUI_PAGE_INSTFILES
+  !define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Installation complete"
+  !define MUI_PAGE_HEADER_TEXT "Installing"
+  !define MUI_PAGE_HEADER_SUBTEXT "Please wait while ${AppName} is being installed."
+
+  !insertmacro MUI_PAGE_COMPONENTS
+
+  # The main installation directory
+
+    Var SERVER_HOME_DIR
+    ;!define MUI_PAGE_CUSTOMFUNCTION_PRE PreServerDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $SERVER_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like to install ${AppName}"  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var INSTANCES_HOME_DIR
+    !define MUI_PAGE_CUSTOMFUNCTION_PRE PreInstancesDir
+    !define MUI_DIRECTORYPAGE_VARIABLE          $INSTANCES_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Server Instances Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the directory where you would like instances data to be stored.$\n$\nThis directory will be the home location for new instances."  ; GUI page title
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+    Var JAVA_HOME_DIR
+    !define MUI_DIRECTORYPAGE_VARIABLE          $JAVA_HOME_DIR  ;selected by user
+    !define MUI_DIRECTORYPAGE_TEXT_DESTINATION  "Java Home Directory"     ;descriptive text
+    !define MUI_DIRECTORYPAGE_TEXT_TOP          "Select the Java home directory that you would like to use for running the installed applications."
+    !insertmacro MUI_PAGE_DIRECTORY  ; this pops-up the GUI page
+
+
+  !insertmacro MUI_PAGE_INSTFILES
+  !insertmacro MUI_PAGE_FINISH
+
+; Uninstall  
+  !insertmacro MUI_UNPAGE_CONFIRM
+  !insertmacro MUI_UNPAGE_INSTFILES
+
+;--------------------------------
+;Modern UI Configuration
+
+  !define MUI_ABORTWARNING
+
+;--------------------------------
+;Languages
+
+!insertmacro MUI_LANGUAGE "English"
+
+
+;--------------------------------
+;Language Strings
+
+  ;Description
+  LangString DESC_SecServerFiles ${LANG_ENGLISH} "Installs all required ApacheDS server files."
+  LangString DESC_SecInstanceFiles ${LANG_ENGLISH} "Creates and registers a default server instance."
+
+  ;Header
+  LangString TEXT_JRE_TITLE ${LANG_ENGLISH} "Java Runtime Environment"
+  LangString TEXT_JRE_SUBTITLE ${LANG_ENGLISH} "Installation"
+  LangString TEXT_PRODVER_TITLE ${LANG_ENGLISH} "Installed version of ${AppName}"
+  LangString TEXT_PRODVER_SUBTITLE ${LANG_ENGLISH} "Installation canceled"
+
+;--------------------------------
+;Installer Sections
+
+SectionGroup "ApacheDS"
+Section "Apache DS Server Files" SecServerFiles
+  SectionIn 1 RO
+  SetOutPath "$SERVER_HOME_DIR\bin"
+  File /r "files\bin\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\lib"
+  File /r "files\lib\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR\conf"
+  File /r "files\conf\*.*"
+
+  SetOutPath "$SERVER_HOME_DIR"
+  File "*"
+  
+    Push "$SERVER_HOME_DIR"
+    Push "*.txt"
+    Call ConvertFiles
+
+    Push "$SERVER_HOME_DIR\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+    GetFunctionAddress $R0 ReplaceConfig ; handle to callback fn
+    Push $R0
+    Push "$SERVER_HOME_DIR\conf\apacheds.conf" ; file to replace in
+    Call ReplaceInFile
+    
+  CreateDirectory "$INSTANCES_HOME_DIR"
+
+  ;Store install folder
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS" "DisplayName" "ApacheDS - (remove only)"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS" "DisplayIcon" "$SERVER_HOME_DIR\uninstall.exe"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS" "UninstallString" '"$SERVER_HOME_DIR\uninstall.exe"'
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS" "NoModify" "1"
+  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS" "NoRepair" "1"
+
+  # Probably need to filter the file here (put in instance home)
+
+
+  ;Create uninstaller
+  WriteUninstaller "$SERVER_HOME_DIR\Uninstall.exe"
+
+    CreateDirectory "$SMPROGRAMS\ApacheDS"
+
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Basic Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-basic-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Advanced Users Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-advanced-users-guide.html"
+    !insertmacro CreateInternetShortcut "$SMPROGRAMS\ApacheDS\Developers Guide" \
+      "http://directory.apache.org/apacheds/1.5/apacheds-v15-developers-guide.html"
+
+    CreateShortCut "$SMPROGRAMS\ApacheDS\Uninstall.lnk" "$SERVER_HOME_DIR\uninstall.exe" "" "$SERVER_HOME_DIR\uninstall.exe" 0
+
+SectionEnd
+
+; This section needs a custom screen to ask for a name for the instance (replace default)
+Section "Default Instance" SecInstanceFiles
+    SectionIn 1
+    StrCpy $R9 "Passed the Example Instance section"
+    
+    Push "default"
+    Call CreateInstanceDirs
+
+    ;I am hand picking the files for now, but we could simplify this by creating a template for new instances
+    SetOutPath "$INSTANCES_HOME_DIR\default\conf"
+    File "files\instances\default\conf\log4j.properties"
+    File "files\instances\default\conf\wrapper.conf"
+
+    Push "$INSTANCES_HOME_DIR\default\conf"
+    Push "*.*"
+    Call ConvertFiles
+
+    Push "default"
+    Push "$INSTANCES_HOME_DIR"
+    Call RegisterInstance
+SectionEnd
+SectionGroupEnd
+
+
+;--------------------------------
+;Descriptions
+
+!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecServerFiles} $(DESC_SecServerFiles)
+  !insertmacro MUI_DESCRIPTION_TEXT ${SecInstanceFiles} $(DESC_SecInstanceFiles)
+!insertmacro MUI_FUNCTION_DESCRIPTION_END
+
+;---------------------------------
+; Functions
+
+; Converts Unix to CR/LF for Windows
+Function ConvertFiles
+    Pop $R0
+    Pop $R1
+
+    FindFirst $R2 $R3 "$R1\$R0"
+    loop:
+      StrCmp $R3 "" done
+      Push "$R1\$R3"
+      Call ConvertUnixNewLines
+      FindNext $R2 $R3
+      Goto loop
+    done:
+      FindClose $R2
+
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function CreateInstanceDirs
+    Pop $0
+    CreateDirectory "$INSTANCES_HOME_DIR\$0\log"
+    CreateDirectory "$INSTANCES_HOME_DIR\$0\conf"
+    CreateDirectory "$INSTANCES_HOME_DIR\$0\partitions"
+    ; the run dir seems to be irrelevant on Windows, but the InstallationLayout.verifyInstallation() method requires it
+    CreateDirectory "$INSTANCES_HOME_DIR\$0\run"
+    Pop $0
+FunctionEnd
+
+Function RegisterInstance
+    Pop $0
+    Pop $1
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -i "$SERVER_HOME_DIR\conf\${ShortName}.conf" set.INSTANCE_HOME="$0" "set.INSTANCE=$1" set.APACHEDS_HOME="$SERVER_HOME_DIR" '
+    Pop $1
+    Pop $0
+FunctionEnd
+
+Function un.RegisterInstance
+    Pop $0
+    nsExec::ExecToLog '"$SERVER_HOME_DIR\bin\${ShortName}" -r "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE=$0"'
+    Pop $0
+FunctionEnd
+
+Function .onInstSuccess
+  Push "$INSTANCES_HOME_DIR\conf\apacheds-default.conf"
+  Call ConvertUnixNewLines
+
+  StrCmp $R9 "" End
+
+  ; 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\${ShortName}" --start "$SERVER_HOME_DIR\conf\${ShortName}.conf" "set.INSTANCE_HOME=$INSTANCES_HOME_DIR" "set.INSTANCE=default" "set.APACHEDS_HOME=$SERVER_HOME_DIR"'
+  
+End:
+FunctionEnd
+
+;--------------------------------
+;Installer Functions
+
+Function .onInit
+    SetCurInstType 0
+    SetAutoClose false
+    StrCpy $SERVER_HOME_DIR "$PROGRAMFILES\ApacheDS"
+    Call CheckInstalledJRE
+    StrCpy $JAVA_HOME_DIR "$JREPath"
+FunctionEnd
+
+Function PreServerDir
+    ;StrCpy $SERVER_HOME_DIR $INSTDIR
+    ;SetAutoClose false
+FunctionEnd
+
+Function PreInstancesDir
+    StrCpy $INSTANCES_HOME_DIR $SERVER_HOME_DIR\instances
+FunctionEnd
+
+Function CheckInstalledJRE
+  Push "${JRE_VERSION}"
+  Call DetectJRE
+  Exch $0	; Get return value from stack
+
+  StrCmp $0 "0" NoFound
+  StrCmp $0 "-1" FoundOld
+  Goto JREAlreadyInstalled
+
+FoundOld:
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "${AppName} requires a more recent version of the Java Runtime Environment than the one found on your computer.  The installation of JRE ${JRE_VERSION} will start."
+  ;!insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "Field 1" "Text" "No Java Runtime Environment could be found on your computer. The installation of JRE v${JRE_VERSION} will start."
+  !insertmacro MUI_HEADER_TEXT "$(TEXT_JRE_TITLE)" "$(TEXT_JRE_SUBTITLE)"
+  ;!insertmacro MUI_INSTALLOPTIONS_DISPLAY_RETURN "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini"
+  Goto MustInstallJRE
+
+MustInstallJRE:
+  Exch $0	; $0 now has the installoptions page return value
+  ; Do something with return value here
+  Pop $0	; Restore $0
+  StrCpy $InstallJRE "yes"
+  Return
+
+JREAlreadyInstalled:
+;  MessageBox MB_OK "No download: ${TEMP2}"
+;  MessageBox MB_OK "JRE already installed"
+  StrCpy $InstallJRE "no"
+  StrCpy $JREPath "$0"
+
+  ;!insertmacro MUI_INSTALLOPTIONS_WRITE "/home/ccustine/development/projects/organicelement/libraries/apacheds_trunk/apacheds/server-installers/src/main/installers/jre.ini" "UserDefinedSection" "JREPath" $JREPATH
+  Pop $0		; Restore $0
+  Return
+
+FunctionEnd
+
+; Returns: 0 - JRE not found. -1 - JRE found but too old. Otherwise - Path to JAVA EXE
+
+; DetectJRE. Version requested is on the stack.
+; Returns (on stack)	"0" on failure (java too old or not installed), otherwise path to java interpreter
+; Stack value will be overwritten!
+
+Function DetectJRE
+  Exch $0	; Get version requested
+		; Now the previous value of $0 is on the stack, and the asked for version of JDK is in $0
+  Push $1	; $1 = Java version string (ie 1.5.0)
+  Push $2	; $2 = Javahome
+  Push $3	; $3 and $4 are used for checking the major/minor version of java
+  Push $4
+  ;MessageBox MB_OK "Detecting JRE"
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
+  ;MessageBox MB_OK "Read : $1"
+  StrCmp $1 "" DetectTry2
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
+  ;MessageBox MB_OK "Read 3: $2"
+  StrCmp $2 "" DetectTry2
+  Goto GetJRE
+
+DetectTry2:
+  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
+  ;MessageBox MB_OK "Detect Read : $1"
+  StrCmp $1 "" NoFound
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
+  ;MessageBox MB_OK "Detect Read 3: $2"
+  StrCmp $2 "" NoFound
+
+GetJRE:
+; $0 = version requested. $1 = version found. $2 = javaHome
+  ;MessageBox MB_OK "Getting JRE"
+  IfFileExists "$2\bin\java.exe" 0 NoFound
+  StrCpy $3 $0 1			; Get major version. Example: $1 = 1.5.0, now $3 = 1
+  StrCpy $4 $1 1			; $3 = major version requested, $4 = major version found
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 0 FoundOld FoundNew
+  StrCpy $3 $0 1 2
+  StrCpy $4 $1 1 2			; Same as above. $3 is minor version requested, $4 is minor version installed
+  ;MessageBox MB_OK "Want $3 , found $4"
+  IntCmp $4 $3 FoundNew FoundOld FoundNew
+
+NoFound:
+  ;MessageBox MB_OK "JRE not found"
+  Push "0"
+  Goto DetectJREEnd
+
+FoundOld:
+  MessageBox MB_OK "JRE too old: $3 is older than $4"
+;  Push ${TEMP2}
+  Push "-1"
+  Goto DetectJREEnd
+FoundNew:
+  ;MessageBox MB_OK "JRE is new: $3 is newer than $4"
+
+  Push "$2"
+;  Push "OK"
+;  Return
+   Goto DetectJREEnd
+DetectJREEnd:
+	; Top of stack is return value, then r4,r3,r2,r1
+	Exch	; => r4,rv,r3,r2,r1,r0
+	Pop $4	; => rv,r3,r2,r1r,r0
+	Exch	; => r3,rv,r2,r1,r0
+	Pop $3	; => rv,r2,r1,r0
+	Exch 	; => r2,rv,r1,r0
+	Pop $2	; => rv,r1,r0
+	Exch	; => r1,rv,r0
+	Pop $1	; => rv,r0
+	Exch	; => r0,rv
+	Pop $0	; => rv
+FunctionEnd
+
+;--------------------------------
+;Uninstaller Section
+
+Section "Uninstall"
+
+  ; Need to parse a list of instances or directories somehow
+  Push "default"
+  Call un.RegisterInstance
+
+  ; remove registry keys
+  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ApacheDS"
+  DeleteRegKey HKLM  "SOFTWARE\${Vendor}\ApacheDS"
+
+  ; remove shortcuts, if any.
+  RMDir /r "$SMPROGRAMS\ApacheDS"
+
+  ; remove files in root, then all dirs created by the installer.... leave user added or instance dirs.
+  Delete "$INSTDIR\*"
+  RMDir /r "$INSTDIR\bin"
+  RMDir /r "$INSTDIR\conf"
+  RMDir /r "$INSTDIR\var"
+  RMDir /r "$INSTDIR\lib"
+  RMDir /r "$INSTDIR\log"
+
+SectionEnd
+
+Function ConvertUnixNewLines
+    ; Usage:
+    ;Push "path\to\text_file.txt"
+    ;Call ConvertUnixNewLines
+
+    Exch $R0 ;file #1 path
+    Push $R1 ;file #1 handle
+    Push $R2 ;file #2 path
+    Push $R3 ;file #2 handle
+    Push $R4 ;data
+    Push $R5
+
+     FileOpen $R1 $R0 r
+     GetTempFileName $R2
+     FileOpen $R3 $R2 w
+
+     loopRead:
+      ClearErrors
+      FileRead $R1 $R4
+      IfErrors doneRead
+
+       StrCpy $R5 $R4 1 -1
+       StrCmp $R5 $\n 0 +4
+       StrCpy $R5 $R4 1 -2
+       StrCmp $R5 $\r +3
+       StrCpy $R4 $R4 -1
+       StrCpy $R4 "$R4$\r$\n"
+
+      FileWrite $R3 $R4
+
+     Goto loopRead
+     doneRead:
+
+     FileClose $R3
+     FileClose $R1
+
+     SetDetailsPrint none
+     Delete $R0
+     Rename $R2 $R0
+     SetDetailsPrint both
+
+    Pop $R5
+    Pop $R4
+    Pop $R3
+    Pop $R2
+    Pop $R1
+    Pop $R0
+FunctionEnd
+
+Function ReplaceInFile
+    ;
+	Exch $R0 ;file name to search in
+	Exch
+	Exch $R4 ;callback function handle
+	Push $R1 ;file handle
+	Push $R2 ;temp file name
+	Push $R3 ;temp file handle
+	Push $R5 ;line read
+
+	GetTempFileName $R2
+  	FileOpen $R1 $R0 r ;file to search in
+  	FileOpen $R3 $R2 w ;temp file
+
+loop_read:
+ 	ClearErrors
+ 	FileRead $R1 $R5 ;read line
+ 	Push $R5 ; put line on stack
+ 	Call $R4
+ 	Pop $R5 ; read line from stack
+ 	IfErrors exit
+ 	FileWrite $R3 $R5 ;write modified line
+	Goto loop_read
+exit:
+  	FileClose $R1
+  	FileClose $R3
+
+   	SetDetailsPrint none
+  	Delete $R0
+  	Rename $R2 $R0
+  	Delete $R2
+   	SetDetailsPrint both
+
+	; pop in reverse order
+	Pop $R5
+	Pop $R3
+	Pop $R2
+	Pop $R1
+	Pop $R4
+	Pop $R0
+FunctionEnd
+
+Function ReplaceConfig
+    ; Example usage of ReplaceInFile
+    ; Called Like this:
+    ;
+    ;GetFunctionAddress $R0 ReplaceInSQL ; handle to callback fn
+    ;Push $R0
+    ;Push "$INSTDIR\template.sql" ; file to replace in
+    ;Call ReplaceInFile
+	;
+	;
+	; save R1
+	Push $R1
+	Exch
+	;
+	;
+	; A sequence of replacements.
+        ; the string to replace in is at the top of the stack
+    Push "@app.java.home@" ; string to find
+	Push "$JAVA_HOME_DIR\bin\java.exe"
+	Call StrReplace
+
+	; restore stack
+	Exch
+	Pop $R1
+FunctionEnd
+
+# Uses $0
+Function openLinkNewWindow
+  Push $3
+  Push $2
+  Push $1
+  Push $0
+  ReadRegStr $0 HKCR "http\shell\open\command" ""
+# Get browser path
+    DetailPrint $0
+  StrCpy $2 '"'
+  StrCpy $1 $0 1
+  StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char
+    StrCpy $2 ' '
+  StrCpy $3 1
+  loop:
+    StrCpy $1 $0 1 $3
+    DetailPrint $1
+    StrCmp $1 $2 found
+    StrCmp $1 "" found
+    IntOp $3 $3 + 1
+    Goto loop
+
+  found:
+    StrCpy $1 $0 $3
+    StrCmp $2 " " +2
+      StrCpy $1 '$1"'
+
+  Pop $0
+  Exec '$1 $0'
+  Pop $1
+  Pop $2
+  Pop $3
+FunctionEnd
+
+Var STR_REPLACE_VAR_0
+Var STR_REPLACE_VAR_1
+Var STR_REPLACE_VAR_2
+Var STR_REPLACE_VAR_3
+Var STR_REPLACE_VAR_4
+Var STR_REPLACE_VAR_5
+Var STR_REPLACE_VAR_6
+Var STR_REPLACE_VAR_7
+Var STR_REPLACE_VAR_8
+
+Function StrReplace
+  Exch $STR_REPLACE_VAR_2
+  Exch 1
+  Exch $STR_REPLACE_VAR_1
+  Exch 2
+  Exch $STR_REPLACE_VAR_0
+    StrCpy $STR_REPLACE_VAR_3 -1
+    StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1
+    StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+    loop:
+      IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3
+      StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found
+      StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done
+      Goto loop
+    found:
+      StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3
+      IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4
+      StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8
+      StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7
+      StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0
+      Goto loop
+    done:
+  Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the
+  Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called
+  Exch $STR_REPLACE_VAR_0
+FunctionEnd
+
+!macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK
+  Push "${HAYSTACK}"
+  Push "${NEEDLE}"
+  Push "${NEEDLE2}"
+  Call StrReplace
+  Pop "${OUT}"
+!macroend
+
+!define StrReplace '!insertmacro "_strReplaceConstructor"'
+

Added: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/welcome.bmp
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/welcome.bmp?rev=1000426&view=auto
==============================================================================
Binary file - no diff available.

Propchange: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/resources/org/apache/directory/daemon/installers/nsis/welcome.bmp
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



Mime
View raw message