directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r998959 [1/2] - 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 Mon, 20 Sep 2010 15:37:04 GMT
Author: pamarcelot
Date: Mon Sep 20 15:37:03 2010
New Revision: 998959

URL: http://svn.apache.org/viewvc?rev=998959&view=rev
Log:
Simplified the classes of the Installers generation plugin.

Added:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java
      - copied, changed from r998104, directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java
      - copied, changed from r998197, directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
Removed:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Application.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
Modified:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Target.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

Copied: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java (from r998104, directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.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?p2=directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java&p1=directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java&r1=998104&r2=998959&rev=998959&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/AbstractMojoCommand.java Mon Sep 20 15:37:03 2010
@@ -40,11 +40,13 @@ import org.codehaus.plexus.util.FileUtil
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public abstract class MojoCommand
+public abstract class AbstractMojoCommand<T extends Target>
 {
-    protected final Map<String, Artifact> dependencyMap;
-    protected final Log log;
-    protected final ServiceInstallersMojo mymojo;
+    protected GenerateMojo mojo;
+    protected T target;
+    
+    protected Map<String, Artifact> dependencyMap;
+    protected Log log;
 
 
     public abstract void execute() throws MojoExecutionException, MojoFailureException;
@@ -53,13 +55,15 @@ public abstract class MojoCommand
     public abstract Properties getFilterProperties();
 
 
-    public MojoCommand( ServiceInstallersMojo mymojo )
+    public AbstractMojoCommand( GenerateMojo mojo, T target )
     {
-        this.mymojo = mymojo;
-        this.log = mymojo.getLog();
-        this.dependencyMap = new HashMap<String, Artifact>();
+        this.mojo = mojo;
+        this.target= target;
+        
+        log = mojo.getLog();
+        dependencyMap = new HashMap<String, Artifact>();
 
-        for ( Iterator ii = mymojo.getProject().getDependencyArtifacts().iterator(); ii.hasNext(); /* */)
+        for ( Iterator ii = mojo.getProject().getDependencyArtifacts().iterator(); ii.hasNext(); /* */)
         {
             Artifact artifact = ( Artifact ) ii.next();
             dependencyMap.put( artifact.getGroupId() + ":" + artifact.getArtifactId(), artifact );
@@ -117,8 +121,8 @@ public abstract class MojoCommand
 
                 if ( !source.isAbsolute() )
                 {
-                    File sourceDirectoryRelative = new File( mymojo.getSourceDirectory(), packagedFiles[ii].getSource() );
-                    File baseRelative = new File( mymojo.getProject().getBasedir(), packagedFiles[ii].getSource() );
+                    File sourceDirectoryRelative = new File( mojo.getSourceDirectory(), packagedFiles[ii].getSource() );
+                    File baseRelative = new File( mojo.getProject().getBasedir(), packagedFiles[ii].getSource() );
                     if ( sourceDirectoryRelative.exists() )
                     {
                         source = sourceDirectoryRelative;
@@ -189,7 +193,7 @@ public abstract class MojoCommand
                 {
                     try
                     {
-                        MojoHelperUtils.copyAsciiFile( mymojo, getFilterProperties(), source, dest, true );
+                        MojoHelperUtils.copyAsciiFile( mojo, getFilterProperties(), source, dest, true );
                     }
                     catch ( IOException e )
                     {

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java?rev=998959&r1=998958&r2=998959&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java Mon Sep 20 15:37:03 2010
@@ -35,17 +35,15 @@ import org.codehaus.plexus.util.FileUtil
  * 
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class CreateImageCommand extends MojoCommand
+public class CreateImageCommand extends AbstractMojoCommand<Target>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
-    private final Target target;
+    private Properties filterProperties = new Properties( System.getProperties() );
     private InstallationLayout layout;
 
 
-    public CreateImageCommand( ServiceInstallersMojo mojo, Target target )
+    public CreateImageCommand( GenerateMojo mojo, Target target )
     {
-        super( mojo );
-        this.target = target;
+        super( mojo, target );
         initializeFiltering();
     }
 
@@ -58,19 +56,8 @@ public class CreateImageCommand extends 
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app", target.getApplication().getName() );
-        filterProperties.put( "app.caps", target.getApplication().getName().toUpperCase() );
-
-        if ( target.getApplication().getVersion() != null )
-        {
-            filterProperties.put( "app.version", target.getApplication().getVersion() );
-        }
-
-        if ( target.getApplication().getDescription() != null )
-        {
-            filterProperties.put( "app.init.message", target.getApplication().getDescription() );
-        }
+        filterProperties.putAll( mojo.getProject().getProperties() );
+        filterProperties.put( "version", mojo.getProject().getVersion() );
     }
 
 
@@ -78,7 +65,7 @@ public class CreateImageCommand extends 
     {
         // make the layout directories
         log.info( "Creating image ... " );
-        File dir = new File( mymojo.getOutputDirectory(), target.getId() );
+        File dir = new File( mojo.getOutputDirectory(), target.getId() );
         layout = new InstallationLayout( dir );
         target.setLayout( layout );
         layout.mkdirs();
@@ -117,7 +104,7 @@ public class CreateImageCommand extends 
         //        {
         //            try
         //            {
-        //                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "LICENSE" ),
+        //                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "LICENSE" ),
         //                    licenseTarget, false );
         //            }
         //            catch ( IOException e )
@@ -157,11 +144,11 @@ public class CreateImageCommand extends 
         //        // copy over the REQUIRED bootstrapper.jar file 
         //        try
         //        {
-        //            FileUtils.copyFile( mymojo.getBootstrapper().getFile(), layout.getBootstrapper() );
+        //            FileUtils.copyFile( mojo.getBootstrapper().getFile(), layout.getBootstrapper() );
         //        }
         //        catch ( IOException e )
         //        {
-        //            throw new MojoFailureException( "Failed to copy bootstrapper.jar " + mymojo.getBootstrapper().getFile()
+        //            throw new MojoFailureException( "Failed to copy bootstrapper.jar " + mojo.getBootstrapper().getFile()
         //                + " into position " + layout.getBootstrapper() );
         //        }
         //
@@ -169,11 +156,11 @@ public class CreateImageCommand extends 
         //        /*
         //                try
         //                {
-        //                    FileUtils.copyFile( mymojo.getLogger().getFile(), layout.getLogger() );
+        //                    FileUtils.copyFile( mojo.getLogger().getFile(), layout.getLogger() );
         //                }
         //                catch ( IOException e )
         //                {
-        //                    throw new MojoFailureException( "Failed to copy logger.jar " + mymojo.getLogger().getFile()
+        //                    throw new MojoFailureException( "Failed to copy logger.jar " + mojo.getLogger().getFile()
         //                        + " into position " + layout.getLogger() );
         //                }
         //        */
@@ -181,11 +168,11 @@ public class CreateImageCommand extends 
         //        // copy over the REQUIRED daemon.jar file 
         //        try
         //        {
-        //            FileUtils.copyFile( mymojo.getDaemon().getFile(), new File( layout.getLibDirectory(), "wrapper.jar" ) );
+        //            FileUtils.copyFile( mojo.getDaemon().getFile(), new File( layout.getLibDirectory(), "wrapper.jar" ) );
         //        }
         //        catch ( IOException e )
         //        {
-        //            throw new MojoFailureException( "Failed to copy daemon.jar " + mymojo.getDaemon().getFile()
+        //            throw new MojoFailureException( "Failed to copy daemon.jar " + mojo.getDaemon().getFile()
         //                + " into position " + layout.getDaemon() );
         //        }
         //
@@ -244,7 +231,7 @@ public class CreateImageCommand extends 
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-32" ),
-                    new File( layout.getBinDirectory(), target.getApplication().getName() ) );
+                    new File( layout.getBinDirectory(), "wrapper" ) );
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "wrapper/lib/libwrapper-linux-x86-32.so" ), new File( layout.getLibDirectory(), "libwrapper.so" ) );
             }
@@ -262,7 +249,7 @@ public class CreateImageCommand extends 
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "wrapper/bin/wrapper-linux-x86-64" ),
-                    new File( layout.getBinDirectory(), target.getApplication().getName() ) );
+                    new File( layout.getBinDirectory(), "wrapper" ) );
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "wrapper/lib/libwrapper-linux-x86-64.so" ), new File( layout.getLibDirectory(), "libwrapper.so" ) );
             }
