directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1000061 - in /directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers: ./ macosxpkg/ nsis/ rpm/
Date Wed, 22 Sep 2010 16:11:13 GMT
Author: pamarcelot
Date: Wed Sep 22 16:11:12 2010
New Revision: 1000061

URL: http://svn.apache.org/viewvc?rev=1000061&view=rev
Log:
Code cleaning.
Removed some useless fields.

Removed:
    directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/CreateImageCommand.java
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/GenerateMojo.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/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

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=1000061&r1=1000060&r2=1000061&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:11:12 2010
@@ -70,159 +70,6 @@ public abstract class AbstractMojoComman
         }
     }
 
-
-    public void reportProcessing( PackagedFile packagedFile )
-    {
-        if ( !log.isInfoEnabled() )
-        {
-            return;
-        }
-
-        log.info( "\t\tProcessing packagedFile with source " + packagedFile.getSource() +
" for destination "
-            + packagedFile.getDestinationPath() );
-    }
-
-
-    public void processPackagedFiles( Target target, PackagedFile[] packagedFiles )
-    {
-        if ( packagedFiles == null )
-        {
-            return;
-        }
-
-        if ( log.isInfoEnabled() )
-        {
-            log.info( "\tProcessing " + packagedFiles.length + " packagedFiles: " );
-        }
-
-        for ( int ii = 0; ii < packagedFiles.length; ii++ )
-        {
-            File source = null;
-            reportProcessing( packagedFiles[ii] );
-
-            try
-            {
-                if ( packagedFiles[ii].isDependency() )
-                {
-                    Artifact artifact = dependencyMap.get( packagedFiles[ii].getSource()
);
-
-                    if ( artifact == null )
-                    {
-                        throw new MojoFailureException( "The packaged file setup as a dependency
on artifact "
-                            + packagedFiles[ii].getSource() + " has not been found in the
project.  " +
-                                    "Check your <dependencies> in the project pom."
);
-                    }
-                    source = artifact.getFile().getAbsoluteFile();
-                }
-                else
-                {
-                    source = new File( packagedFiles[ii].getSource() );
-                }
-
-                if ( !source.isAbsolute() )
-                {
-                    File sourceDirectoryRelative = new File( mojo.getSourceDirectory(), packagedFiles[ii].getSource()
);
-                    File baseRelative = new File( mojo.getProject().getBasedir(), packagedFiles[ii].getSource()
);
-                    if ( sourceDirectoryRelative.exists() )
-                    {
-                        source = sourceDirectoryRelative;
-                    }
-                    else if ( baseRelative.exists() )
-                    {
-                        source = baseRelative;
-                    }
-                    else if ( !source.exists() )
-                    {
-                        throw new MojoFailureException( "Failed to copy packagedFile. Cannot
locate source: " + source );
-                    }
-
-                    source = source.getAbsoluteFile();
-                }
-
-                if ( packagedFiles[ii].isExpandable() )
-                {
-                    // TODO FIXME
-                    //                    File dest = new File( target.getLayout().getInstallationDirectory(),
-                    //                        packagedFiles[ii].getDestinationPath() );
-                    //                    if ( !dest.exists() )
-                    //                    {
-                    //                        dest.mkdirs();
-                    //                    }
-                    //
-                    //                    String fileExtension = source.getName().substring(
source.getName().lastIndexOf( '.' ) );
-                    //                    if ( fileExtension.equalsIgnoreCase( ".jar" ) ||
fileExtension.equalsIgnoreCase( ".zip" )
-                    //                        || fileExtension.equalsIgnoreCase( ".war" )
|| fileExtension.equalsIgnoreCase( ".sar" ) )
-                    //                    {
-                    //                        log.info( "\t\t\t ... expanding " + source
+ "\n\t\t\t => to " + dest );
-                    //                        Expand expand = new Expand();
-                    //                        expand.setSrc( source );
-                    //                        expand.setOverwrite( true );
-                    //                        expand.setDest( dest );
-                    //                        try
-                    //                        {
-                    //                            expand.execute();
-                    //                            continue;
-                    //                        }
-                    //                        catch ( Exception e )
-                    //                        {
-                    //                            throw new MojoFailureException( "Failed
to expaned packagedFile " + source + ": "
-                    //                                + e.getMessage() );
-                    //                        }
-                    //                    }
-
-                    throw new MojoFailureException( "Failed to expand packagedFile: " + source
-                        + ". It does not have a jar, war or zip extension" );
-                }
-
-                // TODO FIXME
-                //                File dest = new File( target.getLayout().getInstallationDirectory(),
-                //                    packagedFiles[ii].getDestinationPath() );
-                //
-                //                if ( packagedFiles[ii].isDirectory() )
-                //                {
-                //                    try
-                //                    {
-                //                        FileUtils.copyDirectoryStructure( source, dest
);
-                //                    }
-                //                    catch ( IOException e )
-                //                    {
-                //                        throw new MojoFailureException( "Failed to copy
packagedFile [directory=true] from source "
-                //                            + source + " to destination " + dest );
-                //                    }
-                //                    continue;
-                //                }
-                //                else if ( packagedFiles[ii].isFiltered() )
-                //                {
-                //                    try
-                //                    {
-                //                        MojoHelperUtils.copyAsciiFile( mojo, getFilterProperties(),
source, dest, true );
-                //                    }
-                //                    catch ( IOException e )
-                //                    {
-                //                        throw new MojoFailureException( "Failed to copy
packagedFile from source " + source +
-                //                            " to destination " + dest );
-                //                    }
-                //                    continue;
-                //                }
-                //
-                //                try
-                //                {
-                //                    FileUtils.copyFile( source, dest );
-                //                }
-                //                catch ( IOException e )
-                //                {
-                //                    throw new MojoFailureException( "Failed to copy packagedFile
from source " + source +
-                //                        " to destination " + dest );
-                //                }
-            }
-            catch ( Exception e )
-            {
-                log.error( "Failed while processing " + source, e );
-            }
-        }
-    }
-
-
     /**
      * Gets the directory associated with the target.
      *

Modified: directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.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?rev=1000061&r1=1000060&r2=1000061&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java
(original)
+++ directory/apacheds/branches/apacheds-apacheds-2.0/installers-plugin/src/main/java/org/apache/directory/daemon/installers/GenerateMojo.java
Wed Sep 22 16:11:12 2010
@@ -40,13 +40,6 @@ import org.apache.directory.daemon.insta
 import org.apache.directory.daemon.installers.rpm.RpmTarget;
 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.artifact.factory.ArtifactFactory;
-import org.apache.maven.artifact.factory.DefaultArtifactFactory;
-import org.apache.maven.artifact.repository.DefaultArtifactRepositoryFactory;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.DefaultArtifactResolver;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -74,14 +67,6 @@ public class GenerateMojo extends Abstra
     private File outputDirectory;
 
     /**
-     * The source directory where various configuration files for the installer 
-     * are stored.
-     * 
-     * @parameter default-value="${project.basedir}/src/main/installers"
-     */
-    private File sourceDirectory;
-
-    /**
      * The associated maven project.
      * 
      * @parameter expression="${project}" default-value="${project}"
@@ -139,127 +124,106 @@ public class GenerateMojo extends Abstra
     private ArchiveTarget[] archiveTargets;
 
     /**
-     * The packages files.
-     * 
-     * @parameter
-     */
-    private PackagedFile[] packagedFiles;
-
-    /**
      * The exclusions.
      * 
      * @parameter
      */
     private Set excludes;
 
