[jboss-svn-commits] JBL Code SVN: r15991 - in labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main: resources and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Oct 22 18:11:29 EDT 2007
Author: steve.ebersole at jboss.com
Date: 2007-10-22 18:11:29 -0400 (Mon, 22 Oct 2007)
New Revision: 15991
Removed:
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationDiffReport.java
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/revdiff/
labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/translation-diff-report.properties
Log:
removed revdiff stuff
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationDiffReport.java
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationDiffReport.java 2007-10-22 22:09:06 UTC (rev 15990)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/java/org/jboss/maven/plugins/jdocbook/TranslationDiffReport.java 2007-10-22 22:11:29 UTC (rev 15991)
@@ -1,187 +0,0 @@
-/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Christian Bauer, Steve Ebersole
- */
-package org.jboss.maven.plugins.jdocbook;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.reporting.MavenReport;
-import org.apache.maven.reporting.MavenReportException;
-import org.jboss.maven.plugins.jdocbook.gen.util.Formatting;
-import org.jboss.maven.plugins.jdocbook.gen.RenderingException;
-import org.jboss.maven.plugins.jdocbook.revdiff.Diff;
-import org.jboss.maven.plugins.jdocbook.revdiff.DiffCreator;
-import org.jboss.maven.plugins.jdocbook.revdiff.GenerationException;
-import org.jboss.maven.plugins.jdocbook.revdiff.TranslationReportGenerator;
-
-/**
- * A plugin for generating a "translation diff" report across different
- * translations of the same document. This is useful for the translators to
- * know what changes exist between their translation and the master.
- * <p/>
- * Eventually, there is a possibility this will not be needed as we move
- * forward if it is decided to move to the xliff format for translations.
- *
- * @goal diff
- * @phase site
- * @requiresDependencyResolution
- *
- * @author Christian Bauer
- * @author Steve Ebersole
- */
-public class TranslationDiffReport extends AbstractDocBookMojo implements MavenReport {
-
- public static final String NAME = "translation-diff-report";
- private File reportOutputDirectory;
-
- private ResourceBundle getBundle(Locale locale) {
- return ResourceBundle.getBundle( NAME, locale, this.getClass().getClassLoader() );
- }
-
- private String buildReportFileName() {
- return getOutputName() + ".html";
- }
-
- // AbstractDocBookMojo impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- /**
- * Copied nearly verbatim from {@link org.apache.maven.reporting.AbstractMavenReport#execute()}
- *
- * {@inheritDoc}
- */
- protected void process(Formatting[] formattings) throws RenderingException {
- try {
- generateReport( Locale.getDefault() );
- }
- catch (GenerationException t) {
- throw new RenderingException( "An error has occurred in " + NAME + " report generation.", t );
- }
- }
-
-
- // MavenReport impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- public String getOutputName() {
- return NAME;
- }
-
- public String getName(Locale locale) {
- return getBundle( locale ).getString( "report.name" );
- }
-
- public String getDescription(Locale locale) {
- return getBundle( locale ).getString( "report.description" );
- }
-
- public String getCategoryName() {
- return CATEGORY_PROJECT_REPORTS;
- }
-
- public void setReportOutputDirectory(File dir) {
- this.reportOutputDirectory = dir;
- }
-
- public File getReportOutputDirectory() {
- if ( reportOutputDirectory == null ) {
- reportOutputDirectory = new File( project.getReporting().getOutputDirectory() );
- }
- return reportOutputDirectory;
- }
-
- public boolean isExternalReport() {
- return false;
- }
-
- public boolean canGenerateReport() {
- return masterTranslationArtifactId != null ||
- ( masterTranslationFile != null && masterTranslationFile.exists() );
- }
-
- public void generate(org.codehaus.doxia.sink.Sink sink, Locale locale) throws MavenReportException {
- try {
- generateReport( locale );
- }
- catch ( GenerationException e ) {
- throw new MavenReportException( "error generating report", e );
- }
- }
-
-
- // report generation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- private void generateReport(Locale locale) throws GenerationException {
- getLog().debug( "starting " + PLUGIN_NAME + ":diff goal execution" );
-
- if ( !canGenerateReport() ) {
- getLog().info( "project is documentation master (or no master defined)" );
- return;
- }
-
- File master = masterTranslationFile;
- if ( master == null ) {
- MasterTranslationLocator locator = new MasterTranslationLocator();
- processArtifacts( locator );
- master = locator.located.getFile();
- }
- if ( master == null ) {
- throw new GenerationException( "unable to locate master source" );
- }
-
- File translation = new File( sourceDirectory, sourceDocumentName );
-
- getLog().debug( " master : " + master.getAbsolutePath() );
- getLog().debug( " translation : " + translation.getAbsolutePath() );
-
- File output = new File( getReportOutputDirectory(), buildReportFileName() );
- prepReportFile( output );
-
- DiffCreator diffCreator = new DiffCreator( options.isXincludeSupported(), getLog() );
- Diff diff = diffCreator.findDiff( master, translation );
-
- TranslationReportGenerator generator = new TranslationReportGenerator( sourceDirectory, getBundle( locale ), getLog() );
- generator.generate( diff, output, locale.toString() );
- }
-
- class MasterTranslationLocator implements ArtifactProcessor {
- private final String groupId = project.getGroupId();
- private Artifact located;
- public void process(Artifact artifact) {
- if ( groupId.equals( artifact.getGroupId() ) && masterTranslationArtifactId.equals( artifact.getArtifactId() ) ) {
- if ( located != null ) {
- getLog().warn( "duplicate matching master found" );
- }
- located = artifact;
- }
- }
- }
-
- private void prepReportFile(File reportFile) throws GenerationException {
- if ( reportFile.exists() ) {
- reportFile.delete();
- }
- if ( !reportFile.exists() ) {
- try {
- reportFile.createNewFile();
- }
- catch ( IOException e ) {
- throw new GenerationException( "unable to prep report file [" + reportFile.getAbsolutePath() + "]" );
- }
- }
- }
-}
Deleted: labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/translation-diff-report.properties
===================================================================
--- labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/translation-diff-report.properties 2007-10-22 22:09:06 UTC (rev 15990)
+++ labs/jbossbuild/maven-plugins/trunk/maven-jdocbook-plugin/src/main/resources/translation-diff-report.properties 2007-10-22 22:11:29 UTC (rev 15991)
@@ -1,3 +0,0 @@
-report.name=Translation Diff Report
-report.description=Calculates differences between translation and master
-report.header=Translation Diff Report
More information about the jboss-svn-commits
mailing list