maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ken...@apache.org
Subject svn commit: r430440 - in /maven/components/trunk/maven-reporting: maven-reporting-api/ maven-reporting-api/src/main/java/org/apache/maven/reporting/ maven-reporting-impl/ maven-reporting-impl/src/main/java/org/apache/maven/reporting/ maven-reporting-im...
Date Thu, 10 Aug 2006 17:09:31 GMT
Author: kenney
Date: Thu Aug 10 10:09:30 2006
New Revision: 430440

URL: http://svn.apache.org/viewvc?rev=430440&view=rev
Log:
PR: MNG-2410
Desc: Add support for multi-page reports using multiple sinks.

* Removed unused MultiPageSink and SinkFactory, and the AbstractMavenMultiPageReport
  (could not find any class extending that one, even in Mojo; Also, it doesn't work
  so It's safe to delete).

* Updated deps on doxia-sink-api to 1.0-alpha-9-SNAPSHOT which has the SinkFactory
  interface.

* Updated dep on doxia-site-renderer to 1.0-alpha-9-SNAPSHOT since that uses the sink-api.

* For backwards compatibility I added an MavenMultiPageReport interface.
  Normal reporting plugins can implement that, and the site plugin detects this interface
  and calls the new generate api method with the SinkFactory parameter.

  In the future, the MavenMultiPageReport should be merged with the MavenReport interface,
  and the original generate method should be removed.

  This is the only way to alter the API without breaking existing plugins.


Added:
    maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
  (with props)
Removed:
    maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenMultiPageReport.java
    maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/sink/
Modified:
    maven/components/trunk/maven-reporting/maven-reporting-api/pom.xml
    maven/components/trunk/maven-reporting/maven-reporting-impl/pom.xml
    maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java

Modified: maven/components/trunk/maven-reporting/maven-reporting-api/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-reporting/maven-reporting-api/pom.xml?rev=430440&r1=430439&r2=430440&view=diff
==============================================================================
--- maven/components/trunk/maven-reporting/maven-reporting-api/pom.xml (original)
+++ maven/components/trunk/maven-reporting/maven-reporting-api/pom.xml Thu Aug 10 10:09:30
2006
@@ -41,7 +41,7 @@
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-sink-api</artifactId>
-      <version>1.0-alpha-7</version>
+      <version>1.0-alpha-9-SNAPSHOT</version>
     </dependency>
   </dependencies>
 </project>

Added: maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java?rev=430440&view=auto
==============================================================================
--- maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
(added)
+++ maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
Thu Aug 10 10:09:30 2006
@@ -0,0 +1,37 @@
+package org.apache.maven.reporting;
+
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkFactory;
+
+import java.util.Locale;
+
+/**
+ * Temporary class for backwards compatibility. This method
+ * should be moved to the MavenReport class, and the other 'generate'
+ * method should be dropped. But that will render all reporting mojo's 
+ * uncompilable. 
+ *
+ * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
+ */
+public interface MavenMultiPageReport
+    extends MavenReport
+{
+    void generate( Sink sink, SinkFactory sinkFactory, Locale locale )
+        throws MavenReportException;
+}

Propchange: maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenMultiPageReport.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/trunk/maven-reporting/maven-reporting-impl/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-reporting/maven-reporting-impl/pom.xml?rev=430440&r1=430439&r2=430440&view=diff
==============================================================================
--- maven/components/trunk/maven-reporting/maven-reporting-impl/pom.xml (original)
+++ maven/components/trunk/maven-reporting/maven-reporting-impl/pom.xml Thu Aug 10 10:09:30
2006
@@ -50,13 +50,18 @@
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
+      <artifactId>doxia-sink-api</artifactId>
+      <version>1.0-alpha-9-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-core</artifactId>
       <version>1.0-alpha-7</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.doxia</groupId>
       <artifactId>doxia-site-renderer</artifactId>
-      <version>1.0-alpha-7</version>
+      <version>1.0-alpha-9-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

Modified: maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java?rev=430440&r1=430439&r2=430440&view=diff
==============================================================================
--- maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
(original)
+++ maven/components/trunk/maven-reporting/maven-reporting-impl/src/main/java/org/apache/maven/reporting/AbstractMavenReport.java
Thu Aug 10 10:09:30 2006
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.SinkFactory;
 import org.apache.maven.doxia.siterenderer.Renderer;
 import org.apache.maven.doxia.siterenderer.RendererException;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
@@ -40,6 +41,8 @@
 {
     private Sink sink;
 
+    private SinkFactory sinkFactory;
+
     private Locale locale = Locale.ENGLISH;
 
     protected abstract Renderer getSiteRenderer();
@@ -51,44 +54,43 @@
     private File reportOutputDirectory;
 
     /**
+     * TODO: This method is never called - all reports are rendered by maven-site-plugin's
+     * ReportDocumentRender.
+     *
      * @see org.apache.maven.plugin.Mojo#execute()
      */
     public void execute()
         throws MojoExecutionException
     {
-        try
-        {
-            String outputDirectory = getOutputDirectory();
-
-            SiteRendererSink sink =
-                getSiteRenderer().createSink( new File( outputDirectory ), getOutputName()
+ ".html" );
+        throw new MojoExecutionException( "Reporting mojo's can only be called from ReportDocumentRender"
);
+    }
 
-            generate( sink, Locale.getDefault() );
+    /**
+     * @see org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink,
org.apache.maven.reporting.SinkFactory, java.util.Locale)
+     * @deprecated
+     */
+    public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale )
+        throws MavenReportException
+    {
+        getLog().warn( "Deprecated API called - no SinkFactory available. Please update this
plugin." );
+        generate( sink, null, locale );
+    }
 
-            // TODO: add back when skinning support is in the site renderer
-//            getSiteRenderer().copyResources( outputDirectory, "maven" );
-        }
-        catch ( RendererException e )
-        {
-            throw new MojoExecutionException( "An error has occurred in " + getName( locale
) + " report generation.",
-                                              e );
-        }
-        catch ( IOException e )
-        {
-            throw new MojoExecutionException( "An error has occurred in " + getName( locale
) + " report generation.",
-                                              e );
-        }
-        catch ( MavenReportException e )
-        {
-            throw new MojoExecutionException( "An error has occurred in " + getName( locale
) + " report generation.",
-                                              e );
-        }
+    /**
+     * @see org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink,
org.apache.maven.reporting.SinkFactory, java.util.Locale)
+     * @deprecated
+     */
+    public void generate( Sink sink, Locale locale )
+        throws MavenReportException
+    {
+        getLog().warn( "Deprecated API called - no SinkFactory available. Please update this
plugin." );
+        generate( sink, null, locale );
     }
 
     /**
-     * @see org.apache.maven.reporting.MavenReport#generate(org.codehaus.doxia.sink.Sink,
java.util.Locale)
+     * @see org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink,
org.apache.maven.reporting.SinkFactory, java.util.Locale)
      */
-    public void generate( org.codehaus.doxia.sink.Sink sink, Locale locale )
+    public void generate( Sink sink, SinkFactory sinkFactory, Locale locale )
         throws MavenReportException
     {
         if ( sink == null )
@@ -98,6 +100,8 @@
 
         this.sink = sink;
 
+        this.sinkFactory = sinkFactory;
+
         executeReport( locale );
 
         closeReport();
@@ -132,6 +136,11 @@
     public Sink getSink()
     {
         return sink;
+    }
+
+    public SinkFactory getSinkFactory()
+    {
+        return sinkFactory;
     }
 
     public boolean isExternalReport()



Mime
View raw message