-    /** daemon bootstrapper */
-    private Artifact bootstrapper;
-    /** logging API need by bootstraper */
-    private Artifact logger;
-    /** commons-daemon dependency needed by native daemon */
-    private Artifact daemon;
-
-    private List<Target> allTargets;
+    /** The list containing all the targets */
+    private List<Target> allTargets = new ArrayList<Target>();
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void execute() throws MojoExecutionException, MojoFailureException
     {
-        FileUtils.mkdir( outputDirectory.getAbsolutePath() );
+        // Printing plugin information in the console
+        getLog().info( "-------------------------------------------------------" );
+        getLog().info( "[installers:generate]" );
 
         // Collecting all targets 
-        initializeAllTargets();
+        collectAllTargets();
 
-        // Makes sure defaulted values are set to globals
-        setDefaults();
-
-        // bail if there is nothing to do 
+        // Returning if there is no target to build 
         if ( allTargets.isEmpty() )
         {
-            getLog().info( "-------------------------------------------------------" );
-            getLog().info( "[installers:generate]" );
             getLog().info( "No installers to generate." );
             getLog().info( "-------------------------------------------------------" );
             return;
         }
 
-        // report what we have to build 
-        reportSetup();
+        // Reporting the targets that have to be built 
+        reportBuildTargets();
 
-        // search for and find the bootstrapper artifact
-        //        setBootstrapArtifacts();
+        // Creating the output directory
+        FileUtils.mkdir( outputDirectory.getAbsolutePath() );
 
-        // generate installers for all targets
+        // Generating installers for all targets
         for ( Target target : allTargets )
         {
-            getLog().info( "Executing target '" + target.getId() + '"' );
+            getLog().info( "Executing target '" + target.getId() + "'" );
 
-            // create the installation image first
-//            CreateImageCommand imgCmd = new CreateImageCommand( this, target );
-//            imgCmd.execute();
-
-            // ---------------------------------------------------------------
-            // Generate all installers
-            // ---------------------------------------------------------------
-
-            if ( target instanceof NsisTarget )
+            // Archive target
+            if ( target instanceof ArchiveTarget )
             {
-                NsisInstallerCommand nsisCmd = null;
-                nsisCmd = new NsisInstallerCommand( this, ( NsisTarget ) target );
-                nsisCmd.execute();
+                ArchiveInstallerCommand archiveCmd = new ArchiveInstallerCommand( this, (
ArchiveTarget ) target );
+                archiveCmd.execute();
             }
 
-            if ( target instanceof RpmTarget )
+            // Bin target
+            if ( target instanceof BinTarget )
             {
-                RpmInstallerCommand rpmCmd = null;
-                rpmCmd = new RpmInstallerCommand( this, ( RpmTarget ) target );
-                rpmCmd.execute();
+                BinInstallerCommand binCmd = new BinInstallerCommand( this, ( BinTarget )
target );
+                binCmd.execute();
             }
 
-            if ( target instanceof MacOsXPkgTarget )
+            // Deb target
+            if ( target instanceof DebTarget )
             {
-                MacOsXPkgInstallerCommand pkgCmd = null;
-                pkgCmd = new MacOsXPkgInstallerCommand( this, ( MacOsXPkgTarget ) target
);
-                pkgCmd.execute();
+                DebInstallerCommand debCmd = new DebInstallerCommand( this, ( DebTarget )
target );
+                debCmd.execute();
             }
 
-            if ( target instanceof SolarisPkgTarget )
+            // Mac OS X PKG target
+            if ( target instanceof MacOsXPkgTarget )
             {
-                SolarisPkgInstallerCommand pkgCmd = null;
-                pkgCmd = new SolarisPkgInstallerCommand( this, ( SolarisPkgTarget ) target
);
+                MacOsXPkgInstallerCommand pkgCmd = new MacOsXPkgInstallerCommand( this, (
MacOsXPkgTarget ) target );
                 pkgCmd.execute();
             }
 
-            if ( target instanceof DebTarget )
+            // NSIS target
+            if ( target instanceof NsisTarget )
             {
-                DebInstallerCommand debCmd = null;
-                debCmd = new DebInstallerCommand( this, ( DebTarget ) target );
-                debCmd.execute();
+                NsisInstallerCommand nsisCmd = new NsisInstallerCommand( this, ( NsisTarget
) target );
+                nsisCmd.execute();
             }
 
-            if ( target instanceof BinTarget )
+            // RPM target
+            if ( target instanceof RpmTarget )
             {
-                BinInstallerCommand binCmd = null;
-                binCmd = new BinInstallerCommand( this, ( BinTarget ) target );
-                binCmd.execute();
+                RpmInstallerCommand rpmCmd = new RpmInstallerCommand( this, ( RpmTarget )
target );
+                rpmCmd.execute();
             }
 
-            if ( target instanceof ArchiveTarget )
+            // Solaris PKG target
+            if ( target instanceof SolarisPkgTarget )
             {
-                ArchiveInstallerCommand archiveCmd = null;
-                archiveCmd = new ArchiveInstallerCommand( this, ( ArchiveTarget ) target
);
-                archiveCmd.execute();
+                SolarisPkgInstallerCommand pkgCmd = new SolarisPkgInstallerCommand( this,
( SolarisPkgTarget ) target );
+                pkgCmd.execute();
             }
+
+            getLog().info( "-------------------------------------------------------" );
         }
     }
 
 
     /**
-     * Initializes all targets.
+     * Collects all targets.
      */
