Author: vsiveton
Date: Wed Nov 17 22:49:50 2010
New Revision: 1036268
URL: http://svn.apache.org/viewvc?rev=1036268&view=rev
Log:
MPIR-207: Add a distribution management report
o added new report
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
(with props)
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
Added:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java?rev=1036268&view=auto
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
(added)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
Wed Nov 17 22:49:50 2010
@@ -0,0 +1,191 @@
+package org.apache.maven.report.projectinfo;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.util.Locale;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.model.DistributionManagement;
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.i18n.I18N;
+import org.codehaus.plexus.util.StringUtils;
+
+/**
+ * Generates the Project Distribution Management report.
+ *
+ * @author <a href="mailto:[email protected]">Vincent Siveton </a>
+ * @version $Id$
+ * @since 2.3
+ * @goal distribution-management
+ */
+public class DistributionManagementReport
+ extends AbstractProjectInfoReport
+{
+ // ----------------------------------------------------------------------
+ // Public methods
+ // ----------------------------------------------------------------------
+
+ @Override
+ public void executeReport( Locale locale )
+ {
+ DistributionManagementRenderer r =
+ new DistributionManagementRenderer( getSink(), getProject(),
getI18N( locale ), locale );
+
+ r.render();
+ }
+
+ /** {...@inheritdoc} */
+ public String getOutputName()
+ {
+ return "distribution-management";
+ }
+
+ @Override
+ protected String getI18Nsection()
+ {
+ return "distributionManagement";
+ }
+
+ // ----------------------------------------------------------------------
+ // Private
+ // ----------------------------------------------------------------------
+
+ /**
+ * Internal renderer class
+ */
+ private static class DistributionManagementRenderer
+ extends AbstractProjectInfoRenderer
+ {
+ private final MavenProject project;
+
+ DistributionManagementRenderer( Sink sink, MavenProject project, I18N
i18n, Locale locale )
+ {
+ super( sink, i18n, locale );
+
+ this.project = project;
+ }
+
+ @Override
+ protected String getI18Nsection()
+ {
+ return "distributionManagement";
+ }
+
+ @Override
+ public void renderBody()
+ {
+ DistributionManagement distributionManagement =
project.getDistributionManagement();
+ if ( distributionManagement == null )
+ {
+ startSection( getI18nString( "overview.title" ) );
+
+ paragraph( getI18nString( "nodistributionmanagement" ) );
+
+ endSection();
+
+ return;
+ }
+
+ startSection( getI18nString( "overview.title" ) );
+ paragraph( getI18nString( "overview.intro" ) );
+
+ if ( StringUtils.isNotEmpty(
distributionManagement.getDownloadUrl() ) )
+ {
+ startSection( getI18nString( "downloadURL" ) );
+ internalLink( distributionManagement.getDownloadUrl() );
+ endSection();
+ }
+
+ if ( distributionManagement.getRelocation() != null )
+ {
+ startSection( getI18nString( "relocation" ) );
+ startTable();
+ tableHeader( new String[] { getI18nString( "field" ),
getI18nString( "value" ) } );
+ tableRow( new String[] { getI18nString( "relocation.groupid" ),
+ distributionManagement.getRelocation().getGroupId() } );
+ tableRow( new String[] { getI18nString(
"relocation.artifactid" ),
+ distributionManagement.getRelocation().getArtifactId() } );
+ tableRow( new String[] { getI18nString( "relocation.version" ),
+ distributionManagement.getRelocation().getVersion() } );
+ tableRow( new String[] { getI18nString( "relocation.message" ),
+ distributionManagement.getRelocation().getMessage() } );
+ endTable();
+ endSection();
+ }
+
+ if ( distributionManagement.getRepository() != null
+ && StringUtils.isNotEmpty(
distributionManagement.getRepository().getUrl() ) )
+ {
+ startSection( getI18nString( "repository" )
+ + getRepoName(
distributionManagement.getRepository().getId() ) );
+ internalLink( distributionManagement.getRepository().getUrl()
);
+ endSection();
+ }
+
+ if ( distributionManagement.getSnapshotRepository() != null
+ && StringUtils.isNotEmpty(
distributionManagement.getSnapshotRepository().getUrl() ) )
+ {
+ startSection( getI18nString( "snapshotRepository" )
+ + getRepoName(
distributionManagement.getSnapshotRepository().getId() ) );
+ internalLink(
distributionManagement.getSnapshotRepository().getUrl() );
+ endSection();
+ }
+
+ if ( distributionManagement.getSite() != null
+ && StringUtils.isNotEmpty(
distributionManagement.getSite().getUrl() ) )
+ {
+ startSection( getI18nString( "site" ) + getRepoName(
distributionManagement.getSite().getId() ) );
+ internalLink( distributionManagement.getSite().getUrl() );
+ endSection();
+ }
+
+ endSection();
+ }
+
+ private void internalLink( String url )
+ {
+ if ( StringUtils.isEmpty( url ) )
+ {
+ return;
+ }
+
+ String urlLowerCase = url.trim().toLowerCase( Locale.ENGLISH );
+ if ( urlLowerCase.startsWith( "http" ) || urlLowerCase.startsWith(
"https" )
+ || urlLowerCase.startsWith( "ftp" ) )
+ {
+ link( url, url );
+ }
+ else
+ {
+ paragraph( url );
+ }
+ }
+
+ private String getRepoName( String name )
+ {
+ if ( StringUtils.isNotEmpty( name ) )
+ {
+ return " - " + name;
+ }
+
+ return "";
+ }
+ }
+}
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DistributionManagementReport.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties?rev=1036268&r1=1036267&r2=1036268&view=diff
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
(original)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report.properties
Wed Nov 17 22:49:50 2010
@@ -258,4 +258,21 @@ report.modules.description
report.modules.title = Project
Modules
report.modules.intro = This
project has declared the following modules:
report.modules.header.name = Name
-report.modules.header.description =
Description
\ No newline at end of file
+report.modules.header.description =
Description
+report.distributionManagement.name =
Distribution Management
+report.distributionManagement.description = This
document provides informations on the distribution management of this project.
+report.distributionManagement.title = Project
Distribution Management
+report.distributionManagement.nodistributionmanagement = No
distribution management is defined for this project.
+report.distributionManagement.overview.title = Overview
+report.distributionManagement.overview.intro = The
following is the distribution management information used by this project.
+report.distributionManagement.downloadURL = Download
URL
+report.distributionManagement.repository = Repository
+report.distributionManagement.snapshotRepository = Snapshot
Repository
+report.distributionManagement.site = Site
+report.distributionManagement.relocation = Relocation
+report.distributionManagement.field = Field
+report.distributionManagement.value = Value
+report.distributionManagement.relocation.groupid = GroupId
+report.distributionManagement.relocation.artifactid = ArtifactId
+report.distributionManagement.relocation.version = Version
+report.distributionManagement.relocation.message = Message
\ No newline at end of file
Modified:
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
URL:
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties?rev=1036268&r1=1036267&r2=1036268&view=diff
==============================================================================
---
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
(original)
+++
maven/plugins/trunk/maven-project-info-reports-plugin/src/main/resources/project-info-report_fr.properties
Wed Nov 17 22:49:50 2010
@@ -254,4 +254,21 @@ report.modules.description
report.modules.title = Modules
du projet
report.modules.intro = Ce sont
les modules qui ont \u00e9t\u00e9 declar\u00e9 pour ce projet:
report.modules.header.name = Nom
-report.modules.header.description =
Description
\ No newline at end of file
+report.modules.header.description =
Description
+report.distributionManagement.name = Gestion
de la distribution
+report.distributionManagement.description = Ce
document fournit des informations sur la gestion de la distribution du projet.
+report.distributionManagement.title = Gestion
de la distribution du projet
+report.distributionManagement.nodistributionmanagement = Aucune
gestion de distribution est d\u00e9finie pour ce projet.
+report.distributionManagement.overview.title = Vue
d'ensemble
+report.distributionManagement.overview.intro = Ce qui
suit est l'information sur la gestion de distribution utilis\u00e9e par ce
projet.
+report.distributionManagement.downloadURL = URL de
t\u00e9l\u00e9chargement
+report.distributionManagement.repository =
R\u00e9f\u00e9rentiel
+report.distributionManagement.snapshotRepository = Snapshot
R\u00e9f\u00e9rentiel
+report.distributionManagement.site = Site
+report.distributionManagement.relocation = Transfert
+report.distributionManagement.field = Champs
+report.distributionManagement.value = Valeur
+report.distributionManagement.relocation.groupid = GroupId
+report.distributionManagement.relocation.artifactid = ArtifactId
+report.distributionManagement.relocation.version = Version
+report.distributionManagement.relocation.message = Message