@@ -278,8 +265,7 @@ public class CreateImageCommand extends 
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "wrapper/bin/wrapper-macosx-universal-32" ), new File( layout.getBinDirectory(), target
-                    .getApplication().getName() ) );
+                    "wrapper/bin/wrapper-macosx-universal-32" ), new File( layout.getBinDirectory(), "wrapper" ) );
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "wrapper/lib/libwrapper-macosx-universal-32.jnilib" ), new File( layout.getLibDirectory(),
                     "libwrapper.jnilib" ) );
@@ -297,8 +283,7 @@ public class CreateImageCommand extends 
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "wrapper/bin/wrapper-solaris-x86-32" ), new File( layout.getBinDirectory(), target
-                    .getApplication().getName() ) );
+                    "wrapper/bin/wrapper-solaris-x86-32" ), new File( layout.getBinDirectory(), "wrapper" ) );
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "wrapper/lib/libwrapper-solaris-x86-32.so" ), new File( layout.getLibDirectory(),
                     "libwrapper.so" ) );
@@ -316,8 +301,7 @@ public class CreateImageCommand extends 
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
-                    "wrapper/bin/wrapper-solaris-sparc-32" ), new File( layout.getBinDirectory(), target
-                    .getApplication().getName() ) );
+                    "wrapper/bin/wrapper-solaris-sparc-32" ), new File( layout.getBinDirectory(), "wrapper" ) );
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream(
                     "wrapper/lib/libwrapper-solaris-sparc-32.so" ), new File( layout.getLibDirectory(),
                     "libwrapper.so" ) );
@@ -328,10 +312,10 @@ public class CreateImageCommand extends 
             }
         }
 
-        // now copy over the jsvc executable renaming it to the mymojo.getApplicationName() 
+        // now copy over the jsvc executable renaming it to the mojo.getApplicationName() 
         if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "sparc" ) )
         {
-            File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
+            File executable = new File( layout.getBinDirectory(), "wrapper" );
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_sparc" ), executable );
@@ -345,7 +329,7 @@ public class CreateImageCommand extends 
 
         if ( target.getOsName().equals( "sunos" ) && target.getOsArch().equals( "i386" ) )
         {
-            File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
+            File executable = new File( layout.getBinDirectory(), "wrapper" );
             try
             {
                 MojoHelperUtils.copyBinaryFile( getClass().getResourceAsStream( "jsvc_solaris_i386" ), executable );
@@ -357,7 +341,7 @@ public class CreateImageCommand extends 
             }
         }
 
-        // now copy over the jsvc executable renaming it to the mymojo.getApplicationName() 
+        // now copy over the jsvc executable renaming it to the mojo.getApplicationName() 
         //        if ( target.getOsName().equals( "macosx" ) && target.getOsArch().equals( "ppc" ) )
         //        {
         //            File executable = new File( layout.getBinDirectory(), target.getApplication().getName() );
@@ -372,8 +356,7 @@ public class CreateImageCommand extends 
         //            }
         //        }
 
-        target.setLibArtifacts( MojoHelperUtils.copyDependencies( mymojo, layout ) );
-
+        target.setLibArtifacts( MojoHelperUtils.copyDependencies( mojo, layout ) );
 
         // -- if present copy the NOTICE.txt file --
 
@@ -392,6 +375,6 @@ public class CreateImageCommand extends 
             }
         }
 
-        processPackagedFiles( target, mymojo.getPackagedFiles() );
+        processPackagedFiles( target, mojo.getPackagedFiles() );
     }
 }

Copied: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java (from r998197, directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java)
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java?p2=directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java&p1=directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java&r1=998197&r2=998959&rev=998959&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java Mon Sep 20 15:37:03 2010
@@ -41,13 +41,10 @@ import org.apache.directory.daemon.insta
 import org.apache.directory.daemon.installers.solarispkg.SolarisPkgInstallerCommand;
 import org.apache.directory.daemon.installers.solarispkg.SolarisPkgTarget;
 import org.apache.maven.artifact.Artifact;
