maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bentm...@apache.org
Subject svn commit: r809402 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/execution/ maven-core/src/main/java/org/apache/maven/lifecycle/ maven-embedder/src/main/java/org/apache/maven/cli/
Date Sun, 30 Aug 2009 18:41:45 GMT
Author: bentmann
Date: Sun Aug 30 18:41:45 2009
New Revision: 809402

URL: http://svn.apache.org/viewvc?rev=809402&view=rev
Log:
o Simplified code (multi-cast can be realized by a delegating listener if required)

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=809402&r1=809401&r2=809402&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Sun
Aug 30 18:41:45 2009
@@ -78,16 +78,13 @@
 
     private void fireEvent( MavenSession session, ExecutionEventCatapult catapult )
     {
-        List<ExecutionListener> listeners = session.getRequest().getExecutionListeners();
+        ExecutionListener listener = session.getRequest().getExecutionListener();
 
-        if ( !listeners.isEmpty() )
+        if ( listener != null )
         {
             ExecutionEvent event = new DefaultLifecycleEvent( session, null );
 
-            for ( ExecutionListener listener : listeners )
-            {
-                catapult.fire( listener, event );
-            }
+            catapult.fire( listener, event );
         }
     }
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=809402&r1=809401&r2=809402&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
Sun Aug 30 18:41:45 2009
@@ -118,7 +118,7 @@
 
     private List<ArtifactRepository> pluginArtifactRepositories;
 
-    private List<ExecutionListener> lifecycleListeners;
+    private ExecutionListener executionListener;
 
     /**
      * Suppress SNAPSHOT updates.
@@ -163,7 +163,7 @@
         copy.setPluginArtifactRepositories( original.getPluginArtifactRepositories() );
         copy.setRepositoryCache( original.getRepositoryCache() );
         copy.setNoSnapshotUpdates( original.isNoSnapshotUpdates() );
-        copy.setExecutionListeners( original.getExecutionListeners() );
+        copy.setExecutionListener( original.getExecutionListener() );
         return original;        
     }
    
@@ -944,26 +944,14 @@
         return this;
     }
 
-    public List<ExecutionListener> getExecutionListeners()
+    public ExecutionListener getExecutionListener()
     {
-        if ( lifecycleListeners == null )
-        {
-            lifecycleListeners = new ArrayList<ExecutionListener>();
-        }
-
-        return lifecycleListeners;
+        return executionListener;
     }
 
-    public MavenExecutionRequest setExecutionListeners( List<ExecutionListener> lifecycleListeners
)
+    public MavenExecutionRequest setExecutionListener( ExecutionListener executionListener
)
     {
-        if ( lifecycleListeners != null )
-        {
-            this.lifecycleListeners = new ArrayList<ExecutionListener>( lifecycleListeners
);
-        }
-        else
-        {
-            this.lifecycleListeners = null;
-        }
+        this.executionListener = executionListener;
 
         return this;
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=809402&r1=809401&r2=809402&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
Sun Aug 30 18:41:45 2009
@@ -263,8 +263,8 @@
     File getUserToolchainsFile();
     MavenExecutionRequest setUserToolchainsFile( File userToolchainsFile );
 
-    List<ExecutionListener> getExecutionListeners();
-    MavenExecutionRequest setExecutionListeners( List<ExecutionListener> executionListeners
);
+    ExecutionListener getExecutionListener();
+    MavenExecutionRequest setExecutionListener( ExecutionListener executionListener );
 
     ProjectBuildingRequest getProjectBuildingRequest();    
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=809402&r1=809401&r2=809402&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Sun Aug 30 18:41:45 2009
@@ -140,16 +140,13 @@
 
     private void fireEvent( MavenSession session, MojoExecution mojoExecution, LifecycleEventCatapult
catapult )
     {
-        List<ExecutionListener> listeners = session.getRequest().getExecutionListeners();
+        ExecutionListener listener = session.getRequest().getExecutionListener();
 
-        if ( !listeners.isEmpty() )
+        if ( listener != null )
         {
             ExecutionEvent event = new DefaultLifecycleEvent( session, mojoExecution );
 
-            for ( ExecutionListener listener : listeners )
-            {
-                catapult.fire( listener, event );
-            }
+            catapult.fire( listener, event );
         }
     }
 

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=809402&r1=809401&r2=809402&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
(original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Sun Aug 30 18:41:45 2009
@@ -16,7 +16,6 @@
  */
 
 import java.io.File;
-import java.util.Arrays;
 
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.ParseException;
@@ -29,7 +28,6 @@
 import org.apache.maven.embedder.MavenEmbedderFileLogger;
 import org.apache.maven.embedder.MavenEmbedderLogger;
 import org.apache.maven.exception.ExceptionSummary;
-import org.apache.maven.execution.ExecutionListener;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionResult;
 import org.codehaus.plexus.classworlds.ClassWorld;
@@ -122,7 +120,7 @@
 
         MavenEmbedderLogger logger = configuration.getMavenEmbedderLogger();
 
-        request.setExecutionListeners( Arrays.<ExecutionListener> asList( new ExecutionEventLogger(
logger ) ) );
+        request.setExecutionListener( new ExecutionEventLogger( logger ) );
 
         if ( debug || commandLine.hasOption( CLIManager.SHOW_VERSION ) )
         {



Mime
View raw message