Author: steve.ebersole(a)jboss.com
Date: 2007-06-24 00:13:24 -0400 (Sun, 24 Jun 2007)
New Revision: 11705
Removed:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/AbstractDocBookMojo.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/DocBookSupportResourcesMojo.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Format.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/GenerationMojo.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Options.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/PackageMojo.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/ResourceMojo.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/TranslationDiffReport.java
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/gen/
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/revdiff/
Log:
more prep for move to codehaus
Deleted:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/AbstractDocBookMojo.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/AbstractDocBookMojo.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/AbstractDocBookMojo.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.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.plugin.docbook.gen.RenderingException;
-import org.jboss.maven.plugin.docbook.gen.XSLTException;
-import org.jboss.maven.plugin.docbook.gen.util.Formatting;
-import org.jboss.maven.plugin.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 org.jboss.maven.plugin.docbook.gen.RenderingException
- * @throws XSLTException
- */
- 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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/DocBookSupportResourcesMojo.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/DocBookSupportResourcesMojo.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/DocBookSupportResourcesMojo.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Format.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Format.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Format.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/GenerationMojo.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/GenerationMojo.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/GenerationMojo.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.docbook;
-
-import java.io.File;
-
-import org.codehaus.plexus.util.FileUtils;
-import org.jboss.maven.plugin.docbook.gen.util.Formatting;
-import org.jboss.maven.plugin.docbook.gen.format.FormatHandlerFactory;
-import org.jboss.maven.plugin.docbook.gen.RenderingException;
-import org.jboss.maven.plugin.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 );
- }
- }
-
-}
Deleted:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Options.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Options.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/Options.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/PackageMojo.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/PackageMojo.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/PackageMojo.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.docbook;
-
-import java.io.File;
-
-import org.jboss.maven.plugin.docbook.gen.util.Formatting;
-import org.jboss.maven.plugin.docbook.gen.RenderingException;
-import org.jboss.maven.plugin.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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/ResourceMojo.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/ResourceMojo.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/ResourceMojo.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -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.jboss.maven.plugin.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.plugin.docbook.gen.util.Formatting;
-import org.jboss.maven.plugin.docbook.gen.RenderingException;
-import org.jboss.maven.plugin.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:
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/TranslationDiffReport.java
===================================================================
---
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/TranslationDiffReport.java 2007-06-24
04:08:36 UTC (rev 11704)
+++
trunk/sandbox/maven-poc/plugins/maven-jboss-docbook-plugin/src/main/java/org/jboss/maven/plugin/docbook/TranslationDiffReport.java 2007-06-24
04:13:24 UTC (rev 11705)
@@ -1,187 +0,0 @@
-/*
- * Copyright © 2007 Red Hat Middleware, LLC. All rights reserved.
- *
- * This copyrighted material is made available to anyone wishing to use, modify,
- * copy, or redistribute it subject to the terms and conditions of the GNU
- * Lesser General Public License, v. 2.1. This program is distributed in the
- * hope that it will be useful, but WITHOUT A WARRANTY; without even the implied
- * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details. You should have received a
- * copy of the GNU Lesser General Public License, v.2.1 along with this
- * distribution; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Red Hat Author(s): Christian Bauer, Steve Ebersole
- */
-package org.jboss.maven.plugin.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.plugin.docbook.gen.util.Formatting;
-import org.jboss.maven.plugin.docbook.gen.RenderingException;
-import org.jboss.maven.plugin.docbook.revdiff.Diff;
-import org.jboss.maven.plugin.docbook.revdiff.DiffCreator;
-import org.jboss.maven.plugin.docbook.revdiff.GenerationException;
-import org.jboss.maven.plugin.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() + "]" );
- }
- }
- }
-}