-import org.apache.maven.model.Developer;
-import org.apache.maven.model.MailingList;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
-import org.apache.tools.ant.util.JavaEnvUtils;
 import org.codehaus.plexus.util.FileUtils;
 
 
@@ -60,12 +57,13 @@ import org.codehaus.plexus.util.FileUtil
  * @requiresDependencyResolution runtime
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ServiceInstallersMojo extends AbstractMojo
+public class GenerateMojo extends AbstractMojo
 {
     /**
      * The target directory into which the mojo creates os and platform 
      * specific images.
-     * @parameter default-value="${project.build.directory}/images"
+     * 
+     * @parameter default-value="${project.build.directory}/installers"
      */
     private File outputDirectory;
 
@@ -78,57 +76,72 @@ public class ServiceInstallersMojo exten
     private File sourceDirectory;
 
     /**
+     * The associated maven project.
+     * 
      * @parameter expression="${project}" default-value="${project}"
      * @required
      */
     private MavenProject project;
 
     /**
+     * The RPM installer targets.
+     * 
      * @parameter
      */
     private RpmTarget[] rpmTargets;
 
     /**
+     * The Mac OS X installer targets.
+     * 
      * @parameter
      */
     private MacOsXPkgTarget[] macOsXPkgTargets;
 
     /**
+     * The Solaris PKG installers targets.
+     * 
      * @parameter
      */
     private SolarisPkgTarget[] solarisPkgTargets;
 
     /**
+     * The NSIS installer targets.
+     * 
      * @parameter
      */
     private NsisTarget[] nsisTargets;
 
     /**
+     * The Debian installer targets.
+     * 
      * @parameter
      */
     private DebTarget[] debTargets;
 
     /**
+     * The Binary installer targets.
+     * 
      * @parameter
      */
     private BinTarget[] binTargets;
+
     /**
+     * The Archive installers targets.
+     * 
      * @parameter
      */
     private ArchiveTarget[] archiveTargets;
 
     /**
-     * @parameter 
-     * @required
-     */
-    private Application application;
-
-    /**
+     * The packages files.
+     * 
      * @parameter
      */
     private PackagedFile[] packagedFiles;
 
     /**
+     * The exclusions.
+     * 
      * @parameter
      */
     private Set excludes;
@@ -147,10 +160,10 @@ public class ServiceInstallersMojo exten
     {
         FileUtils.mkdir( outputDirectory.getAbsolutePath() );
 
-        // collect all targets 
+        // Collecting all targets 
         initializeAllTargets();
 
-        // makes sure defaulted values are set to globals
+        // Makes sure defaulted values are set to globals
         setDefaults();
 
         // bail if there is nothing to do 
@@ -232,27 +245,37 @@ public class ServiceInstallersMojo exten
     }
 
 
+    /**
+     * Initializes all targets.
+     */
     private void initializeAllTargets()
     {
         allTargets = new ArrayList<Target>();
-        addAll( allTargets, nsisTargets );
-        addAll( allTargets, rpmTargets );
-        addAll( allTargets, debTargets );
-        addAll( allTargets, macOsXPkgTargets );
-        addAll( allTargets, solarisPkgTargets );
-        addAll( allTargets, binTargets );
-        addAll( allTargets, archiveTargets );
+
+        addAllTargets( allTargets, nsisTargets );
+        addAllTargets( allTargets, rpmTargets );
+        addAllTargets( allTargets, debTargets );
+        addAllTargets( allTargets, macOsXPkgTargets );
+        addAllTargets( allTargets, solarisPkgTargets );
+        addAllTargets( allTargets, binTargets );
+        addAllTargets( allTargets, archiveTargets );
     }
 
 
-    private void addAll( List<Target> list, Target[] array )
+    /**
+     * Adds an array of targets to the given list.
+     *
+     * @param list
+     *      the list of targets
+     * @param array
+     *      an array of targets
+     */
+    private void addAllTargets( List<Target> list, Target[] array )
     {
-        if ( array == null )
+        if ( ( list != null ) && ( array != null ) )
         {
-            return;
+            list.addAll( Arrays.asList( array ) );
         }
-
-        list.addAll( Arrays.asList( array ) );
     }
 
 
@@ -263,119 +286,121 @@ public class ServiceInstallersMojo exten
             return;
         }
 
