Author: wsmoak
Date: Sat May 17 19:16:42 2008
New Revision: 657491

URL: http://svn.apache.org/viewvc?rev=657491&view=rev
Log:
[MRM-804] Execute the repository content consumers for the uploaded or 
generated pom file so that artifacts will be available in search and browse 
immediately after uploading.

Modified:
    
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java

Modified: 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
URL: 
http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java?rev=657491&r1=657490&r2=657491&view=diff
==============================================================================
--- 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
 (original)
+++ 
archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java
 Sat May 17 19:16:42 2008
@@ -316,6 +316,7 @@
             try
             {
                 copyFile( artifactFile, targetPath, artifactPath.substring( 
lastIndex + 1 ) );
+                consumers.executeConsumers( repoConfig, repository.toFile( 
artifactReference ) );
             }
             catch ( IOException ie )
             {
@@ -327,7 +328,8 @@
             {
                 try
                 {
-                    createPom( targetPath, artifactPath.substring( lastIndex + 
1 ) );
+                    File generatedPomFile = createPom( targetPath, 
artifactPath.substring( lastIndex + 1 ) );
+                    consumers.executeConsumers( repoConfig, generatedPomFile );
                 }
                 catch ( IOException ie )
                 {
@@ -348,6 +350,7 @@
                 {
                     String targetFilename = artifactPath.substring( lastIndex 
+ 1 ).replaceAll( packaging, "pom" );
                     copyFile( pomFile, targetPath, targetFilename );
+                    consumers.executeConsumers( repoConfig, new File( 
targetPath, targetFilename ) );
                 }
                 catch ( IOException ie )
                 {
@@ -368,8 +371,6 @@
             //TODO: MRM-785 (success message does not display on web page)
             addActionMessage( msg );
 
-            consumers.executeConsumers( repoConfig, repository.toFile( 
artifactReference ) );
-            
             return SUCCESS;
         }
         catch ( RepositoryNotFoundException re )
@@ -410,7 +411,7 @@
         }
     }
 
-    private void createPom( File targetPath, String filename )
+    private File createPom( File targetPath, String filename )
         throws IOException, ProjectModelException
     {
         ArchivaProjectModel projectModel = new ArchivaProjectModel();
@@ -422,6 +423,8 @@
         File pomFile = new File( targetPath, filename.replaceAll( packaging, 
"pom" ) );
 
         pomWriter.write( projectModel, pomFile );
+
+        return pomFile;
     }
 
     private File getMetadata( String targetPath )


Reply via email to