[hibernate-commits] Hibernate SVN: r12662 - in sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main: java/org/codehaus/mojo/docbook and 12 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Mon Jul 2 09:53:28 EDT 2007


Author: steve.ebersole at jboss.com
Date: 2007-07-02 09:53:27 -0400 (Mon, 02 Jul 2007)
New Revision: 12662

Added:
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/AbstractDocBookMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/DocBookSupportResourcesMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Format.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/GenerationMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Options.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/PackageMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/ResourceMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/TranslationDiffReport.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/RenderingException.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/XSLTException.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/BasicFormatHandler.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandler.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandlerFactory.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/PdfFormatHandler.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/Formatting.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/NoOpWriter.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/ResourceHelper.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StaleSourceChecker.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StandardDocBookFormatSpecification.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/TransformerType.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/TransformerFactory.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/AbstractCatalogManager.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ExplicitCatalogManager.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ImplicitCatalogManager.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/BasicUrnResolver.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/CurrentVersionResolver.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ExplicitUrnResolver.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/RelativeJarUriResolver.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ResolverChain.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/VersionResolver.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/BaselineHandler.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItem.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItemDescriptor.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/Diff.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/DiffCreator.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/GenerationException.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/IndexReportGenerator.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationHandler.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationReportGenerator.java
Removed:
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/AbstractDocBookMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/DocBookSupportResourcesMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Format.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/GenerationMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Options.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/PackageMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/ResourceMojo.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/TranslationDiffReport.java
Modified:
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/OLinkDBUpdater.java
   sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/resources/META-INF/plexus/components.xml