-        if ( application.getName() == null )
-        {
-            throw new MojoFailureException( "Installed application name cannot be null." );
-        }
-
-        if ( application.getCompany() == null )
-        {
-            if ( project.getOrganization() != null )
-            {
-                application.setCompany( project.getOrganization().getName() );
-            }
-            else
-            {
-                application.setCompany( "Apache Software Foundation" );
-            }
-        }
-
-        if ( application.getDescription() == null )
-        {
-            if ( project.getDescription() != null )
-            {
-                application.setDescription( project.getDescription() );
-            }
-            else
-            {
-                application.setDescription( "No description of this application is available." );
-            }
-        }
-
-        if ( project.getInceptionYear() != null )
-        {
-            application.setCopyrightYear( project.getInceptionYear() );
-        }
-
-        if ( application.getUrl() == null )
-        {
-            if ( project.getUrl() != null )
-            {
-                application.setUrl( project.getUrl() );
-            }
-            else if ( project.getOrganization() != null )
-            {
-                application.setUrl( project.getOrganization().getUrl() );
-            }
-            else
-            {
-                application.setUrl( "http://www.apache.org" );
-            }
-        }
-
-        if ( application.getVersion() == null )
-        {
-            application.setVersion( project.getVersion() );
-        }
-
-        if ( application.getMinimumJavaVersion() == null )
-        {
-            application.setMinimumJavaVersion( JavaEnvUtils.getJavaVersion() );
-        }
-
-        if ( application.getAuthors() == null )
-        {
-            List<String> authors = new ArrayList<String>();
-            @SuppressWarnings(value =
-                { "unchecked" })
-            List<Developer> developers = project.getDevelopers();
-
-            for ( Developer developer : developers )
-            {
-                if ( developer.getEmail() != null )
-                {
-                    authors.add( developer.getEmail() );
-                }
-                else
-                {
-                    authors.add( developer.getName() );
-                }
-            }
-
-            application.setAuthors( authors );
-        }
-
-        if ( application.getEmail() == null )
-        {
-            if ( !project.getMailingLists().isEmpty() )
-            {
-                application.setEmail( ( ( MailingList ) project.getMailingLists().get( 0 ) ).getPost() );
-            }
-
-            application.setEmail( "general@apache.org" );
-        }
-
-        if ( application.getIcon() == null )
-        {
-            application.setIcon( new File( "src/main/installers/logo.ico" ) );
-        }
-
-        if ( application.getReadme() == null )
-        {
-            application.setReadme( new File( "README" ) );
-        }
-
-        if ( application.getLicense() == null )
-        {
-            application.setLicense( new File( "LICENSE" ) );
-        }
+        // TODO FIXME
+        //        if ( application.getName() == null )
+        //        {
+        //            throw new MojoFailureException( "Installed application name cannot be null." );
+        //        }
+        //
+        //        if ( application.getCompany() == null )
+        //        {
+        //            if ( project.getOrganization() != null )
+        //            {
+        //                application.setCompany( project.getOrganization().getName() );
+        //            }
+        //            else
+        //            {
+        //                application.setCompany( "Apache Software Foundation" );
+        //            }
+        //        }
+        //
+        //        if ( application.getDescription() == null )
+        //        {
+        //            if ( project.getDescription() != null )
+        //            {
+        //                application.setDescription( project.getDescription() );
+        //            }
+        //            else
+        //            {
+        //                application.setDescription( "No description of this application is available." );
+        //            }
+        //        }
+        //
+        //        if ( project.getInceptionYear() != null )
+        //        {
+        //            application.setCopyrightYear( project.getInceptionYear() );
+        //        }
+        //
+        //        if ( application.getUrl() == null )
+        //        {
+        //            if ( project.getUrl() != null )
+        //            {
+        //                application.setUrl( project.getUrl() );
+        //            }
+        //            else if ( project.getOrganization() != null )
+        //            {
+        //                application.setUrl( project.getOrganization().getUrl() );
+        //            }
+        //            else
+        //            {
+        //                application.setUrl( "http://www.apache.org" );
+        //            }
+        //        }
+        //
+        //        if ( application.getVersion() == null )
+        //        {
+        //            application.setVersion( project.getVersion() );
+        //        }
+        //
+        //        if ( application.getMinimumJavaVersion() == null )
+        //        {
+        //            application.setMinimumJavaVersion( JavaEnvUtils.getJavaVersion() );
+        //        }
+        //
+        //        if ( application.getAuthors() == null )
+        //        {
+        //            List<String> authors = new ArrayList<String>();
+        //            @SuppressWarnings(value =
+        //                { "unchecked" })
+        //            List<Developer> developers = project.getDevelopers();
+        //
+        //            for ( Developer developer : developers )
+        //            {
+        //                if ( developer.getEmail() != null )
+        //                {
+        //                    authors.add( developer.getEmail() );
+        //                }
+        //                else
+        //                {
+        //                    authors.add( developer.getName() );
+        //                }
+        //            }
+        //
+        //            application.setAuthors( authors );
+        //        }
+        //
+        //        if ( application.getEmail() == null )
+        //        {
+        //            if ( !project.getMailingLists().isEmpty() )
+        //            {
+        //                application.setEmail( ( ( MailingList ) project.getMailingLists().get( 0 ) ).getPost() );
+        //            }
+        //
+        //            application.setEmail( "general@apache.org" );
+        //        }
+        //
+        //        if ( application.getIcon() == null )
+        //        {
+        //            application.setIcon( new File( "src/main/installers/logo.ico" ) );
+        //        }
+        //
+        //        if ( application.getReadme() == null )
+        //        {
+        //            application.setReadme( new File( "README" ) );
+        //        }
+        //
+        //        if ( application.getLicense() == null )
+        //        {
+        //            application.setLicense( new File( "LICENSE" ) );
+        //        }
 
         for ( Target target : allTargets )
         {
-            if ( target.getApplication() == null )
-            {
-                target.setApplication( this.application );
-            }
+            // TODO FIXME
+            //            if ( target.getApplication() == null )
+            //            {
+            //                target.setApplication( this.application );
+            //            }
 
             if ( target.getLoggerConfigurationFile() == null )
             {
@@ -448,8 +473,7 @@ public class ServiceInstallersMojo exten
     public void reportSetup()
     {
         getLog().info( "-------------------------------------------------------" );
-        getLog().info( "[installers:create]" );
-        getLog().info( "applicationName = " + application.getName() );
+        getLog().info( "[installers:generate]" );
         getLog().info( "sourceDirectory = " + sourceDirectory );
         getLog().info( "outputDirectory = " + outputDirectory );
         getLog().info( "---------------------- allTargets ---------------------" );
@@ -480,7 +504,7 @@ public class ServiceInstallersMojo exten
             }
         }
 
-        getLog().info( "===================================================================" );
+        getLog().info( "-------------------------------------------------------" );
     }
 
 

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java?rev=998959&r1=998958&r2=998959&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java Mon Sep 20 15:37:03 2010
@@ -67,7 +67,7 @@ public class MojoHelperUtils
     }
 
 