-    private void initializeAllTargets()
+    private void collectAllTargets()
     {
-        allTargets = new ArrayList<Target>();
-
         addAllTargets( allTargets, nsisTargets );
         addAllTargets( allTargets, rpmTargets );
         addAllTargets( allTargets, debTargets );
@@ -287,202 +251,11 @@ public class GenerateMojo extends Abstra
     }
 
 
-    private void setDefaults() throws MojoFailureException
-    {
-        if ( allTargets == null )
-        {
-            return;
-        }
-
-        // 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 )
-        {
-            // TODO FIXME
-            //            if ( target.getApplication() == null )
-            //            {
-            //                target.setApplication( this.application );
-            //            }
-            //
-            //            if ( target.getLoggerConfigurationFile() == null )
-            //            {
-            //                target.setLoggerConfigurationFile( new File( sourceDirectory,
"log4j.properties" ) );
-            //            }
-            //
-            //            if ( target.getBootstrapperConfigurationFile() == null )
-            //            {
-            //                target.setBootstrapperConfigurationFile( new File( sourceDirectory,
"bootstrapper.properties" ) );
-            //            }
-            //
-            //            if ( target.getServerConfigurationFile() == null )
-            //            {
-            //                target.setServerConfigurationFile( new File( sourceDirectory,
"server.xml" ) );
-            //            }
-            //
-            //            if ( target.getOsVersion() == null )
-            //            {
-            //                target.setOsVersion( "*" );
-            //            }
-        }
-    }
-
-
-    //    private void setBootstrapArtifacts() throws MojoFailureException
-    //    {
-    //        Artifact artifact = null;
-    //        Iterator artifacts = project.getDependencyArtifacts().iterator();
-    //
-    //        while ( artifacts.hasNext() )
-    //        {
-    //            artifact = ( Artifact ) artifacts.next();
-    //            if ( artifact.getArtifactId().equals( BOOTSTRAPPER_ARTIFACT_ID )
-    //                && artifact.getGroupId().equals( BOOTSTRAPPER_GROUP_ID ) )
-    //            {
-    //                getLog().info( "Found bootstrapper dependency with version: " + artifact.getVersion()
);
-    //                bootstrapper = artifact;
-    //            }
-    //            else if ( artifact.getArtifactId().equals( LOGGER_ARTIFACT_ID )
-    //                && artifact.getGroupId().equals( LOGGER_GROUP_ID ) )
-    //            {
-    //                getLog().info( "Found logger dependency with version: " + artifact.getVersion()
);
-    //                logger = artifact;
-    //            }
-    //            else if ( artifact.getArtifactId().equals( DAEMON_ARTIFACT_ID )
-    //                && artifact.getGroupId().equals( DAEMON_GROUP_ID ) )
-    //            {
-    //                getLog().info( "Found daemon dependency with version: " + artifact.getVersion()
);
-    //                daemon = artifact;
-    //            }
-    //        }
-    //
-    //        if ( bootstrapper == null )
-    //        {
-    //            throw new MojoFailureException( "Bootstrapper dependency artifact required:
" + BOOTSTRAPPER_GROUP_ID + ":"
-    //                + BOOTSTRAPPER_ARTIFACT_ID );
-    //        }
-    //        if ( logger == null )
-    //        {
-    //            throw new MojoFailureException( "Logger dependency artifact required: "
+ LOGGER_GROUP_ID + ":"
-    //                + LOGGER_ARTIFACT_ID );
-    //        }
-    //        if ( daemon == null )
-    //        {
-    //            throw new MojoFailureException( "Daemon dependency artifact required: "
+ DAEMON_GROUP_ID + ":"
-    //                + DAEMON_ARTIFACT_ID );
-    //        }
-    //    }
-
-    public void reportSetup()
+    /**
+     * Reports the targets that need to be built.
+     */
+    public void reportBuildTargets()
     {
-        getLog().info( "-------------------------------------------------------" );
-        getLog().info( "[installers:generate]" );
-        getLog().info( "sourceDirectory = " + sourceDirectory );
         getLog().info( "outputDirectory = " + outputDirectory );
         getLog().info( "---------------------- allTargets ---------------------" );
 
@@ -511,30 +284,24 @@ public class GenerateMojo extends Abstra
     }
 
 