Log:
reverting back from codehaus move

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/AbstractDocBookMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/AbstractDocBookMojo.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/AbstractDocBookMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,255 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.maven.doxia.siterenderer.Renderer;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectHelper;
-import org.codehaus.plexus.archiver.manager.ArchiverManager;
-import org.codehaus.mojo.docbook.gen.RenderingException;
-import org.codehaus.mojo.docbook.gen.XSLTException;
-import org.codehaus.mojo.docbook.gen.util.Formatting;
-import org.codehaus.mojo.docbook.gen.util.StandardDocBookFormatSpecification;
-
-/**
- * Basic support for the various DocBook mojos in this package.  Mainly, we are
- * defining common configuration attributes of the packaging.
- * <p/>
- * todo : I'd much prefer to see the "partial artifact coord" stuff go away
- * and use custom package types to convey this information.  This frees the
- * user from duplicate entry of the information.
- * 
- * @author Steve Ebersole
- */
-public abstract class AbstractDocBookMojo extends AbstractMojo {
-	public static final String PLUGIN_NAME = "jboss-docbook";
-
-	/**
-	 * INTERNAL : The project being built
-	 *
-     * @parameter expression="${project}"
-     * @required
-     * @readonly
-     */
-    protected MavenProject project;
-
-	/**
-	 * INTERNAL : The artifacts associated with the dependencies defined as part
-	 * of the project to which we are being attached.
-	 *
-	 * @parameter expression="${project.artifacts}"
-     * @required
-     * @readonly
-	 */
-	protected Set projectArtifacts;
-
-	/**
-	 * INTERNAL : The artifacts associated to the dependencies defined as part
-	 * of our configuration within the project to which we are being attached.
-	 *
-	 * @parameter expression="${plugin.artifacts}"
-     * @required
-     * @readonly
-	 */
-	protected List pluginArtifacts;
-
-    /**
-     * INTERNAL : used to get reference to environemtn Archiver/UnArchiver.
-     *
-     * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}"
-     * @required
-     * @readonly
-     */
-    protected ArchiverManager archiverManager;
-
-	/**
-	 * INTERNAL : used in the translation diff report
-	 *
-	 * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}"
-     * @required
-     * @readonly
-     */
-    protected Renderer siteRenderer;
-
-	/**
-	 * INTERNAL : used during packaging to attach produced artifacts
-	 *
-	 * @parameter expression="${component.org.apache.maven.project.MavenProjectHelper}"
-     * @required
-     * @readonly
-     */
-    protected MavenProjectHelper projectHelper;
-
-	/**
-	 * The name of the document (relative to sourceDirectory) which is the
-	 * document to be rendered.
-	 *
-	 * @parameter
-	*  @required
-	 */
-	protected String sourceDocumentName;
-
-	/**
-	 * The directory where the sources are located.
-	 *
-	 * @parameter expression="${basedir}/src/main/docbook"
-	 */
-	protected File sourceDirectory;
-
-	/**
-	 * The directory containing local images
-	 *
-	 * @parameter expression="${basedir}/src/main/images"
-	 */
-	protected File imagesDirectory;
-
-	/**
-	 * The directory containing local css
-	 *
-	 * @parameter expression="${basedir}/src/main/css"
-	 */
-	protected File cssDirectory;
-
-	/**
-	 * The directory containing local fonts
-	 *
-	 * @parameter expression="${basedir}/src/main/fonts"
-	 */
-	protected File fontsDirectory;
-
-	/**
-	 * The directory where the output will be written.
-	 *
-	 * @parameter expression="${basedir}/target/docbook"
-	 */
-	protected File targetDirectory;
-
-	/**
-	 * The directory where "docbook resource" staging occurs.  Mainly this is
-	 * used for (1) image/css staging for html-based output; (2) base directory
-	 * for value of <tt>img.src.path</tt> DocBook XSLT parameter for fop-based 
-	 * formattings.
-	 *
-	 * @parameter expression="${basedir}/target/staging"
-	 * @required
-	 * @readonly
-	 */
-	protected File stagingDirectory;
-
-	/**
-	 * The formats in which to perform rendering.
-	 *
-     * @parameter
-	 * @required
-	 */
-	protected Format[] formats;
-
-	/**
-	 * The artifactId of the master translation (unless, of course, this is the
-	 * master translation).  It is assumed that the master translation:<ol>
-	 * <li>is part of the same groupId</li>
-	 * <li>has its source defined as a dependency (classifier = source)</li>
-	 * </ol>
-	 *
-     * @parameter
-	 */
-	protected String masterTranslationArtifactId;
-
-	/**
-	 * Local path to the master translation to use for diff reporting.
-	 *
-     * @parameter
-	 */
-	protected File masterTranslationFile;
-
-	/**
-	 * The relative path font configuration to use.
-	 *
-     * @parameter
-	 */
-	protected String fontConfig;
-
-	/**
-	 * Configurable options
-	 *
-     * @parameter
-	 */
-	protected Options options;
-	
-
-	/**
-	 * The override method to perform the actual processing of the
-	 * mojo.
-	 * 
-	 * @param formattings The fomattings configured for render
-	 * @throws RenderingException Indicates problem performing rendering
-	 * @throws XSLTException Indicates problem building or executing XSLT transformer
-	 */
-	protected abstract void process(Formatting[] formattings) throws RenderingException, XSLTException;
-
-	public final void execute() throws MojoExecutionException, MojoFailureException {
-		try {
-			process( buildFormattings() );
-		}
-		catch ( XSLTException e ) {
-			throw new MojoExecutionException( "XSLT problem", e );
-		}
-		catch ( RenderingException e ) {
-			throw new MojoExecutionException( "Rendering problem", e );
-		}
-	}
-
-	private Formatting[] buildFormattings() {
-		Formatting[] formattings = new Formatting[ formats.length ];
-		for ( int i = 0; i < formats.length; i++ ) {
-			formattings[i] = new Formatting( StandardDocBookFormatSpecification.parse( formats[i].getFormatName() ), formats[i] );
-		}
-		return formattings;
-	}
-
-	protected static interface ArtifactProcessor {
-		public void process(org.apache.maven.artifact.Artifact artifact);
-	}
-
-	protected void processArtifacts(ArtifactProcessor processor) {
-		processProjectArtifacts( processor );
-		processPluginArtifacts( processor );
-	}
-
-	protected void processProjectArtifacts(ArtifactProcessor processor) {
-		processArtifacts( processor, projectArtifacts );
-	}
-
-	protected void processPluginArtifacts(ArtifactProcessor processor) {
-		processArtifacts( processor, pluginArtifacts );
-	}
-
-	private void processArtifacts(ArtifactProcessor processor, Collection artifacts) {
-		Iterator itr = artifacts.iterator();
-		while ( itr.hasNext() ) {
-			processor.process( ( org.apache.maven.artifact.Artifact ) itr.next() );
-		}
-	}
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/DocBookSupportResourcesMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/DocBookSupportResourcesMojo.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/DocBookSupportResourcesMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,103 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.codehaus.plexus.util.FileUtils;
-
-/**
- * Defines resources-like processing for docbook-support files such
- * as XSLT, fonts, resources (images/css/etc), moving them to specific locations
- * within the output directory for inclusion in the final package.
- *
- * @goal support-resources
- * @phase process-resources
- * @requiresDependencyResolution
- *
- * @author Steve Ebersole
- */
-public class DocBookSupportResourcesMojo extends AbstractMojo {
-
-	/**
-	 * The directory containing the XSLT sources.
-	 *
-	 * @parameter expression="${basedir}/src/main/styles"
-	 */
-	protected File xsltSourceDirectory;
-
-	/**
-	 * The directory containing fonts to be included in package.
-	 *
-	 * @parameter expression="${basedir}/src/main/fonts"
-	 */
-	protected File fontSourceDirectory;
-
-	/**
-	 * The directory containing images to be included in package.
-	 *
-	 * @parameter expression="${basedir}/src/main/images"
-	 */
-	protected File imagesSourceDirectory;
-
-	/**
-	 * The directory containing css to be included in package.
-	 *
-	 * @parameter expression="${basedir}/src/main/css"
-	 */
-	protected File cssSourceDirectory;
-
-	/**
-	 * The directory from which packaging is staged.
-	 *
-	 * @parameter expression="${project.build.outputDirectory}"
-	 */
-	protected File outputDirectory;
-
-	public void execute() throws MojoExecutionException, MojoFailureException {
-		copySource( xsltSourceDirectory, new File( outputDirectory, "styles" ) );
-		copySource( fontSourceDirectory, new File( outputDirectory, "fonts" ) );
-		copySource( imagesSourceDirectory, new File( outputDirectory, "images" ) );
-		copySource( cssSourceDirectory, new File( outputDirectory, "css" ) );
-	}
-
-	private void copySource(File sourceDirectory, File targetDirectory)
-			throws MojoExecutionException {
-		getLog().info( "attempting to copy directory : " + sourceDirectory.getAbsolutePath() );
-		if ( !sourceDirectory.exists() ) {
-			return;
-		}
-		String[] list = sourceDirectory.list();
-		if ( list == null || list.length == 0 ) {
-			return;
-		}
-
-		if ( !targetDirectory.exists() ) {
-			targetDirectory.mkdirs();
-		}
-
-		try {
-			FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
-		}
-		catch ( IOException e ) {
-			throw new MojoExecutionException( "unable to copy source directory [" + sourceDirectory.getAbsolutePath() + "]", e );
-		}
-	}
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Format.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Format.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Format.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,80 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-/**
- * Represents a user format specification.
- *
- * @author Steve Ebersole
- */
-public class Format {
-	private String formatName;
-
-	private String targetFileExtension;
-	private String finalName;
-	private String stylesheetResource;
-	private Boolean imagePathSettingRequired;
-	private Boolean imageCopyingRequired;
-	private Boolean doingChunking;
-
-	public Format() {
-	}
-
-	public Format(
-			String formatName,
-			String targetFileExtension,
-			String finalName,
-			String stylesheetResource,
-			Boolean imagePathSettingRequired,
-			Boolean imageCopyingRequired,
-			Boolean doingChunking) {
-		this.formatName = formatName;
-		this.targetFileExtension = targetFileExtension;
-		this.finalName = finalName;
-		this.stylesheetResource = stylesheetResource;
-		this.imagePathSettingRequired = imagePathSettingRequired;
-		this.imageCopyingRequired = imageCopyingRequired;
-		this.doingChunking = doingChunking;
-	}
-
-	public String getFormatName() {
-		return formatName;
-	}
-
-	public String getTargetFileExtension() {
-		return targetFileExtension;
-	}
-
-	public String getFinalName() {
-		return finalName;
-	}
-
-	public String getStylesheetResource() {
-		return stylesheetResource;
-	}
-
-	public Boolean getImagePathSettingRequired() {
-		return imagePathSettingRequired;
-	}
-
-	public Boolean getImageCopyingRequired() {
-		return imageCopyingRequired;
-	}
-
-	public Boolean getDoingChunking() {
-		return doingChunking;
-	}
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/GenerationMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/GenerationMojo.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/GenerationMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,99 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.io.File;
-
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.mojo.docbook.gen.util.Formatting;
-import org.codehaus.mojo.docbook.gen.format.FormatHandlerFactory;
-import org.codehaus.mojo.docbook.gen.RenderingException;
-import org.codehaus.mojo.docbook.gen.XSLTException;
-import org.apache.maven.artifact.Artifact;
-
-/**
- * This mojo's responsibility within the plugin/packaging is actually performing 
- * the DocBook transformations.  At the highest level, it takes the source and
- * process it via the specified DocBook XSLT to produce output.
- *
- * @goal generate
- * @phase compile
- * @requiresDependencyResolution
- *
- * @author Steve Ebersole
- */
-public class GenerationMojo extends AbstractDocBookMojo {
-
-	protected void process(Formatting[] formattings) throws XSLTException, RenderingException {
-		if ( !sourceDirectory.exists() ) {
-			getLog().info( "sourceDirectory [" + sourceDirectory.getAbsolutePath() + "] did not exist" );
-			return;
-		}
-		File source = new File( sourceDirectory, sourceDocumentName );
-		if ( !source.exists() ) {
-			getLog().info( "source [" + source.getAbsolutePath() + "] did not exist" );
-			return;
-		}
-
-		if ( !targetDirectory.exists() ) {
-			FileUtils.mkdir( targetDirectory.getAbsolutePath() );
-		}
-
-		if ( options.getDocbookVersion() == null ) {
-			processArtifacts(
-					new ArtifactProcessor() {
-						public void process(Artifact artifact) {
-							if ( "net.sf.docbook".equals( artifact.getGroupId() ) &&
-									"docbook".equals( artifact.getArtifactId() ) ) {
-								getLog().debug( "Found docbook version : " + artifact.getVersion() );
-								if ( options.getDocbookVersion() != null ) {
-									getLog().warn( "found multiple docbook versions" );
-								}
-								options.setDocbookVersion( artifact.getVersion() );
-							}
-						}
-					}
-			);
-		}
-
-		File fontConfigFile = null;
-		if ( fontConfig != null ) {
-			getLog().debug( "checking for fontConfig existence [" + fontConfig + "]" );
-			if ( stagingDirectory != null ) {
-				File tmp = new File( stagingDirectory, fontConfig );
-				if ( tmp.exists() ) {
-					getLog().info( "using font configuration : " + tmp.getAbsolutePath() );
-					fontConfigFile = tmp;
-				}
-			}
-		}
-
-		FormatHandlerFactory formatHandlerFactory = new FormatHandlerFactory(
-				options,
-				source,
-				targetDirectory,
-				stagingDirectory,
-				fontConfigFile,
-				project,
-				getLog()
-		);
-
-		for ( int i = 0; i < formattings.length; i++ ) {
-			formatHandlerFactory.buildFormatHandler( formattings[i] ).render( source );
-		}
-	}
-
-}

Modified: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/OLinkDBUpdater.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/OLinkDBUpdater.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/OLinkDBUpdater.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -32,9 +32,9 @@
 import javax.xml.transform.stream.StreamSource;
 
 import org.apache.maven.plugin.logging.Log;
-import org.codehaus.mojo.docbook.gen.util.NoOpWriter;
-import org.codehaus.mojo.docbook.gen.util.ResourceHelper;
-import org.codehaus.mojo.docbook.gen.util.StandardDocBookFormatSpecification;
+import org.jboss.maven.plugins.docbook.gen.util.NoOpWriter;
+import org.jboss.maven.plugins.docbook.gen.util.ResourceHelper;
+import org.jboss.maven.plugins.docbook.gen.util.StandardDocBookFormatSpecification;
 import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
 import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
 import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Options.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Options.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/Options.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,78 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.util.Properties;
-
-/**
- * A (detachable) representation of the user configuration.
- *
- * @author Steve Ebersole
- */
-public class Options {
-    private boolean xincludeSupported;
-	private String[] catalogs;
-	private String xmlTransformerType;
-	private Properties transformerParameters;
-	private boolean useRelativeImageUris = true;
-	private String docbookVersion;
-
-	public Options() {
-	}
-
-	public Options(
-			boolean xincludeSupported,
-			String[] catalogs,
-			String xmlTransformerType,
-			Properties transformerParameters,
-			boolean useRelativeImageUris,
-			String docBookVersion) {
-		this.xincludeSupported = xincludeSupported;
-		this.catalogs = catalogs;
-		this.xmlTransformerType = xmlTransformerType;
-		this.transformerParameters = transformerParameters;
-		this.useRelativeImageUris = useRelativeImageUris;
-		this.docbookVersion = docBookVersion;
-	}
-
-	public boolean isXincludeSupported() {
-		return xincludeSupported;
-	}
-
-	public String[] getCatalogs() {
-		return catalogs;
-	}
-
-	public String getXmlTransformerType() {
-		return xmlTransformerType;
-	}
-
-	public Properties getTransformerParameters() {
-		return transformerParameters;
-	}
-
-	public boolean isUseRelativeImageUris() {
-		return useRelativeImageUris;
-	}
-
-	public String getDocbookVersion() {
-		return docbookVersion;
-	}
-
-	void setDocbookVersion(String docbookVersion) {
-		this.docbookVersion = docbookVersion;
-	}
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/PackageMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/PackageMojo.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/PackageMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,56 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.io.File;
-
-import org.codehaus.mojo.docbook.gen.util.Formatting;
-import org.codehaus.mojo.docbook.gen.RenderingException;
-import org.codehaus.mojo.docbook.gen.format.FormatHandlerFactory;
-
-/**
- * This mojo's responsibility within the plugin/packaging is to bundle the
- * individual formats into deployable formats.  The desicion  Note that some formats (PDF, e.g.) are
- * already deployable.
- * <p/>
- * After bundling, each bundle is then attached to the project
- *
- * @goal bundle
- * @phase package
- * @requiresDependencyResolution
- *
- * @author Steve Ebersole
- */
-public class PackageMojo extends AbstractDocBookMojo {
-	protected void process(Formatting[] formattings) throws RenderingException {
-		File source = new File( sourceDirectory, sourceDocumentName );
-		FormatHandlerFactory formatHandlerFactory = new FormatHandlerFactory(
-				options,
-				source,
-				targetDirectory,
-				stagingDirectory,
-				null,
-				project,
-				getLog()
-		);
-
-		project.getArtifact().setFile( project.getFile() );
-
-		for ( int i = 0; i < formattings.length; i++ ) {
-			formatHandlerFactory.buildFormatHandler( formattings[i] ).attachOutput( source, projectHelper );
-		}
-	}
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/ResourceMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/ResourceMojo.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/ResourceMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -1,128 +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): Steve Ebersole
- */
-package org.codehaus.mojo.docbook;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.maven.artifact.Artifact;
-import org.codehaus.plexus.archiver.ArchiverException;
-import org.codehaus.plexus.archiver.UnArchiver;
-import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
-import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.mojo.docbook.gen.util.Formatting;
-import org.codehaus.mojo.docbook.gen.RenderingException;
-import org.codehaus.mojo.docbook.gen.XSLTException;
-
-/**
- * This mojo's responsibility within the plugin/packaging is to process resources
- * defined by various inputs, moving them into a staging directory for use
- * during XSLT processing.  This is needed because the DocBook XSLT only allow
- * defining a single <tt>img.src.path</tt> value; FOP only allows a single
- * <tt>fontBaseDir</tt> value; etc.
- *
- * @goal resources
- * @phase process-resources
- * @requiresDependencyResolution
- *
- * @author Steve Ebersole
- */
-public class ResourceMojo extends AbstractDocBookMojo {
-
-	protected void process(Formatting[] formattings) throws RenderingException, XSLTException {
-		processProjectResources();
-		processDependencySupportArtifacts( collectDocBookSupportDependentArtifacts() );
-	}
-
-	// project local resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-	private void processProjectResources() throws RenderingException {
-		copySource( imagesDirectory, new File( stagingDirectory, "images" ) );
-		copySource( cssDirectory, new File( stagingDirectory, "css" ) );
-		copySource( fontsDirectory, new File( stagingDirectory, "fonts" ) );
-	}
-
-	private void copySource(File sourceDirectory, File targetDirectory)
-			throws RenderingException {
-		getLog().info( "attempting to copy directory : " + sourceDirectory.getAbsolutePath() );
-		if ( !sourceDirectory.exists() ) {
-			return;
-		}
-		String[] list = sourceDirectory.list();
-		if ( list == null || list.length == 0 ) {
-			return;
-		}
-
-		if ( !targetDirectory.exists() ) {
-			targetDirectory.mkdirs();
-		}
-
-		try {
-			FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
-		}
-		catch ( IOException e ) {
-			throw new RenderingException( "unable to copy source directory [" + sourceDirectory.getAbsolutePath() + "]", e );
-		}
-	}
-
-
-	// dependency support resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-	private List collectDocBookSupportDependentArtifacts() {
-		final ArrayList rtn = new ArrayList();
-		processArtifacts(
-				new ArtifactProcessor() {
-					public void process(Artifact artifact) {
-						if ( "docbook-support".equals( artifact.getType() ) ) {
-							rtn.add( artifact );
-						}
-					}
-				}
-		);
-		return rtn;
-	}
-
-	private void processDependencySupportArtifacts(List artifacts) throws RenderingException {
-		Iterator itr = artifacts.iterator();
-		while ( itr.hasNext() ) {
-			final Artifact supportArtifact = ( Artifact ) itr.next();
-			processDependencySupportArtifact( supportArtifact.getFile(), stagingDirectory );
-		}
-	}
-
-	protected void processDependencySupportArtifact(File file, File target) throws RenderingException {
-		getLog().info( "unpacking dependency resource [" + file.getAbsolutePath() + "] to staging-dir [" + target.getAbsolutePath() + "]" );
-		try {
-            target.mkdirs();
-			UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
-            unArchiver.setSourceFile( file );
-            unArchiver.setDestDirectory( target );
-			unArchiver.extract();
-		}
-        catch ( NoSuchArchiverException e ) {
-            throw new RenderingException( "Unknown archiver type", e );
-        }
-        catch ( ArchiverException e ) {
-            throw new RenderingException( "Error unpacking file [" + file + "] to [" + target + "]", e );
-        }
-        catch ( IOException e ) {
-            throw new RenderingException( "Error unpacking file [" + file + "] to [" + target + "]", e );
-        }
-    }
-}

Deleted: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/TranslationDiffReport.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/TranslationDiffReport.java	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/TranslationDiffReport.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -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.codehaus.mojo.docbook;
-
-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.codehaus.mojo.docbook.gen.util.Formatting;
-import org.codehaus.mojo.docbook.gen.RenderingException;
-import org.codehaus.mojo.docbook.revdiff.Diff;
-import org.codehaus.mojo.docbook.revdiff.DiffCreator;
-import org.codehaus.mojo.docbook.revdiff.GenerationException;
-import org.codehaus.mojo.docbook.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() + "]" );
-			}
-		}
-	}
-}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/AbstractDocBookMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/AbstractDocBookMojo.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/AbstractDocBookMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,255 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.manager.ArchiverManager;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.util.StandardDocBookFormatSpecification;
+
+/**
+ * Basic support for the various DocBook mojos in this package.  Mainly, we are
+ * defining common configuration attributes of the packaging.
+ * <p/>
+ * todo : I'd much prefer to see the "partial artifact coord" stuff go away
+ * and use custom package types to convey this information.  This frees the
+ * user from duplicate entry of the information.
+ * 
+ * @author Steve Ebersole
+ */
+public abstract class AbstractDocBookMojo extends AbstractMojo {
+	public static final String PLUGIN_NAME = "jboss-docbook";
+
+	/**
+	 * INTERNAL : The project being built
+	 *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    protected MavenProject project;
+
+	/**
+	 * INTERNAL : The artifacts associated with the dependencies defined as part
+	 * of the project to which we are being attached.
+	 *
+	 * @parameter expression="${project.artifacts}"
+     * @required
+     * @readonly
+	 */
+	protected Set projectArtifacts;
+
+	/**
+	 * INTERNAL : The artifacts associated to the dependencies defined as part
+	 * of our configuration within the project to which we are being attached.
+	 *
+	 * @parameter expression="${plugin.artifacts}"
+     * @required
+     * @readonly
+	 */
+	protected List pluginArtifacts;
+
+    /**
+     * INTERNAL : used to get reference to environemtn Archiver/UnArchiver.
+     *
+     * @parameter expression="${component.org.codehaus.plexus.archiver.manager.ArchiverManager}"
+     * @required
+     * @readonly
+     */
+    protected ArchiverManager archiverManager;
+
+	/**
+	 * INTERNAL : used in the translation diff report
+	 *
+	 * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}"
+     * @required
+     * @readonly
+     */
+    protected Renderer siteRenderer;
+
+	/**
+	 * INTERNAL : used during packaging to attach produced artifacts
+	 *
+	 * @parameter expression="${component.org.apache.maven.project.MavenProjectHelper}"
+     * @required
+     * @readonly
+     */
+    protected MavenProjectHelper projectHelper;
+
+	/**
+	 * The name of the document (relative to sourceDirectory) which is the
+	 * document to be rendered.
+	 *
+	 * @parameter
+	*  @required
+	 */
+	protected String sourceDocumentName;
+
+	/**
+	 * The directory where the sources are located.
+	 *
+	 * @parameter expression="${basedir}/src/main/docbook"
+	 */
+	protected File sourceDirectory;
+
+	/**
+	 * The directory containing local images
+	 *
+	 * @parameter expression="${basedir}/src/main/images"
+	 */
+	protected File imagesDirectory;
+
+	/**
+	 * The directory containing local css
+	 *
+	 * @parameter expression="${basedir}/src/main/css"
+	 */
+	protected File cssDirectory;
+
+	/**
+	 * The directory containing local fonts
+	 *
+	 * @parameter expression="${basedir}/src/main/fonts"
+	 */
+	protected File fontsDirectory;
+
+	/**
+	 * The directory where the output will be written.
+	 *
+	 * @parameter expression="${basedir}/target/docbook"
+	 */
+	protected File targetDirectory;
+
+	/**
+	 * The directory where "docbook resource" staging occurs.  Mainly this is
+	 * used for (1) image/css staging for html-based output; (2) base directory
+	 * for value of <tt>img.src.path</tt> DocBook XSLT parameter for fop-based 
+	 * formattings.
+	 *
+	 * @parameter expression="${basedir}/target/staging"
+	 * @required
+	 * @readonly
+	 */
+	protected File stagingDirectory;
+
+	/**
+	 * The formats in which to perform rendering.
+	 *
+     * @parameter
+	 * @required
+	 */
+	protected Format[] formats;
+
+	/**
+	 * The artifactId of the master translation (unless, of course, this is the
+	 * master translation).  It is assumed that the master translation:<ol>
+	 * <li>is part of the same groupId</li>
+	 * <li>has its source defined as a dependency (classifier = source)</li>
+	 * </ol>
+	 *
+     * @parameter
+	 */
+	protected String masterTranslationArtifactId;
+
+	/**
+	 * Local path to the master translation to use for diff reporting.
+	 *
+     * @parameter
+	 */
+	protected File masterTranslationFile;
+
+	/**
+	 * The relative path font configuration to use.
+	 *
+     * @parameter
+	 */
+	protected String fontConfig;
+
+	/**
+	 * Configurable options
+	 *
+     * @parameter
+	 */
+	protected Options options;
+	
+
+	/**
+	 * The override method to perform the actual processing of the
+	 * mojo.
+	 * 
+	 * @param formattings The fomattings configured for render
+	 * @throws RenderingException Indicates problem performing rendering
+	 * @throws XSLTException Indicates problem building or executing XSLT transformer
+	 */
+	protected abstract void process(Formatting[] formattings) throws RenderingException, XSLTException;
+
+	public final void execute() throws MojoExecutionException, MojoFailureException {
+		try {
+			process( buildFormattings() );
+		}
+		catch ( XSLTException e ) {
+			throw new MojoExecutionException( "XSLT problem", e );
+		}
+		catch ( RenderingException e ) {
+			throw new MojoExecutionException( "Rendering problem", e );
+		}
+	}
+
+	private Formatting[] buildFormattings() {
+		Formatting[] formattings = new Formatting[ formats.length ];
+		for ( int i = 0; i < formats.length; i++ ) {
+			formattings[i] = new Formatting( StandardDocBookFormatSpecification.parse( formats[i].getFormatName() ), formats[i] );
+		}
+		return formattings;
+	}
+
+	protected static interface ArtifactProcessor {
+		public void process(org.apache.maven.artifact.Artifact artifact);
+	}
+
+	protected void processArtifacts(ArtifactProcessor processor) {
+		processProjectArtifacts( processor );
+		processPluginArtifacts( processor );
+	}
+
+	protected void processProjectArtifacts(ArtifactProcessor processor) {
+		processArtifacts( processor, projectArtifacts );
+	}
+
+	protected void processPluginArtifacts(ArtifactProcessor processor) {
+		processArtifacts( processor, pluginArtifacts );
+	}
+
+	private void processArtifacts(ArtifactProcessor processor, Collection artifacts) {
+		Iterator itr = artifacts.iterator();
+		while ( itr.hasNext() ) {
+			processor.process( ( org.apache.maven.artifact.Artifact ) itr.next() );
+		}
+	}
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/DocBookSupportResourcesMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/DocBookSupportResourcesMojo.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/DocBookSupportResourcesMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,103 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Defines resources-like processing for docbook-support files such
+ * as XSLT, fonts, resources (images/css/etc), moving them to specific locations
+ * within the output directory for inclusion in the final package.
+ *
+ * @goal support-resources
+ * @phase process-resources
+ * @requiresDependencyResolution
+ *
+ * @author Steve Ebersole
+ */
+public class DocBookSupportResourcesMojo extends AbstractMojo {
+
+	/**
+	 * The directory containing the XSLT sources.
+	 *
+	 * @parameter expression="${basedir}/src/main/styles"
+	 */
+	protected File xsltSourceDirectory;
+
+	/**
+	 * The directory containing fonts to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/fonts"
+	 */
+	protected File fontSourceDirectory;
+
+	/**
+	 * The directory containing images to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/images"
+	 */
+	protected File imagesSourceDirectory;
+
+	/**
+	 * The directory containing css to be included in package.
+	 *
+	 * @parameter expression="${basedir}/src/main/css"
+	 */
+	protected File cssSourceDirectory;
+
+	/**
+	 * The directory from which packaging is staged.
+	 *
+	 * @parameter expression="${project.build.outputDirectory}"
+	 */
+	protected File outputDirectory;
+
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		copySource( xsltSourceDirectory, new File( outputDirectory, "styles" ) );
+		copySource( fontSourceDirectory, new File( outputDirectory, "fonts" ) );
+		copySource( imagesSourceDirectory, new File( outputDirectory, "images" ) );
+		copySource( cssSourceDirectory, new File( outputDirectory, "css" ) );
+	}
+
+	private void copySource(File sourceDirectory, File targetDirectory)
+			throws MojoExecutionException {
+		getLog().info( "attempting to copy directory : " + sourceDirectory.getAbsolutePath() );
+		if ( !sourceDirectory.exists() ) {
+			return;
+		}
+		String[] list = sourceDirectory.list();
+		if ( list == null || list.length == 0 ) {
+			return;
+		}
+
+		if ( !targetDirectory.exists() ) {
+			targetDirectory.mkdirs();
+		}
+
+		try {
+			FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
+		}
+		catch ( IOException e ) {
+			throw new MojoExecutionException( "unable to copy source directory [" + sourceDirectory.getAbsolutePath() + "]", e );
+		}
+	}
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Format.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Format.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Format.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,80 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+/**
+ * Represents a user format specification.
+ *
+ * @author Steve Ebersole
+ */
+public class Format {
+	private String formatName;
+
+	private String targetFileExtension;
+	private String finalName;
+	private String stylesheetResource;
+	private Boolean imagePathSettingRequired;
+	private Boolean imageCopyingRequired;
+	private Boolean doingChunking;
+
+	public Format() {
+	}
+
+	public Format(
+			String formatName,
+			String targetFileExtension,
+			String finalName,
+			String stylesheetResource,
+			Boolean imagePathSettingRequired,
+			Boolean imageCopyingRequired,
+			Boolean doingChunking) {
+		this.formatName = formatName;
+		this.targetFileExtension = targetFileExtension;
+		this.finalName = finalName;
+		this.stylesheetResource = stylesheetResource;
+		this.imagePathSettingRequired = imagePathSettingRequired;
+		this.imageCopyingRequired = imageCopyingRequired;
+		this.doingChunking = doingChunking;
+	}
+
+	public String getFormatName() {
+		return formatName;
+	}
+
+	public String getTargetFileExtension() {
+		return targetFileExtension;
+	}
+
+	public String getFinalName() {
+		return finalName;
+	}
+
+	public String getStylesheetResource() {
+		return stylesheetResource;
+	}
+
+	public Boolean getImagePathSettingRequired() {
+		return imagePathSettingRequired;
+	}
+
+	public Boolean getImageCopyingRequired() {
+		return imageCopyingRequired;
+	}
+
+	public Boolean getDoingChunking() {
+		return doingChunking;
+	}
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/GenerationMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/GenerationMojo.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/GenerationMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,99 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.io.File;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.format.FormatHandlerFactory;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+import org.apache.maven.artifact.Artifact;
+
+/**
+ * This mojo's responsibility within the plugin/packaging is actually performing 
+ * the DocBook transformations.  At the highest level, it takes the source and
+ * process it via the specified DocBook XSLT to produce output.
+ *
+ * @goal generate
+ * @phase compile
+ * @requiresDependencyResolution
+ *
+ * @author Steve Ebersole
+ */
+public class GenerationMojo extends AbstractDocBookMojo {
+
+	protected void process(Formatting[] formattings) throws XSLTException, RenderingException {
+		if ( !sourceDirectory.exists() ) {
+			getLog().info( "sourceDirectory [" + sourceDirectory.getAbsolutePath() + "] did not exist" );
+			return;
+		}
+		File source = new File( sourceDirectory, sourceDocumentName );
+		if ( !source.exists() ) {
+			getLog().info( "source [" + source.getAbsolutePath() + "] did not exist" );
+			return;
+		}
+
+		if ( !targetDirectory.exists() ) {
+			FileUtils.mkdir( targetDirectory.getAbsolutePath() );
+		}
+
+		if ( options.getDocbookVersion() == null ) {
+			processArtifacts(
+					new ArtifactProcessor() {
+						public void process(Artifact artifact) {
+							if ( "net.sf.docbook".equals( artifact.getGroupId() ) &&
+									"docbook".equals( artifact.getArtifactId() ) ) {
+								getLog().debug( "Found docbook version : " + artifact.getVersion() );
+								if ( options.getDocbookVersion() != null ) {
+									getLog().warn( "found multiple docbook versions" );
+								}
+								options.setDocbookVersion( artifact.getVersion() );
+							}
+						}
+					}
+			);
+		}
+
+		File fontConfigFile = null;
+		if ( fontConfig != null ) {
+			getLog().debug( "checking for fontConfig existence [" + fontConfig + "]" );
+			if ( stagingDirectory != null ) {
+				File tmp = new File( stagingDirectory, fontConfig );
+				if ( tmp.exists() ) {
+					getLog().info( "using font configuration : " + tmp.getAbsolutePath() );
+					fontConfigFile = tmp;
+				}
+			}
+		}
+
+		FormatHandlerFactory formatHandlerFactory = new FormatHandlerFactory(
+				options,
+				source,
+				targetDirectory,
+				stagingDirectory,
+				fontConfigFile,
+				project,
+				getLog()
+		);
+
+		for ( int i = 0; i < formattings.length; i++ ) {
+			formatHandlerFactory.buildFormatHandler( formattings[i] ).render( source );
+		}
+	}
+
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Options.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Options.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/Options.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,78 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.util.Properties;
+
+/**
+ * A (detachable) representation of the user configuration.
+ *
+ * @author Steve Ebersole
+ */
+public class Options {
+    private boolean xincludeSupported;
+	private String[] catalogs;
+	private String xmlTransformerType;
+	private Properties transformerParameters;
+	private boolean useRelativeImageUris = true;
+	private String docbookVersion;
+
+	public Options() {
+	}
+
+	public Options(
+			boolean xincludeSupported,
+			String[] catalogs,
+			String xmlTransformerType,
+			Properties transformerParameters,
+			boolean useRelativeImageUris,
+			String docBookVersion) {
+		this.xincludeSupported = xincludeSupported;
+		this.catalogs = catalogs;
+		this.xmlTransformerType = xmlTransformerType;
+		this.transformerParameters = transformerParameters;
+		this.useRelativeImageUris = useRelativeImageUris;
+		this.docbookVersion = docBookVersion;
+	}
+
+	public boolean isXincludeSupported() {
+		return xincludeSupported;
+	}
+
+	public String[] getCatalogs() {
+		return catalogs;
+	}
+
+	public String getXmlTransformerType() {
+		return xmlTransformerType;
+	}
+
+	public Properties getTransformerParameters() {
+		return transformerParameters;
+	}
+
+	public boolean isUseRelativeImageUris() {
+		return useRelativeImageUris;
+	}
+
+	public String getDocbookVersion() {
+		return docbookVersion;
+	}
+
+	void setDocbookVersion(String docbookVersion) {
+		this.docbookVersion = docbookVersion;
+	}
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/PackageMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/PackageMojo.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/PackageMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,56 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.io.File;
+
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.format.FormatHandlerFactory;
+
+/**
+ * This mojo's responsibility within the plugin/packaging is to bundle the
+ * individual formats into deployable formats.  The desicion  Note that some formats (PDF, e.g.) are
+ * already deployable.
+ * <p/>
+ * After bundling, each bundle is then attached to the project
+ *
+ * @goal bundle
+ * @phase package
+ * @requiresDependencyResolution
+ *
+ * @author Steve Ebersole
+ */
+public class PackageMojo extends AbstractDocBookMojo {
+	protected void process(Formatting[] formattings) throws RenderingException {
+		File source = new File( sourceDirectory, sourceDocumentName );
+		FormatHandlerFactory formatHandlerFactory = new FormatHandlerFactory(
+				options,
+				source,
+				targetDirectory,
+				stagingDirectory,
+				null,
+				project,
+				getLog()
+		);
+
+		project.getArtifact().setFile( project.getFile() );
+
+		for ( int i = 0; i < formattings.length; i++ ) {
+			formatHandlerFactory.buildFormatHandler( formattings[i] ).attachOutput( source, projectHelper );
+		}
+	}
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/ResourceMojo.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/ResourceMojo.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/ResourceMojo.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,128 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.maven.artifact.Artifact;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.UnArchiver;
+import org.codehaus.plexus.archiver.manager.NoSuchArchiverException;
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+
+/**
+ * This mojo's responsibility within the plugin/packaging is to process resources
+ * defined by various inputs, moving them into a staging directory for use
+ * during XSLT processing.  This is needed because the DocBook XSLT only allow
+ * defining a single <tt>img.src.path</tt> value; FOP only allows a single
+ * <tt>fontBaseDir</tt> value; etc.
+ *
+ * @goal resources
+ * @phase process-resources
+ * @requiresDependencyResolution
+ *
+ * @author Steve Ebersole
+ */
+public class ResourceMojo extends AbstractDocBookMojo {
+
+	protected void process(Formatting[] formattings) throws RenderingException, XSLTException {
+		processProjectResources();
+		processDependencySupportArtifacts( collectDocBookSupportDependentArtifacts() );
+	}
+
+	// project local resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	private void processProjectResources() throws RenderingException {
+		copySource( imagesDirectory, new File( stagingDirectory, "images" ) );
+		copySource( cssDirectory, new File( stagingDirectory, "css" ) );
+		copySource( fontsDirectory, new File( stagingDirectory, "fonts" ) );
+	}
+
+	private void copySource(File sourceDirectory, File targetDirectory)
+			throws RenderingException {
+		getLog().info( "attempting to copy directory : " + sourceDirectory.getAbsolutePath() );
+		if ( !sourceDirectory.exists() ) {
+			return;
+		}
+		String[] list = sourceDirectory.list();
+		if ( list == null || list.length == 0 ) {
+			return;
+		}
+
+		if ( !targetDirectory.exists() ) {
+			targetDirectory.mkdirs();
+		}
+
+		try {
+			FileUtils.copyDirectoryStructure( sourceDirectory, targetDirectory );
+		}
+		catch ( IOException e ) {
+			throw new RenderingException( "unable to copy source directory [" + sourceDirectory.getAbsolutePath() + "]", e );
+		}
+	}
+
+
+	// dependency support resources ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+	private List collectDocBookSupportDependentArtifacts() {
+		final ArrayList rtn = new ArrayList();
+		processArtifacts(
+				new ArtifactProcessor() {
+					public void process(Artifact artifact) {
+						if ( "docbook-support".equals( artifact.getType() ) ) {
+							rtn.add( artifact );
+						}
+					}
+				}
+		);
+		return rtn;
+	}
+
+	private void processDependencySupportArtifacts(List artifacts) throws RenderingException {
+		Iterator itr = artifacts.iterator();
+		while ( itr.hasNext() ) {
+			final Artifact supportArtifact = ( Artifact ) itr.next();
+			processDependencySupportArtifact( supportArtifact.getFile(), stagingDirectory );
+		}
+	}
+
+	protected void processDependencySupportArtifact(File file, File target) throws RenderingException {
+		getLog().info( "unpacking dependency resource [" + file.getAbsolutePath() + "] to staging-dir [" + target.getAbsolutePath() + "]" );
+		try {
+            target.mkdirs();
+			UnArchiver unArchiver = archiverManager.getUnArchiver( "jar" );
+            unArchiver.setSourceFile( file );
+            unArchiver.setDestDirectory( target );
+			unArchiver.extract();
+		}
+        catch ( NoSuchArchiverException e ) {
+            throw new RenderingException( "Unknown archiver type", e );
+        }
+        catch ( ArchiverException e ) {
+            throw new RenderingException( "Error unpacking file [" + file + "] to [" + target + "]", e );
+        }
+        catch ( IOException e ) {
+            throw new RenderingException( "Error unpacking file [" + file + "] to [" + target + "]", e );
+        }
+    }
+}

Added: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/TranslationDiffReport.java
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/TranslationDiffReport.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/TranslationDiffReport.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,187 @@
+/*
+ * 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.docbook;
+
+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.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.revdiff.Diff;
+import org.jboss.maven.plugins.docbook.revdiff.DiffCreator;
+import org.jboss.maven.plugins.docbook.revdiff.GenerationException;
+import org.jboss.maven.plugins.docbook.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() + "]" );
+			}
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/RenderingException.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/RenderingException.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/RenderingException.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/RenderingException.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,31 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen;
+
+/**
+ * Indicates issues performing rendering.
+ *
+ * @author Steve Ebersole
+ */
+public class RenderingException extends Exception {
+	public RenderingException(String message) {
+		super( message );
+	}
+
+	public RenderingException(String message, Throwable cause) {
+		super( message, cause );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/XSLTException.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/XSLTException.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/XSLTException.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/XSLTException.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,32 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen;
+
+/**
+ * Indicates problems either building XSLT transformers or performing
+ * transformations.
+ *
+ * @author Steve Ebersole
+ */
+public class XSLTException extends Exception {
+	public XSLTException(String message) {
+		super( message );
+	}
+
+	public XSLTException(String message, Throwable cause) {
+		super( message, cause );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/BasicFormatHandler.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/format/BasicFormatHandler.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/BasicFormatHandler.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/BasicFormatHandler.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,215 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.format;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.archiver.ArchiverException;
+import org.codehaus.plexus.archiver.jar.JarArchiver;
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.util.ResourceHelper;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * Provides basic support for renderers, mainly in the form of templating.
+ *
+ * @author Steve Ebersole
+ */
+public class BasicFormatHandler implements FormatHandler {
+	public static final String DTD_VALIDATION_FEATURE = "http://xml.org/sax/features/validation";
+	public static final String DTD_LOADING_FEATURE = "http://apache.org/xml/features/nonvalidating/load-external-dtd";
+
+	protected final FormatHandlerFactory factory;
+	protected final Formatting formatting;
+
+	public BasicFormatHandler(FormatHandlerFactory factory, Formatting formatting) {
+		this.factory = factory;
+		this.formatting = formatting;
+	}
+
+	public File prepareDirectory() throws RenderingException {
+		File target = new File( factory.getTargetDirectory(), formatting.getFormatName() );
+		if ( ! target.exists() ) {
+			FileUtils.mkdir( target.getAbsolutePath() );
+		}
+		if ( formatting.isImageCopyingRequired() ) {
+			if ( factory.getStagingDirectory().exists() ) {
+				File imageBase = new File( factory.getStagingDirectory(), "images" );
+				if ( imageBase.exists() ) {
+					try {
+						FileUtils.copyDirectoryStructure( imageBase, target );
+					}
+					catch ( IOException e ) {
+						throw new RenderingException( "unable to copy images", e );
+					}
+				}
+			}
+		}
+		return target;
+	}
+
+	public void attachOutput(File sourceFile, MavenProjectHelper projectHelper) throws RenderingException {
+		File rawOutputDir = new File( factory.getTargetDirectory(), formatting.getFormatName() );
+
+		String warName = factory.getMavenProject().getBuild().getFinalName() +
+				"-" + formatting.getFormatName() + ".war";
+		File war = new File( factory.getTargetDirectory(), warName );
+
+		JarArchiver archiver = new JarArchiver();
+		archiver.setDestFile( war );
+		try {
+			archiver.addDirectory( rawOutputDir );
+			archiver.createArchive();
+		}
+		catch ( IOException e ) {
+			throw new RenderingException( "Unable to create archive [" + war.getAbsolutePath() + "]", e );
+		}
+		catch ( ArchiverException e ) {
+			throw new RenderingException( "Unable to populate archive [" + war.getAbsolutePath() + "]", e );
+		}
+
+		projectHelper.attachArtifact( factory.getMavenProject(), "war", formatting.getFormatName(), war );
+	}
+
+	public final void render(File sourceFile) throws RenderingException, XSLTException {
+		getLog().debug( "starting formatting [" + formatting.getFormatName() + "]" );
+
+		File target = prepareTarget( prepareDirectory(), sourceFile );
+
+		Transformer transformer = buildTransformer( target );
+		Source transformationSource = buildSource( sourceFile );
+		Result transformationResult = buildResult( target );
+		try {
+			transformer.transform( transformationSource, transformationResult );
+		}
+		catch ( TransformerException e ) {
+			throw new XSLTException( "unable to perform transformation", e );
+		}
+		finally {
+			releaseResult( transformationResult );
+		}
+	}
+
+	private File prepareTarget(File directory, File sourceFile) throws RenderingException {
+		String targetFileName = deduceTargetFileName( sourceFile );
+		getLog().debug( "preparing target file [" + targetFileName + "]" );
+		File target = new File( directory, targetFileName );
+		if ( target.exists() ) {
+			if ( !target.delete() ) {
+				getLog().warn( "unable to clean up previous output file [" + target.getAbsolutePath() + "]" );
+			}
+		}
+		if ( !target.exists() ) {
+			try {
+				target.createNewFile();
+			}
+			catch ( IOException e ) {
+				throw new RenderingException( "unable to create output file [" + target.getAbsolutePath() + "]", e );
+			}
+		}
+		return target;
+	}
+
+	private String deduceTargetFileName(File source) {
+		return formatting.getNamingStrategy().deduceTargetFileName( source );
+	}
+
+	protected Transformer buildTransformer(File targetFile) throws RenderingException, XSLTException {
+		final URL transformationStylesheet = resolveTransformationStylesheet();
+		Transformer transformer = factory.getTransformerFactory()
+				.buildTransformer( formatting, transformationStylesheet );
+		if ( formatting.isImagePathSettingRequired() ) {
+			String imgSrcPath = factory.getStagingDirectory().getAbsolutePath() + "/images/";
+			getLog().debug( "setting 'img.src.path' [" + imgSrcPath + "]" );
+			transformer.setParameter( "img.src.path", imgSrcPath );
+		}
+		if ( factory.getOptions().isUseRelativeImageUris() ) {
+			getLog().debug( "enforcing retention of relative image URIs" );
+			transformer.setParameter( "keep.relative.image.uris", "0" );
+		}
+		if ( formatting.isDoingChunking() ) {
+			getLog().debug( "Chunking output." );
+			String rootFilename = targetFile.getName();
+			rootFilename = rootFilename.substring( 0, rootFilename.lastIndexOf( '.' ) );
+			transformer.setParameter( "root.filename", rootFilename );
+			transformer.setParameter( "base.dir", targetFile.getParent() + File.separator );
+			transformer.setParameter( "manifest.in.base.dir", "1" );
+		}
+		return transformer;
+	}
+
+	protected final URL resolveTransformationStylesheet() throws RenderingException {
+		return ResourceHelper.requireResource( formatting.getStylesheetResource() );
+	}
+
+	private Source buildSource(File sourceFile) throws RenderingException {
+		try {
+			EntityResolver resolver = factory.getCatalogResolver();
+			SAXParserFactory factory = createParserFactory();
+			XMLReader reader = factory.newSAXParser().getXMLReader();
+			reader.setEntityResolver( resolver );
+
+			// Disable DTD loading and validation
+			reader.setFeature( DTD_LOADING_FEATURE, false );
+			reader.setFeature( DTD_VALIDATION_FEATURE, false );
+
+			return new SAXSource( reader, new InputSource( sourceFile.getAbsolutePath() ) );
+		}
+		catch ( ParserConfigurationException e ) {
+			throw new RenderingException( "unable to build SAX Parser", e );
+		}
+		catch ( SAXException e ) {
+			throw new RenderingException( "unable to build SAX Parser", e );
+		}
+	}
+
+	protected final SAXParserFactory createParserFactory() {
+        SAXParserFactory parserFactory = new SAXParserFactoryImpl();
+        parserFactory.setXIncludeAware( factory.getOptions().isXincludeSupported() );
+        return parserFactory;
+    }
+
+	protected Result buildResult(File targetFile) throws RenderingException, XSLTException {
+		return new StreamResult( targetFile );
+	}
+
+	protected void releaseResult(Result transformationResult) {
+		// typically nothing to do...
+	}
+
+	protected Log getLog() {
+		return factory.getLog();
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandler.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/format/FormatHandler.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandler.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandler.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,60 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.format;
+
+import java.io.File;
+
+import org.apache.maven.project.MavenProjectHelper;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+
+/**
+ * Handles format-specific processing steps.
+ *
+ * @author Steve Ebersole
+ */
+public interface FormatHandler {
+	/**
+	 * This is used during the prepare-resources phase to create and prepare
+	 * the format specific output directory for rendering.  Generally,
+	 * preparation might mean copying any format-specific resources to the
+	 * format output directory.
+	 *
+	 * @return The format output directory
+	 * @throws RenderingException Indicates problem preparing output directory
+	 */
+	public File prepareDirectory() throws RenderingException;
+
+	/**
+	 * Performs the actual rendering or transforming of the DocBook sources into
+	 * the respective output format.
+	 *
+	 * @param source The source DocBook file.
+	 * @throws RenderingException Problem writing the output file(s).
+	 * @throws XSLTException Problem performing XSL transformation.
+	 */
+	public void render(File source) throws RenderingException, XSLTException;
+
+	/**
+	 * Attaches the formatting output (after possibly bundling it into an archive)
+	 * to the maven project.
+	 *
+	 * @param sourceFile The source DocBook file.
+	 * @param projectHelper The project helper (used to attach produced artifact)
+	 * @throws RenderingException Indicates problem performing attaching
+	 */
+	public void attachOutput(File sourceFile, MavenProjectHelper projectHelper) throws RenderingException;
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandlerFactory.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/format/FormatHandlerFactory.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandlerFactory.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/FormatHandlerFactory.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,128 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.format;
+
+import java.io.File;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
+import org.jboss.maven.plugins.docbook.Options;
+import org.jboss.maven.plugins.docbook.gen.util.TransformerType;
+import org.jboss.maven.plugins.docbook.gen.util.StandardDocBookFormatSpecification;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.xslt.TransformerFactory;
+import org.jboss.maven.plugins.docbook.gen.xslt.catalog.ExplicitCatalogManager;
+import org.jboss.maven.plugins.docbook.gen.xslt.catalog.ImplicitCatalogManager;
+
+/**
+ * Builds a renderer for the given format
+ *
+ * @author Steve Ebersole
+ */
+public class FormatHandlerFactory {
+	private final Options options;
+	private final File source;
+	private final File targetDirectory;
+	private final File stagingDirectory;
+	private final File fontConfig;
+	private final MavenProject mavenProject;
+	private final Log log;
+
+	private CatalogResolver catalogResolver;
+	private TransformerFactory transformerFactory;
+
+	public FormatHandlerFactory(
+			Options options,
+			File source,
+			File targetDirectory,
+			File stagingDirectory,
+			File fontConfig,
+			MavenProject mavenProject,
+			Log log) {
+		this.options = options;
+		this.source = source;
+		this.targetDirectory = targetDirectory;
+		this.stagingDirectory = stagingDirectory;
+		this.fontConfig = fontConfig;
+		this.mavenProject = mavenProject;
+		this.log = log;
+	}
+
+	public Options getOptions() {
+		return options;
+	}
+
+	public File getSource() {
+		return source;
+	}
+
+	public File getTargetDirectory() {
+		return targetDirectory;
+	}
+
+	public File getStagingDirectory() {
+		return stagingDirectory;
+	}
+
+	public File getFontConfig() {
+		return fontConfig;
+	}
+
+	public MavenProject getMavenProject() {
+		return mavenProject;
+	}
+
+	public Log getLog() {
+		return log;
+	}
+
+	public CatalogResolver getCatalogResolver() {
+		if ( catalogResolver == null ) {
+			CatalogManager catalogManager;
+			if ( options.getCatalogs() == null || options.getCatalogs().length == 0 ) {
+				catalogManager = new ImplicitCatalogManager();
+			}
+			else {
+				catalogManager = new ExplicitCatalogManager( options.getCatalogs() );
+			}
+			catalogResolver = new CatalogResolver( catalogManager );
+		}
+		return catalogResolver;
+	}
+
+	public TransformerFactory getTransformerFactory() {
+		if ( transformerFactory == null ) {
+			transformerFactory = new TransformerFactory(
+					TransformerType.parse( options.getXmlTransformerType() ),
+					options.getTransformerParameters(),
+					getCatalogResolver(),
+					options.getDocbookVersion()
+			);
+		}
+		return transformerFactory;
+	}
+
+	public FormatHandler buildFormatHandler(Formatting formatting) {
+		if ( formatting.getFormatName().equals( StandardDocBookFormatSpecification.PDF.getName() ) ) {
+			return new PdfFormatHandler( this, formatting );
+		}
+		else {
+			return new BasicFormatHandler( this, formatting );
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/PdfFormatHandler.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/format/PdfFormatHandler.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/PdfFormatHandler.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/format/PdfFormatHandler.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,175 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.format;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import javax.xml.transform.Result;
+import javax.xml.transform.sax.SAXResult;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.fop.apps.Driver;
+import org.apache.fop.apps.FOPException;
+import org.apache.maven.plugin.logging.Log;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.RenderingException;
+
+/**
+ * Special handling for pdf rendering
+ *
+ * @author Steve Ebersole
+ */
+public class PdfFormatHandler extends BasicFormatHandler {
+
+	public PdfFormatHandler(FormatHandlerFactory factory, Formatting formatting) {
+		super( factory, formatting );
+	}
+
+	protected Result buildResult(File targetFile) throws RenderingException {
+		getLog().info( "building formatting result [" + targetFile.getAbsolutePath() + "]" );
+		prepareFonts();
+		return new ResultImpl( targetFile );
+	}
+
+	private void prepareFonts() throws RenderingException {
+		// if fonts were specified, then prepare the FOP font metrics configuration
+		//		: this is the piece that improved dramatically after fop-0.25,
+		// 		which unfortunately we are stuck with for other reasons :(
+		if ( factory.getFontConfig() != null ) {
+			org.apache.fop.configuration.Configuration.put( "fontBaseDir", new File( factory.getStagingDirectory(), "fonts" ) );
+			try {
+				new org.apache.fop.apps.Options( factory.getFontConfig() );
+			}
+			catch ( FOPException e ) {
+				throw new RenderingException( "unable to properly prepare FOP fonts", e );
+			}
+			org.apache.fop.configuration.Configuration.put( "fontBaseDir", new File( factory.getStagingDirectory(), "fonts" ) );
+		}
+	}
+
+	protected void releaseResult(Result transformationResult) {
+		( ( ResultImpl ) transformationResult ).release();
+	}
+
+	private class ResultImpl extends SAXResult {
+		private OutputStream outputStream;
+
+		public ResultImpl(File targetFile) throws RenderingException {
+			Driver driver = new Driver();
+			driver.setLogger( new LoggingBridge( getLog() ) );
+			driver.setRenderer( Driver.RENDER_PDF );
+
+			try {
+				outputStream = new BufferedOutputStream( new FileOutputStream( targetFile ) );
+				driver.setOutputStream( outputStream );
+				setHandler( driver.getContentHandler() );
+			}
+			catch ( Throwable t ) {
+				throw new RenderingException( "error building transformation result [" + targetFile.getAbsolutePath() + "]", t );
+			}
+		}
+		
+		private void release() {
+			try {
+				outputStream.flush();
+				outputStream.close();
+			}
+			catch ( IOException e ) {
+				getLog().warn( "error releasing I/O resources", e );
+			}
+		}
+	}
+
+	private static class LoggingBridge implements Logger {
+
+		private Log mavenLog;
+
+		public LoggingBridge(Log mavenLog) {
+			this.mavenLog = mavenLog;
+		}
+
+		public Logger getChildLogger(String arg0) {
+			return null;
+		}
+
+		public void debug(String arg0) {
+			mavenLog.debug( arg0 );
+		}
+
+		public void debug(String arg0, Throwable arg1) {
+			mavenLog.debug( arg0, arg1 );
+		}
+
+		// todo : info logging from FOP is excessively verbose...
+
+		public void info(String arg0) {
+			mavenLog.info( arg0 );
+		}
+
+		public void info(String arg0, Throwable arg1) {
+			mavenLog.info( arg0, arg1 );
+		}
+
+		public void warn(String arg0) {
+			mavenLog.warn( arg0 );
+		}
+
+		public void warn(String arg0, Throwable arg1) {
+			mavenLog.warn( arg0, arg1 );
+		}
+
+		public void error(String arg0) {
+			mavenLog.error( arg0 );
+		}
+
+		public void error(String arg0, Throwable arg1) {
+			mavenLog.error( arg0, arg1 );
+		}
+
+		public void fatalError(String arg0) {
+			mavenLog.error( arg0 );
+		}
+
+		public void fatalError(String arg0, Throwable arg1) {
+			mavenLog.error( arg0, arg1 );
+		}
+
+		public boolean isDebugEnabled() {
+			return mavenLog.isDebugEnabled();
+		}
+
+		public boolean isErrorEnabled() {
+			return mavenLog.isErrorEnabled();
+		}
+
+		public boolean isFatalErrorEnabled() {
+			return mavenLog.isErrorEnabled();
+		}
+
+		public boolean isInfoEnabled() {
+			return mavenLog.isInfoEnabled();
+		}
+
+		public boolean isWarnEnabled() {
+			return mavenLog.isWarnEnabled();
+		}
+
+	}
+
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/Formatting.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/Formatting.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/Formatting.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/Formatting.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,117 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.util;
+
+import java.io.File;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.plugins.docbook.Format;
+
+/**
+ * Defined formatting information.  Basically stuff to either pass into the xsl
+ * transformer or stuff needed to prepare for transformation.
+ *
+ * @author Steve Ebersole
+ */
+public class Formatting {
+	private final String formatName;
+	private final String stylesheetResource;
+	private final boolean imagePathSettingRequired;
+	private final boolean imageCopyingRequired;
+	private final boolean doingChunking;
+	private final StandardDocBookFormatSpecification standardDocBookSpec;
+	private final TargetNamingStrategy namingStrategy;
+
+	public Formatting(StandardDocBookFormatSpecification standardDocBookSpec, Format userSpec) {
+		// todo : there may not be a matching standard docbook format spec...
+		if ( ! standardDocBookSpec.getName().equals( userSpec.getFormatName() ) ) {
+			throw new IllegalArgumentException( "formatting type mismatch" );
+		}
+
+		this.standardDocBookSpec = standardDocBookSpec;
+		this.formatName = userSpec.getFormatName();
+
+		this.stylesheetResource = userSpec.getStylesheetResource() == null
+				? standardDocBookSpec.getStylesheetResource()
+				: "/styles" + userSpec.getStylesheetResource();
+
+		this.imageCopyingRequired = userSpec.getImageCopyingRequired() == null
+				? standardDocBookSpec.isImageCopyingRequired()
+				: userSpec.getImageCopyingRequired().booleanValue();
+
+		this.imagePathSettingRequired = userSpec.getImagePathSettingRequired() == null
+				? standardDocBookSpec.isImagePathSettingRequired()
+				: userSpec.getImagePathSettingRequired().booleanValue();
+
+		this.doingChunking =userSpec.getDoingChunking() == null
+				? standardDocBookSpec.isDoingChunking()
+				: userSpec.getDoingChunking().booleanValue();
+
+		this.namingStrategy = new TargetNamingStrategy( standardDocBookSpec, userSpec );
+	}
+
+	public String getFormatName() {
+		return formatName;
+	}
+
+	public StandardDocBookFormatSpecification getStandardDocBookSpec() {
+		return standardDocBookSpec;
+	}
+
+	public String getStylesheetResource() {
+		return stylesheetResource;
+	}
+
+	public boolean isImagePathSettingRequired() {
+		return imagePathSettingRequired;
+	}
+
+	public boolean isImageCopyingRequired() {
+		return imageCopyingRequired;
+	}
+
+	public boolean isDoingChunking() {
+		return doingChunking;
+	}
+
+	public TargetNamingStrategy getNamingStrategy() {
+		return namingStrategy;
+	}
+
+	public static class TargetNamingStrategy {
+		private String targetFileExtension;
+		private String finalName;
+
+		public TargetNamingStrategy(StandardDocBookFormatSpecification standardDocBookSpec, Format userSpec) {
+			if ( userSpec.getFinalName() != null ) {
+				this.targetFileExtension = null;
+				this.finalName = userSpec.getFinalName();
+			}
+			else {
+				this.targetFileExtension = userSpec.getTargetFileExtension() == null
+						? standardDocBookSpec.getStandardFileExtension()
+						: userSpec.getTargetFileExtension();
+				this.finalName = null;
+			}
+		}
+
+		public String deduceTargetFileName(File source) {
+			return finalName == null
+				? FileUtils.basename( source.getAbsolutePath() ) + targetFileExtension
+				: finalName;
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/NoOpWriter.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/NoOpWriter.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/NoOpWriter.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/NoOpWriter.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,35 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.util;
+
+import java.io.Writer;
+
+/**
+ * A writer which does no writing :)
+ *
+ * @author Steve Ebersole
+ */
+public class NoOpWriter extends Writer {
+
+	public void write(char cbuf[], int off, int len) {
+	}
+
+	public void flush() {
+	}
+
+	public void close() {
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/ResourceHelper.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/ResourceHelper.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/ResourceHelper.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/ResourceHelper.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,41 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.util;
+
+import java.net.URL;
+
+/**
+ * Simple helpers for locating and handling classpath resource lookups.
+ *
+ * @author Steve Ebersole
+ */
+public class ResourceHelper {
+	public static URL requireResource(String name) {
+		URL resource = locateResource( name );
+		if ( resource == null ) {
+			throw new IllegalArgumentException( "could not locate resource [" + name + "]" );
+		}
+		return resource;
+	}
+
+	public static URL locateResource(String name) {
+		ClassLoader loader = Thread.currentThread().getContextClassLoader();
+		if ( loader == null ) {
+			loader = ResourceHelper.class.getClassLoader();
+		}
+		return loader.getResource( name );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StaleSourceChecker.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/StaleSourceChecker.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StaleSourceChecker.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StaleSourceChecker.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,30 @@
+package org.jboss.maven.plugins.docbook.gen.util;
+
+import java.io.File;
+import java.util.Collections;
+
+import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
+import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
+import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
+
+/**
+ * Delegate used for checking sources for staleness.
+ *
+ * @author Steve Ebersole
+ */
+public class StaleSourceChecker {
+	public static boolean hasStaleSources(File sourceDirectory, File databaseDirectory) {
+		try {
+			StaleSourceScanner scanner = new StaleSourceScanner(
+					0,
+					Collections.singleton( "**/*.xml" ),
+					Collections.EMPTY_SET
+			);
+			scanner.addSourceMapping( new SuffixMapping( ".xml", ".xml.db" ) );
+			return ! scanner.getIncludedSources( sourceDirectory, databaseDirectory ).isEmpty();
+		}
+        catch ( InclusionScanException e ) {
+            throw new RuntimeException( "Error scanning sources in " + sourceDirectory, e );
+        }
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StandardDocBookFormatSpecification.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/StandardDocBookFormatSpecification.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StandardDocBookFormatSpecification.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/StandardDocBookFormatSpecification.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,148 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.util;
+
+/**
+ * The basic definition of the standard docbook formats.
+ *
+ * @author Steve Ebersole
+ */
+public class StandardDocBookFormatSpecification {
+	public static final StandardDocBookFormatSpecification ECLIPSE =
+			new HtmlBasedStandardDocBookFormat( "eclipse", "/eclipse/eclipse.xsl" );
+
+	public static final StandardDocBookFormatSpecification HTML =
+			new HtmlBasedStandardDocBookFormat( "html", "/html/chunk.xsl" );
+
+	public static final StandardDocBookFormatSpecification HTML_SINGLE =
+			new HtmlBasedStandardDocBookFormat( "html_single", "/html/docbook.xsl", false );
+
+	public static final StandardDocBookFormatSpecification HTMLHELP =
+			new HtmlBasedStandardDocBookFormat( "htmlhelp", "/htmlhelp/htmlhelp.xsl" );
+
+	public static final StandardDocBookFormatSpecification JAVAHELP =
+			new HtmlBasedStandardDocBookFormat( "javahelp", "/javahelp/javahelp.xsl" );
+
+	public static final StandardDocBookFormatSpecification MAN =
+			new HtmlBasedStandardDocBookFormat( "man", "/manpages/docbook.xsl", false );
+
+	public static final StandardDocBookFormatSpecification PDF =
+			new StandardDocBookFormatSpecification( "pdf", "pdf", "/fo/docbook.xsl", true, false, false );
+
+	public static final StandardDocBookFormatSpecification WEBSITE =
+			new HtmlBasedStandardDocBookFormat( "website", "/website/website.xsl", false );
+
+// I'd rather not support this...
+//	public static final FormatType WORDML =
+//			new FormatType( "wordml", "doc", "/wordml/wordml.xsl", ?, ?, ? );
+
+	public static final StandardDocBookFormatSpecification XHTML =
+			new StandardDocBookFormatSpecification( "xhtml", "xhtml", "/xhtml/docbook.xsl", false, true, false );
+
+	private final String name;
+	private final String standardFileExtension;
+	private final String stylesheetResource;
+	private final boolean imagePathSettingRequired;
+	private final boolean imageCopyingRequired;
+	private final boolean doingChunking;
+
+	public StandardDocBookFormatSpecification(
+			String name,
+			String standardFileExtension,
+			String stylesheetResource,
+			boolean imagePathSettingRequired,
+			boolean imageCopyingRequired,
+			boolean doingChunking) {
+		this.name = name;
+		this.standardFileExtension = standardFileExtension;
+		this.stylesheetResource = stylesheetResource;
+		this.imagePathSettingRequired = imagePathSettingRequired;
+		this.imageCopyingRequired = imageCopyingRequired;
+		this.doingChunking = doingChunking;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getStandardFileExtension() {
+		return standardFileExtension;
+	}
+
+	public String getStylesheetResource() {
+		return stylesheetResource;
+	}
+
+	public boolean isImagePathSettingRequired() {
+		return imagePathSettingRequired;
+	}
+
+	public boolean isImageCopyingRequired() {
+		return imageCopyingRequired;
+	}
+
+	public boolean isDoingChunking() {
+		return doingChunking;
+	}
+
+	public static StandardDocBookFormatSpecification parse(String name) {
+		if ( ECLIPSE.name.equals( name ) ) {
+			return ECLIPSE;
+		}
+		else if ( HTML.name.equals( name ) ) {
+			return HTML;
+		}
+		else if ( HTML_SINGLE.name.equals( name ) ) {
+			return HTML_SINGLE;
+		}
+		else if ( HTMLHELP.name.equals( name ) ) {
+			return HTMLHELP;
+		}
+		else if ( JAVAHELP.name.equals( name ) ) {
+			return JAVAHELP;
+		}
+		else if ( MAN.name.equals( name ) ) {
+			return MAN;
+		}
+		else if ( PDF.name.equals( name ) ) {
+			return PDF;
+		}
+		else if ( WEBSITE.name.equals( name ) ) {
+			return WEBSITE;
+		}
+//		else if ( WORDML.name.equals( name ) ) {
+//			return WORDML;
+//		}
+		else if ( XHTML.name.equals( name ) ) {
+			return XHTML;
+		}
+		else {
+			return null;
+		}
+	}
+
+
+	// convenience for html based formats to simplify ctors ~~~~~~~~~~~~~~~~~~~
+
+	private static class HtmlBasedStandardDocBookFormat extends StandardDocBookFormatSpecification {
+		private HtmlBasedStandardDocBookFormat(String name, String stylesheetResource) {
+			this( name, stylesheetResource, true );
+		}
+		private HtmlBasedStandardDocBookFormat(String name, String stylesheetResource, boolean doingChunking) {
+			super( name, "html", stylesheetResource, false, true, doingChunking );
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/TransformerType.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/util/TransformerType.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/TransformerType.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/util/TransformerType.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,52 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.util;
+
+/**
+ * Enumeration of supported XSLT transformers.
+ *
+ * @author Steve Ebersole
+ */
+public class TransformerType {
+	public static final TransformerType SAXON = new TransformerType( "saxon", false );
+	public static final TransformerType XALAN = new TransformerType( "xalan", true );
+
+	private final String name;
+	private final boolean supportsReset;
+
+	private TransformerType(String name, boolean supportsReset) {
+		this.name = name;
+		this.supportsReset = supportsReset;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public boolean supportsReset() {
+		return supportsReset;
+	}
+
+	public static TransformerType parse(String name) {
+		if ( XALAN.name.equals( name ) ) {
+			return XALAN;
+		}
+		else {
+			// default
+			return SAXON;
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/TransformerFactory.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/TransformerFactory.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/TransformerFactory.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/TransformerFactory.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,139 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamSource;
+
+import com.icl.saxon.Controller;
+import org.apache.xml.resolver.tools.CatalogResolver;
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+import org.jboss.maven.plugins.docbook.gen.util.ResourceHelper;
+import org.jboss.maven.plugins.docbook.gen.util.TransformerType;
+import org.jboss.maven.plugins.docbook.gen.util.Formatting;
+import org.jboss.maven.plugins.docbook.gen.util.NoOpWriter;
+import org.jboss.maven.plugins.docbook.gen.util.StandardDocBookFormatSpecification;
+import org.jboss.maven.plugins.docbook.gen.xslt.resolve.CurrentVersionResolver;
+import org.jboss.maven.plugins.docbook.gen.xslt.resolve.ResolverChain;
+import org.jboss.maven.plugins.docbook.gen.xslt.resolve.VersionResolver;
+import org.jboss.maven.plugins.docbook.gen.xslt.resolve.ExplicitUrnResolver;
+import org.jboss.maven.plugins.docbook.gen.xslt.resolve.RelativeJarUriResolver;
+
+/**
+ * A factory for {@link javax.xml.transform.Transformer} instances, configurable
+ * to return either SAXON or XALAN based transformers.
+ *
+ * @author Steve Ebersole
+ */
+public class TransformerFactory {
+	private final TransformerType transformerType;
+	private final Properties transformerParameters;
+	private final CatalogResolver catalogResolver;
+	private final String docbookVersion;
+
+	public TransformerFactory(
+			TransformerType transformerType,
+			Properties transformerParameters,
+			CatalogResolver catalogResolver,
+			String docbookVersion) {
+		this.transformerType = transformerType;
+		this.transformerParameters = transformerParameters;
+		this.catalogResolver = catalogResolver;
+		this.docbookVersion = docbookVersion;
+	}
+
+	public Transformer buildTransformer(Formatting formatting, URL customStylesheet) throws XSLTException {
+		URIResolver uriResolver = buildUriResolver( formatting.getStandardDocBookSpec() );
+
+		javax.xml.transform.TransformerFactory transformerFactory = buildTransformerFactory();
+		transformerFactory.setURIResolver( uriResolver );
+
+		URL xsltStylesheet = customStylesheet == null
+				? ResourceHelper.requireResource( formatting.getStylesheetResource() )
+				: customStylesheet;
+
+		Transformer transformer;
+		try {
+			Source source = new StreamSource( xsltStylesheet.openStream(), xsltStylesheet.toExternalForm() );
+			transformer = transformerFactory.newTransformer( source );
+		}
+		catch ( IOException e ) {
+			throw new XSLTException( "problem opening stylesheet", e );
+		}
+		catch ( TransformerConfigurationException e ) {
+			throw new XSLTException( "unable to build transformer", e );
+		}
+
+		transformer.setURIResolver( uriResolver );
+		applyParameters( transformer );
+
+		if ( transformer instanceof Controller ) {
+			Controller controller = ( Controller ) transformer;
+			try {
+				controller.makeMessageEmitter();
+				controller.getMessageEmitter().setWriter( new NoOpWriter() );
+			}
+			catch ( TransformerException te ) {
+				// intentionally empty
+			}
+		}
+		return transformer;
+	}
+
+	private javax.xml.transform.TransformerFactory buildTransformerFactory() {
+		if ( transformerType == TransformerType.XALAN ) {
+			return new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl();
+		}
+		else {
+			// saxon as default...
+			return new com.icl.saxon.TransformerFactoryImpl();
+		}
+	}
+
+	private void applyParameters(Transformer transformer) {
+		if ( transformerParameters == null ) {
+			return;
+		}
+		Iterator itr = transformerParameters.entrySet().iterator();
+		while ( itr.hasNext() ) {
+			final Map.Entry entry = ( Map.Entry ) itr.next();
+			transformer.setParameter( ( String ) entry.getKey(), entry.getValue() );
+		}
+	}
+
+	public URIResolver buildUriResolver(StandardDocBookFormatSpecification formatType) throws XSLTException {
+		ResolverChain resolverChain = new ResolverChain();
+		if ( formatType != null ) {
+			resolverChain.addResolver( new ExplicitUrnResolver( formatType ) );
+		}
+		resolverChain.addResolver( new CurrentVersionResolver() );
+		if ( docbookVersion != null ) {
+			resolverChain.addResolver( new VersionResolver( docbookVersion ) );
+		}
+		resolverChain.addResolver( new RelativeJarUriResolver() );
+		resolverChain.addResolver( catalogResolver );
+		return resolverChain;
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/AbstractCatalogManager.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/catalog/AbstractCatalogManager.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/AbstractCatalogManager.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/AbstractCatalogManager.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,46 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.catalog;
+
+import org.apache.xml.resolver.CatalogManager;
+
+/**
+ * Basic support for our notion of CatalogManagers.
+ *
+ * @author Steve Ebersole
+ */
+public abstract class AbstractCatalogManager extends CatalogManager {
+	public AbstractCatalogManager(String[] catalogNames) {
+		super();
+		setIgnoreMissingProperties( true );
+		if ( catalogNames != null && catalogNames.length != 0 ) {
+			StringBuffer buffer = new StringBuffer();
+			boolean first = true;
+			for ( int i = 0; i < catalogNames.length; i++ ) {
+				if ( catalogNames[i] != null ) {
+					if ( first ) {
+						first = false;
+					}
+					else {
+						buffer.append( ';' );
+					}
+				}
+				buffer.append( catalogNames[i] );
+			}
+			setCatalogFiles( buffer.toString() );
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ExplicitCatalogManager.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/catalog/ExplicitCatalogManager.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ExplicitCatalogManager.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ExplicitCatalogManager.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,28 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.catalog;
+
+/**
+ * Utilizes explicit, user-supplied catalog names to build a
+ * CatalogManager.
+ *
+ * @author Steve Ebersole
+ */
+public class ExplicitCatalogManager extends AbstractCatalogManager {
+	public ExplicitCatalogManager(String[] catalogNames) {
+		super( catalogNames );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ImplicitCatalogManager.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/catalog/ImplicitCatalogManager.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ImplicitCatalogManager.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/catalog/ImplicitCatalogManager.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,56 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.catalog;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+
+/**
+ * CatalogManager which resolves its catalogs internally via  classpath
+ * resource lookups.  Its looks for resources named '/catalog.xml' on the
+ * classpath.
+ *
+ * @author Steve Ebersole
+ */
+public class ImplicitCatalogManager extends AbstractCatalogManager {
+	public ImplicitCatalogManager() {
+		super( resolveCatalogNames() );
+	}
+
+	private static String[] resolveCatalogNames() {
+        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+		if ( classLoader == null ) {
+			classLoader = ImplicitCatalogManager.class.getClassLoader();
+		}
+		ArrayList names = new ArrayList();
+        try {
+            Enumeration enumeration = classLoader.getResources( "/catalog.xml" );
+            while ( enumeration.hasMoreElements() ) {
+				final URL resource = ( URL ) enumeration.nextElement();
+				final String resourcePath = resource.toExternalForm();
+				if ( resourcePath != null ) {
+					names.add( resourcePath );
+				}
+            }
+        }
+		catch ( IOException ignore ) {
+			// intentionally empty
+		}
+		return ( String[] ) names.toArray( new String[ names.size() ] );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/BasicUrnResolver.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/BasicUrnResolver.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/BasicUrnResolver.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/BasicUrnResolver.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,44 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+
+/**
+ * Basic support for URIResolvers which map a URN unto a single replacement
+ * {@link Source}.
+ *
+ * @author Steve Ebersole
+ */
+public class BasicUrnResolver implements URIResolver {
+	private final String urn;
+	private final Source source;
+
+	public BasicUrnResolver(String urn, Source source) {
+		this.urn = urn;
+		this.source = source;
+	}
+
+	public Source resolve(String href, String base) throws TransformerException {
+		return urn.equals( href ) ? source : null;
+	}
+
+	public String toString() {
+		return super.toString() + " [URN:" + urn + "]";
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/CurrentVersionResolver.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/CurrentVersionResolver.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/CurrentVersionResolver.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/CurrentVersionResolver.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,28 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+/**
+ * Map hrefs starting with <tt>http://docbook.sourceforge.net/release/xsl/current/</tt>
+ * to classpath resource lookups.
+ *
+ * @author Steve Ebersole
+ */
+public class CurrentVersionResolver extends VersionResolver {
+	public CurrentVersionResolver() {
+		super( "current" );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ExplicitUrnResolver.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/ExplicitUrnResolver.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ExplicitUrnResolver.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ExplicitUrnResolver.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,55 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.maven.plugins.docbook.gen.XSLTException;
+import org.jboss.maven.plugins.docbook.gen.util.ResourceHelper;
+import org.jboss.maven.plugins.docbook.gen.util.StandardDocBookFormatSpecification;
+
+
+/**
+ * Resolves an explicit <tt>urn:docbook:stylesheet</tt> URN against the standard
+ * DocBook stylesheets.
+ *
+ * @author Steve Ebersole
+ */
+public class ExplicitUrnResolver extends BasicUrnResolver {
+	private final StandardDocBookFormatSpecification formatType;
+
+	public ExplicitUrnResolver(StandardDocBookFormatSpecification type) throws XSLTException {
+		super( "urn:docbook:stylesheet", createSource( type ) );
+		this.formatType = type;
+	}
+
+	private static Source createSource(StandardDocBookFormatSpecification type) throws XSLTException {
+		URL stylesheet = ResourceHelper.requireResource( type.getStylesheetResource() );
+		try {
+			return new StreamSource( stylesheet.openStream(), stylesheet.toExternalForm() );
+		}
+		catch ( IOException e ) {
+			throw new XSLTException( "could not locate DocBook stylesheet [" + type.getName() + "]", e );
+		}
+	}
+
+	public String toString() {
+		return super.toString() + " [" + formatType.getName() + "]";
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/RelativeJarUriResolver.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/RelativeJarUriResolver.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/RelativeJarUriResolver.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/RelativeJarUriResolver.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,51 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+import java.net.URL;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * Responsible for resolving relative references from jar base urls.
+ *
+ * @author Steve Ebersole
+ */
+public class RelativeJarUriResolver implements URIResolver {
+	public Source resolve(String href, String base) throws TransformerException {
+		// href need to be relative
+		if ( href.indexOf( "://" ) > 0 || href.startsWith( "/" ) ) {
+			return null;
+		}
+
+		// base would need to start with jar:
+		if ( !base.startsWith( "jar:" ) ) {
+			return null;
+		}
+
+		String fullHref = base.substring( 4, base.lastIndexOf( '/' ) + 1 )
+				+ href;
+		try {
+			URL url = new URL( fullHref );
+			return new StreamSource( url.openStream(), url.toExternalForm() );
+		}
+		catch ( Throwable t ) {
+			return null;
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ResolverChain.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/ResolverChain.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ResolverChain.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/ResolverChain.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,71 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+
+/**
+ * Allows chaining a series of {@link URIResolver resolvers} together.
+ * <p/>
+ * "Precedence" of the resolvers is determined by the order in which
+ * they are {@link #addResolver added}.
+ *
+ * @author Steve Ebersole
+ */
+public class ResolverChain implements URIResolver {
+	private List resolvers = new ArrayList();
+
+	public ResolverChain() {
+	}
+
+	public ResolverChain(URIResolver resolver) {
+		this();
+		addResolver( resolver );
+	}
+
+	/**
+	 * Adds a resolver to the chain.
+	 *
+	 * @param resolver The resolver to add.
+	 */
+	public void addResolver(URIResolver resolver) {
+		resolvers.add( resolver );
+	}
+
+	/**
+	 * Here we iterate over all the chained resolvers and delegate to them
+	 * until we find one which can handle the resolve request (if any).
+	 *
+	 * {@inheritDoc}
+	 */
+	public Source resolve(String href, String base) throws TransformerException {
+		Source result = null;
+		Iterator itr = resolvers.iterator();
+		while ( itr.hasNext() ) {
+			final URIResolver resolver = ( URIResolver ) itr.next();
+			result = resolver.resolve( href, base );
+			if ( result != null ) {
+				break;
+			}
+		}
+		return result;
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/VersionResolver.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/gen/xslt/resolve/VersionResolver.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/VersionResolver.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/gen/xslt/resolve/VersionResolver.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,70 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.gen.xslt.resolve;
+
+import java.io.IOException;
+import java.net.URL;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.URIResolver;
+import javax.xml.transform.stream.StreamSource;
+
+import org.jboss.maven.plugins.docbook.gen.util.ResourceHelper;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class VersionResolver implements URIResolver {
+	public static final String BASE_HREF = "http://docbook.sourceforge.net/release/xsl/";
+
+	private final String version;
+	private final String versionHref;
+
+	public VersionResolver(String version) {
+		this.version = version;
+		this.versionHref = BASE_HREF + version;
+	}
+
+	public Source resolve(String href, String base) throws TransformerException {
+		if ( href.startsWith( versionHref ) ) {
+			return resolve( href );
+		}
+		else if ( base.startsWith( versionHref ) ) {
+			return resolve( base + "/" + href );
+		}
+		return null;
+	}
+
+	private Source resolve(String href) {
+		String resource = href.substring( versionHref.length() );
+		try {
+			URL resourceURL = ResourceHelper.requireResource( resource );
+			return new StreamSource( resourceURL.openStream(), resourceURL.toExternalForm() );
+		}
+		catch ( IllegalArgumentException e ) {
+			return null;
+		}
+		catch ( IOException e ) {
+			return null;
+		}
+	}
+
+	public String toString() {
+		return super.toString() + " [version=" + version + "]";
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/BaselineHandler.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/BaselineHandler.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/BaselineHandler.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/BaselineHandler.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,74 @@
+/*
+ * 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.docbook.revdiff;
+
+import java.util.Map;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * An XML parse handler used to create a catalog of baseline elements.
+ * <p/>
+ * Typically this would be used against the master translation to create
+ * a baseline against which particular translations would be checked.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class BaselineHandler extends DefaultHandler {
+	private final Map catalog;
+	private Locator docLocator;
+
+	public void setDocumentLocator(Locator locator) {
+		this.docLocator = locator;
+	}
+
+	public BaselineHandler(Map catalog) {
+		this.catalog = catalog;
+	}
+
+	public void startElement(
+			String namespaceURI,
+			String localName,
+			String qualifiedName,
+			Attributes atts) throws SAXException {
+
+		// Only add ModuleElements that have an identifier
+		String identifier = atts.getValue( "id" );
+		if ( identifier != null ) {
+			// The default revision is 0
+			int revision = 0;
+			if ( atts.getValue( "revision" ) != null ) {
+				revision = Integer.parseInt( atts.getValue( "revision" ) );
+			}
+
+			// Generate new ContentItem and new original state
+			ContentItem contentItem = new ContentItem( identifier );
+			ContentItemDescriptor descriptor = new ContentItemDescriptor(
+					docLocator.getSystemId(),
+					qualifiedName,
+					revision,
+					docLocator.getLineNumber(),
+					docLocator.getColumnNumber()
+			);
+			contentItem.setMasterDescriptor( descriptor );
+			catalog.put( identifier, contentItem );
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItem.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/ContentItem.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItem.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItem.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,71 @@
+/*
+ * 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
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+/**
+ * Describes a particular piece of content, including descriptors
+ * from both the master and a particular translation
+ *
+ * @author Christian Bauer
+ */
+public class ContentItem {
+    private final String identifier;
+    private ContentItemDescriptor masterDescriptor;
+    private ContentItemDescriptor translationDescriptor;
+
+    public ContentItem(String identifier) {
+        this.identifier = identifier;
+    }
+
+    public String getIdentifier() {
+        return identifier;
+    }
+
+    public ContentItemDescriptor getMasterDescriptor() {
+        return masterDescriptor;
+    }
+
+    public void setMasterDescriptor(ContentItemDescriptor masterDescriptor) {
+        this.masterDescriptor = masterDescriptor;
+    }
+
+    public ContentItemDescriptor getTranslationDescriptor() {
+        return translationDescriptor;
+    }
+
+    public void setTranslationDescriptor(ContentItemDescriptor translationDescriptor) {
+        this.translationDescriptor = translationDescriptor;
+    }
+
+
+	public boolean equals(Object o) {
+		if ( this == o ) {
+			return true;
+		}
+		if ( o == null || getClass() != o.getClass() ) {
+			return false;
+		}
+
+		ContentItem that = ( ContentItem ) o;
+
+		return identifier.equals( that.identifier );
+
+	}
+
+	public int hashCode() {
+		return identifier.hashCode();
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItemDescriptor.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/ContentItemDescriptor.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItemDescriptor.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/ContentItemDescriptor.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,58 @@
+/*
+ * 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
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+/**
+ *
+ * @author Christian Bauer
+ */
+public class ContentItemDescriptor {
+    public static int REVISION_IGNORE = -1;
+
+    private final String sourceSystemId;
+    private final String elementName;
+    private final int revision;
+    private final int row;
+    private final int column;
+
+	public ContentItemDescriptor(String sourceSystemId, String elementName, int revision, int row, int column) {
+		this.sourceSystemId = sourceSystemId;
+		this.elementName = elementName;
+		this.revision = revision;
+		this.row = row;
+		this.column = column;
+	}
+
+	public int getRevision() {
+        return revision;
+    }
+
+    public String getElementName() {
+        return elementName;
+    }
+
+    public String getSourceSystemId() {
+        return sourceSystemId;
+    }
+
+    public int getRow() {
+        return row;
+    }
+
+	public int getColumn() {
+		return column;
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/Diff.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/Diff.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/Diff.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/Diff.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,54 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * Represents the difference between two sources.
+ *
+ * @author Steve Ebersole
+ */
+public class Diff {
+	private Set elementsOnlyInMaster = new HashSet();
+	private Set elementsOnlyInTranslation = new HashSet();
+	private Set elementsDiffRevision = new HashSet();
+
+	public void addOnlyInMaster(ContentItem element) {
+		elementsOnlyInMaster.add( element );
+	}
+
+	public void addOnlyInTranslation(ContentItem element) {
+		elementsOnlyInTranslation.add( element );
+	}
+
+	public void addDiffRevision(ContentItem element) {
+		elementsDiffRevision.add( element );
+	}
+
+	public Iterator getElementsOnlyInMaster() {
+		return elementsOnlyInMaster.iterator();
+	}
+
+	public Iterator getElementsOnlyInTranslation() {
+		return elementsOnlyInTranslation.iterator();
+	}
+	public Iterator getElementsDiffRevision() {
+		return elementsDiffRevision.iterator();
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/DiffCreator.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/DiffCreator.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/DiffCreator.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/DiffCreator.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,115 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Responsible for creating a diff description.
+ *
+ * @author Steve Ebersole
+ */
+public class DiffCreator {
+
+	private final XMLReader parser;
+	private final Log log;
+
+	public DiffCreator(boolean xincludeSupport, Log log) throws GenerationException {
+		this.parser = generateParser( xincludeSupport );
+		this.log = log;
+	}
+
+	public synchronized Diff findDiff(File master, File translation) throws GenerationException {
+		Map catalog = new HashMap();
+
+		// Parse master file
+		BaselineHandler baselineHandler = new BaselineHandler( catalog );
+		parser.setContentHandler( baselineHandler );
+		try {
+			parser.parse( master.getAbsolutePath() );
+		}
+		catch( IOException e ) {
+			throw new GenerationException( "unable to locate specified master [" + master.getAbsolutePath() + "]", e );
+		}
+		catch ( SAXException e ) {
+			throw new GenerationException( "error parsing master [" + master.getAbsolutePath() + "]", e );
+		}
+
+		log.debug( "encountered [" + catalog.size() + "] master content elements" );
+
+		Diff diff = new Diff();
+
+		// Parse translation
+		TranslationHandler translationHandler = new TranslationHandler( catalog, diff );
+		parser.setContentHandler( translationHandler );
+		try {
+			parser.parse( translation.getAbsolutePath() );
+		}
+		catch ( IOException e ) {
+			throw new GenerationException( "unable to locate specified translation [" + translation.getAbsolutePath() + "]", e );
+		}
+		catch ( SAXException e ) {
+			throw new GenerationException( "error parsing translation [" + translation.getAbsolutePath() + "]", e );
+		}
+
+		// as a final step, allow translation handler to finish up
+		translationHandler.finish();
+
+		return diff;
+	}
+
+	private XMLReader generateParser(boolean xincludeSupport) throws GenerationException {
+		try {
+			XMLReader parser = createParserFactory( xincludeSupport ).newSAXParser().getXMLReader();
+//			SAXParser parser = new SAXParser();
+			// Disable validation against DTD
+			parser.setFeature( "http://xml.org/sax/features/validation", false );
+			// Disable DTD loading in Xerces
+			parser.setFeature( "http://apache.org/xml/features/nonvalidating/load-external-dtd", false );
+			return parser;
+		}
+		catch ( SAXNotSupportedException e ) {
+			throw new GenerationException( "unable to generate SAX Parser", e );
+		}
+		catch ( SAXNotRecognizedException e ) {
+			throw new GenerationException( "unable to generate SAX Parser", e );
+		}
+		catch ( ParserConfigurationException e ) {
+			throw new GenerationException( "unable to generate SAX Parser", e );
+		}
+		catch ( SAXException e ) {
+			throw new GenerationException( "unable to generate SAX Parser", e );
+		}
+	}
+
+	private SAXParserFactory createParserFactory(boolean xincludeSupport) {
+        SAXParserFactory factory = new SAXParserFactoryImpl();
+        factory.setXIncludeAware( xincludeSupport );
+        return factory;
+    }
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/GenerationException.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/GenerationException.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/GenerationException.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/GenerationException.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,31 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+/**
+ * Indicates problems generating the diff report
+ *
+ * @author Steve Ebersole
+ */
+public class GenerationException extends Exception {
+	public GenerationException(String message) {
+		super( message );
+	}
+
+	public GenerationException(String message, Throwable cause) {
+		super( message, cause );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/IndexReportGenerator.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/IndexReportGenerator.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/IndexReportGenerator.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/IndexReportGenerator.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,84 @@
+/*
+ * 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): Steve Ebersole
+ */
+package org.jboss.maven.plugins.docbook.revdiff;
+
+import java.util.Locale;
+import java.util.List;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.reporting.MavenReportException;
+
+/**
+ *
+ * @author Steve Ebersole
+ */
+public class IndexReportGenerator {
+	private final ResourceBundle bundle;
+	private final Sink sink;
+	private final Log log;
+
+	public static class TranslationReportDescriptor {
+		private final Locale translation;
+		private final String reportPath;
+
+		public TranslationReportDescriptor(Locale translation, String reportPath) {
+			this.translation = translation;
+			this.reportPath = reportPath;
+		}
+	}
+
+	public IndexReportGenerator(ResourceBundle bundle, Sink sink, Log log) {
+		this.bundle = bundle;
+		this.sink = sink;
+		this.log = log;
+	}
+
+	public void generate(List reportDescriptors) throws MavenReportException {
+		log.debug( "writing index report via provided sink" );
+		sink.head();
+		sink.text( bundle.getString( "report.name" ) );
+        sink.head_();
+
+        sink.body();
+		sink.sectionTitle1();
+        sink.anchor( bundle.getString( "report.header" ) );
+        sink.anchor_();
+        sink.text( bundle.getString( "report.header" ) );
+        sink.sectionTitle1_();
+
+		sink.table();
+		Iterator itr = reportDescriptors.iterator();
+		while ( itr.hasNext() ) {
+			final TranslationReportDescriptor descriptor = ( TranslationReportDescriptor ) itr.next();
+			sink.tableRow();
+			sink.tableCell();
+			sink.link( descriptor.reportPath );
+			sink.text( descriptor.translation.getDisplayName( Locale.ENGLISH ) + " (" + descriptor.translation.toString() + ")" );
+			sink.link_();
+			sink.tableCell_();
+			sink.tableRow_();
+		}
+		sink.table_();
+
+		sink.body_();
+        sink.flush();
+        sink.close();
+		log.debug( "index report sink flushed and closed" );
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationHandler.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/TranslationHandler.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationHandler.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationHandler.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,106 @@
+/*
+ * 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.docbook.revdiff;
+
+import java.util.Map;
+import java.util.Iterator;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * Handles actually discerning diffs between the translations based on the
+ * revision numbers of the content elements.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class TranslationHandler extends DefaultHandler {
+	private final Map catalog;
+	private final Diff diff;
+	private Locator docLocator;
+
+	public TranslationHandler(Map catalog, Diff diff) {
+		this.catalog = catalog;
+		this.diff = diff;
+	}
+
+	public void setDocumentLocator(Locator locator) {
+		this.docLocator = locator;
+	}
+
+	public void startElement(
+			String namespaceURI,
+			String localName,
+			String qualifiedName,
+			Attributes atts) throws SAXException {
+
+		String identifier = atts.getValue( "id" );
+		if ( identifier != null ) {
+			int revision = 0;
+			if ( atts.getValue( "revision" ) != null ) {
+				revision = Integer.parseInt( atts.getValue( "revision" ) );
+			}
+
+			ContentItemDescriptor translationState = new ContentItemDescriptor(
+					docLocator.getSystemId(),
+					qualifiedName,
+					revision,
+					docLocator.getLineNumber(),
+					docLocator.getColumnNumber()
+			);
+
+			// Locate the corresponding ContentItem from the master
+			//
+			// NOTE: we use remove to keep track of the fact that the transation
+			// has used that element; that way, afterwards, we know all the
+			// "unused" ones which would indicate elements recently added to
+			// the master...
+			ContentItem contentItem = ( ContentItem ) catalog.remove( identifier );
+			if ( contentItem == null ) {
+				// we have encountered an element in the translation which
+				// is not present in the master.  This *should indicate that we
+				// have a section that was removed from the master, but not yet
+				// removed from the translation...
+				if ( revision != ContentItemDescriptor.REVISION_IGNORE ) {
+					contentItem = new ContentItem( identifier );
+					contentItem.setTranslationDescriptor( translationState );
+					diff.addOnlyInTranslation( contentItem );
+				}
+			}
+			else {
+				// the element is present in both; check the revisions
+				if ( revision != contentItem.getMasterDescriptor().getRevision() && revision != ContentItemDescriptor.REVISION_IGNORE ) {
+					contentItem.setTranslationDescriptor( translationState );
+					diff.addDiffRevision( contentItem );
+				}
+			}
+		}
+	}
+
+	public void finish() {
+		// anything left in the catalog at this point is stuff that is present
+		// in the master but absent from the translation...
+		Iterator itr = catalog.entrySet().iterator();
+		while ( itr.hasNext() ) {
+			final ContentItem contentItem = ( ContentItem ) ( ( Map.Entry ) itr.next() ).getValue();
+			itr.remove();
+			diff.addOnlyInMaster( contentItem );
+		}
+	}
+}

Copied: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationReportGenerator.java (from rev 12660, sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/codehaus/mojo/docbook/revdiff/TranslationReportGenerator.java)
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationReportGenerator.java	                        (rev 0)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugins/docbook/revdiff/TranslationReportGenerator.java	2007-07-02 13:53:27 UTC (rev 12662)
@@ -0,0 +1,202 @@
+/*
+ * 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.docbook.revdiff;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+
+/**
+ * Generate a diff report.
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class TranslationReportGenerator {
+	// todo : use templating...
+	private final String base;
+	private final ResourceBundle bundle;
+	private final Log log;
+
+	public TranslationReportGenerator(File basedir, ResourceBundle bundle, Log log) {
+		try {
+			this.base = basedir.toURL().toExternalForm();
+		}
+		catch ( MalformedURLException e ) {
+			throw new IllegalArgumentException( "basedir was a malformed url" );
+		}
+		log.debug( "constructing docbook diff report generator [base=" + base + "]" );
+		this.bundle = bundle;
+		this.log = log;
+	}
+
+	public void generate(Diff diff, File output, String translation) throws GenerationException {
+		if ( output.exists() ) {
+			log.debug( "cleaning up previous translation-diff report output [" + output.getAbsolutePath() + "]" );
+			output.delete();
+		}
+
+		File outputDirectory = output.getParentFile();
+		if ( !outputDirectory.exists() ) {
+			String outputDirectoryPath = outputDirectory.getAbsolutePath();
+			log.debug( "creating translation-diff report directory [" + outputDirectoryPath + "]" );
+			FileUtils.mkdir( outputDirectoryPath );
+		}
+
+		try {
+			output.createNewFile();
+		}
+		catch ( IOException e ) {
+			throw new GenerationException( "unable to create output file [" + output.getAbsolutePath() + "]", e );
+		}
+
+		try {
+			FileWriter writer = new FileWriter( output );
+			writer.write( pageHead( translation ) );
+
+			writer.write( "<table cellpadding=4>" );
+
+			writer.write( generateNewInMaster( diff ) );
+			writer.write( "<tr><td>&nbsp;</td></tr>" );
+			writer.write( generateDiffRevision( diff ) );
+			writer.write( "<tr><td>&nbsp;</td></tr>" );
+			writer.write( generateNewInTranslation( diff ) );
+
+			writer.write( "</table>" );
+			writer.write( pageFoot() );
+			writer.close();
+		}
+		catch ( IOException e ) {
+			throw new GenerationException( "error writing report [" + output.getAbsolutePath() + "]", e );
+		}
+	}
+
+	private String pageHead(String translation) {
+		StringBuffer buf = new StringBuffer( 256 );
+		buf.append( "<html><head><title>" ).append( bundle.getString( "report.name" ) ).append( "</title></head><body><div align=\"center\">" );
+		buf.append( "<h3>" ).append( bundle.getString( "report.header") ).append( " - " ).append( translation ).append( "</h3>" );
+		return buf.toString();
+	}
+
+	private String pageFoot() {
+		StringBuffer buf = new StringBuffer( 256 );
+		buf.append( "</div></body></html>" );
+		return buf.toString();
+	}
+
+	private String generateNewInMaster(Diff diff) {
+		StringBuffer buf = new StringBuffer();
+		Iterator itr = diff.getElementsOnlyInMaster();
+		while ( itr.hasNext() ) {
+			final ContentItem contentItem = ( ContentItem ) itr.next();
+			buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+			buf.append( "<tr><td>" );
+			buf.append( "<b>" ).append( formatReference( contentItem.getMasterDescriptor() ) ).append( "</b>" );
+			buf.append( "</td></tr>" );
+		}
+
+		String result = "";
+		if ( buf.length() > 0 ) {
+			result = "<tr bgcolor=#cccccc><td><b>New in master:</b></td></tr>";
+		}
+		return result + buf.toString();
+	}
+
+	private String generateDiffRevision(Diff diff) {
+		StringBuffer buf = new StringBuffer();
+		Iterator itr = diff.getElementsDiffRevision();
+		while ( itr.hasNext() ) {
+			final ContentItem contentItem = ( ContentItem ) itr.next();
+			buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+			if ( !contentItem.getMasterDescriptor().getElementName().equals( contentItem.getTranslationDescriptor().getElementName() ) ) {
+				buf.append( "<tr><td bgcolor=#ee6666>" );
+				buf.append( "Element names differ: " )
+						.append( contentItem.getMasterDescriptor().getElementName() )
+						.append( "/" )
+						.append( contentItem.getTranslationDescriptor().getElementName() );
+				buf.append( "</td></tr>" );
+			}
+			buf.append( "<tr><td>" );
+			buf.append( "Master: <b>" ).append( formatReference( contentItem.getMasterDescriptor() ) ).append( "</b>" );
+			buf.append( "</td></tr>" );
+			buf.append( "<tr><td>" );
+			buf.append( "Translation: <b>" ).append( formatReference( contentItem.getTranslationDescriptor() ) ).append( "</b>" );
+			buf.append( "</td></tr>" );
+			buf.append( "<tr><td>" );
+			buf.append( "Master Revision: " ).append( contentItem.getMasterDescriptor().getRevision() );
+			buf.append( "</td></tr>" );
+			buf.append( "<tr><td>" );
+			buf.append( "Translation Revision: " ).append( contentItem.getTranslationDescriptor().getRevision() );
+			buf.append( "</td></tr>" );
+		}
+
+		String result = "";
+		if ( buf.length() > 0 ) {
+			result = "<tr bgcolor=#cccccc><td><b>Translation needs update:</b></td></tr>";
+		}
+		return result + buf.toString();
+	}
+
+	private String generateNewInTranslation(Diff diff) {
+		StringBuffer buf = new StringBuffer();
+		Iterator itr = diff.getElementsOnlyInTranslation();
+		while ( itr.hasNext() ) {
+			final ContentItem contentItem = ( ContentItem ) itr.next();
+			buf.append( "<tr><td bgcolor=#eeeeee>ID: " ).append( contentItem.getIdentifier() ).append( "</td></tr>" );
+			buf.append( "<tr><td>" );
+			buf.append( "<b>" ).append( formatReference( contentItem.getTranslationDescriptor() ) ).append( "</b>" );
+			buf.append( "</td></tr>" );
+		}
+		String result = "";
+		if ( buf.length() > 0 ) {
+			result = "<tr bgcolor=#cccccc><td><b>Only present in translation:</b></td></tr>";
+		}
+		return result + buf.toString();
+	}
+
+	private String formatReference(ContentItemDescriptor descriptor) {
+		return makeSystemIdRelative( descriptor.getSourceSystemId() ) +
+				":" + descriptor.getElementName() +
+				" (" + descriptor.getRow() + "," + descriptor.getColumn() + ")";
+	}
+
+	private String makeSystemIdRelative(String systemId) {
+		String systemIdUrl = toURL( systemId ).toExternalForm();
+		log.debug( "checking source [" + systemIdUrl + "] against base [" + base + "]" );
+		if ( systemIdUrl.startsWith( base ) ) {
+			return systemIdUrl.substring( base.length() );
+		}
+		else {
+			return systemIdUrl;
+		}
+	}
+
+	private URL toURL(String systemId) {
+		try {
+			return new URL( systemId );
+		}
+		catch ( MalformedURLException e ) {
+			throw new UnsupportedOperationException( "unable to parse systemId [" + systemId + "] as URL" );
+		}
+	}
+}

Modified: sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/resources/META-INF/plexus/components.xml	2007-07-02 13:37:33 UTC (rev 12661)
+++ sandbox/trunk/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/resources/META-INF/plexus/components.xml	2007-07-02 13:53:27 UTC (rev 12662)
@@ -6,13 +6,13 @@
 
         <component>
             <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
-            <role-hint>docbook</role-hint>
+            <role-hint>jdocbook</role-hint>
             <implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
             <configuration>
                 <phases>
-                    <process-resources>org.jboss.maven.plugins:maven-jboss-docbook-plugin:resources</process-resources>
-                    <compile>org.jboss.maven.plugins:maven-jboss-docbook-plugin:generate</compile>
-                    <package>org.jboss.maven.plugins:maven-jboss-docbook-plugin:bundle</package>
+                    <process-resources>org.jboss.maven.plugins:maven-jdocbook-plugin:resources</process-resources>
+                    <compile>org.jboss.maven.plugins:maven-jdocbook-plugin:generate</compile>
+                    <package>org.jboss.maven.plugins:maven-jdocbook-plugin:bundle</package>
                     <install>org.apache.maven.plugins:maven-install-plugin:install</install>
                     <deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
                 </phases>
@@ -56,7 +56,9 @@
         <component>
             <role>org.apache.maven.reporting.MavenReport</role>
             <role-hint>diff</role-hint>
-            <implementation>org.codehaus.mojo.docbook.TranslationDiffReport</implementation>
+            <implementation>
+                org.jboss.maven.plugins.docbook.TranslationDiffReport
+            </implementation>
             <instantiation-strategy>per-lookup</instantiation-strategy>
         </component>
 




More information about the hibernate-commits mailing list