-    public static void copyAsciiFile( ServiceInstallersMojo mymojo, Properties filterProperties, InputStream from,
+    public static void copyAsciiFile( GenerateMojo mymojo, Properties filterProperties, InputStream from,
         File to, boolean filtering ) throws IOException
     {
         // buffer so it isn't reading a byte at a time!
@@ -110,14 +110,14 @@ public class MojoHelperUtils
     }
 
 
-    public static void copyAsciiFile( ServiceInstallersMojo mymojo, Properties filterProperties, File from, File to,
+    public static void copyAsciiFile( GenerateMojo mymojo, Properties filterProperties, File from, File to,
         boolean filtering ) throws IOException
     {
         copyAsciiFile( mymojo, filterProperties, new FileInputStream( from ), to, filtering );
     }
 
 
-    public static List copyDependencies( ServiceInstallersMojo mymojo, InstallationLayout layout )
+    public static List copyDependencies( GenerateMojo mymojo, InstallationLayout layout )
         throws MojoFailureException
     {
         List<Artifact> libArtifacts = new ArrayList<Artifact>();

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Target.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Target.java?rev=998959&r1=998958&r2=998959&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Target.java (original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/Target.java Mon Sep 20 15:37:03 2010
@@ -76,23 +76,9 @@ public class Target
     private InstallationLayout layout;
     private List libArtifacts;
 
-    private Application application;
-
     protected PackagedFile[] packagedFiles;
 
 
-    public void setApplication( Application application )
-    {
-        this.application = application;
-    }
-
-
-    public Application getApplication()
-    {
-        return application;
-    }
-
-
     public void setOsName( String osName )
     {
         this.osName = osName.toLowerCase( Locale.US );

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=998959&r1=998958&r2=998959&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 Mon Sep 20 15:37:03 2010
@@ -24,12 +24,11 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.AbstractMojoCommand;
+import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
-import org.apache.directory.daemon.installers.ServiceInstallersMojo;
 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.BZip2;
 import org.apache.tools.ant.taskdefs.GZip;
@@ -43,28 +42,22 @@ import org.codehaus.plexus.util.FileUtil
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ArchiveInstallerCommand extends MojoCommand
+public class ArchiveInstallerCommand extends AbstractMojoCommand<ArchiveTarget>
 {
-    private final Properties filterProperties = new Properties( System.getProperties() );
-    /** The archive target */
-    private final ArchiveTarget target;
-    /** The Maven logger */
-    private final Log log;
+    private Properties filterProperties = new Properties( System.getProperties() );
 
 
     /**
      * Creates a new instance of ArchiveInstallerCommand.
      *
-     * @param mymojo
+     * @param mojo
      *      the Server Installers Mojo
      * @param target
      *      the target
      */
-    public ArchiveInstallerCommand( ServiceInstallersMojo mymojo, ArchiveTarget target )
+    public ArchiveInstallerCommand( GenerateMojo mojo, ArchiveTarget target )
     {
-        super( mymojo );
-        this.target = target;
-        this.log = mymojo.getLog();
+        super( mojo, target );
         initializeFiltering();
     }
 
@@ -107,8 +100,8 @@ public class ArchiveInstallerCommand ext
 
         // Creating the archive directory
         File targetDirectory = new File( imagesDirectory, target.getId() );
-        File archiveDirectory = new File( targetDirectory, target.getApplication().getName() + "_"
-            + target.getApplication().getVersion() );
+        File archiveDirectory = new File( targetDirectory, "apacheds" + "_"
+            + mojo.getProject().getVersion() );
 
         log.info( "Copying Archive Installer files" );
 
@@ -116,15 +109,15 @@ public class ArchiveInstallerCommand ext
         try
         {
             // Copying the apacheds.bat file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.bat" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.bat" ),
                 new File( targetDirectory, "apacheds.bat" ), false );
 
             // Copying the cpappend.bat file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "cpappend.bat" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "cpappend.bat" ),
                 new File( targetDirectory, "cpappend.bat" ), false );
 
             // Copying the apacheds.sh file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.sh" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.sh" ),
                 new File( targetDirectory, "apacheds.sh" ), false );
 
             // Copying all the files in the final archive directory
@@ -236,7 +229,7 @@ public class ArchiveInstallerCommand ext
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
      */
     public Properties getFilterProperties()
     {
@@ -246,16 +239,6 @@ public class ArchiveInstallerCommand ext
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app", target.getApplication().getName() );
-        String version = target.getApplication().getVersion();
-        if ( version != null )
-        {
-            filterProperties.put( "app.version", version );
-        }
-        else
-        {
-            filterProperties.put( "app.version", "1.0" );
-        }
+        filterProperties.putAll( mojo.getProject().getProperties() );
     }
 }

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=998959&r1=998958&r2=998959&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 Mon Sep 20 15:37:03 2010
@@ -24,12 +24,11 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.AbstractMojoCommand;
+import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
-import org.apache.directory.daemon.installers.ServiceInstallersMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
 import org.apache.tools.ant.taskdefs.Execute;
 import org.codehaus.plexus.util.FileUtils;
 
@@ -39,13 +38,9 @@ import org.codehaus.plexus.util.FileUtil
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class BinInstallerCommand extends MojoCommand
+public class BinInstallerCommand extends AbstractMojoCommand<BinTarget>
 {
     private final Properties filterProperties = new Properties( System.getProperties() );
-    /** The PKG target */
-    private final BinTarget target;
-    /** The Maven logger */
-    private final Log log;
     /** The sh utility executable */
     private File shUtility = new File( "/bin/sh" );
     /** The final name of the installer */
@@ -55,16 +50,14 @@ public class BinInstallerCommand extends
     /**
      * Creates a new instance of BinInstallerCommand.
      *
-     * @param mymojo
+     * @param mojo
      *      the Server Installers Mojo
      * @param target
      *      the Bin target
      */
-    public BinInstallerCommand( ServiceInstallersMojo mymojo, BinTarget target )
+    public BinInstallerCommand( GenerateMojo mojo, BinTarget target )
     {
-        super( mymojo );
-        this.target = target;
-        this.log = mymojo.getLog();
+        super( mojo, target );
         initializeFiltering();
     }
 
@@ -133,35 +126,35 @@ public class BinInstallerCommand extends
         try
         {
             // Copying the apacheds.conf file to the server installation layout
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
                 new File( binRootFolderServerDirectory, "conf/apacheds.conf" ), false );
 
             // Copying the default instance apacheds.conf file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
                 "apacheds-default.conf" ), new File( binRootFolderInstanceDirectory, "apacheds.conf" ), false );
 
             // Copying the log4j.properties file for the default instance
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( binRootFolderServerDirectory,
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( binRootFolderServerDirectory,
                 "conf/log4j.properties" ), new File( binRootFolderInstanceDirectory, "log4j.properties" ), false );
 
             // Copying the server.xml file for the default instance
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( binRootFolderServerDirectory,
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( binRootFolderServerDirectory,
                 "conf/server.xml" ), new File( binRootFolderInstanceDirectory, "server.xml" ), false );
 
             // Copying the apacheds-init script file for the default instance
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds-init" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds-init" ),
                 new File( binRootFolderInstanceDirectory, "apacheds-init" ), true );
 
             // Copying shell script utilities for the installer
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "bootstrap.sh" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "bootstrap.sh" ),
                 new File( binDirectory, "bootstrap.sh" ), true );
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
                 "createInstaller.sh" ), new File( binDirectory, "createInstaller.sh" ), true );
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "functions.sh" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "functions.sh" ),
                 new File( binShDirectory, "functions.sh" ), false );
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "install.sh" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "install.sh" ),
                 new File( binShDirectory, "install.sh" ), false );
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "variables.sh" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "variables.sh" ),
                 new File( binShDirectory, "variables.sh" ), false );
 
             // Removing the redundant server.xml file (see DIRSERVER-1112)