+    /**
+     * Gets the output directory.
+     *
+     * @return
+     *      the output directory
+     */
     public File getOutputDirectory()
     {
         return outputDirectory;
     }
 
 
-    public Artifact getBootstrapper()
-    {
-        return bootstrapper;
-    }
-
-
-    public Artifact getDaemon()
-    {
-        return daemon;
-    }
-
-
-    public Artifact getLogger()
-    {
-        return logger;
-    }
-
-
+    /**
+     * Gets the associated Maven project.
+     *
+     * @return
+     *      the associated Maven project
+     */
     public MavenProject getProject()
     {
         return project;
@@ -545,22 +312,4 @@ public class GenerateMojo extends Abstra
     {
         return this.excludes;
     }
-
-
-    public File getSourceDirectory()
-    {
-        return this.sourceDirectory;
-    }
-
-
-    public void setPackagedFiles( PackagedFile[] packagedFiles )
-    {
-        this.packagedFiles = packagedFiles;
-    }
-
-
-    public PackagedFile[] getPackagedFiles()
-    {
-        return packagedFiles;
-    }
 }

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=1000061&r1=1000060&r2=1000061&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
Wed Sep 22 16:11:12 2010
@@ -124,9 +124,9 @@ public class MojoHelperUtils
         Artifact artifact = null;
         List<String> rejects = new ArrayList<String>();
 
