directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1000078 - in /directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers: ./ archive/ bin/ deb/ macosxpkg/ nsis/ rpm/ solarispkg/
Date Wed, 22 Sep 2010 16:43:35 GMT
Author: pamarcelot
Date: Wed Sep 22 16:43:35 2010
New Revision: 1000078

URL: http://svn.apache.org/viewvc?rev=1000078&view=rev
Log:
Moved some methods and fields to the abstract class.

Modified:
    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/archive/ArchiveInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.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/nsis/NsisInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/solarispkg/SolarisPkgInstallerCommand.java

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=1000078&r1=1000077&r2=1000078&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
Wed Sep 22 16:43:35 2010
@@ -22,17 +22,13 @@ package org.apache.directory.daemon.inst
 
 import java.io.File;
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
 import java.util.Properties;
 
-import org.apache.maven.artifact.Artifact;
+import org.apache.directory.server.InstallationLayout;
+import org.apache.directory.server.InstanceLayout;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
-import org.codehaus.plexus.util.Expand;
-import org.codehaus.plexus.util.FileUtils;
 
 
 /**
@@ -42,34 +38,86 @@ import org.codehaus.plexus.util.FileUtil
  */
 public abstract class AbstractMojoCommand<T extends Target>
 {
+    /** The filter properties */
+    protected Properties filterProperties = new Properties( System.getProperties() );
+
+    /** The associated mojo */
     protected GenerateMojo mojo;
+
+    /** The associated target */
     protected T target;
 
-    protected Map<String, Artifact> dependencyMap;
+    /** The logger */
     protected Log log;
 
 
-    public abstract void execute() throws MojoExecutionException, MojoFailureException;
-
-
-    public abstract Properties getFilterProperties();
-
-
+    /**
+     * Creates a new instance of AbstractMojoCommand.
+     *
+     * @param mojo
+     *      the associated mojo
+     * @param target
+     *      the associated target
+     */
     public AbstractMojoCommand( GenerateMojo mojo, T target )
     {
         this.mojo = mojo;
         this.target = target;
 
         log = mojo.getLog();
-        dependencyMap = new HashMap<String, Artifact>();
 
-        for ( Iterator ii = mojo.getProject().getDependencyArtifacts().iterator(); ii.hasNext();
/* */)
-        {
-            Artifact artifact = ( Artifact ) ii.next();
-            dependencyMap.put( artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact
);
-        }
+        initializeFilterProperties();
     }
 
+
+    /**
+     * Executes the command.
+     *
+     * @throws MojoExecutionException
+     * @throws MojoFailureException
+     */
+    public abstract void execute() throws MojoExecutionException, MojoFailureException;
+
+
+    /**
+     * Gets the filter properties.
+     *
+     * @return
+     *      the filter properties
+     */
+    public Properties getFilterProperties()
+    {
+        return filterProperties;
+    }
+
+
+    /**
+     * Initializes filter properties.
+     */
+    protected void initializeFilterProperties()
+    {
+        filterProperties.putAll( mojo.getProject().getProperties() );
+    }
+
+
+    /**
+     * Gets the installation directory file.
+     *
+     * @return
+     *      the installation directory file
+     */
+    public abstract File getInstallationDirectory();
+
+
+    /**
+     * Get the instance directory file.
+     *
+     * @return
+     *      the instance directory file
+     */
+    public abstract File getInstanceDirectory();
+
+
     /**
      * Gets the directory associated with the target.
      *
@@ -80,4 +128,189 @@ public abstract class AbstractMojoComman
     {
         return new File( mojo.getOutputDirectory(), target.getId() );
     }
+
+
+    /**
+     * Creates installation layout and copies files to it.
+     *
+     * @param mojo
+     *      the mojo
+     * @throws Exception
+     */
+    public void copyCommonFiles( GenerateMojo mojo ) throws Exception
+    {
+        // Creating the installation layout and directories
+        InstallationLayout installationLayout = new InstallationLayout( getInstallationDirectory()
);
+        installationLayout.mkdirs();
+
+        // Creating the instance layout and directories
+        InstanceLayout instanceLayout = new InstanceLayout( getInstanceDirectory() );
+        instanceLayout.mkdirs();
+
+        MojoHelperUtils.copyDependencies( mojo, installationLayout );
+
+        // Copying the LICENSE and NOTICE files
+        MojoHelperUtils.copyBinaryFile(
+                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/LICENSE"
),
+                new File( installationLayout.getInstallationDirectory(), "LICENSE" ) );
+        MojoHelperUtils.copyBinaryFile(
+                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/NOTICE"
),
+                new File( installationLayout.getInstallationDirectory(),
+                    "NOTICE" ) );
+
+        // Copying wrapper files
+        copyWrapperFiles( installationLayout, instanceLayout );
+
+        // Copying the log4j.properties file
+        MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
+            getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/log4j.properties"
),
+            new File( instanceLayout.getConfDirectory(), "log4j.properties" ), true );
+
+        // Copying the 'apacheds' script
+        MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
+            getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/apacheds.init"
),
+            new File( installationLayout.getBinDirectory(), "apacheds" ), true );
+    }
+
+
+    /**
+     * Copies wrapper files to the installation layout.
+     *
+     * @param installationLayout
+     *      the installation layout
+     * @param instanceLayout
+     * @throws MojoFailureException
+     */
+    private void copyWrapperFiles( InstallationLayout installationLayout, InstanceLayout
instanceLayout )
+        throws MojoFailureException
+    {
+        // Mac OS X
+        if ( target.isOsNameMacOSX() )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-macosx-universal-32"
), new File(
+                        installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-macosx-universal-32.jnilib"
),
+                    new File( installationLayout.getLibDirectory(),
+                        "libwrapper.jnilib" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Linux i386 & x86
+        if ( target.isOsNameLinux() && ( target.isOsArchI386() || target.isOsArchx86()
) )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile(
+                    getClass().getResourceAsStream(
+                        "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-32"
),
+                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-32.so"
),
+                    new File( installationLayout.getLibDirectory(), "libwrapper.so" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Linux x86_64 & amd64
+        if ( target.isOsNameLinux() && ( target.isOsArchX86_64() || target.isOsArchAmd64()
) )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile(
+                    getClass().getResourceAsStream(
+                        "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-64"
),
+                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-64.so"
),
+                    new File( installationLayout.getLibDirectory(), "libwrapper.so" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Solaris x86
+        if ( target.isOsNameSolaris() && target.isOsArchx86() )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-x86-32"
),
+                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-x86-32.so"
), new File(
+                        installationLayout.getLibDirectory(),
+                    "libwrapper.so" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Solaris Sparc
+        if ( target.isOsNameSolaris() && target.isOsArchSparc() )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-sparc-32"
),
+                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-sparc-32.so"
), new File(
+                        installationLayout.getLibDirectory(),
+                    "libwrapper.so" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Windows
+        if ( target.isOsNameWindows() )
+        {
+            try
+            {
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-windows-x86-32.exe"
),
+                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
+                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
+                    "/org/apache/directory/daemon/installers/wrapper/lib/wrapper-windows-x86-32.dll"
), new File(
+                        installationLayout.getLibDirectory(),
+                    "libwrapper.so" ) );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
+            }
+        }
+
+        // Wrapper configuration files
+        try
+        {
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
+                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/wrapper-installation.conf"
),
+                new File( installationLayout.getConfDirectory(), "wrapper.conf" ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
+                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/wrapper-instance.conf"
),
+                new File( instanceLayout.getConfDirectory(), "wrapper.conf" ), true );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and
bin directories" );
+        }
+    }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java?rev=1000078&r1=1000077&r2=1000078&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/archive/ArchiveInstallerCommand.java
Wed Sep 22 16:43:35 2010
@@ -22,18 +22,11 @@ package org.apache.directory.daemon.inst
 
 import java.io.File;
 import java.io.IOException;
