directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r575343 - in /directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers: ./ inno/ izpack/ nsis/ rpm/
Date Thu, 13 Sep 2007 16:04:37 GMT
Author: elecharny
Date: Thu Sep 13 09:04:35 2007
New Revision: 575343

URL: http://svn.apache.org/viewvc?rev=575343&view=rev
Log:
Removed warnings by using generics, cleaning the antlr .g files from useless imports, removed
useless casts.

Modified:
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/inno/InnoInstallerCommand.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/izpack/IzPackInstallerCommand.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
    directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoCommand.java
Thu Sep 13 09:04:35 2007
@@ -43,7 +43,7 @@
  */
 public abstract class MojoCommand
 {
-    protected final Map dependencyMap;
+    protected final Map<String, Artifact> dependencyMap;
     protected final Log log;
     protected final ServiceInstallersMojo mymojo;
     
@@ -55,7 +55,7 @@
     {
         this.mymojo = mymojo;
         this.log = mymojo.getLog();
-        this.dependencyMap = new HashMap();
+        this.dependencyMap = new HashMap<String, Artifact>();
         
         for ( Iterator ii = mymojo.getProject().getDependencyArtifacts().iterator(); ii.hasNext();
/* */ )
         {
@@ -77,7 +77,7 @@
     }
     
     
-    public void processPackagedFiles( Target target, PackagedFile[] packagedFiles ) throws
MojoFailureException
+    public void processPackagedFiles( Target target, PackagedFile[] packagedFiles )
     {
         if ( packagedFiles == null )
         {
@@ -98,7 +98,7 @@
             {
                 if ( packagedFiles[ii].isDependency() )
                 {
-                    Artifact artifact = ( Artifact ) dependencyMap.get( packagedFiles[ii].getSource()
);
+                    Artifact artifact = dependencyMap.get( packagedFiles[ii].getSource()
);
                     
                     if ( artifact == null )
                     {

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/MojoHelperUtils.java
Thu Sep 13 09:04:35 2007
@@ -131,14 +131,15 @@
     public static List copyDependencies( ServiceInstallersMojo mymojo, InstallationLayout
layout )
         throws MojoFailureException
     {
-        List libArtifacts = new ArrayList();
+        List<Artifact> libArtifacts = new ArrayList<Artifact>();
         Artifact artifact = null;
-        List rejects = new ArrayList();
+        List<String> rejects = new ArrayList<String>();
 
         mymojo.getLog().info( "" );
         mymojo.getLog().info( "    Including artifacts: " );
         mymojo.getLog().info( "    -------------------" );
         Iterator artifacts = mymojo.getProject().getRuntimeArtifacts().iterator();
+        
         while ( artifacts.hasNext() )
         {
             artifact = ( Artifact ) artifacts.next();
@@ -152,10 +153,6 @@
             {
                 rejects.add( key );
             }
-//            else if ( artifact.equals( mymojo.getLogger() ) )
-//            {
-//                rejects.add( key );
-//            }
             else
             {
                 if ( mymojo.getExcludes().contains( key ) )

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/ServiceInstallersMojo.java
Thu Sep 13 09:04:35 2007
@@ -23,6 +23,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
@@ -179,7 +180,7 @@
 
     private File exportedSources;
     private File docsBase;
-    private List allTargets;
+    private List<Target> allTargets;
 
 
     public void execute() throws MojoExecutionException, MojoFailureException
@@ -212,10 +213,8 @@
         setBootstrapArtifacts();
 
         // generate installers for all targets
-        for ( int ii = 0; ii < allTargets.size(); ii++ )
+        for ( Target target:allTargets )
         {
-            Target target = ( Target ) allTargets.get( ii );
-
             // create the installation image first
             CreateImageCommand imgCmd = new CreateImageCommand( this, target );
             imgCmd.execute();
@@ -257,7 +256,7 @@
 
     private void initializeAllTargets()
     {
-        allTargets = new ArrayList();
+        allTargets = new ArrayList<Target>();
         addAll( allTargets, izPackTargets );
         addAll( allTargets, innoTargets );
         addAll( allTargets, nsisTargets );
@@ -267,17 +266,16 @@
     }
 
 
-    private void addAll( List list, Object[] array )
+    private void addAll( List<Target> list, Target[] array )
     {
         if ( array == null )
-            return;
-        for ( int ii = 0; ii < array.length; ii++ )
         {
-            list.add( array[ii] );
+            return;
         }
+        
+        list = Arrays.asList( array );
     }
 
-
     private void setDefaults() throws MojoFailureException
     {
         if ( allTargets == null )
@@ -347,11 +345,12 @@
 
         if ( application.getAuthors() == null )
         {
-            List authors = new ArrayList();
-            List developers = project.getDevelopers();
-            for ( int ii = 0; ii < developers.size(); ii++ )
+            List<String> authors = new ArrayList<String>();
+            @SuppressWarnings(value={"unchecked"})
+            List<Developer> developers = project.getDevelopers();
+            
+            for ( Developer developer:developers )
             {
-                Developer developer = ( Developer ) developers.get( ii );
                 if ( developer.getEmail() != null )
                 {
                     authors.add( developer.getEmail() );
@@ -390,10 +389,8 @@
             application.setLicense( new File( "LICENSE" ) );
         }
 
-        for ( int ii = 0; ii < allTargets.size(); ii++ )
+        for ( Target target:allTargets )
         {
-            Target target = ( Target ) allTargets.get( ii );
-
             if ( target.getApplication() == null )
             {
                 target.setApplication( this.application );
@@ -445,6 +442,7 @@
     private void setupSourcesAndDocs() throws MojoFailureException
     {
         File generatedDocs = null;
+        
         if ( svnBaseUrl != null )
         {
             exportedSources = new File( outputDirectory, "src" );
@@ -465,6 +463,7 @@
     {
         Artifact artifact = null;
         Iterator artifacts = project.getDependencyArtifacts().iterator();
+        
         while ( artifacts.hasNext() )
         {
             artifact = ( Artifact ) artifacts.next();
@@ -515,27 +514,33 @@
         getLog().info( "outputDirectory = " + outputDirectory );
         getLog().info( "----------------------------- allTargets -----------------------------"
);
 
+        boolean isFirst = true;
+        
         if ( allTargets != null )
         {
-            for ( int ii = 0; ii < allTargets.size(); ii++ )
+            if ( isFirst )
             {
-                getLog().info( "id: " + ( ( Target ) allTargets.get( ii ) ).getId() );
-                getLog().info( "osName: " + ( ( Target ) allTargets.get( ii ) ).getOsName()
);
-                getLog().info( "osArch: " + ( ( Target ) allTargets.get( ii ) ).getOsArch()
);
-                getLog().info( "osVersion: " + ( ( Target ) allTargets.get( ii ) ).getOsVersion()
);
-                getLog().info( "daemonFramework: " + ( ( Target ) allTargets.get( ii ) ).getDaemonFramework()
);
+                isFirst = false;
+            }
+            else
+            {
+                getLog().info( "" );
+            }
+            
+            for ( Target target:allTargets )
+            {
+                getLog().info( "id: " + target.getId() );
+                getLog().info( "osName: " + target.getOsName() );
+                getLog().info( "osArch: " + target.getOsArch() );
+                getLog().info( "osVersion: " + target.getOsVersion() );
+                getLog().info( "daemonFramework: " + target.getDaemonFramework() );
                 getLog().info(
-                    "loggerConfigurationFile: " + ( ( Target ) allTargets.get( ii ) ).getLoggerConfigurationFile()
);
+                    "loggerConfigurationFile: " + target.getLoggerConfigurationFile() );
                 getLog().info(
                     "bootstrapperConfigurationFiles: "
-                        + ( ( Target ) allTargets.get( ii ) ).getBootstrapperConfigurationFile()
);
+                        + target.getBootstrapperConfigurationFile() );
                 getLog().info(
-                    "serverConfigurationFil: " + ( ( Target ) allTargets.get( ii ) ).getServerConfigurationFile()
);
-
-                if ( ii + 1 < allTargets.size() )
-                {
-                    getLog().info( "" );
-                }
+                    "serverConfigurationFil: " + target.getServerConfigurationFile() );
             }
         }
 

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/inno/InnoInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/inno/InnoInstallerCommand.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/inno/InnoInstallerCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/inno/InnoInstallerCommand.java
Thu Sep 13 09:04:35 2007
@@ -59,7 +59,7 @@
     private File innoCompiler;
 
 
-    public InnoInstallerCommand( ServiceInstallersMojo mymojo, InnoTarget target ) throws
MojoFailureException
+    public InnoInstallerCommand( ServiceInstallersMojo mymojo, InnoTarget target )
     {
         super( mymojo );
         this.target = target;
@@ -266,7 +266,7 @@
     }
 
 
-    private void initializeFiltering() throws MojoFailureException
+    private void initializeFiltering()
     {
         filterProperties.putAll( mymojo.getProject().getProperties() );
         filterProperties.put( "app", target.getApplication().getName() );
@@ -381,7 +381,7 @@
     }
 
 
-    private String getApplicationLibraryJars() throws MojoFailureException
+    private String getApplicationLibraryJars()
     {
         StringBuffer buf = new StringBuffer();
         List artifacts = target.getLibArtifacts();

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/izpack/IzPackInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/izpack/IzPackInstallerCommand.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/izpack/IzPackInstallerCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/izpack/IzPackInstallerCommand.java
Thu Sep 13 09:04:35 2007
@@ -112,7 +112,7 @@
     }
 
 
-    private void doIzPackFiles() throws MojoFailureException
+    private void doIzPackFiles()
     {
         // -------------------------------------------------------------------
         // For windows we include use a different template file than for unix

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/nsis/NsisInstallerCommand.java
Thu Sep 13 09:04:35 2007
@@ -54,7 +54,7 @@
     private File nsisCompiler;
 
 
-    public NsisInstallerCommand( ServiceInstallersMojo mymojo, NsisTarget target ) throws
MojoFailureException
+    public NsisInstallerCommand( ServiceInstallersMojo mymojo, NsisTarget target )
     {
         super( mymojo );
         this.target = target;
@@ -223,7 +223,7 @@
     }
 
 
-    private void initializeFiltering() throws MojoFailureException
+    private void initializeFiltering()
     {
         filterProperties.putAll( mymojo.getProject().getProperties() );
         filterProperties.put( "app", target.getApplication().getName() );
@@ -339,7 +339,7 @@
     }
 
 
-    private String getApplicationLibraryJars() throws MojoFailureException
+    private String getApplicationLibraryJars()
     {
         StringBuffer buf = new StringBuffer();
         List artifacts = target.getLibArtifacts();

Modified: directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
URL: http://svn.apache.org/viewvc/directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java?rev=575343&r1=575342&r2=575343&view=diff
==============================================================================
--- directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
(original)
+++ directory/daemon/trunk/plugin/src/main/java/org/apache/directory/daemon/installers/rpm/RpmInstallerCommand.java
Thu Sep 13 09:04:35 2007
@@ -60,7 +60,7 @@
     private File rpmBuilder;
 
 
-    public RpmInstallerCommand(ServiceInstallersMojo mymojo, RpmTarget target) throws MojoFailureException
+    public RpmInstallerCommand(ServiceInstallersMojo mymojo, RpmTarget target)
     {
         super( mymojo );
         this.target = target;
@@ -265,7 +265,7 @@
     }
 
 
-    private void initializeFiltering() throws MojoFailureException
+    private void initializeFiltering()
     {
         filterProperties.putAll( mymojo.getProject().getProperties() );
         filterProperties.put( "app", target.getApplication().getName() );
@@ -341,7 +341,7 @@
         if ( target.getDocsDirectory() != null )
         {
             File docRoot = new File( target.getLayout().getBaseDirectory(), target.getDocsTargetPath()
);
-            ArrayList docList = new ArrayList( 200 );
+            List<File> docList = new ArrayList<File>( 200 );
             listFiles( docList, docRoot );
             filterProperties.put( "mk.docs.dirs", getMkDocsDirs( docList, target ) );
             filterProperties.put( "install.docs", getInstallDocs( docList, target ) );
@@ -357,7 +357,7 @@
         if ( target.getSourcesDirectory() != null )
         {
             File srcRoot = new File( target.getLayout().getBaseDirectory(), target.getSourcesTargetPath()
);
-            ArrayList srcList = new ArrayList( 200 );
+            List<File> srcList = new ArrayList<File>( 200 );
             listFiles( srcList, srcRoot );
             filterProperties.put( "mk.sources.dirs", getMkSourcesDirs( srcList, target )
);
             filterProperties.put( "install.sources", getInstallSources( srcList, target )
);
@@ -440,7 +440,7 @@
     }
 
 
-    static void listFiles( List fileList, File dir )
+    static void listFiles( List<File> fileList, File dir )
     {
         if ( dir.isFile() )
         {
@@ -449,14 +449,15 @@
 
         fileList.add( dir );
         File[] files = dir.listFiles();
-        for ( int ii = 0; ii < files.length; ii++ )
+        
+        for ( File file:files )
         {
-            if ( files[ii].isFile() )
+            if ( file.isFile() )
             {
-                fileList.add( files[ii] );
+                fileList.add( file );
             }
 
-            listFiles( fileList, files[ii] );
+            listFiles( fileList, file );
         }
     }
 
@@ -583,7 +584,7 @@
     }
 
 
-    private String getInstallLibraryJars() throws MojoFailureException
+    private String getInstallLibraryJars()
     {
         StringBuffer buf = new StringBuffer();
         List artifacts = target.getLibArtifacts();



Mime
View raw message