-        mymojo.getLog().info( "" );
-        mymojo.getLog().info( "    Including artifacts: " );
-        mymojo.getLog().info( "    -------------------" );
+//        mymojo.getLog().info( "" );
+//        mymojo.getLog().info( "    Including artifacts: " );
+//        mymojo.getLog().info( "    -------------------" );
         Iterator artifacts = mymojo.getProject().getRuntimeArtifacts().iterator();
 
         while ( artifacts.hasNext() )
@@ -134,53 +134,40 @@ public class MojoHelperUtils
             artifact = ( Artifact ) artifacts.next();
             String key = artifact.getGroupId() + ":" + artifact.getArtifactId();
 
-            mymojo.getLog().info( "artifact=> " + key );
-
-            if ( artifact.equals( mymojo.getBootstrapper() ) )
+            if ( ( mymojo.getExcludes() != null ) && ( mymojo.getExcludes().contains(
key ) ) )
             {
                 rejects.add( key );
+                continue;
             }
-            else if ( artifact.equals( mymojo.getDaemon() ) )
+
+            try
             {
-                rejects.add( key );
+                FileUtils.copyFileToDirectory( artifact.getFile(), layout.getLibDirectory()
);
+                libArtifacts.add( artifact );
+//                mymojo.getLog().info( "        o " + key );
             }
-            else
+            catch ( IOException e )
             {
-                if ( ( mymojo.getExcludes() != null ) && ( mymojo.getExcludes().contains(
key ) ) )
-                {
-                    rejects.add( key );
-                    continue;
-                }
-
-                try
-                {
-                    FileUtils.copyFileToDirectory( artifact.getFile(), layout.getLibDirectory()
);
-                    libArtifacts.add( artifact );
-                    mymojo.getLog().info( "        o " + key );
-                }
-                catch ( IOException e )
-                {
-                    throw new MojoFailureException( "Failed to copy dependency artifact "
+ artifact
+                throw new MojoFailureException( "Failed to copy dependency artifact " + artifact
                         + " into position " + layout.getLibDirectory() );
-                }
             }
         }
 