-import java.util.Properties;
 
 import org.apache.directory.daemon.installers.AbstractMojoCommand;
 import org.apache.directory.daemon.installers.GenerateMojo;
-import org.apache.directory.daemon.installers.MojoHelperUtils;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.BZip2;
-import org.apache.tools.ant.taskdefs.GZip;
-import org.apache.tools.ant.taskdefs.Tar;
-import org.apache.tools.ant.taskdefs.Zip;
 import org.codehaus.plexus.util.FileUtils;
 
 
@@ -44,9 +37,6 @@ import org.codehaus.plexus.util.FileUtil
  */
 public class ArchiveInstallerCommand extends AbstractMojoCommand<ArchiveTarget>
 {
-    private Properties filterProperties = new Properties( System.getProperties() );
-
-
     /**
      * Creates a new instance of ArchiveInstallerCommand.
      *
@@ -58,7 +48,7 @@ public class ArchiveInstallerCommand ext
     public ArchiveInstallerCommand( GenerateMojo mojo, ArchiveTarget target )
     {
         super( mojo, target );
-        initializeFiltering();
+        initializeFilterProperties();
     }
 
 
@@ -229,17 +219,16 @@ public class ArchiveInstallerCommand ext
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
-     */
-    public Properties getFilterProperties()
+    public File getInstallationDirectory()
     {
-        return filterProperties;
+        // TODO Auto-generated method stub
+        return null;
     }
 
 
-    private void initializeFiltering()
+    public File getInstanceDirectory()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        // TODO Auto-generated method stub
+        return null;
     }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java?rev=1000078&r1=1000077&r2=1000078&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/bin/BinInstallerCommand.java
