maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1074968 - /maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java
Date Sun, 27 Feb 2011 00:26:37 GMT
Author: hboutemy
Date: Sun Feb 27 00:26:37 2011
New Revision: 1074968

URL: http://svn.apache.org/viewvc?rev=1074968&view=rev
Log:
refactor to be more like 2.x branch

Modified:
    maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java

Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java?rev=1074968&r1=1074967&r2=1074968&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java
(original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java
Sun Feb 27 00:26:37 2011
@@ -45,27 +45,35 @@ import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.WriterFactory;
 
 /**
- * Renders a Maven report.
+ * Renders a Maven report in a doxia site.
  *
  * @author <a href="mailto:brett@apache.org">Brett Porter</a>
  */
 public class ReportDocumentRenderer
     implements DocumentRenderer
 {
-    private MavenReportExecution mavenReportExecution;
+    private final MavenReport report;
 
-    private RenderingContext renderingContext;
+    private final RenderingContext renderingContext;
 
-    private Log log;
+    private final String pluginInfo;
+
+    private final ClassLoader classLoader;
+    
+    private final Log log;
 
     public ReportDocumentRenderer( MavenReportExecution mavenReportExecution, RenderingContext
renderingContext, Log log )
     {
-        this.mavenReportExecution = mavenReportExecution;
+        this.report = mavenReportExecution.getMavenReport();
 
         this.renderingContext = renderingContext;
 
-        this.log = log;
+        this.pluginInfo =
+            mavenReportExecution.getPlugin().getArtifactId() + ':' + mavenReportExecution.getPlugin().getVersion();
 
+        this.classLoader = mavenReportExecution.getClassLoader();
+
+        this.log = log;
     }
 
     private static class MySink
@@ -144,19 +152,16 @@ public class ReportDocumentRenderer
         throws RendererException, FileNotFoundException
     {
         Locale locale = siteRenderingContext.getLocale();
-
-        MavenReport report = mavenReportExecution.getMavenReport();
-
         String localReportName = report.getName( locale );
-        String pluginInfo =
-            mavenReportExecution.getPlugin().getArtifactId() + ':' + mavenReportExecution.getPlugin().getVersion();
-        log.info( "Generating \"" + localReportName + "\" report    --- " + pluginInfo );
+
+        log.info( "Generating \"" + localReportName + "\" report"
+                  + ( pluginInfo == null ? "." : ( "    --- " + pluginInfo ) ) );
 
         MySinkFactory sf = new MySinkFactory( renderingContext );
 
         SiteRendererSink sink = new SiteRendererSink( renderingContext );
         ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
-        Thread.currentThread().setContextClassLoader( this.mavenReportExecution.getClassLoader()
);
+        Thread.currentThread().setContextClassLoader( classLoader );
         try
         {
             if ( report instanceof MavenMultiPageReport )
@@ -244,6 +249,6 @@ public class ReportDocumentRenderer
      */
     public boolean isExternalReport()
     {
-        return mavenReportExecution.getMavenReport().isExternalReport();
+        return report.isExternalReport();
     }
 }



Mime
View raw message