@@ -224,7 +217,7 @@ public class BinInstallerCommand extends
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
      */
     public Properties getFilterProperties()
     {
@@ -234,17 +227,7 @@ public class BinInstallerCommand extends
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app", target.getApplication().getName() );
-        String version = target.getApplication().getVersion();
-        if ( version != null )
-        {
-            filterProperties.put( "app.version", version );
-        }
-        else
-        {
-            filterProperties.put( "app.version", "1.0" );
-        }
+        filterProperties.putAll( mojo.getProject().getProperties() );
         filterProperties.put( "tmpArchive", "__tmp.tar.gz" );
         finalName = target.getFinalName();
         if ( !finalName.endsWith( ".bin" ) )
@@ -252,6 +235,6 @@ public class BinInstallerCommand extends
             finalName = finalName + ".bin";
         }
         filterProperties.put( "finalName", finalName );
-        filterProperties.put( "apacheds.version", target.getApplication().getVersion() );
+        filterProperties.put( "apacheds.version", mojo.getProject().getVersion() );
     }
 }

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=998959&r1=998958&r2=998959&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 Mon Sep 20 15:37:03 2010
@@ -24,12 +24,11 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.AbstractMojoCommand;
+import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
-import org.apache.directory.daemon.installers.ServiceInstallersMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
 import org.apache.tools.ant.taskdefs.Execute;
 
 
@@ -38,13 +37,9 @@ import org.apache.tools.ant.taskdefs.Exe
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class DebInstallerCommand extends MojoCommand
+public class DebInstallerCommand extends AbstractMojoCommand<DebTarget>
 {
     private final Properties filterProperties = new Properties( System.getProperties() );
-    /** The Deb target */
-    private final DebTarget target;
-    /** The Maven logger */
-    private final Log log;
     /** The dpkg utility*/
     private File dpkgUtility;
 
@@ -52,16 +47,14 @@ public class DebInstallerCommand extends
     /**
      * Creates a new instance of DebInstallerCommand.
      *
-     * @param mymojo
+     * @param mojo
      *      the Server Installers Mojo
      * @param target
      *      the DEB target
      */
-    public DebInstallerCommand( ServiceInstallersMojo mymojo, DebTarget target )
+    public DebInstallerCommand( GenerateMojo mojo, DebTarget target )
     {
-        super( mymojo );
-        this.target = target;
-        this.log = mymojo.getLog();
+        super( mojo, target );
         initializeFiltering();
     }
 
@@ -109,14 +102,14 @@ public class DebInstallerCommand extends
         log.info( "Copying DEB Package files" );
 
         // Copying the apacheds files in the '/opt/apacheds-$VERSION/' directory
-        File debApacheDsHomeDirectory = new File( debDirectory, "opt/apacheds-" + target.getApplication().getVersion() );
+        File debApacheDsHomeDirectory = new File( debDirectory, "opt/apacheds-" + mojo.getProject().getVersion() );
         try
         {
             // Copying the generated layout
             MojoHelperUtils.copyFiles( baseDirectory, debApacheDsHomeDirectory );
 
             // Replacing the apacheds.conf file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
                 new File( debApacheDsHomeDirectory, "conf/apacheds.conf" ), false );
         }
         catch ( IOException e )
@@ -128,7 +121,7 @@ public class DebInstallerCommand extends
 
         // Copying the instances in the '/var/lib/apacheds-$VERSION/default' directory
         File debDefaultInstanceDirectory = new File( debDirectory, "var/lib/apacheds-"
-            + target.getApplication().getVersion() + "/default" );
+            + mojo.getProject().getVersion() + "/default" );
         debDefaultInstanceDirectory.mkdirs();
         File debDefaultInstanceConfDirectory = new File( debDefaultInstanceDirectory, "conf" );
         debDefaultInstanceConfDirectory.mkdirs();
@@ -138,25 +131,25 @@ public class DebInstallerCommand extends
         new File( debDefaultInstanceDirectory, "run" ).mkdirs();
         File debEtcInitdDirectory = new File( debDirectory, "etc/init.d" );
         debEtcInitdDirectory.mkdirs();
-        new File( debDirectory, "/var/run/apacheds-" + target.getApplication().getVersion() ).mkdirs();
+        new File( debDirectory, "/var/run/apacheds-" + mojo.getProject().getVersion() ).mkdirs();
         try
         {
             // Copying the apacheds.conf file in the default instance conf directory
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
                 "apacheds-default.conf" ), new File( debDefaultInstanceConfDirectory, "apacheds.conf" ), false );
 
             // Copying the log4j.properties file in the default instance conf directory
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( debApacheDsHomeDirectory,
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( debApacheDsHomeDirectory,
                 "conf/log4j.properties" ), new File( debDefaultInstanceConfDirectory, "log4j.properties" ), false );
 
             // Copying the server.xml file in the default instance conf directory
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, new File( debApacheDsHomeDirectory,
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, new File( debApacheDsHomeDirectory,
                 "conf/server.xml" ), new File( debDefaultInstanceConfDirectory, "server.xml" ), false );
 
             // Copying the init script in /etc/init.d/
             MojoHelperUtils
-                .copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds-init" ), new File(
-                    debEtcInitdDirectory, "apacheds-" + target.getApplication().getVersion() + "-default" ), true );
+                .copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds-init" ), new File(
+                    debEtcInitdDirectory, "apacheds-" + mojo.getProject().getVersion() + "-default" ), true );
 
             // Removing the redundant server.xml file (see DIRSERVER-1112)
             new File( debApacheDsHomeDirectory, "conf/server.xml" ).delete();
@@ -175,13 +168,13 @@ public class DebInstallerCommand extends
         // Copying the 'control' file
         try
         {
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "control" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "control" ),
                 new File( debDebianDirectory, "control" ), true );
 
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "postinst" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "postinst" ),
                 new File( debDebianDirectory, "postinst" ), true );
 
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "prerm" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "prerm" ),
                 new File( debDebianDirectory, "prerm" ), true );
         }
         catch ( IOException e )