Wed Sep 22 16:43:35 2010
@@ -40,7 +40,6 @@ import org.codehaus.plexus.util.FileUtil
  */
 public class BinInstallerCommand extends AbstractMojoCommand<BinTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
     /** The sh utility executable */
     private File shUtility = new File( "/bin/sh" );
     /** The final name of the installer */
@@ -58,7 +57,7 @@ public class BinInstallerCommand extends
     public BinInstallerCommand( GenerateMojo mojo, BinTarget target )
     {
         super( mojo, target );
-        initializeFiltering();
+        initializeFilterProperties();
     }
 
 
@@ -217,18 +216,13 @@ public class BinInstallerCommand extends
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
+    /**
+     * {@inheritDoc}
      */
-    public Properties getFilterProperties()
+    protected void initializeFilterProperties()
     {
-        return filterProperties;
-    }
-
+        super.initializeFilterProperties();
 
-    private void initializeFiltering()
-    {
-        filterProperties.putAll( mojo.getProject().getProperties() );
         filterProperties.put( "tmpArchive", "__tmp.tar.gz" );
         finalName = target.getFinalName();
         if ( !finalName.endsWith( ".bin" ) )
@@ -238,4 +232,18 @@ public class BinInstallerCommand extends
         filterProperties.put( "finalName", finalName );
         filterProperties.put( "apacheds.version", mojo.getProject().getVersion() );
     }
+
+
+    public File getInstallationDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public File getInstanceDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java?rev=1000078&r1=1000077&r2=1000078&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/deb/DebInstallerCommand.java
Wed Sep 22 16:43:35 2010
@@ -55,7 +55,7 @@ public class DebInstallerCommand extends
     public DebInstallerCommand( GenerateMojo mojo, DebTarget target )
     {
         super( mojo, target );
-        initializeFiltering();
+        initializeFilterProperties();
     }
 
 
@@ -218,9 +218,13 @@ public class DebInstallerCommand extends
     }
 
 
-    private void initializeFiltering()
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        super.initializeFilterProperties();
+
         String version = mojo.getProject().getVersion();
         if ( version != null )
         {
@@ -243,11 +247,16 @@ public class DebInstallerCommand extends
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
-     */
-    public Properties getFilterProperties()
+    public File getInstallationDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public File getInstanceDirectory()
     {
-        return filterProperties;
+        // TODO Auto-generated method stub
+        return null;
     }
 }

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=1000078&r1=1000077&r2=1000078&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
Wed Sep 22 16:43:35 2010
@@ -42,7 +42,6 @@ import org.apache.tools.ant.taskdefs.Exe
  */
 public class MacOsXPkgInstallerCommand extends AbstractMojoCommand<MacOsXPkgTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
 
     /** The hdiutil utility executable */
     private File hdiutilUtility = new File( "/usr/bin/hdiutil" );
@@ -59,7 +58,7 @@ public class MacOsXPkgInstallerCommand e
     public MacOsXPkgInstallerCommand( GenerateMojo mojo, MacOsXPkgTarget target )
     {
         super( mojo, target );
-        initializeFiltering();
+        initializeFilterProperties();
     }
 
 
@@ -320,9 +319,13 @@ public class MacOsXPkgInstallerCommand e
     }
 
 