-        if ( ( mymojo.getExcludes() != null ) && ( !mymojo.getExcludes().isEmpty()
) )
-        {
-            mymojo.getLog().info( "" );
-            mymojo.getLog().info( "    Excluded artifacts: " );
-            mymojo.getLog().info( "    ------------------" );
-            for ( int ii = 0; ii < rejects.size(); ii++ )
-            {
-                mymojo.getLog().info( "        o " + rejects.get( ii ) );
-            }
-        }
-        else
-        {
-            mymojo.getLog().info( "No artifacts have been excluded." );
-        }
-        mymojo.getLog().info( "" );
+        //        if ( ( mymojo.getExcludes() != null ) && ( !mymojo.getExcludes().isEmpty()
) )
+        //        {
+        //            mymojo.getLog().info( "" );
+        //            mymojo.getLog().info( "    Excluded artifacts: " );
+        //            mymojo.getLog().info( "    ------------------" );
+        //            for ( int ii = 0; ii < rejects.size(); ii++ )
+        //            {
+        //                mymojo.getLog().info( "        o " + rejects.get( ii ) );
+        //            }
+        //        }
+        //        else
+        //        {
+        //            mymojo.getLog().info( "No artifacts have been excluded." );
+        //        }
+        //        mymojo.getLog().info( "" );
 
         return libArtifacts;
     }

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=1000061&r1=1000060&r2=1000061&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:11:12 2010
@@ -103,7 +103,7 @@ public class MacOsXPkgInstallerCommand e
         File targetDirectory = getTargetDirectory();
         targetDirectory.mkdirs();
 
-        log.info( "Copying PKG installer files" );
+        log.info( "  Copying PKG installer files" );
 
         // Creating the root directories hierarchy
         File pkgRootDirectory = new File( targetDirectory, "root" );
@@ -204,7 +204,7 @@ public class MacOsXPkgInstallerCommand e
         }
 
         // Generating the PKG
-        log.info( "Generating Mac OS X PKG Installer" );
+        log.info( "  Generating Mac OS X PKG Installer" );
         Execute createPkgTask = new Execute();
         String[] cmd = new String[]
             {
@@ -245,7 +245,7 @@ public class MacOsXPkgInstallerCommand e
         File dmgDirectory = new File( mojo.getOutputDirectory(), target.getId() + "-dmg"
);
         dmgDirectory.mkdirs();
 
-        log.info( "Copying DMG files" );
+        log.info( "  Copying DMG files" );
 
         // Create dmg directory and its sub-directory
         File dmgDmgBackgroundDirectory = new File( dmgDirectory, "dmg/.background" );
@@ -281,7 +281,7 @@ public class MacOsXPkgInstallerCommand e
                     .toString() }, dmgDirectory, false );
 
         // Generating the DMG
-        log.info( "Generating Mac OS X DMG Installer" );
+        log.info( "  Generating Mac OS X DMG Installer" );
         String finalName = target.getFinalName();
         if ( !finalName.endsWith( ".dmg" ) )
         {
@@ -323,15 +323,6 @@ public class MacOsXPkgInstallerCommand e
     private void initializeFiltering()
     {
         filterProperties.putAll( mojo.getProject().getProperties() );
-        if ( mojo.getProject().getVersion() != null )
-        {
-            filterProperties.put( "app.version", mojo.getProject().getVersion() );
-        }
-        else
-        {
-            filterProperties.put( "app.version", "1.0" );
-        }
-
         filterProperties.put( "installation.directory", "/usr/local/apacheds-"
             + mojo.getProject().getVersion() );
         filterProperties.put( "instances.directory", "/usr/local/apacheds-"
@@ -378,7 +369,7 @@ public class MacOsXPkgInstallerCommand e
         // Creating the instance layout and directories
         InstanceLayout instanceLayout = new InstanceLayout( getInstanceDirectory() );
         instanceLayout.mkdirs();
-        
+
         MojoHelperUtils.copyDependencies( mojo, installationLayout );
 
         // Copying the LICENSE and NOTICE files

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=1000061&r1=1000060&r2=1000061&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:11:12 2010
@@ -110,7 +110,6 @@ public class NsisInstallerCommand extend
         // -------------------------------------------------------------------
 
         // check first to see if the default install.iss file is present in src/main/installers
-        File projectNsisFile = new File( mojo.getSourceDirectory(), "install.nsi" );
         if ( target.getNsisConfigurationFile() != null && target.getNsisConfigurationFile().exists()
)
         {
             try
@@ -124,31 +123,10 @@ public class NsisInstallerCommand extend
                     + target.getNsisConfigurationFile() + " to " + nsisConfigurationFile
);
             }
         }
-        else if ( projectNsisFile.exists() )
-        {
-            try
-            {
-                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, projectNsisFile, nsisConfigurationFile,
true );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to filter and copy project provided
" + projectNsisFile
-                    + " to " + nsisConfigurationFile );
-            }
-        }
         else
         {
-            InputStream in = getClass().getResourceAsStream( "install.iss" );
-            URL resource = getClass().getResource( "install.iss" );
-            try
-            {
-                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, in, nsisConfigurationFile,
true );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to filter and copy bundled " + resource
+ " to "
-                    + nsisConfigurationFile );
-            }
+            throw new MojoFailureException( "NSIS configuration file does not exist ("
+                + target.getNsisConfigurationFile() + ")." );
         }
 
         // -------------------------------------------------------------------