@@ -226,10 +219,9 @@ public class DebInstallerCommand extends
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app", target.getApplication().getName() );
-        String version = target.getApplication().getVersion();
-        if ( target.getApplication().getVersion() != null )
+        filterProperties.putAll( mojo.getProject().getProperties() );
+        String version = mojo.getProject().getVersion();
+        if ( version != null )
         {
             if ( version.endsWith( "-SNAPSHOT" ) )
             {
@@ -240,18 +232,18 @@ public class DebInstallerCommand extends
                 filterProperties.put( "version.debian", version );
             }
 
-            filterProperties.put( "app.version", version );
+            filterProperties.put( "version", version );
         }
         else
         {
-            filterProperties.put( "app.version", "1.0" );
+            filterProperties.put( "version", "1.0" );
         }
         filterProperties.put( "arch", target.getOsArch() );
     }
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
      */
     public Properties getFilterProperties()
     {

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=998959&r1=998958&r2=998959&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 Mon Sep 20 15:37:03 2010
@@ -24,12 +24,11 @@ import java.io.File;
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.AbstractMojoCommand;
+import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
-import org.apache.directory.daemon.installers.ServiceInstallersMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.logging.Log;
 import org.apache.tools.ant.taskdefs.Execute;
 
 
@@ -38,13 +37,9 @@ import org.apache.tools.ant.taskdefs.Exe
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class MacOsXPkgInstallerCommand extends MojoCommand
+public class MacOsXPkgInstallerCommand extends AbstractMojoCommand<MacOsXPkgTarget>
 {
     private final Properties filterProperties = new Properties( System.getProperties() );
-    /** The PKG target */
-    private final MacOsXPkgTarget target;
-    /** The Maven logger */
-    private final Log log;
     /** The PackageMaker utility executable */
     private File packageMakerUtility;
     /** The hdiutil utility executable */
@@ -54,16 +49,14 @@ public class MacOsXPkgInstallerCommand e
     /**
      * Creates a new instance of MacOsXPkgInstallerCommand.
      *
-     * @param mymojo
+     * @param mojo
      *      the Server Installers Mojo
      * @param target
      *      the PKG target
      */
-    public MacOsXPkgInstallerCommand( ServiceInstallersMojo mymojo, MacOsXPkgTarget target )
+    public MacOsXPkgInstallerCommand( GenerateMojo mojo, MacOsXPkgTarget target )
     {
-        super( mymojo );
-        this.target = target;
-        this.log = mymojo.getLog();
+        super( mojo, target );
         initializeFiltering();
     }
 
@@ -125,8 +118,8 @@ public class MacOsXPkgInstallerCommand e
         pkgRootDirectory.mkdirs();
         File pkgRootUsrBinDirectory = new File( pkgRootDirectory, "usr/bin" );
         pkgRootUsrBinDirectory.mkdirs();
-        File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, "usr/local/"
-            + target.getApplication().getName() + "-" + target.getApplication().getVersion() );
+        File pkgRootUsrLocalApachedsDirectory = new File( pkgRootDirectory, "usr/local/apacheds-"
+            + mojo.getProject().getVersion() );
         pkgRootUsrLocalApachedsDirectory.mkdirs();
         File pkgRootInstancesDirectory = new File( pkgRootUsrLocalApachedsDirectory, "instances" );
         pkgRootInstancesDirectory.mkdirs();
@@ -149,32 +142,32 @@ public class MacOsXPkgInstallerCommand e
             MojoHelperUtils.copyFiles( baseDirectory, pkgRootUsrLocalApachedsDirectory );
 
             // Copying the apacheds.init file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.init" ),
-                new File( pkgRootUsrLocalApachedsDirectory, "bin/" + target.getApplication().getName() + ".init" ),
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream( "apacheds.init" ),
+                new File( pkgRootUsrLocalApachedsDirectory, "bin/apacheds.init" ),
                 true );
 
             // Replacing the apacheds.conf file
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream( "apacheds.conf" ),
+            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( mymojo, filterProperties, getClass().getResourceAsStream(
+            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( mymojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
+            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( mymojo, filterProperties, new File( pkgRootUsrLocalApachedsDirectory,
+            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( mymojo, filterProperties, getClass().getResourceAsStream(
-                "apacheds-usr-bin.sh" ), new File( pkgRootUsrBinDirectory, target.getApplication().getName() ), true );
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
+                "apacheds-usr-bin.sh" ), new File( pkgRootUsrBinDirectory, "apacheds" ), true );
 
             // Copying the org.apache.directory.server.plist file to /Library/LaunchDaemons/
-            MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, getClass().getResourceAsStream(
+            MojoHelperUtils.copyAsciiFile( mojo, filterProperties, getClass().getResourceAsStream(
                 "org.apache.directory.server.plist" ), new File( pkgRootLibraryLaunchDaemons,
                 "org.apache.directory.server.plist" ), true );
 
@@ -221,11 +214,11 @@ public class MacOsXPkgInstallerCommand e
         Execute createPkgTask = new Execute();
         String[] cmd = new String[]
             { packageMakerUtility.getAbsolutePath(), "--root", "root/", "--resources", "Resources/", "--info",
-                "Info.plist", "--title", "Apache Directory Server " + target.getApplication().getVersion(),
-                "--version", target.getApplication().getVersion(), "--scripts", "scripts", "--out",
+                "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 );
+        createPkgTask.setSpawn( true ); // TODO should we remove this?
         createPkgTask.setWorkingDirectory( pkgDirectory );
         try
         {
@@ -315,11 +308,10 @@ public class MacOsXPkgInstallerCommand e
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app.name", target.getApplication().getName() );
-        if ( target.getApplication().getVersion() != null )
+        filterProperties.putAll( mojo.getProject().getProperties() );
+        if ( mojo.getProject().getVersion() != null )
         {
-            filterProperties.put( "app.version", target.getApplication().getVersion() );
+            filterProperties.put( "app.version", mojo.getProject().getVersion() );
         }
         else
         {
@@ -329,7 +321,7 @@ public class MacOsXPkgInstallerCommand e
 
 
     /* (non-Javadoc)
-     * @see org.apache.directory.daemon.installers.MojoCommand#getFilterProperties()
+     * @see org.apache.directory.daemon.installers.AbstractMojoCommand#getFilterProperties()
      */
     public Properties getFilterProperties()
     {

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=998959&r1=998958&r2=998959&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 Mon Sep 20 15:37:03 2010
@@ -26,9 +26,9 @@ import java.io.InputStream;
 import java.net.URL;
 import java.util.Properties;
 
-import org.apache.directory.daemon.installers.MojoCommand;
+import org.apache.directory.daemon.installers.AbstractMojoCommand;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
-import org.apache.directory.daemon.installers.ServiceInstallersMojo;
+import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.logging.Log;
@@ -43,21 +43,17 @@ import org.codehaus.plexus.util.FileUtil
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class NsisInstallerCommand extends MojoCommand
+public class NsisInstallerCommand extends AbstractMojoCommand<NsisTarget>
 {
     private final Properties filterProperties = new Properties( System.getProperties() );
-    private final NsisTarget target;
     private final File nsisConfigurationFile;
-    private final Log log;
 
     private File nsisCompiler;
 
 
-    public NsisInstallerCommand( ServiceInstallersMojo mymojo, NsisTarget target )
+    public NsisInstallerCommand( GenerateMojo mojo, NsisTarget target )
     {
-        super( mymojo );
-        this.target = target;
-        this.log = mymojo.getLog();
+        super( mojo, target );
         File imagesDir = target.getLayout().getInstallationDirectory().getParentFile();
         nsisConfigurationFile = new File( imagesDir, target.getId() + ".nsi" );
         initializeFiltering();
@@ -112,12 +108,12 @@ public class NsisInstallerCommand extend
         // -------------------------------------------------------------------
 
         // check first to see if the default install.iss file is present in src/main/installers
-        File projectNsisFile = new File( mymojo.getSourceDirectory(), "install.nsi" );
+        File projectNsisFile = new File( mojo.getSourceDirectory(), "install.nsi" );
         if ( target.getNsisConfigurationFile() != null && target.getNsisConfigurationFile().exists() )
         {
             try
             {
-                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, target.getNsisConfigurationFile(),
+                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, target.getNsisConfigurationFile(),
                         nsisConfigurationFile, true );
             }
             catch ( IOException e )
@@ -130,7 +126,7 @@ public class NsisInstallerCommand extend
         {
             try
             {
-                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, projectNsisFile, nsisConfigurationFile, true );
+                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, projectNsisFile, nsisConfigurationFile, true );
             }
             catch ( IOException e )
             {
@@ -144,7 +140,7 @@ public class NsisInstallerCommand extend
             URL resource = getClass().getResource( "install.iss" );
             try
             {
-                MojoHelperUtils.copyAsciiFile( mymojo, filterProperties, in, nsisConfigurationFile, true );
+                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, in, nsisConfigurationFile, true );
             }
             catch ( IOException e )
             {
@@ -157,15 +153,14 @@ public class NsisInstallerCommand extend
         // 3: copy native files
         // -------------------------------------------------------------------
 
-        // now copy over the Prunsrv and Prunmgr executables renaming them to the mymojo.getApplicationName() + w for mgr
+        // 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(),
-                target.getApplication().getName() + ".exe" );
-            File override = new File( mymojo.getSourceDirectory(), target.getWrapperExecutablePath() );
+            File executableTarget = new File( target.getLayout().getBinDirectory(), "apacheds.exe" );
+            File override = new File( mojo.getSourceDirectory(), target.getWrapperExecutablePath() );
             if ( override.exists() )
             {
-                mymojo.getLog().info( "Using native launcher supplied by project: " + override.getAbsolutePath() );
+                mojo.getLog().info( "Using native launcher supplied by project: " + override.getAbsolutePath() );
                 try
                 {
                     FileUtils.copyFile( override, executableTarget );
@@ -229,17 +224,14 @@ public class NsisInstallerCommand extend
 
     private void initializeFiltering()
     {
-        filterProperties.putAll( mymojo.getProject().getProperties() );
-        filterProperties.put( "app", target.getApplication().getName() );
-        filterProperties.put( "app.base.dir", mymojo.getProject().getBasedir().getAbsolutePath() );
+        filterProperties.putAll( mojo.getProject().getProperties() );
+        filterProperties.put( "app.base.dir", mojo.getProject().getBasedir().getAbsolutePath() );
 
-        char firstChar = target.getApplication().getName().charAt( 0 );
-        firstChar = Character.toUpperCase( firstChar );
-        filterProperties.put( "app.displayname", firstChar + target.getApplication().getName().substring( 1 ) );
+        filterProperties.put( "app.displayname", "ApacheDS" );
 
-        if ( target.getApplication().getVersion() != null )
+        if ( mojo.getProject().getVersion() != null )
         {
-            filterProperties.put( "app.version", target.getApplication().getVersion() );
+            filterProperties.put( "app.version", mojo.getProject().getVersion() );
         }
         else
         {
@@ -250,34 +242,24 @@ public class NsisInstallerCommand extend
         // WARNING: hard code values just to for testing
         // -------------------------------------------------------------------
 
-        // @todo use the list of committers and add multiple authors to nsis
-        if ( target.getApplication().getAuthors().isEmpty() )
-        {
-            filterProperties.put( "app.author", "Apache Software Foundation" );
-        }
-        else
-        {
-            filterProperties.put( "app.author", target.getApplication().getAuthors().get( 0 ) );
-        }
-
         if ( target.getFinalName() != null )
         {
             filterProperties.put( "app.final.name", target.getFinalName() );
         }
         else
         {
-            String finalName = target.getApplication().getName() + "-" + target.getApplication().getVersion()
+            String finalName = "apacheds-" + mojo.getProject().getVersion()
                 + "-win32-setup.exe";
             filterProperties.put( "app.final.name", finalName );
         }
 
-        filterProperties.put( "app.email", target.getApplication().getEmail() );
-        filterProperties.put( "app.url", target.getApplication().getUrl() );
-        filterProperties.put( "app.java.version", target.getApplication().getMinimumJavaVersion() );
+        //        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.description", target.getApplication().getDescription() );
         filterProperties.put( "app.copyright.year", target.getCopyrightYear() );
 
         // TODO FIXME



Mime
View raw message