-    private void initializeFiltering()
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        super.initializeFilterProperties();
+
         filterProperties.put( "installation.directory", "/usr/local/apacheds-"
             + mojo.getProject().getVersion() );
         filterProperties.put( "instances.directory", "/usr/local/apacheds-"
@@ -331,15 +334,6 @@ public class MacOsXPkgInstallerCommand e
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
-     */
-    public Properties getFilterProperties()
-    {
-        return filterProperties;
-    }
-
-
     public File getInstallationDirectory()
     {
         return new File( getTargetDirectory(), "root/usr/local/apacheds-"
@@ -352,188 +346,4 @@ public class MacOsXPkgInstallerCommand e
         return new File( getInstallationDirectory(), "instances/default" );
     }
 
-
-    /**
-     * Creates installation layout and copies files to it.
-     *
-     * @param mojo
-     *      the mojo
-     * @throws Exception
-     */
-    public void copyCommonFiles( GenerateMojo mojo ) throws Exception
-    {
-        // Creating the installation layout and directories
-        InstallationLayout installationLayout = new InstallationLayout( getInstallationDirectory()
);
-        installationLayout.mkdirs();
-
-        // Creating the instance layout and directories
-        InstanceLayout instanceLayout = new InstanceLayout( getInstanceDirectory() );
-        instanceLayout.mkdirs();
-
-        MojoHelperUtils.copyDependencies( mojo, installationLayout );
-
-        // Copying the LICENSE and NOTICE files
-        MojoHelperUtils.copyBinaryFile(
-                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/LICENSE"
),
-                new File( installationLayout.getInstallationDirectory(), "LICENSE" ) );
-        MojoHelperUtils.copyBinaryFile(
-                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/NOTICE"
),
-                new File( installationLayout.getInstallationDirectory(),
-                    "NOTICE" ) );
-
-        // Copying wrapper files
-        copyWrapperFiles( installationLayout, instanceLayout );
-
-        // Copying the log4j.properties file
-        MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
-            getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/log4j.properties"
),
-            new File( instanceLayout.getConfDirectory(), "log4j.properties" ), true );
-
-        // Copying the 'apacheds' script
-        MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
-            getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/apacheds.init"
),
-            new File( installationLayout.getBinDirectory(), "apacheds" ), true );
-    }
-
-
-    /**
-     * Copies wrapper files to the installation layout.
-     *
-     * @param installationLayout
-     *      the installation layout
-     * @param instanceLayout
-     * @throws MojoFailureException
-     */
-    private void copyWrapperFiles( InstallationLayout installationLayout, InstanceLayout
instanceLayout )
-        throws MojoFailureException
-    {
-        // Mac OS X
-        if ( target.isOsNameMacOSX() )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-macosx-universal-32"
), new File(
-                        installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-macosx-universal-32.jnilib"
),
-                    new File( installationLayout.getLibDirectory(),
-                        "libwrapper.jnilib" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Linux i386 & x86
-        if ( target.isOsNameLinux() && ( target.isOsArchI386() || target.isOsArchx86()
) )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile(
-                    getClass().getResourceAsStream(
-                        "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-32"
),
-                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-32.so"
),
-                    new File( installationLayout.getLibDirectory(), "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Linux x86_64 & amd64
-        if ( target.isOsNameLinux() && ( target.isOsArchX86_64() || target.isOsArchAmd64()
) )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile(
-                    getClass().getResourceAsStream(
-                        "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-linux-x86-64"
),
-                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-linux-x86-64.so"
),
-                    new File( installationLayout.getLibDirectory(), "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Solaris x86
-        if ( target.isOsNameSolaris() && target.isOsArchx86() )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-x86-32"
),
-                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-x86-32.so"
), new File(
-                        installationLayout.getLibDirectory(),
-                    "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Solaris Sparc
-        if ( target.isOsNameSolaris() && target.isOsArchSparc() )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-solaris-sparc-32"
),
-                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/libwrapper-solaris-sparc-32.so"
), new File(
-                        installationLayout.getLibDirectory(),
-                    "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Windows
-        if ( target.isOsNameWindows() )
-        {
-            try
-            {
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/bin/wrapper-windows-x86-32.exe"
),
-                    new File( installationLayout.getBinDirectory(), "wrapper" ) );
-                MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "/org/apache/directory/daemon/installers/wrapper/lib/wrapper-windows-x86-32.dll"
), new File(
-                        installationLayout.getLibDirectory(),
-                    "libwrapper.so" ) );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to copy Tanuki binary files to lib
and bin directories" );
-            }
-        }
-
-        // Wrapper configuration files
-        try
-        {
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
-                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/wrapper-installation.conf"
),
-                new File( installationLayout.getConfDirectory(), "wrapper.conf" ), true );
-            MojoHelperUtils.copyAsciiFile( mojo, filterProperties,
-                getClass().getResourceAsStream( "/org/apache/directory/daemon/installers/wrapper-instance.conf"
),
-                new File( instanceLayout.getConfDirectory(), "wrapper.conf" ), true );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoFailureException( "Failed to copy Tanuki binary files to lib and
bin directories" );
-        }
-    }
 }

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=1000078&r1=1000077&r2=1000078&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
Wed Sep 22 16:43:35 2010
@@ -45,7 +45,6 @@ import org.codehaus.plexus.util.FileUtil
  */
 public class NsisInstallerCommand extends AbstractMojoCommand<NsisTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
     private final File nsisConfigurationFile = new File( "" ); // TODO FIXME
 
     private File nsisCompiler;