@@ -259,12 +237,12 @@ public class NsisInstallerCommand extend
         // TODO FIXME
         //        filterProperties.put( "app.email", target.getApplication().getEmail() );
         //        filterProperties.put( "app.url", target.getApplication().getUrl() );
-//        filterProperties.put( "app.java.version", "1.5" );
-//        filterProperties.put( "app.license", target.getLayout().getLicenseFile().getPath()
);
-//        filterProperties.put( "app.license.name", target.getLayout().getLicenseFile().getName()
);
-//        filterProperties.put( "app.company.name", target.getCompanyName() );
+        //        filterProperties.put( "app.java.version", "1.5" );
+        //        filterProperties.put( "app.license", target.getLayout().getLicenseFile().getPath()
);
+        //        filterProperties.put( "app.license.name", target.getLayout().getLicenseFile().getName()
);
+        //        filterProperties.put( "app.company.name", target.getCompanyName() );
         //        filterProperties.put( "app.description", target.getApplication().getDescription()
);
-//        filterProperties.put( "app.copyright.year", target.getCopyrightYear() );
+        //        filterProperties.put( "app.copyright.year", target.getCopyrightYear() );
 
         // TODO FIXME
         //        if ( !target.getLayout().getReadmeFile().exists() )

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=1000061&r1=1000060&r2=1000061&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:11:12 2010
@@ -22,8 +22,6 @@ package org.apache.directory.daemon.inst
 
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
 import java.util.List;
 import java.util.Properties;
 
@@ -31,12 +29,10 @@ import org.apache.directory.daemon.insta
 import org.apache.directory.daemon.installers.GenerateMojo;
 import org.apache.directory.daemon.installers.MojoHelperUtils;
 import org.apache.directory.daemon.installers.Target;
-import org.apache.maven.artifact.Artifact;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.taskdefs.Touch;
-import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.Os;
 
 
@@ -183,7 +179,6 @@ public class RpmInstallerCommand extends
         //        }
 
         // check first to see if the default spec file is present in src/main/installers
-        File projectRpmFile = new File( mojo.getSourceDirectory(), "spec.template" );
         if ( target.getRpmSpecificationFile() != null && target.getRpmSpecificationFile().exists()
)
         {
             try
@@ -197,31 +192,10 @@ public class RpmInstallerCommand extends
                     + target.getRpmSpecificationFile() + " to " + rpmConfigurationFile );
             }
         }
-        else if ( projectRpmFile.exists() )
-        {
-            try
-            {
-                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, projectRpmFile, rpmConfigurationFile,
true );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to filter and copy project provided
" + projectRpmFile + " to "
-                    + rpmConfigurationFile );
-            }
-        }
         else
         {
-            InputStream in = getClass().getResourceAsStream( "spec.template" );
-            URL resource = getClass().getResource( "spec.template" );
-            try
-            {
-                MojoHelperUtils.copyAsciiFile( mojo, filterProperties, in, rpmConfigurationFile,
true );
-            }
-            catch ( IOException e )
-            {
-                throw new MojoFailureException( "Failed to filter and copy bundled " + resource
+ " to "
-                    + rpmConfigurationFile );
-            }
+            throw new MojoFailureException( "RPM specification file does not exist ("
+                + target.getRpmSpecificationFile() + ")." );
         }
 
         // TODO FIXME



Mime
View raw message