svn commit: r168217 - in /maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin: pom.xml src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMoj

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r168217 - in /maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin: pom.xml src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMoj

Emmanuel Venisse
Author: evenisse
Date: Wed May  4 17:17:49 2005
New Revision: 168217

URL: http://svn.apache.org/viewcvs?rev=168217&view=rev
Log:
o Add Mailing List Report
o Add a simple report generator mojo for dependencies and mailing list

Added:
    maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java
    maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMojo.java
Modified:
    maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml
    maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml

Modified: maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml?rev=168217&r1=168216&r2=168217&view=diff
==============================================================================
--- maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml (original)
+++ maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml Wed May  4 17:17:49 2005
@@ -13,6 +13,11 @@
   <inceptionYear>2005</inceptionYear>
   <dependencies>
     <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-project</artifactId>
+      <version>2.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>doxia</groupId>
       <artifactId>doxia-core</artifactId>
       <version>1.0-alpha-2-SNAPSHOT</version>

Added: maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java?rev=168217&view=auto
==============================================================================
--- maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java (added)
+++ maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/MailingListsReport.java Wed May  4 17:17:49 2005
@@ -0,0 +1,106 @@
+package org.apache.maven.reports.projectinfo;
+
+/*
+ * Copyright 2004-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.model.MailingList;
+import org.apache.maven.model.Model;
+import org.apache.maven.reporting.AbstractMavenReportRenderer;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.doxia.sink.Sink;
+
+import java.io.IOException;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:[hidden email]">Brett Porter</a>
+ * @version $Id: MailingListsReport.java,v 1.4 2005/02/23 00:08:03 brett Exp $
+ */
+public class MailingListsReport
+    extends AbstractMavenReport
+{
+    public void execute()
+        throws MavenReportException
+    {
+        try
+        {
+            MailingListsRenderer r = new MailingListsRenderer( getSink(), getConfiguration().getModel() );
+
+            r.render();
+        }
+        catch( IOException e )
+        {
+            throw new MavenReportException( "Can't write the report " + getOutputName(), e );
+        }
+    }
+
+    public String getOutputName()
+    {
+        return "mail-lists";
+    }
+
+    static class MailingListsRenderer
+        extends AbstractMavenReportRenderer
+    {
+        private Model model;
+
+        public MailingListsRenderer( Sink sink, Model model )
+        {
+            super( sink );
+
+            this.model = model;
+        }
+
+        // How to i18n these ...
+        public String getTitle()
+        {
+            return "Project Mailing Lists";
+        }
+
+        public void renderBody()
+        {
+            startSection( getTitle() );
+
+            if ( model.getMailingLists().isEmpty() )
+            {
+                // TODO: should the report just be excluded?
+                paragraph( "There are no mailing lists currently associated with this project." );
+            }
+            else
+            {
+                paragraph( "These are the mailing lists that have been established for this project. For each list, " +
+                           "there is a subscribe, unsubscribe, and an archive link." );
+
+                startTable();
+
+                tableHeader( new String[]{"Name", "Subscribe", "Unsubscribe", "Archive"} );
+
+                for ( Iterator i = model.getMailingLists().iterator(); i.hasNext(); )
+                {
+                    MailingList m = (MailingList) i.next();
+
+                    // TODO: render otherArchives?
+                    tableRow( new String[]{m.getName(), m.getSubscribe(), m.getUnsubscribe(), m.getArchive()} );
+                }
+
+                endTable();
+            }
+            endSection();
+        }
+
+    }
+}

Added: maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMojo.java?rev=168217&view=auto
==============================================================================
--- maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMojo.java (added)
+++ maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ProjectReportsMojo.java Wed May  4 17:17:49 2005
@@ -0,0 +1,79 @@
+package org.apache.maven.reports.projectinfo;
+
+/*
+ * 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.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.MavenReport;
+import org.apache.maven.reporting.MavenReportConfiguration;
+import org.apache.maven.reporting.MavenReportException;
+
+import java.io.File;
+
+/**
+ * @goal generate
+ * @description A Maven2 plugin which generates the set of project reports
+ *
+ * @author <a href="mailto:[hidden email]">Brett Porter</a>
+ * @version $Id: ProjectReportsMojo.java,v 1.3 2005/02/23 00:08:03 brett Exp $
+ */
+public class ProjectReportsMojo
+    extends AbstractMojo
+{
+    /**
+     * @parameter alias="workingDirectory" expression="${project.build.directory}/site-generated"
+     * @required
+     */
+    private String outputDirectory;
+
+    /**
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    public void execute()
+        throws MojoExecutionException
+    {
+        MavenReportConfiguration config = new MavenReportConfiguration();
+
+        config.setModel( project.getModel() );
+
+        config.setOutputDirectory( new File( outputDirectory ) );
+
+        MavenReport dependenciesReport = new DependenciesReport();
+
+        dependenciesReport.setConfiguration( config );
+
+        MavenReport mailingListsReport = new MailingListsReport();
+
+        mailingListsReport.setConfiguration( config );
+
+        try
+        {
+            dependenciesReport.generate();
+
+            mailingListsReport.generate();
+        }
+        catch ( MavenReportException e )
+        {
+            throw new MojoExecutionException( "An error is occurred in the report generation.", e );
+        }
+    }
+}

Modified: maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewcvs/maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml?rev=168217&r1=168216&r2=168217&view=diff
==============================================================================
--- maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/trunk/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml Wed May  4 17:17:49 2005
@@ -11,31 +11,11 @@
       <implementation>org.apache.maven.reports.projectinfo.DependenciesReport</implementation>
       <instantiation-strategy>per-lookup</instantiation-strategy>
     </component>
+    <component>
+      <role>org.apache.maven.reporting.MavenReport</role>
+      <role-hint>mail-lists</role-hint>
+      <implementation>org.apache.maven.reports.projectinfo.MailingListsReport</implementation>
+      <instantiation-strategy>per-lookup</instantiation-strategy>
+    </component>
   </components>
-  <dependencies>
-    <dependency>
-      <groupId>doxia</groupId>
-      <artifactId>doxia-core</artifactId>
-      <type>jar</type>
-      <version>1.0-alpha-2-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven.reporting</groupId>
-      <artifactId>maven-reporting-api</artifactId>
-      <type>jar</type>
-      <version>2.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-model</artifactId>
-      <type>jar</type>
-      <version>2.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.maven</groupId>
-      <artifactId>maven-plugin-api</artifactId>
-      <type>jar</type>
-      <version>2.0-SNAPSHOT</version>
-    </dependency>
-  </dependencies>
 </component-set>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]