@@ -57,13 +56,7 @@ public class NsisInstallerCommand extend
         // TODO FIXME
         //        File imagesDir = target.getLayout().getInstallationDirectory().getParentFile();
         //        nsisConfigurationFile = new File( imagesDir, target.getId() + ".nsi" );
-        initializeFiltering();
-    }
-
-
-    public Properties getFilterProperties()
-    {
-        return filterProperties;
+        initializeFilterProperties();
     }
 
 
@@ -203,9 +196,13 @@ public class NsisInstallerCommand extend
     }
 
 
-    private void initializeFiltering()
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        super.initializeFilterProperties();
+
         filterProperties.put( "app.base.dir", mojo.getProject().getBasedir().getAbsolutePath()
);
 
         filterProperties.put( "app.displayname", "ApacheDS" );
@@ -278,4 +275,18 @@ public class NsisInstallerCommand extend
         touch.setFile( file );
         touch.execute();
     }
+
+
+    public File getInstallationDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public File getInstanceDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java?rev=1000078&r1=1000077&r2=1000078&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
Wed Sep 22 16:43:35 2010
@@ -43,7 +43,6 @@ import org.codehaus.plexus.util.Os;
  */
 public class RpmInstallerCommand extends AbstractMojoCommand<RpmTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
     private final File rpmConfigurationFile = new File( "" ); // TODO FIXME
     private File rpmBuilder;
 
@@ -54,13 +53,7 @@ public class RpmInstallerCommand extends
         // TODO FIXME
         //        File imagesDir = target.getLayout().getInstallationDirectory().getParentFile();
         //        rpmConfigurationFile = new File( imagesDir, target.getId() + ".spec" );
-        initializeFiltering();
-    }
-
-
-    public Properties getFilterProperties()
-    {
-        return filterProperties;
+        initializeFilterProperties();
     }
 
 
@@ -242,9 +235,13 @@ public class RpmInstallerCommand extends
     }
 
 
-    private void initializeFiltering()
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        super.initializeFilterProperties();
+
         //        filterProperties.put( "app", target.getApplication().getName() );
         //        filterProperties.put( "app.caps", target.getApplication().getName().toUpperCase()
);
         //        filterProperties.put( "app.java.home", "java" );
@@ -580,4 +577,18 @@ public class RpmInstallerCommand extends
         //
         //        MojoHelperUtils.exec( cmd, target.getLayout().getInstallationDirectory().getParentFile(),
target.isDoSudo() );
     }
+
+
+    public File getInstallationDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public File getInstanceDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
 }

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/solarispkg/SolarisPkgInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/solarispkg/SolarisPkgInstallerCommand.java?rev=1000078&r1=1000077&r2=1000078&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/solarispkg/SolarisPkgInstallerCommand.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/solarispkg/SolarisPkgInstallerCommand.java
Wed Sep 22 16:43:35 2010
@@ -39,8 +39,6 @@ import org.apache.tools.ant.taskdefs.Exe
  */
 public class SolarisPkgInstallerCommand extends AbstractMojoCommand<SolarisPkgTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
-
     private File pkgMaker;
     private File pkgTranslator;
 
@@ -56,7 +54,7 @@ public class SolarisPkgInstallerCommand 
     public SolarisPkgInstallerCommand( GenerateMojo mojo, SolarisPkgTarget target )
     {
         super( mojo, target );
-        initializeFiltering();
+        initializeFilterProperties();
     }
 
 
@@ -241,9 +239,13 @@ public class SolarisPkgInstallerCommand 
     }
 
 
-    private void initializeFiltering()
+    /**
+     * {@inheritDoc}
+     */
+    protected void initializeFilterProperties()
     {
-        filterProperties.putAll( mojo.getProject().getProperties() );
+        super.initializeFilterProperties();
+
         filterProperties.put( "app", "apacheds" );
         filterProperties.put( "app.name", "apacheds" );
         filterProperties.put( "osArch", target.getOsArch() );
@@ -258,11 +260,16 @@ public class SolarisPkgInstallerCommand 
     }
 
 
-    /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
-     */
-    public Properties getFilterProperties()
+    public File getInstallationDirectory()
+    {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+
+    public File getInstanceDirectory()
     {
-        return filterProperties;
+        // TODO Auto-generated method stub
+        return null;
     }
 }



Mime
View raw message