Hibernate SVN: r11470 - trunk/HibernateExt/shards/doc/reference/en/modules.
by hibernate-commits@lists.jboss.org
Author: max.ross
Date: 2007-05-06 17:47:18 -0400 (Sun, 06 May 2007)
New Revision: 11470
Modified:
trunk/HibernateExt/shards/doc/reference/en/modules/configuration.xml
Log:
Fix doc bug http://opensource.atlassian.com/projects/hibernate/browse/HSHARDS-6
Config files are now referred to by consistent names.
Modified: trunk/HibernateExt/shards/doc/reference/en/modules/configuration.xml
===================================================================
--- trunk/HibernateExt/shards/doc/reference/en/modules/configuration.xml 2007-05-04 13:45:20 UTC (rev 11469)
+++ trunk/HibernateExt/shards/doc/reference/en/modules/configuration.xml 2007-05-06 21:47:18 UTC (rev 11470)
@@ -169,7 +169,7 @@
shard-specific database url, database user, and database password, and that's all. This means that if you change the
connection pool parameters in shard1.hibernate.cfg.xml, those parameters will be ignored. If you add another
mapping file to the <classname>Configuration</classname>
- loaded with the properties defined in weather2.hibernate.cfg.xml, that mapping will be ignored.
+ loaded with the properties defined in shard2.hibernate.cfg.xml, that mapping will be ignored.
With the exception of the properties listed above, the configuration of our shard-aware
<classname>SessionFactory</classname> comes entirely from the prototype
<classname>Configuration</classname>. This may seem a bit strict, but the sharding code
@@ -202,7 +202,7 @@
Now let's take a look at the configuration and mapping files that we loaded in. You'll definitely recognize
them, but there are a few key additions and modifications related to sharding.
<programlisting><![CDATA[
- 1 <!-- Contents of weather0.hibernate.cfg.xml -->
+ 1 <!-- Contents of shard0.hibernate.cfg.xml -->
2 <hibernate-configuration>
3 <session-factory name="HibernateSessionFactory0"> <!-- note the different name -->
4 <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
@@ -216,7 +216,7 @@
12 </hibernate-configuration>
]]></programlisting>
<programlisting><![CDATA[
- 1 <!-- Contents of weather1.hibernate.cfg.xml -->
+ 1 <!-- Contents of shard1.hibernate.cfg.xml -->
2 <hibernate-configuration>
3 <session-factory name="HibernateSessionFactory1"> <!-- note the different name -->
4 <property name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
@@ -229,7 +229,7 @@
11 </session-factory>
12 </hibernate-configuration>
]]></programlisting>
- We'll skip the contents of weather2.hibernate.cfg.xml because the pattern should by now be obvious. We're
+ We'll skip the contents of shard2.hibernate.cfg.xml because the pattern should by now be obvious. We're
giving each session factory a unique name via the name attribute of the session-factory element, and we're
also giving each session factory a shard id. This is required. If you try to configure a
<classname>ShardedSessionFactory</classname> with a <classname>Configuration</classname>
17 years, 9 months
Hibernate SVN: r11469 - trunk/sandbox/maven-poc/Hibernate3/documentation.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-04 09:45:20 -0400 (Fri, 04 May 2007)
New Revision: 11469
Modified:
trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml
Log:
simplify translation diff report config based on plugin changes
Modified: trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml 2007-05-04 13:14:04 UTC (rev 11468)
+++ trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml 2007-05-04 13:45:20 UTC (rev 11469)
@@ -106,22 +106,6 @@
<plugin>
<groupId>org.jboss.maven.plugin</groupId>
<artifactId>jboss-docbook-plugin</artifactId>
- <reportSets>
- <reportSet>
- <reports>
- <report>diff</report>
- </reports>
- </reportSet>
- </reportSets>
- <configuration>
- <masterTranslation>en</masterTranslation>
- <sourceIncludes>
- <include>master.xml</include>
- </sourceIncludes>
- <translations>
- <translation>fr</translation>
- </translations>
- </configuration>
</plugin>
</plugins>
</reporting>
17 years, 9 months
Hibernate SVN: r11468 - trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-04 09:14:04 -0400 (Fri, 04 May 2007)
New Revision: 11468
Added:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/IndexReportGenerator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationReportGenerator.java
Removed:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
Modified:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java
Log:
fixed the diff report; yay!
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/IndexReportGenerator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/IndexReportGenerator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/IndexReportGenerator.java 2007-05-04 13:14:04 UTC (rev 11468)
@@ -0,0 +1,70 @@
+package org.jboss.maven.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;
+
+/**
+ * {@inheritDoc}
+ *
+ * @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" );
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java 2007-05-04 04:45:30 UTC (rev 11467)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java 2007-05-04 13:14:04 UTC (rev 11468)
@@ -1,187 +0,0 @@
-package org.jboss.maven.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 ReportGenerator {
- // todo : use templating...
- private final String base;
- private final ResourceBundle bundle;
- private final Log log;
-
- public ReportGenerator(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> </td></tr>" );
- writer.write( generateDiffRevision( diff ) );
- writer.write( "<tr><td> </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: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java 2007-05-04 04:45:30 UTC (rev 11467)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java 2007-05-04 13:14:04 UTC (rev 11468)
@@ -4,7 +4,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -49,8 +48,7 @@
/**
* Which translation is considered the master.
*
- * @parameter default="en"
- * @required
+ * @parameter default-value="en"
*/
private String masterTranslation;
@@ -58,23 +56,21 @@
* (non master) translations to be included in the report.
*
* @parameter
- * @required
*/
- private String[] translations;
+ private String[] translationIncludes;
/**
* Patternsets of sources (relative to translationsDirectory) to include
* in reporting.
*
- * @parameter default="*.xml"
- * @required
+ * @parameter
*/
private String[] sourceIncludes;
/**
* A boolean, indicating if XInclude should be supported.
*
- * @parameter default="false"
+ * @parameter default-value="false"
*/
private boolean xincludeSupported;
@@ -154,8 +150,7 @@
}
public boolean canGenerateReport() {
- return translations != null && translations.length > 0
- && sourceIncludes != null && sourceIncludes.length > 0;
+ return true;
}
protected void executeReport(Locale locale) throws MavenReportException {
@@ -172,25 +167,42 @@
return;
}
+ if ( translationIncludes == null || translationIncludes.length == 0 ) {
+ // use all translations...
+ ArrayList includes = new ArrayList();
+ File[] subdirs = translationsDirectory.listFiles();
+ for ( int i = 0; i < subdirs.length; i++ ) {
+ includes.add( subdirs[i].getName() );
+ }
+ translationIncludes = ( String[] ) includes.toArray( new String[ includes.size() ] );
+ }
+
+ if ( sourceIncludes == null || sourceIncludes.length == 0 ) {
+ sourceIncludes = new String[] { "*.xml" };
+ }
+
List reports = new ArrayList();
- for ( int i = 0; i < translations.length; i++ ) {
- if ( masterTranslation.equals( translations[i] ) ) {
+ for ( int i = 0; i < translationIncludes.length; i++ ) {
+ if ( masterTranslation.equals( translationIncludes[i] ) ) {
continue;
}
- final File translationDirectory = new File( translationsDirectory, translations[i] );
+ final File translationDirectory = new File( translationsDirectory, translationIncludes[i] );
if ( ! translationDirectory.exists() ) {
getLog().info( "translation directory [" + translationDirectory.getAbsolutePath() + "] did not exist" );
continue;
}
- File output = new File( getReportOutputDirectory(), "report-" + translations[i] + ".html" );
- prepReportFile( output );
-
- generateTranslationReport( masterTranslationDirectory, translationDirectory, output, new Locale( translations[i] ) );
- reports.add( output.getName() );
+ if ( generateTranslationReport( masterTranslationDirectory, translationDirectory, translationIncludes[i] ) ) {
+ reports.add(
+ new IndexReportGenerator.TranslationReportDescriptor(
+ new Locale( translationIncludes[i] ),
+ NAME + "/" + buildTranslationReportName( translationIncludes[i] )
+ )
+ );
+ }
}
- writeReportIndex( reports );
+ new IndexReportGenerator( getBundle( locale ), getSink(), getLog() ).generate( reports );
}
private void prepReportFile(File reportFile) throws MavenReportException {
@@ -207,12 +219,15 @@
}
}
- private void generateTranslationReport(
+ private String buildTranslationReportName(String translationName) {
+ return "report-" + translationName + ".html";
+ }
+
+ private boolean generateTranslationReport(
File masterTranslationDirectory,
File translationDirectory,
- File output,
- Locale locale) throws MavenReportException {
- getLog().debug( "starting docbook:diff processing [translation=" + locale + "]" );
+ String translationName) throws MavenReportException {
+ getLog().debug( "starting docbook:diff processing [translation=" + translationName + "]" );
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( masterTranslationDirectory );
@@ -228,12 +243,16 @@
if ( ! Arrays.equals( masterSources, translationSources ) ) {
getLog().warn( "includes returned different master and translation sets" );
- return;
+ return false;
}
+ Locale locale = new Locale( translationName );
+ File output = new File( getReportOutputDirectory(), buildTranslationReportName( translationName ) );
+ prepReportFile( output );
+
try {
DiffCreator diffCreator = new DiffCreator( xincludeSupported, getLog() );
- ReportGenerator generator = new ReportGenerator( translationsDirectory, getBundle( locale ), getLog() );
+ TranslationReportGenerator generator = new TranslationReportGenerator( translationsDirectory, getBundle( locale ), getLog() );
for ( int i = 0; i < masterSources.length; i++ ) {
getLog().debug( "processing source [" + masterSources[i] + "]" );
@@ -246,39 +265,7 @@
catch ( GenerationException e ) {
throw new MavenReportException( "unable to generate report", e );
}
+ return true;
}
- private void writeReportIndex(List reports) throws MavenReportException {
- getLog().debug( "writing index report via provided sink" );
- getSink().head();
- getSink().text( getBundle( Locale.ENGLISH ).getString( "report.name" ) );
- getSink().head_();
-
- getSink().body();
- getSink().sectionTitle1();
- getSink().anchor( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
- getSink().anchor_();
- getSink().text( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
- getSink().sectionTitle1_();
-
- getSink().table();
- Iterator itr = reports.iterator();
- while ( itr.hasNext() ) {
- final String reportURL = ( String ) itr.next();
- getSink().tableRow();
- getSink().tableCell();
- getSink().link( reportURL );
- getSink().text( reportURL );
- getSink().link_();
- getSink().tableCell_();
- getSink().tableRow_();
- }
- getSink().table_();
-
- getSink().body_();
- getSink().flush();
- getSink().close();
- getLog().debug( "index report sink flushed and closed" );
- }
-
}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationReportGenerator.java (from rev 11464, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationReportGenerator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationReportGenerator.java 2007-05-04 13:14:04 UTC (rev 11468)
@@ -0,0 +1,187 @@
+package org.jboss.maven.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> </td></tr>" );
+ writer.write( generateDiffRevision( diff ) );
+ writer.write( "<tr><td> </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" );
+ }
+ }
+}
17 years, 9 months
Hibernate SVN: r11466 - trunk/sandbox/maven-poc/Hibernate3/documentation.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-04 00:44:41 -0400 (Fri, 04 May 2007)
New Revision: 11466
Modified:
trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml
Log:
new directory layout
Modified: trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml 2007-05-04 04:44:00 UTC (rev 11465)
+++ trunk/sandbox/maven-poc/Hibernate3/documentation/pom.xml 2007-05-04 04:44:41 UTC (rev 11466)
@@ -16,51 +16,114 @@
<name>Hibernate Manual</name>
<description>The Hibernate reference manual</description>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>jboss-docbook-plugin</artifactId>
+ <version>1.0</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<build>
<plugins>
<plugin>
- <groupId>org.jboss.maven.plugin</groupId>
- <artifactId>jboss-docbook-plugin</artifactId>
- <version>1.0</version>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>jboss-docbook-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <xincludeSupported>true</xincludeSupported>
+ <sourceIncludes>
+ <include>master.xml</include>
+ </sourceIncludes>
+ <formats>
+ <format>
+ <formatName>pdf</formatName>
+ <stylesheet>fopdf.xsl</stylesheet>
+ <finalNameMap>
+ <master.xml>hibernate_reference.pdf</master.xml>
+ </finalNameMap>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <stylesheet>html.xsl</stylesheet>
+ <relativeFormatDirectory>html_single</relativeFormatDirectory>
+ <finalNameMap>
+ <master.xml>index.html</master.xml>
+ </finalNameMap>
+ </format>
+ <format>
+ <formatName>html</formatName>
+ <chunkedOutput>true</chunkedOutput>
+ <stylesheet>html_chunk.xsl</stylesheet>
+ <finalNameMap>
+ <master.xml>index.html</master.xml>
+ </finalNameMap>
+ </format>
+ </formats>
+ <entities>
+ <entity>
+ <name>release</name>
+ <value>${version}</value>
+ </entity>
+ </entities>
+ <translations>
+ <translation>
+ <language>en</language>
+ </translation>
+ <translation>
+ <language>fr</language>
+ </translation>
+ </translations>
+ <transformerParameters>
+ <property>
+ <name>custom.titlepage.img</name>
+ <value>${basedir}/src/main/docbook/standard/resources/shared/images/hibernate_logo_a.png</value>
+ </property>
+ </transformerParameters>
+ </configuration>
+ <dependencies>
+ <dependency>
+ <groupId>org.docbook</groupId>
+ <artifactId>docbook-xml</artifactId>
+ <version>4.4</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
- <executions>
- <execution>
- <goals>
- <goal>generate</goal>
- </goals>
- <phase>generate-sources</phase>
- <configuration>
- <translations><t>en</t></translations>
- <source>master.xml</source>
- <xincludeSupported>true</xincludeSupported>
- <formats>
- <format>
- <type>pdf</type>
- <stylesheet>styles/fopdf.xsl</stylesheet>
- <styleSheetRelativeToTranslation>true</styleSheetRelativeToTranslation>
- <finalName>hibernate_reference.pdf</finalName>
- </format>
- </formats>
- <entities>
- <entity>
- <name>release</name>
- <value>${version}</value>
- </entity>
- </entities>
- </configuration>
- </execution>
- </executions>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.jboss.maven.plugin</groupId>
+ <artifactId>jboss-docbook-plugin</artifactId>
+ <reportSets>
+ <reportSet>
+ <reports>
+ <report>diff</report>
+ </reports>
+ </reportSet>
+ </reportSets>
+ <configuration>
+ <masterTranslation>en</masterTranslation>
+ <sourceIncludes>
+ <include>master.xml</include>
+ </sourceIncludes>
+ <translations>
+ <translation>fr</translation>
+ </translations>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
- <dependencies>
- <dependency>
- <groupId>org.docbook</groupId>
- <artifactId>docbook-xml</artifactId>
- <version>4.4</version>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- </plugin>
- </plugins>
- </build>
</project>
\ No newline at end of file
17 years, 9 months
Hibernate SVN: r11464 - in trunk/sandbox/maven-poc/plugins/docbook: src/main/java/org/jboss/maven/docbook/gen and 9 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-04 00:41:23 -0400 (Fri, 04 May 2007)
New Revision: 11464
Added:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml
trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/
Removed:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/
Modified:
trunk/sandbox/maven-poc/plugins/docbook/pom.xml
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl
Log:
semi happy with this although the diff report thing is still a tad broken
Modified: trunk/sandbox/maven-poc/plugins/docbook/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-04 04:41:23 UTC (rev 11464)
@@ -29,31 +29,66 @@
<version>2.0</version>
</dependency>
<dependency>
- <groupId>xml-resolver</groupId>
- <artifactId>xml-resolver</artifactId>
- <version>1.1</version>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-impl</artifactId>
+ <version>2.0.4</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
<groupId>plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.0.1</version>
</dependency>
<dependency>
- <groupId>fop</groupId>
- <artifactId>fop</artifactId>
- <version>0.20.5</version>
- </dependency>
- <dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
- <groupId>saxon</groupId>
- <artifactId>saxon</artifactId>
- <version>6.5.3</version>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-core</artifactId>
+ <version>${doxiaVersion}</version>
</dependency>
<dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-decoration-model</artifactId>
+ <version>${doxiaSiteVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.doxia</groupId>
+ <artifactId>doxia-site-renderer</artifactId>
+ <version>${doxiaSiteVersion}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-component-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-container-default</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>xml-resolver</groupId>
+ <artifactId>xml-resolver</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.0</version>
@@ -66,6 +101,16 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>6.5.3</version>
+ </dependency>
+ <dependency>
+ <groupId>fop</groupId>
+ <artifactId>fop</artifactId>
+ <version>0.20.5</version>
+ </dependency>
+ <dependency>
<groupId>javax.media</groupId>
<artifactId>jai-core</artifactId>
<version>1.1.2</version>
@@ -90,17 +135,9 @@
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.4</source>
- <target>1.4</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <properties>
+ <doxiaVersion>1.0-alpha-8</doxiaVersion>
+ <doxiaSiteVersion>1.0-alpha-8</doxiaSiteVersion>
+ </properties>
</project>
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -6,7 +6,6 @@
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.jboss.maven.docbook.gen.Settings;
import org.jboss.maven.docbook.gen.rendering.MainRenderer;
import org.jboss.maven.docbook.gen.rendering.RenderingException;
import org.jboss.maven.docbook.gen.rendering.FormatterFactory;
@@ -19,37 +18,30 @@
* specifically handles language translations in a more transparent way.
*
* @goal generate
- * @phase generate-sources
+ * @phase package
*
* @author Steve Ebersole
*/
public class GenerationMojo extends AbstractMojo {
/**
- * The directory where the DocBook sources and translations can be found.
- *
- * @parameter expression="${basedir}/src/main/docbook"
- */
- private File sourcesDirectory;
-
- /**
* The directory containing default (i.e. language-agnostic) shared resources.
*
- * @parameter expression="${sourcesDirectory}/standard/resources"
+ * @parameter expression="${basedir}/src/main/docbook/standard/resources"
*/
private File standardResourcesDirectory;
/**
* The directory containing the default (i.e. language-agnostic) XSLT stylesheets.
*
- * @parameter expression="${sourcesDirectory}/standard/style"
+ * @parameter expression="${basedir}/src/main/docbook/standard/xslt"
*/
private File standardStylesheetDirectory;
/**
* The directory containing the translated DocBook sources.
*
- * @parameter expression="${sourcesDirectory}/translations"
+ * @parameter expression="${basedir}/src/main/docbook/translations"
*/
private File translationsDirectory;
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -126,7 +126,16 @@
protected Transformer buildTransformer(File targetFile) throws RenderingException {
final URL docbookStylesheet = format.isChunkedOutput() ? getChunkedStyleSheetUrl() : getDefaultStylesheetUrl();
final URL transformationStylesheet = resolveTransformationStylesheet();
- return getSettings().getTransformerFactory().buildTransformer( docbookStylesheet, transformationStylesheet );
+ Transformer transformer = getSettings().getTransformerFactory()
+ .buildTransformer( docbookStylesheet, transformationStylesheet );
+ // "inclusion" of graphics in html is much different than other formats
+ // REF: http://sagehill.net/docbookxsl/GraphicsLocations.html
+ if ( ! StandardDocBookFormatType.HTML.getName().equals( format.getFormatName() ) ) {
+ String imgSrcPath = translationRenderer.getTranslationTargetDirectory().getAbsolutePath() + "/";
+ getLog().debug( "setting 'img.src.path' [" + imgSrcPath + "]" );
+ transformer.setParameter( "img.src.path", imgSrcPath );
+ }
+ return transformer;
}
private Source buildSource(File sourceFile) throws RenderingException {
@@ -134,7 +143,7 @@
EntityResolver resolver = getSettings().getTransformerFactory().getCatalogResolver();
if ( getSettings().getEntities() != null ) {
resolver = new InjectingEntityResolver(
- java.util.Arrays.asList( getSettings().getEntities() ),
+ getSettings().getEntities(),
resolver,
format.getFormatName(),
translationRenderer.getMainRenderer().getSettings().getLog()
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -71,7 +71,9 @@
for ( int i = 0; i < matched.length; i++ ) {
final File source = new File( translationSourceDirectory, matched[i] );
- mainRenderer.getSettings().getFormatterFactory().buildFormatter( this, formats[i] ).format( source );
+ for ( int x = 0; x < formats.length; x++ ) {
+ mainRenderer.getSettings().getFormatterFactory().buildFormatter( this, formats[x] ).format( source );
+ }
}
}
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,6 +1,7 @@
package org.jboss.maven.docbook.gen.xslt;
import java.io.IOException;
+import java.io.File;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
@@ -68,9 +69,13 @@
}
try {
- javax.xml.transform.TransformerFactory transformerFactory = transformerType == TransformerType.XALAN
- ? new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl()
- : new com.icl.saxon.TransformerFactoryImpl();
+ javax.xml.transform.TransformerFactory transformerFactory;
+ if ( transformerType == TransformerType.XALAN ) {
+ transformerFactory = new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl();
+ }
+ else {
+ transformerFactory = new com.icl.saxon.TransformerFactoryImpl();
+ }
transformerFactory.setURIResolver( uriResolver );
Source source = new StreamSource( xsltStylesheet.openStream(), xsltStylesheet.toExternalForm() );
Transformer transformer = transformerFactory.newTransformer( source );
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/BaselineHandler.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,61 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Map;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+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 = new Integer( atts.getValue( "revision" ) ).intValue();
+ }
+
+ // 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: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItem.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,59 @@
+package org.jboss.maven.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;
+
+ if ( !identifier.equals( that.identifier ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode() {
+ return identifier.hashCode();
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ContentItemDescriptor.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,44 @@
+package org.jboss.maven.docbook.revdiff;
+
+/**
+ * {@inheritDoc}
+ *
+ * @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;
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/Diff.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,39 @@
+package org.jboss.maven.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();
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/DiffCreator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,100 @@
+package org.jboss.maven.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;
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/GenerationException.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,16 @@
+package org.jboss.maven.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 );
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElement.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,53 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElement {
-
- private String identifier;
- private ModuleElementState orgState;
- private ModuleElementState copyState;
-
- public ModuleElement(String identifier) {
- this.identifier = identifier;
- }
-
- public String getIdentifier() {
- return identifier;
- }
-
- public ModuleElementState getOrgState() {
- return orgState;
- }
-
- public void setOrgState(ModuleElementState orgState) {
- this.orgState = orgState;
- }
-
- public ModuleElementState getCopyState() {
- return copyState;
- }
-
- public void setCopyState(ModuleElementState copyState) {
- this.copyState = copyState;
- }
-
- public boolean equals(Object o) {
- if (this == o) return true;
- if (!(o instanceof ModuleElement)) return false;
-
- final ModuleElement moduleElement = (ModuleElement) o;
-
- if (!identifier.equals(moduleElement.identifier)) return false;
-
- return true;
- }
-
- public int hashCode() {
- return identifier.hashCode();
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementState.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,48 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementState {
- public static int REVISION_IGNORE = -1;
-
- private int revision;
- private String elementName;
- private String fileURL;
- private int row;
-
- public int getRevision() {
- return revision;
- }
-
- public void setRevision(int revision) {
- this.revision = revision;
- }
-
- public String getElementName() {
- return elementName;
- }
-
- public void setElementName(String elementName) {
- this.elementName = elementName;
- }
-
- public String getFileURL() {
- return fileURL;
- }
-
- public void setFileURL(String fileURL) {
- this.fileURL = fileURL;
- }
-
- public int getRow() {
- return row;
- }
-
- public void setRow(int row) {
- this.row = row;
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsComparator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,77 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementsComparator extends DefaultHandler {
-
- private Locator docLocator;
- private Set moduleElements;
-
- public ModuleElementsComparator(Set moduleElements) {
- this.moduleElements = moduleElements;
- }
-
- public void setDocumentLocator(Locator locator) {
- this.docLocator = locator;
- }
-
- 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 for a ModuleElement is 0
- int revision = 0;
- if ( atts.getValue( "revision" ) != null ) {
- revision = new Integer( atts.getValue( "revision" ) ).intValue();
- }
-
- // Create new ModuleElement
- ModuleElement meNew = new ModuleElement( identifier );
-
- // Get original ModuleElement, if it exists (ugly...)
- ModuleElement meOld = null;
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement o = ( ModuleElement ) it.next();
- if ( o.equals( meNew ) ) {
- meOld = o;
- }
- }
-
- // Set state of new ModuleELement
- ModuleElementState newState = new ModuleElementState();
- newState.setRevision( revision );
- newState.setElementName( localName );
- newState.setFileURL( docLocator.getSystemId() );
- newState.setRow( docLocator.getLineNumber() );
-
- // Check if already present
- if ( meOld != null ) {
- // Present in both, set state of the copy on the original
- meOld.setCopyState( newState );
- }
- else {
- // ModuleElement exists only in the copy, set state and save
- meNew.setCopyState( newState );
- moduleElements.add( meNew );
- }
- }
-
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleElementsExtractor.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,55 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleElementsExtractor extends DefaultHandler {
-
- private Locator docLocator;
- private Set moduleElements;
-
- public ModuleElementsExtractor(Set moduleElements) {
- this.moduleElements = moduleElements;
- }
-
- public void setDocumentLocator(Locator locator) {
- this.docLocator = locator;
- }
-
- 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 for a ModuleElement is 0
- int revision = 0;
- if ( atts.getValue( "revision" ) != null ) {
- revision = new Integer( atts.getValue( "revision" ) ).intValue();
- }
-
- // Generate new ModuleElement and new original state
- ModuleElement me = new ModuleElement( identifier );
- ModuleElementState meState = new ModuleElementState();
- meState.setRevision( revision );
- meState.setElementName( localName );
- meState.setFileURL( docLocator.getSystemId() );
- meState.setRow( docLocator.getLineNumber() );
- me.setOrgState( meState );
- moduleElements.add( me );
- }
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,13 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-import java.util.Properties;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public interface ModuleReport {
- public void runReport(Set moduleElements, Properties properties);
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ModuleReportHTML.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,159 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-/**
- * {@inheritDoc}
- *
- * @author Christian Bauer
- */
-public class ModuleReportHTML implements ModuleReport {
-
- public static final String DESTINATION_FILE = "DESTINATION_FILE";
-
- public void runReport(Set moduleElements, Properties properties) {
- if ( moduleElements == null ) {
- throw new NullPointerException( "Can't run a report on a null set of module elements." );
- }
- if ( !properties.containsKey( DESTINATION_FILE ) ) {
- throw new IllegalArgumentException( "Property not set: " + DESTINATION_FILE );
- }
-
- File file = new File( properties.getProperty( DESTINATION_FILE ) );
- try {
- FileWriter writer = new FileWriter( file );
- writer.write( pageHead() );
-
- if ( moduleElements.size() == 0 ) {
- writer.write( "<div align=center>No IDs found in either version.</div>" );
- writer.close();
- return;
- }
-
- writer.write( "<table cellpadding=4>" );
-
- writer.write( generateNewInOriginal( moduleElements ) );
- writer.write( "<tr><td> </td></tr>" );
- writer.write( generateDiffRevision( moduleElements ) );
- writer.write( "<tr><td> </td></tr>" );
- writer.write( generateNewInCopy( moduleElements ) );
-
- writer.write( "</table>" );
- writer.write( pageFoot() );
- writer.close();
- }
- catch ( IOException e ) {
- e.printStackTrace();
- }
- }
-
- private String pageHead() {
- StringBuffer buf = new StringBuffer( 256 );
- buf.append( "<html><head><title>Rowan Report:</title></head><body><div align=\"center\">" );
- buf.append( "<h3>Revision Diff Report</h3>" );
- return buf.toString();
- }
-
- private String pageFoot() {
- StringBuffer buf = new StringBuffer( 256 );
- buf.append( "</div></body></html>" );
- return buf.toString();
- }
-
- private String generateNewInOriginal(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- if ( me.getOrgState() != null && me.getCopyState() == null ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "<b>" + me.getOrgState().getFileURL() +
- " (" + me.getOrgState().getRow() + ", " + me.getOrgState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- }
- }
-
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>New in original:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
- private String generateDiffRevision(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- // If both states are present, but their revision is different (and shouldn't
- // be ignored) OR if the referenced element is also different...
- if ( me.getOrgState() != null && me.getCopyState() != null &&
- ( ( me.getOrgState().getRevision() != me.getCopyState().getRevision() ) ||
- !me.getOrgState().getElementName().equals( me.getCopyState().getElementName() ) ) &&
- me.getCopyState().getRevision() != ModuleElementState.REVISION_IGNORE ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- if ( !me.getOrgState().getElementName().equals( me.getCopyState().getElementName() ) ) {
- buf.append( "<tr><td bgcolor=#ee6666>" );
- buf.append(
- "Element names differ: " + me.getOrgState().getElementName() +
- "/" + me.getCopyState().getElementName()
- );
- buf.append( "</td></tr>" );
- }
- buf.append( "<tr><td>" );
- buf.append(
- "Original: <b>" + me.getOrgState().getFileURL() +
- " (" + me.getOrgState().getRow() + ", " + me.getOrgState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "Copy: <b>" + me.getCopyState().getFileURL() +
- " (" + me.getCopyState().getRow() + ", " + me.getCopyState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append( "Original Revision: " + me.getOrgState().getRevision() );
- buf.append( "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append( "Copy Revision: " + me.getCopyState().getRevision() );
- buf.append( "</td></tr>" );
- }
- }
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>Copy needs update:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
- private String generateNewInCopy(Set moduleElements) {
- StringBuffer buf = new StringBuffer();
- for ( Iterator it = moduleElements.iterator(); it.hasNext(); ) {
- ModuleElement me = ( ModuleElement ) it.next();
- if ( me.getCopyState() != null && me.getOrgState() == null &&
- me.getCopyState().getRevision() != ModuleElementState.REVISION_IGNORE ) {
- buf.append( "<tr><td bgcolor=#eeeeee>ID: " + me.getIdentifier() + "</td></tr>" );
- buf.append( "<tr><td>" );
- buf.append(
- "<b>" + me.getCopyState().getFileURL() +
- " (" + me.getCopyState().getRow() + ", " + me.getCopyState().getElementName() + ")</b>"
- );
- buf.append( "</td></tr>" );
- }
- }
- String result = "";
- if ( buf.length() > 0 ) {
- result = "<tr bgcolor=#cccccc><td><b>Only present in copy:</b></td></tr>";
- }
- return result + buf.toString();
- }
-
-}
-
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/ReportGenerator.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,187 @@
+package org.jboss.maven.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 ReportGenerator {
+ // todo : use templating...
+ private final String base;
+ private final ResourceBundle bundle;
+ private final Log log;
+
+ public ReportGenerator(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> </td></tr>" );
+ writer.write( generateDiffRevision( diff ) );
+ writer.write( "<tr><td> </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" );
+ }
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -1,101 +0,0 @@
-package org.jboss.maven.docbook.revdiff;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Properties;
-import java.io.IOException;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.xerces.parsers.SAXParser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.jboss.maven.docbook.revdiff.ModuleElementsExtractor;
-import org.jboss.maven.docbook.revdiff.ModuleElementsComparator;
-import org.jboss.maven.docbook.revdiff.ModuleReportHTML;
-import org.jboss.maven.docbook.revdiff.ModuleReport;
-
-/**
- * A plugin for generating a "revision diff" report across different
- * translations of the same document. This is useful for the translators to
- * know what changes exist between their translation and another.
- *
- * @goal revision-diff
- *
- * @author Christian Bauer
- * @author Steve Ebersole
- */
-public class RevisionDiffMojo extends AbstractMojo {
- /**
- * The translation against which to baseline the diff.
- *
- * @parameter
- * @required
- */
- private String original;
-
- /**
- * The translation to be compared to the master.
- *
- * @parameter
- * @required
- */
- private String copy;
-
- /**
- * The file where the diff report should be written.
- *
- * @parameter default="${build.outputDirectory}/docbkx/revdiff
- * @required
- */
- private String reportFile;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- Set moduleElements = new HashSet();
- XMLReader parser = generateParser();
- try {
- // Parse original file
- parser.setContentHandler( new ModuleElementsExtractor( moduleElements ) );
- parser.parse( original );
-
- // Parse copy
- parser.setContentHandler( new ModuleElementsComparator( moduleElements ) );
- parser.parse( copy );
-
- // Set properties for HTML report
- Properties props = new Properties();
- props.setProperty( ModuleReportHTML.DESTINATION_FILE, reportFile );
-
- // Generate HTML report
- ModuleReport report = new ModuleReportHTML();
- report.runReport( moduleElements, props );
- }
- catch ( IOException e ) {
- throw new MojoExecutionException( "Files not found : " + original + " or " + copy, e );
-
- }
- catch ( Exception e ) {
- throw new MojoExecutionException( "unable to run revdiff report", e );
- }
-
- }
-
- private XMLReader generateParser() throws MojoExecutionException {
- try {
- 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 MojoExecutionException( "unable to generate SAX Parser", e );
- }
- catch ( SAXNotRecognizedException e ) {
- throw new MojoExecutionException( "unable to generate SAX Parser", e );
- }
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java (from rev 11460, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationDiffReport.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,284 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+import org.codehaus.plexus.util.DirectoryScanner;
+
+/**
+ * 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.
+ *
+ * @goal diff
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class TranslationDiffReport extends AbstractMavenReport {
+
+ public static final String NAME = "translation-diff-report";
+
+ /**
+ * The directory containing the translated DocBook sources.
+ *
+ * @parameter expression="${basedir}/src/main/docbook/translations"
+ * @required
+ */
+ private File translationsDirectory;
+
+ /**
+ * Directory where reports will go.
+ *
+ * @parameter expression="${project.reporting.outputDirectory}"
+ * @required
+ * @readonly
+ */
+ private File reportingDirectory;
+
+ /**
+ * Which translation is considered the master.
+ *
+ * @parameter default="en"
+ * @required
+ */
+ private String masterTranslation;
+
+ /**
+ * (non master) translations to be included in the report.
+ *
+ * @parameter
+ * @required
+ */
+ private String[] translations;
+
+ /**
+ * Patternsets of sources (relative to translationsDirectory) to include
+ * in reporting.
+ *
+ * @parameter default="*.xml"
+ * @required
+ */
+ private String[] sourceIncludes;
+
+ /**
+ * A boolean, indicating if XInclude should be supported.
+ *
+ * @parameter default="false"
+ */
+ private boolean xincludeSupported;
+
+ /**
+ * Whether to build an aggregated report at the root, or build individual reports.
+ *
+ * @parameter expression="${aggregate}" default-value="false"
+ */
+ protected boolean aggregate;
+
+ /**
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ private File reportOutputDirectory;
+
+ /**
+ * @parameter expression="${component.org.apache.maven.doxia.siterenderer.Renderer}"
+ * @required
+ * @readonly
+ */
+ private Renderer siteRenderer;
+
+ protected Renderer getSiteRenderer() {
+ return siteRenderer;
+ }
+
+ protected MavenProject getProject() {
+ return project;
+ }
+
+ public String getCategoryName() {
+ return CATEGORY_PROJECT_REPORTS;
+ }
+
+ protected String getOutputDirectory() {
+ return getReportOutputDirectory().getAbsolutePath();
+ }
+
+ public String getOutputName() {
+ return "index";
+ }
+
+ public String getName(Locale locale) {
+ return getBundle( locale ).getString( "report.name" );
+ }
+
+ public String getDescription(Locale locale) {
+ return getBundle( locale ).getString( "report.description" );
+ }
+
+ private ResourceBundle getBundle(Locale locale) {
+ return ResourceBundle.getBundle( NAME, locale, this.getClass().getClassLoader() );
+ }
+
+ public void setReportOutputDirectory(File dir) {
+ if ( NAME.equals( dir.getName() ) ) {
+ this.reportOutputDirectory = dir;
+ }
+ else {
+ this.reportOutputDirectory = new File( dir, NAME );
+ }
+ }
+
+ public File getReportOutputDirectory() {
+ if ( reportOutputDirectory == null ) {
+ reportOutputDirectory = new File( reportingDirectory, NAME );
+ }
+ return reportOutputDirectory;
+ }
+
+ public boolean isExternalReport() {
+ return false;
+ }
+
+ public boolean canGenerateReport() {
+ return translations != null && translations.length > 0
+ && sourceIncludes != null && sourceIncludes.length > 0;
+ }
+
+ protected void executeReport(Locale locale) throws MavenReportException {
+ getLog().debug( "starting docbook:diff goal execution [masterTranslation=" + masterTranslation + "]" );
+
+ if ( ! translationsDirectory.exists() ) {
+ getLog().debug( "translations directory [" + translationsDirectory.getAbsolutePath() + "] did not exist" );
+ return;
+ }
+
+ File masterTranslationDirectory = new File( translationsDirectory, masterTranslation );
+ if ( ! masterTranslationDirectory.exists() ) {
+ getLog().info( "master translation directory [" + masterTranslationDirectory.getAbsolutePath() + "] did not exist" );
+ return;
+ }
+
+ List reports = new ArrayList();
+ for ( int i = 0; i < translations.length; i++ ) {
+ if ( masterTranslation.equals( translations[i] ) ) {
+ continue;
+ }
+ final File translationDirectory = new File( translationsDirectory, translations[i] );
+ if ( ! translationDirectory.exists() ) {
+ getLog().info( "translation directory [" + translationDirectory.getAbsolutePath() + "] did not exist" );
+ continue;
+ }
+
+ File output = new File( getReportOutputDirectory(), "report-" + translations[i] + ".html" );
+ prepReportFile( output );
+
+ generateTranslationReport( masterTranslationDirectory, translationDirectory, output, new Locale( translations[i] ) );
+ reports.add( output.getName() );
+ }
+
+ writeReportIndex( reports );
+ }
+
+ private void prepReportFile(File reportFile) throws MavenReportException {
+ if ( reportFile.exists() ) {
+ reportFile.delete();
+ }
+ if ( !reportFile.exists() ) {
+ try {
+ reportFile.createNewFile();
+ }
+ catch ( IOException e ) {
+ throw new MavenReportException( "unable to prep report file [" + reportFile.getAbsolutePath() + "]" );
+ }
+ }
+ }
+
+ private void generateTranslationReport(
+ File masterTranslationDirectory,
+ File translationDirectory,
+ File output,
+ Locale locale) throws MavenReportException {
+ getLog().debug( "starting docbook:diff processing [translation=" + locale + "]" );
+
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir( masterTranslationDirectory );
+ scanner.setIncludes( sourceIncludes );
+ scanner.scan();
+ String[] masterSources = scanner.getIncludedFiles();
+
+ scanner = new DirectoryScanner();
+ scanner.setBasedir( translationDirectory );
+ scanner.setIncludes( sourceIncludes );
+ scanner.scan();
+ String[] translationSources = scanner.getIncludedFiles();
+
+ if ( ! Arrays.equals( masterSources, translationSources ) ) {
+ getLog().warn( "includes returned different master and translation sets" );
+ return;
+ }
+
+ try {
+ DiffCreator diffCreator = new DiffCreator( xincludeSupported, getLog() );
+ ReportGenerator generator = new ReportGenerator( translationsDirectory, getBundle( locale ), getLog() );
+
+ for ( int i = 0; i < masterSources.length; i++ ) {
+ getLog().debug( "processing source [" + masterSources[i] + "]" );
+ final File master = new File( masterTranslationDirectory, masterSources[i] );
+ final File translation = new File( translationDirectory, translationSources[i] );
+ final Diff diff = diffCreator.findDiff( master, translation );
+ generator.generate( diff, output, locale.toString() );
+ }
+ }
+ catch ( GenerationException e ) {
+ throw new MavenReportException( "unable to generate report", e );
+ }
+ }
+
+ private void writeReportIndex(List reports) throws MavenReportException {
+ getLog().debug( "writing index report via provided sink" );
+ getSink().head();
+ getSink().text( getBundle( Locale.ENGLISH ).getString( "report.name" ) );
+ getSink().head_();
+
+ getSink().body();
+ getSink().sectionTitle1();
+ getSink().anchor( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
+ getSink().anchor_();
+ getSink().text( getBundle( Locale.ENGLISH ).getString( "report.header" ) );
+ getSink().sectionTitle1_();
+
+ getSink().table();
+ Iterator itr = reports.iterator();
+ while ( itr.hasNext() ) {
+ final String reportURL = ( String ) itr.next();
+ getSink().tableRow();
+ getSink().tableCell();
+ getSink().link( reportURL );
+ getSink().text( reportURL );
+ getSink().link_();
+ getSink().tableCell_();
+ getSink().tableRow_();
+ }
+ getSink().table_();
+
+ getSink().body_();
+ getSink().flush();
+ getSink().close();
+ getLog().debug( "index report sink flushed and closed" );
+ }
+
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/TranslationHandler.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,93 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.net.URL;
+import java.net.MalformedURLException;
+
+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 = new Integer( atts.getValue( "revision" ) ).intValue();
+ }
+
+ 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 );
+ }
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/META-INF/plexus/components.xml 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,10 @@
+<component-set>
+ <components>
+ <component>
+ <role>org.apache.maven.reporting.MavenReport</role>
+ <role-hint>diff</role-hint>
+ <implementation>org.jboss.maven.docbook.revdiff.TranslationDiffReport</implementation>
+ <instantiation-strategy>per-lookup</instantiation-strategy>
+ </component>
+ </components>
+</component-set>
\ No newline at end of file
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/resources/translation-diff-report.properties 2007-05-04 04:41:23 UTC (rev 11464)
@@ -0,0 +1,3 @@
+report.name=Translation Diff Report
+report.description=Calculates differences between translation and master
+report.header=Translation Diff Report
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-03 07:29:23 UTC (rev 11463)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-04 04:41:23 UTC (rev 11464)
@@ -58,12 +58,19 @@
),
},
new Format[] {
+// new Format(
+// "pdf",
+// "fopdf.xsl",
+// false,
+// "pdf",
+// finalNameMap
+// ),
new Format(
- "pdf",
- "fopdf.xsl",
+ "html",
+ "html.xsl",
false,
- "pdf",
- finalNameMap
+ "html",
+ null
)
}
);
@@ -75,7 +82,7 @@
File translationsDirectory = sourceFile.getParentFile().getParentFile();
File baseDirectory = translationsDirectory.getParentFile();
File standardResources = new File( baseDirectory, "standard/resources" );
- File standardStyles = new File( baseDirectory, "standard/style" );
+ File standardStyles = new File( baseDirectory, "standard/xslt" );
File targetDirectory = baseDirectory.getParentFile()
.getParentFile()
@@ -91,7 +98,8 @@
System.out.println( "writing output to : " + targetDirectory.getAbsolutePath() );
Properties props = new Properties();
- props.setProperty( "book.titlepage.img", new File( translationsDirectory, "../standard/resources/shared/images/hibernate_logo_a.png" ).getAbsolutePath() );
+ props.setProperty( "custom.titlepage.img", new File( translationsDirectory, "../standard/resources/shared/images/hibernate_logo_a.png" ).getAbsolutePath() );
+// props.setProperty( "html.stylesheet", new File( translationsDirectory, "../standard/resources/shared/css/html.css" ).getAbsolutePath() );
Settings settings = new Settings(
translationsDirectory,
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt (from rev 11461, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style)
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/fopdf.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -28,7 +28,7 @@
Custom Title Page
################################################### -->
- <xsl:param name="book.titlepage.img">1</xsl:param>
+ <xsl:param name="custom.titlepage.img">1</xsl:param>
<xsl:template name="book.titlepage.recto">
<fo:block>
<fo:table table-layout="fixed" width="175mm">
@@ -40,7 +40,7 @@
<fo:external-graphic content-height="1.2cm">
<xsl:attribute name="src">
<xsl:call-template name="fo-external-image">
- <xsl:with-param name="filename" select="$book.titlepage.img"/>
+ <xsl:with-param name="filename" select="$custom.titlepage.img"/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -14,16 +14,13 @@
christian(a)hibernate.org
-->
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY db_xsl_path "../../support/docbook-xsl/">
-]>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ exclude-result-prefixes="#default">
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns="http://www.w3.org/TR/xhtml1/transitional"
- exclude-result-prefixes="#default">
-
-<xsl:import href="&db_xsl_path;/html/docbook.xsl"/>
+ <xsl:import href="urn:docbkx:stylesheet" />
<!--###################################################
HTML Settings
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/xslt/html_chunk.xsl 2007-05-04 04:41:23 UTC (rev 11464)
@@ -14,16 +14,13 @@
christian(a)hibernate.org
-->
-<!DOCTYPE xsl:stylesheet [
- <!ENTITY db_xsl_path "../../support/docbook-xsl/">
-]>
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ exclude-result-prefixes="#default">
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- version="1.0"
- xmlns="http://www.w3.org/TR/xhtml1/transitional"
- exclude-result-prefixes="#default">
-
-<xsl:import href="&db_xsl_path;/html/chunk.xsl"/>
+ <xsl:import href="urn:docbkx:stylesheet" />
<!--###################################################
HTML Settings
17 years, 9 months
Hibernate SVN: r11462 - trunk/sandbox/maven-poc/plugins/docbook.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-03 03:28:15 -0400 (Thu, 03 May 2007)
New Revision: 11462
Modified:
trunk/sandbox/maven-poc/plugins/docbook/pom.xml
Log:
refactoring
Modified: trunk/sandbox/maven-poc/plugins/docbook/pom.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-03 07:25:50 UTC (rev 11461)
+++ trunk/sandbox/maven-poc/plugins/docbook/pom.xml 2007-05-03 07:28:15 UTC (rev 11462)
@@ -77,6 +77,17 @@
<version>1.1.2</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>batik</groupId>
+ <artifactId>batik-1.5-fop</artifactId>
+ <version>0.20-5</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
17 years, 9 months
Hibernate SVN: r11461 - in trunk/sandbox/maven-poc/plugins/docbook/src/test: resources/org/jboss/maven/docbook/gen and 9 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-03 03:25:50 -0400 (Thu, 03 May 2007)
New Revision: 11461
Added:
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/css/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/css/html.css
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.zargo
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.zargo
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.zargo
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.svg
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/hibernate_logo_a.png
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.svg
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.gif
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.svg
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/en/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/en/master.xml
Removed:
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/master.xml
trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/styles/
Modified:
trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/XsltCompilationTest.java
Log:
refactoring
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-03 07:24:48 UTC (rev 11460)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/RendererTest.java 2007-05-03 07:25:50 UTC (rev 11461)
@@ -3,11 +3,14 @@
import java.net.URL;
import java.io.File;
import java.util.Properties;
+import java.util.Map;
+import java.util.HashMap;
import junit.framework.TestCase;
-import org.jboss.maven.docbook.Entity;
-import org.jboss.maven.docbook.Format;
-import org.jboss.maven.docbook.Translation;
+import org.jboss.maven.docbook.gen.rendering.StandardFormatterFactory;
+import org.jboss.maven.docbook.gen.rendering.MainRenderer;
+import org.jboss.maven.docbook.gen.xslt.TransformerType;
+import org.jboss.maven.docbook.gen.xslt.TransformerFactory;
import org.apache.maven.plugin.logging.SystemStreamLog;
/**
@@ -16,10 +19,13 @@
* @author Steve Ebersole
*/
public class RendererTest extends TestCase {
- private Renderer renderer;
+ private MainRenderer mainRenderer;
public void testStandardRendering() throws Throwable {
- renderer.render(
+ Map finalNameMap = new HashMap();
+ finalNameMap.put( "master.xml", "hibernate_manual.pdf" );
+
+ mainRenderer.render(
new Translation[] {
new Translation(
"en",
@@ -32,16 +38,18 @@
"pdf",
null,
false,
- false,
- "pdf",
- "hibernate_manual.pdf"
+ null,
+ finalNameMap
)
}
);
}
public void testCustomRendering() throws Throwable{
- renderer.render(
+ Map finalNameMap = new HashMap();
+ finalNameMap.put( "master.xml", "hibernate_manual.pdf" );
+
+ mainRenderer.render(
new Translation[] {
new Translation(
"en",
@@ -52,53 +60,55 @@
new Format[] {
new Format(
"pdf",
- "styles/fopdf.xsl",
- true,
+ "fopdf.xsl",
false,
"pdf",
- "hibernate_manual.pdf"
+ finalNameMap
)
}
);
}
protected void setUp() throws Exception {
- URL docURL = getClass().getResource( "/org/jboss/maven/docbook/gen/en/master.xml" );
+ URL docURL = getClass().getResource( "/org/jboss/maven/docbook/gen/translations/en/master.xml" );
File sourceFile = new File( docURL.toExternalForm().substring( 5 ) );
- File sourceDirectory = sourceFile.getParentFile().getParentFile();
- File targetDirectory = sourceFile.getParentFile()
+ File translationsDirectory = sourceFile.getParentFile().getParentFile();
+ File baseDirectory = translationsDirectory.getParentFile();
+ File standardResources = new File( baseDirectory, "standard/resources" );
+ File standardStyles = new File( baseDirectory, "standard/style" );
+
+ File targetDirectory = baseDirectory.getParentFile()
.getParentFile()
.getParentFile()
.getParentFile()
.getParentFile()
.getParentFile()
- .getParentFile()
- .getParentFile()
.getParentFile();
targetDirectory = new File( targetDirectory, "target" );
targetDirectory = new File( targetDirectory, "test" );
targetDirectory = new File( targetDirectory, "docbook" );
+ System.out.println( "writing output to : " + targetDirectory.getAbsolutePath() );
+
Properties props = new Properties();
- props.setProperty( "book.titlepage.img", new File( sourceDirectory, "en/images/hibernate_logo_a.png" ).getAbsolutePath() );
+ props.setProperty( "book.titlepage.img", new File( translationsDirectory, "../standard/resources/shared/images/hibernate_logo_a.png" ).getAbsolutePath() );
- Configuration configuration = new Configuration(
- sourceDirectory,
- "master.xml",
- null,
+ Settings settings = new Settings(
+ translationsDirectory,
+ new String[] { "master.xml" },
+ standardResources,
+ standardStyles,
targetDirectory,
- null,
true,
new Entity[] {
- new Entity( "release", "test" )
+ new Entity( "version", "test" )
},
new StandardFormatterFactory(),
- TransformerType.SAXON,
- props,
+ new TransformerFactory( TransformerType.SAXON, props ),
new SystemStreamLog()
);
- renderer = new Renderer( configuration );
+ mainRenderer = new MainRenderer( settings );
}
protected void tearDown() throws Exception {
Modified: trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/XsltCompilationTest.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/XsltCompilationTest.java 2007-05-03 07:24:48 UTC (rev 11460)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/java/org/jboss/maven/docbook/gen/XsltCompilationTest.java 2007-05-03 07:25:50 UTC (rev 11461)
@@ -4,6 +4,10 @@
import java.net.URL;
import junit.framework.TestCase;
+import org.jboss.maven.docbook.gen.xslt.TransformerType;
+import org.jboss.maven.docbook.gen.xslt.TransformerFactory;
+import org.jboss.maven.docbook.gen.rendering.RenderingException;
+import org.jboss.maven.docbook.gen.rendering.StandardDocBookFormatType;
/**
* {@inheritDoc}
@@ -21,16 +25,16 @@
URL stylesheet;
// check pdf compilation
- stylesheet = toUrl( PdfFormatter.STYLESHEET );
- factory.buildTransformer( stylesheet, stylesheet, null );
+ stylesheet = toUrl( StandardDocBookFormatType.PDF.getNormalStylesheet() );
+ factory.buildTransformer( stylesheet, stylesheet );
// check chunked html compilation
- stylesheet = toUrl( HtmlFormatter.CHUNK_STYLESHEET );
- factory.buildTransformer( stylesheet, stylesheet, null );
+ stylesheet = toUrl( StandardDocBookFormatType.HTML.getChunkedStylesheet() );
+ factory.buildTransformer( stylesheet, stylesheet );
// check normal html compilation
- stylesheet = toUrl( HtmlFormatter.DEF_STYLESHEET );
- factory.buildTransformer( stylesheet, stylesheet, null );
+ stylesheet = toUrl( StandardDocBookFormatType.HTML.getNormalStylesheet() );
+ factory.buildTransformer( stylesheet, stylesheet );
}
private URL toUrl(String resource) {
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/master.xml
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/master.xml 2007-05-03 07:24:48 UTC (rev 11460)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/master.xml 2007-05-03 07:25:50 UTC (rev 11461)
@@ -1,124 +0,0 @@
-<?xml version='1.0' encoding="iso-8859-1"?>
-
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-<!ENTITY release "(undefined)">
-]>
-
-<book lang="en">
-
- <bookinfo>
- <title>HIBERNATE - Relational Persistence for Idiomatic Java</title>
- <subtitle>Hibernate Reference Documentation</subtitle>
- <releaseinfo>&release;</releaseinfo>
- </bookinfo>
-
- <toc/>
-
- <preface id="preface" revision="2">
- <title>Preface</title>
-
- <para>
- Working with object-oriented software and a relational database can be cumbersome
- and time consuming in today's enterprise environments. Hibernate is an object/relational
- mapping tool for Java environments. The term object/relational mapping (ORM) refers to
- the technique of mapping a data representation from an object model to a relational
- data model with a SQL-based schema.
- </para>
-
- <para>
- Hibernate not only takes care of the mapping from Java classes to
- database tables (and from Java data types to SQL data types), but also provides data
- query and retrieval facilities and can significantly reduce development time otherwise
- spent with manual data handling in SQL and JDBC.
- </para>
-
- <para>
- Hibernates goal is to relieve the developer from 95 percent of common data persistence
- related programming tasks. Hibernate may not be the best solution for data-centric
- applications that only use stored-procedures to implement the business logic in the
- database, it is most useful with object-oriented domain models and business logic in
- the Java-based middle-tier. However, Hibernate can certainly help you to remove or
- encapsulate vendor-specific SQL code and will help with the common task of result set
- translation from a tabular representation to a graph of objects.
- </para>
-
- <para>
- If you are new to Hibernate and Object/Relational Mapping or even Java,
- please follow these steps:
- </para>
-
- <orderedlist>
- <listitem>
- <para>
- Read <xref linkend="tutorial"/> for a tutorial with step-by-step
- instructions. The source code for the tutorial is included in the
- distribution in the <literal>doc/reference/tutorial/</literal>
- directory.
- </para>
- </listitem>
- <listitem>
- <para>
- Read <xref linkend="architecture"/> to understand the environments where
- Hibernate can be used.
- </para>
- </listitem>
- <listitem>
- <para>
- Have a look at the <literal>eg/</literal> directory in the Hibernate
- distribution, it contains a simple standalone application. Copy your
- JDBC driver to the <literal>lib/</literal> directory and edit
- <literal>etc/hibernate.properties</literal>, specifying correct values for
- your database. From a command prompt in the distribution directory,
- type <literal>ant eg</literal> (using Ant), or under Windows, type
- <literal>build eg</literal>.
- </para>
- </listitem>
- <listitem>
- <para>
- Use this reference documentation as your primary source of information.
- Consider reading <emphasis>Hibernate in Action</emphasis>
- (http://www.manning.com/bauer) if you need more help with application
- design or if you prefer a step-by-step tutorial. Also visit
- http://caveatemptor.hibernate.org and download the example application
- for Hibernate in Action.
- </para>
- </listitem>
- <listitem>
- <para>
- FAQs are answered on the Hibernate website.
- </para>
- </listitem>
- <listitem>
- <para>
- Third party demos, examples, and tutorials are linked on the Hibernate
- website.
- </para>
- </listitem>
- <listitem>
- <para>
- The Community Area on the Hibernate website is a good resource for
- design patterns and various integration solutions (Tomcat, JBoss AS,
- Struts, EJB, etc.).
- </para>
- </listitem>
- </orderedlist>
-
- <para>
- If you have questions, use the user forum linked on the Hibernate website. We also
- provide a JIRA issue trackings system for bug reports and feature requests. If you
- are interested in the development of Hibernate, join the developer mailing list. If
- you are interested in translating this documentation into your language, contact us
- on the developer mailing list.
- </para>
-
- <para>
- Commercial development support, production support, and training for Hibernate is
- available through JBoss Inc. (see http://www.hibernate.org/SupportTraining/).
- Hibernate is a Professional Open Source project and a critical component of the
- JBoss Enterprise Middleware System (JEMS) suite of products.
- </para>
-
- </preface>
-
-</book>
-
Added: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/css/html.css
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/css/html.css (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/css/html.css 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,97 @@
+A {
+ color: #003399;
+}
+
+A:active {
+ color: #003399;
+}
+
+A:visited {
+ color: #888888;
+}
+
+P, OL, UL, LI, DL, DT, DD, BLOCKQUOTE {
+ color: #000000;
+}
+
+TD, TH, SPAN {
+ color: #000000;
+}
+
+BLOCKQUOTE {
+ margin-right: 0px;
+}
+
+
+H1, H2, H3, H4, H5, H6 {
+ color: #000000;
+ font-weight:500;
+ margin-top:10px;
+ padding-top:15px;
+}
+
+TABLE {
+ border-collapse: collapse;
+ border-spacing:0;
+ border: 1px thin black;
+ empty-cells: hide;
+}
+
+TD {
+ padding: 4pt;
+}
+
+H1 { font-size: 150%; }
+H2 { font-size: 140%; }
+H3 { font-size: 110%; font-weight: bold; }
+H4 { font-size: 110%; font-weight: bold;}
+H5 { font-size: 100%; font-style: italic; }
+H6 { font-size: 100%; font-style: italic; }
+
+TT {
+font-size: 90%;
+ font-family: "Courier New", Courier, monospace;
+ color: #000000;
+}
+
+PRE {
+font-size: 100%;
+ padding: 5px;
+ border-style: solid;
+ border-width: 1px;
+ border-color: #CCCCCC;
+ background-color: #F4F4F4;
+}
+
+UL, OL, LI {
+ list-style: disc;
+}
+
+HR {
+ width: 100%;
+ height: 1px;
+ background-color: #CCCCCC;
+ border-width: 0px;
+ padding: 0px;
+ color: #CCCCCC;
+}
+
+.variablelist {
+ padding-top: 10;
+ padding-bottom:10;
+ margin:0;
+}
+
+.itemizedlist, UL {
+ padding-top: 0;
+ padding-bottom:0;
+ margin:0;
+}
+
+.term {
+ font-weight:bold;
+}
+
+
+
+
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/AuthorWork.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.zargo (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/AuthorWork.zargo)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/AuthorWork.zargo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/CustomerOrderProduct.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.zargo (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/CustomerOrderProduct.zargo)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/CustomerOrderProduct.zargo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/EmployerEmployee.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.zargo (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/EmployerEmployee.zargo)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/EmployerEmployee.zargo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/full_cream.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.svg (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/full_cream.svg)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.svg (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/full_cream.svg 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,429 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
+[
+ <!ATTLIST svg
+ xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+]>
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="354.331"
+ height="336.614"
+ id="svg1">
+ <defs
+ id="defs3">
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop128" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="1"
+ id="stop129" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient130"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ <radialGradient
+ cx="0.5"
+ cy="0.5"
+ fx="0.5"
+ fy="0.5"
+ r="0.5"
+ id="radialGradient131"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ </defs>
+ <g
+ transform="matrix(0.823795,0,0,0.823795,0.120302,5.25349)"
+ style="font-size:12;"
+ id="g659">
+ <rect
+ width="212.257"
+ height="57.2441"
+ x="17.9576"
+ y="100.132"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect137" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ transform="matrix(0.743454,0,0,0.482981,6.46949,52.2178)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect132" />
+ </g>
+ <rect
+ width="325.86"
+ height="63.6537"
+ x="17.4083"
+ y="15.194"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect136" />
+ <rect
+ width="325.86"
+ height="63.6537"
+ x="13.6713"
+ y="12.4966"
+ style="font-size:12;fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect126" />
+ <g
+ transform="matrix(1.14345,0,0,0.729078,-1.67818,105.325)"
+ style="font-size:12;"
+ id="g164">
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="16.6979"
+ y="222.966"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect138" />
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="14.7335"
+ y="221.002"
+ transform="translate(-1.30962,-1.30992)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect133" />
+ </g>
+ <text
+ x="170.824753"
+ y="58.402939"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text183">
+ <tspan
+ x="170.824997"
+ y="58.402901"
+ id="tspan360">
+Application</tspan>
+ </text>
+ <text
+ x="178.076340"
+ y="364.281433"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text197">
+ <tspan
+ x="178.076004"
+ y="364.281006"
+ id="tspan421">
+Database</tspan>
+ </text>
+ <text
+ x="68.605331"
+ y="138.524582"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text216">
+ <tspan
+ x="68.605301"
+ y="138.524994"
+ id="tspan384">
+SessionFactory</tspan>
+ </text>
+ <rect
+ width="67.0014"
+ height="101.35"
+ x="196.927"
+ y="89.2389"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect387" />
+ <rect
+ width="67.0014"
+ height="101.35"
+ x="194.633"
+ y="86.4389"
+ style="font-size:12;fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect388" />
+ <text
+ x="249.108841"
+ y="173.885559"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text389">
+ <tspan
+ x="249.108994"
+ y="173.886002"
+ id="tspan392">
+Session</tspan>
+ </text>
+ <rect
+ width="73.0355"
+ height="101.35"
+ x="270.995"
+ y="90.0018"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect395" />
+ <rect
+ width="73.0355"
+ height="101.35"
+ x="267.869"
+ y="87.2018"
+ style="font-size:12;fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect396" />
+ <text
+ x="328.593658"
+ y="174.715622"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text397">
+ <tspan
+ x="328.593994"
+ y="174.716003"
+ id="tspan563">
+Transaction</tspan>
+ </text>
+ <g
+ transform="matrix(0.29544,0,0,0.397877,9.70533,103.96)"
+ style="font-size:12;"
+ id="g565">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect566" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect567" />
+ </g>
+ <text
+ x="25.592752"
+ y="204.497803"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:10;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text568">
+ <tspan
+ x="25.592800"
+ y="204.498001"
+ id="tspan662">
+TransactionFactory</tspan>
+ </text>
+ <g
+ transform="matrix(0.298082,0,0,0.397877,99.6898,103.96)"
+ style="font-size:12;"
+ id="g573">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect574" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect575" />
+ </g>
+ <text
+ x="134.030670"
+ y="205.532791"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:10;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text576">
+ <tspan
+ x="134.031006"
+ y="205.533005"
+ id="tspan664">
+ConnectionProvider</tspan>
+ </text>
+ <g
+ transform="matrix(1.14345,0,0,0.729078,-1.67818,38.9539)"
+ style="font-size:12;"
+ id="g587">
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="16.6979"
+ y="222.966"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect588" />
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="14.7335"
+ y="221.002"
+ transform="translate(-1.30962,-1.30992)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect589" />
+ </g>
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="25.6196"
+ y="206.028"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect594" />
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="24.4229"
+ y="204.135"
+ style="font-size:12;fill:#b3b3b3;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect595" />
+ <text
+ x="85.575645"
+ y="282.300354"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;text-anchor:middle;"
+ id="text596">
+ <tspan
+ x="85.575600"
+ y="282.299988"
+ id="tspan607">
+JNDI</tspan>
+ </text>
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="236.937"
+ y="206.791"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect610" />
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="235.741"
+ y="204.898"
+ style="font-size:12;fill:#b3b3b3;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect611" />
+ <text
+ x="342.093201"
+ y="283.226410"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;text-anchor:middle;"
+ id="text612">
+ <tspan
+ x="342.092987"
+ y="283.226013"
+ id="tspan621">
+JTA</tspan>
+ </text>
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="130.134"
+ y="206.791"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect616" />
+ <rect
+ width="90.951"
+ height="44.4829"
+ x="128.937"
+ y="204.898"
+ style="font-size:12;fill:#b3b3b3;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect617" />
+ <text
+ x="212.445343"
+ y="283.226410"
+ transform="scale(0.823795,0.823795)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;text-anchor:middle;"
+ id="text618">
+ <tspan
+ x="212.445007"
+ y="283.226013"
+ id="tspan623">
+JDBC</tspan>
+ </text>
+ <g
+ transform="matrix(0.823795,0,0,0.823795,0.120302,6.19341)"
+ style="font-size:12;"
+ id="g637">
+ <g
+ transform="matrix(0.499515,0,0,0.415467,-0.237339,5.61339)"
+ id="g167">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect134" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect135" />
+ </g>
+ <text
+ x="33.749969"
+ y="50.589706"
+ style="font-size:11;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text188">
+ <tspan
+ x="33.750000"
+ y="50.589699"
+ id="tspan635">
+Transient Objects</tspan>
+ </text>
+ </g>
+ <g
+ transform="matrix(0.823795,0,0,0.823795,0.120302,5.25349)"
+ style="font-size:12;"
+ id="g644">
+ <g
+ transform="matrix(0.297486,0,0,0.516482,230.251,36.9178)"
+ id="g364">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect365" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect366" />
+ </g>
+ <text
+ x="277.123230"
+ y="85.155571"
+ style="font-size:11;font-weight:normal;stroke-width:1pt;font-family:Helvetica;text-anchor:middle;"
+ id="text367">
+ <tspan
+ x="277.122986"
+ y="85.155602"
+ id="tspan631">
+Persistent</tspan>
+ <tspan
+ x="277.122986"
+ y="96.155602"
+ id="tspan633">
+Objects</tspan>
+ </text>
+ </g>
+</svg>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/hibernate_logo_a.png (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/hibernate_logo_a.png)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/hibernate_logo_a.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/lite.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.svg (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/lite.svg)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.svg (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/lite.svg 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,334 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
+[
+ <!ATTLIST svg
+ xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+]>
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="318.898"
+ height="248.031"
+ id="svg1">
+ <defs
+ id="defs3">
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop128" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="1"
+ id="stop129" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient130"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ <radialGradient
+ cx="0.5"
+ cy="0.5"
+ fx="0.5"
+ fy="0.5"
+ r="0.5"
+ id="radialGradient131"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ </defs>
+ <rect
+ width="291.837"
+ height="57.0074"
+ x="17.3169"
+ y="18.646"
+ style="font-size:12;fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect136" />
+ <rect
+ width="291.837"
+ height="57.0074"
+ x="13.9703"
+ y="16.2302"
+ style="font-size:12;fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect126" />
+ <g
+ transform="matrix(0.326107,0,0,0.765831,9.59261,8.98517)"
+ style="font-size:12;"
+ id="g161">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect137" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect132" />
+ </g>
+ <g
+ transform="matrix(1.02406,0,0,0.652953,0.223384,39.9254)"
+ style="font-size:12;"
+ id="g164">
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="16.6979"
+ y="222.966"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect138" />
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="14.7335"
+ y="221.002"
+ transform="translate(-1.30962,-1.30992)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect133" />
+ </g>
+ <g
+ transform="matrix(0.449834,0,0,0.338463,-3.15909,9.73319)"
+ style="font-size:12;"
+ id="g167">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect134" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect135" />
+ </g>
+ <text
+ x="302.277679"
+ y="65.943230"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text183">
+ <tspan
+ x="302.277954"
+ y="65.943184"
+ id="tspan360">
+Application</tspan>
+ </text>
+ <text
+ x="36.235924"
+ y="63.796055"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:14;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text188">
+ <tspan
+ x="36.235950"
+ y="63.796051"
+ id="tspan427">
+Transient Objects</tspan>
+ </text>
+ <text
+ x="180.416245"
+ y="290.543701"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:18;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text197">
+ <tspan
+ x="180.415939"
+ y="290.543549"
+ id="tspan421">
+Database</tspan>
+ </text>
+ <text
+ x="25.037701"
+ y="179.154755"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text216">
+ <tspan
+ x="25.037655"
+ y="179.154648"
+ id="tspan384">
+SessionFactory</tspan>
+ </text>
+ <g
+ transform="matrix(0.252763,0,0,0.765831,109.104,8.98517)"
+ style="font-size:12;"
+ id="g386">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect387" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect388" />
+ </g>
+ <g
+ transform="matrix(0.297394,0,0,0.572692,101.502,21.6359)"
+ style="font-size:12;"
+ id="g364">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect365" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect366" />
+ </g>
+ <text
+ x="202.746506"
+ y="102.992203"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:14;font-weight:normal;stroke-width:1pt;font-family:Helvetica;text-anchor:middle;"
+ id="text367">
+ <tspan
+ x="202.746948"
+ y="102.992249"
+ id="tspan423">
+Persistent</tspan>
+ <tspan
+ x="202.746948"
+ y="116.992355"
+ id="tspan425">
+Objects</tspan>
+ </text>
+ <text
+ x="174.458496"
+ y="180.080795"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text389">
+ <tspan
+ x="174.458618"
+ y="180.080338"
+ id="tspan392">
+Session</tspan>
+ </text>
+ <g
+ transform="matrix(0.127369,0,0,0.765831,188.675,8.98517)"
+ style="font-size:12;"
+ id="g394">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect395" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect396" />
+ </g>
+ <text
+ x="260.413269"
+ y="179.154739"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text397">
+ <tspan
+ x="260.412964"
+ y="179.154343"
+ id="tspan400">
+JDBC</tspan>
+ </text>
+ <g
+ transform="matrix(0.127369,0,0,0.765831,229.156,8.98517)"
+ style="font-size:12;"
+ id="g405">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect406" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect407" />
+ </g>
+ <text
+ x="320.606903"
+ y="179.154739"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text408">
+ <tspan
+ x="320.606964"
+ y="179.154343"
+ id="tspan417">
+JNDI</tspan>
+ </text>
+ <g
+ transform="matrix(0.127369,0,0,0.765831,269.281,8.98517)"
+ style="font-size:12;"
+ id="g411">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect412" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect413" />
+ </g>
+ <text
+ x="377.096313"
+ y="179.154739"
+ transform="scale(0.73778,0.73778)"
+ style="font-size:16;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text414">
+ <tspan
+ x="377.096008"
+ y="179.154999"
+ id="tspan145">
+JTA</tspan>
+ </text>
+</svg>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.gif (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/overview.gif)
===================================================================
(Binary files differ)
Property changes on: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.svg (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/images/overview.svg)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.svg (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/resources/shared/images/overview.svg 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,250 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
+"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"
+[
+ <!ATTLIST svg
+ xmlns:xlink CDATA #FIXED "http://www.w3.org/1999/xlink">
+]>
+<!-- Created with Sodipodi ("http://www.sodipodi.com/") -->
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ width="248.031"
+ height="248.031"
+ id="svg1">
+ <defs
+ id="defs3">
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad">
+ <stop
+ style="stop-color:#000000;stop-opacity:1;"
+ offset="0"
+ id="stop128" />
+ <stop
+ style="stop-color:#ffffff;stop-opacity:1;"
+ offset="1"
+ id="stop129" />
+ </linearGradient>
+ <linearGradient
+ x1="0"
+ y1="0"
+ x2="1"
+ y2="0"
+ id="linearGradient130"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ <radialGradient
+ cx="0.5"
+ cy="0.5"
+ fx="0.5"
+ fy="0.5"
+ r="0.5"
+ id="radialGradient131"
+ xlink:href="#linearGradient127"
+ gradientUnits="objectBoundingBox"
+ spreadMethod="pad" />
+ </defs>
+ <g
+ transform="matrix(0.771934,0,0,0.771934,4.36019,-3.02123)"
+ style="font-size:12;"
+ id="g158">
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="16.6979"
+ y="17.3527"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect136" />
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="14.7335"
+ y="15.3883"
+ transform="translate(-1.30962,-1.30992)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect126" />
+ </g>
+ <g
+ transform="matrix(0.771934,0,0,0.771934,4.36019,3.04452)"
+ style="font-size:12;"
+ id="g161">
+ <rect
+ width="285.502"
+ height="118.523"
+ x="16.6979"
+ y="99.2053"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect137" />
+ <rect
+ width="285.502"
+ height="118.523"
+ x="13.4238"
+ y="95.9309"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect132" />
+ </g>
+ <g
+ transform="matrix(0.771934,0,0,0.771934,4.36019,8.0993)"
+ style="font-size:12;"
+ id="g164">
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="16.6979"
+ y="222.966"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect138" />
+ <rect
+ width="285.502"
+ height="77.2688"
+ x="14.7335"
+ y="221.002"
+ transform="translate(-1.30962,-1.30992)"
+ style="fill:#d2d2d2;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect133" />
+ </g>
+ <g
+ transform="matrix(0.771934,0,0,0.543505,2.59104,21.1103)"
+ style="font-size:12;"
+ id="g167">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect134" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect135" />
+ </g>
+ <text
+ x="105.392174"
+ y="56.568123"
+ transform="scale(0.771934,0.771934)"
+ style="font-size:24;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text183">
+ <tspan
+ x="105.392273"
+ y="56.568146"
+ id="tspan186">
+Application</tspan>
+ </text>
+ <text
+ x="81.820183"
+ y="103.149330"
+ transform="scale(0.771934,0.771934)"
+ style="font-size:20;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text188">
+ <tspan
+ x="81.820213"
+ y="103.149727"
+ id="tspan206">
+Persistent Objects</tspan>
+ </text>
+ <text
+ x="111.548180"
+ y="278.927887"
+ transform="scale(0.771934,0.771934)"
+ style="font-size:24;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text197">
+ <tspan
+ x="111.547874"
+ y="278.927551"
+ id="tspan200">
+Database</tspan>
+ </text>
+ <text
+ x="94.436180"
+ y="153.805740"
+ transform="scale(0.771934,0.771934)"
+ style="font-size:24;font-weight:normal;stroke-width:1pt;font-family:Helvetica;"
+ id="text216">
+ <tspan
+ x="94.436180"
+ y="153.805740"
+ id="tspan221">
+HIBERNATE</tspan>
+ </text>
+ <g
+ transform="matrix(0.771934,0,0,0.771934,2.59083,1.02261)"
+ style="font-size:12;"
+ id="g254">
+ <g
+ transform="translate(4.58374,2.61928)"
+ id="g176">
+ <g
+ transform="matrix(0.571429,0,0,0.67347,-10.6174,117.093)"
+ id="g170">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect171" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect172" />
+ </g>
+ <g
+ transform="matrix(0.571429,0,0,0.67347,138.682,117.093)"
+ id="g173">
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="61.8805"
+ y="68.4288"
+ style="fill:#757575;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect174" />
+ <rect
+ width="199.065"
+ height="61.5532"
+ x="59.2613"
+ y="65.8095"
+ style="fill:#e0e0e0;fill-rule:evenodd;stroke-width:1pt;"
+ id="rect175" />
+ </g>
+ </g>
+ <text
+ x="47.259438"
+ y="182.367538"
+ style="font-weight:bold;stroke-width:1pt;font-family:Courier;"
+ id="text191">
+ <tspan
+ x="47.259399"
+ y="182.367996"
+ id="tspan212">
+hibernate.</tspan>
+ <tspan
+ x="47.259399"
+ y="194.367996"
+ id="tspan214">
+properties</tspan>
+ </text>
+ <text
+ x="198.523010"
+ y="188.260941"
+ style="font-weight:normal;stroke-width:1pt;font-family:helvetica;"
+ id="text194">
+ <tspan
+ id="tspan195">
+XML Mapping</tspan>
+ </text>
+ </g>
+</svg>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/styles/fopdf.xsl)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/fopdf.xsl 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,518 @@
+<?xml version="1.0"?>
+
+<!--
+
+ This is the XSL FO configuration file for the Hibernate
+ Reference Documentation. It defines a custom titlepage and
+ the parameters for the A4 sized PDF printable output.
+
+ It took me days to figure out this stuff and fix most of
+ the obvious bugs in the DocBook XSL distribution. Some of
+ the workarounds might not be appropriate with a newer version
+ of DocBook XSL. This file is released as part of Hibernate,
+ hence LGPL licensed.
+
+ christian(a)hibernate.org
+
+-->
+
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ exclude-result-prefixes="#default">
+
+ <xsl:import href="urn:docbkx:stylesheet" />
+
+ <!--###################################################
+ Custom Title Page
+ ################################################### -->
+
+ <xsl:param name="book.titlepage.img">1</xsl:param>
+ <xsl:template name="book.titlepage.recto">
+ <fo:block>
+ <fo:table table-layout="fixed" width="175mm">
+ <fo:table-column column-width="175mm"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell text-align="center">
+ <fo:block>
+ <fo:external-graphic content-height="1.2cm">
+ <xsl:attribute name="src">
+ <xsl:call-template name="fo-external-image">
+ <xsl:with-param name="filename" select="$book.titlepage.img"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ </fo:external-graphic>
+ </fo:block>
+ <fo:block font-family="Helvetica" font-size="18pt" padding-before="10mm">
+ <xsl:value-of select="bookinfo/subtitle"/>
+ </fo:block>
+ <fo:block font-family="Helvetica" font-size="12pt" padding="10mm">
+ Version:
+ <xsl:value-of select="bookinfo/releaseinfo"/>
+ </fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:block>
+ </xsl:template>
+
+ <!-- Prevent blank pages in output -->
+ <xsl:template name="book.titlepage.before.verso">
+ </xsl:template>
+ <xsl:template name="book.titlepage.verso">
+ </xsl:template>
+ <xsl:template name="book.titlepage.separator">
+ </xsl:template>
+
+ <!--###################################################
+ Header
+ ################################################### -->
+
+ <!-- More space in the center header for long text -->
+ <xsl:attribute-set name="header.content.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$body.font.family"/>
+ </xsl:attribute>
+ <xsl:attribute name="margin-left">-5em</xsl:attribute>
+ <xsl:attribute name="margin-right">-5em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Custom Footer
+ ################################################### -->
+
+ <!-- This footer prints the Hibernate version number on the left side -->
+ <xsl:template name="footer.content">
+ <xsl:param name="pageclass" select="''"/>
+ <xsl:param name="sequence" select="''"/>
+ <xsl:param name="position" select="''"/>
+ <xsl:param name="gentext-key" select="''"/>
+
+ <xsl:variable name="Version">
+ <xsl:choose>
+ <xsl:when test="//releaseinfo">
+ <xsl:text>Hibernate </xsl:text>
+ <xsl:value-of select="//releaseinfo"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- nop -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$sequence='blank'">
+ <xsl:choose>
+ <xsl:when test="$double.sided != 0 and $position = 'left'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided = 0 and $position = 'center'">
+ <!-- nop -->
+ </xsl:when>
+
+ <xsl:otherwise>
+ <fo:page-number/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:when>
+
+ <xsl:when test="$pageclass='titlepage'">
+ <!-- nop: other titlepage sequences have no footer -->
+ </xsl:when>
+
+ <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='left'">
+ <fo:page-number/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='right'">
+ <fo:page-number/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided = 0 and $position='right'">
+ <fo:page-number/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided != 0 and $sequence = 'odd' and $position='left'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided != 0 and $sequence = 'even' and $position='right'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+
+ <xsl:when test="$double.sided = 0 and $position='left'">
+ <xsl:value-of select="$Version"/>
+ </xsl:when>
+
+ <xsl:otherwise>
+ <!-- nop -->
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+
+ <!--###################################################
+ Custom Toc Line
+ ################################################### -->
+
+ <!-- Improve the TOC. -->
+ <xsl:template name="toc.line">
+ <xsl:variable name="id">
+ <xsl:call-template name="object.id"/>
+ </xsl:variable>
+
+ <xsl:variable name="label">
+ <xsl:apply-templates select="." mode="label.markup"/>
+ </xsl:variable>
+
+ <fo:block text-align-last="justify"
+ end-indent="{$toc.indent.width}pt"
+ last-line-end-indent="-{$toc.indent.width}pt">
+ <fo:inline keep-with-next.within-line="always">
+ <fo:basic-link internal-destination="{$id}">
+
+ <!-- Chapter titles should be bold. -->
+ <xsl:choose>
+ <xsl:when test="local-name(.) = 'chapter'">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ </xsl:when>
+ </xsl:choose>
+
+ <xsl:if test="$label != ''">
+ <xsl:copy-of select="$label"/>
+ <xsl:value-of select="$autotoc.label.separator"/>
+ </xsl:if>
+ <xsl:apply-templates select="." mode="titleabbrev.markup"/>
+ </fo:basic-link>
+ </fo:inline>
+ <fo:inline keep-together.within-line="always">
+ <xsl:text> </xsl:text>
+ <fo:leader leader-pattern="dots"
+ leader-pattern-width="3pt"
+ leader-alignment="reference-area"
+ keep-with-next.within-line="always"/>
+ <xsl:text> </xsl:text>
+ <fo:basic-link internal-destination="{$id}">
+ <fo:page-number-citation ref-id="{$id}"/>
+ </fo:basic-link>
+ </fo:inline>
+ </fo:block>
+ </xsl:template>
+
+ <!--###################################################
+ Extensions
+ ################################################### -->
+
+ <!-- These extensions are required for table printing and other stuff -->
+ <xsl:param name="use.extensions">1</xsl:param>
+ <xsl:param name="tablecolumns.extension">0</xsl:param>
+ <!-- FOP provide only PDF Bookmarks at the moment -->
+ <xsl:param name="fop.extensions">1</xsl:param>
+
+ <!--###################################################
+ Table Of Contents
+ ################################################### -->
+
+ <!-- Generate the TOCs for named components only -->
+ <xsl:param name="generate.toc">
+ book toc
+ </xsl:param>
+
+ <!-- Show only Sections up to level 3 in the TOCs -->
+ <xsl:param name="toc.section.depth">3</xsl:param>
+
+ <!-- Dot and Whitespace as separator in TOC between Label and Title-->
+ <xsl:param name="autotoc.label.separator" select="'. '"/>
+
+
+ <!--###################################################
+ Paper & Page Size
+ ################################################### -->
+
+ <!-- Paper type, no headers on blank pages, no double sided printing -->
+ <xsl:param name="paper.type" select="'A4'"/>
+ <xsl:param name="double.sided">0</xsl:param>
+ <xsl:param name="headers.on.blank.pages">0</xsl:param>
+ <xsl:param name="footers.on.blank.pages">0</xsl:param>
+
+ <!-- Space between paper border and content (chaotic stuff, don't touch) -->
+ <xsl:param name="page.margin.top">5mm</xsl:param>
+ <xsl:param name="region.before.extent">10mm</xsl:param>
+ <xsl:param name="body.margin.top">10mm</xsl:param>
+
+ <xsl:param name="body.margin.bottom">15mm</xsl:param>
+ <xsl:param name="region.after.extent">10mm</xsl:param>
+ <xsl:param name="page.margin.bottom">0mm</xsl:param>
+
+ <xsl:param name="page.margin.outer">18mm</xsl:param>
+ <xsl:param name="page.margin.inner">18mm</xsl:param>
+
+ <!-- No intendation of Titles -->
+ <xsl:param name="title.margin.left">0pc</xsl:param>
+
+ <!--###################################################
+ Fonts & Styles
+ ################################################### -->
+
+ <!-- Default Font size -->
+ <xsl:param name="body.font.master">11</xsl:param>
+
+ <!-- Line height in body text -->
+ <xsl:param name="line-height">1.4</xsl:param>
+
+ <!-- Monospaced fonts are smaller than regular text -->
+ <xsl:attribute-set name="monospace.properties">
+ <xsl:attribute name="font-family">
+ <xsl:value-of select="$monospace.font.family"/>
+ </xsl:attribute>
+ <xsl:attribute name="font-size">0.8em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Tables
+ ################################################### -->
+
+ <!-- The table width should be adapted to the paper size -->
+ <xsl:param name="default.table.width">17.4cm</xsl:param>
+
+ <!-- Some padding inside tables -->
+ <xsl:attribute-set name="table.cell.padding">
+ <xsl:attribute name="padding-left">4pt</xsl:attribute>
+ <xsl:attribute name="padding-right">4pt</xsl:attribute>
+ <xsl:attribute name="padding-top">4pt</xsl:attribute>
+ <xsl:attribute name="padding-bottom">4pt</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Only hairlines as frame and cell borders in tables -->
+ <xsl:param name="table.frame.border.thickness">0.1pt</xsl:param>
+ <xsl:param name="table.cell.border.thickness">0.1pt</xsl:param>
+
+ <!--###################################################
+ Labels
+ ################################################### -->
+
+ <!-- Label Chapters and Sections (numbering) -->
+ <xsl:param name="chapter.autolabel">1</xsl:param>
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+
+ <!-- Label only Sections up to level 2 -->
+ <xsl:param name="local.l10n.xml" select="document('')"/>
+ <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">
+ <l:l10n language="en">
+ <l:context name="title-numbered">
+ <l:template name="sect3" text="%t"/>
+ <l:template name="sect4" text="%t"/>
+ <l:template name="sect5" text="%t"/>
+ </l:context>
+ <l:context name="section-xref-numbered">
+ <l:template name="sect3" text="the section called %t"/>
+ <l:template name="sect4" text="the section called %t"/>
+ <l:template name="sect5" text="the section called %t"/>
+ </l:context>
+ </l:l10n>
+ </l:i18n>
+
+ <!--###################################################
+ Titles
+ ################################################### -->
+
+ <!-- Chapter title size -->
+ <xsl:attribute-set name="chapter.titlepage.recto.style">
+ <xsl:attribute name="text-align">left</xsl:attribute>
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.8"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Why is the font-size for chapters hardcoded in the XSL FO templates?
+ Let's remove it, so this sucker can use our attribute-set only... -->
+ <xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
+ <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
+ xsl:use-attribute-sets="chapter.titlepage.recto.style">
+ <xsl:call-template name="component.title">
+ <xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
+ </xsl:call-template>
+ </fo:block>
+ </xsl:template>
+
+ <!-- Sections 1, 2 and 3 titles have a small bump factor and padding -->
+ <xsl:attribute-set name="section.title.level1.properties">
+ <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.5"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="section.title.level2.properties">
+ <xsl:attribute name="space-before.optimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.6em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.25"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+ <xsl:attribute-set name="section.title.level3.properties">
+ <xsl:attribute name="space-before.optimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.4em</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master * 1.0"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Titles of formal objects (tables, examples, ...) -->
+ <xsl:attribute-set name="formal.title.properties" use-attribute-sets="normal.para.spacing">
+ <xsl:attribute name="font-weight">bold</xsl:attribute>
+ <xsl:attribute name="font-size">
+ <xsl:value-of select="$body.font.master"/>
+ <xsl:text>pt</xsl:text>
+ </xsl:attribute>
+ <xsl:attribute name="hyphenate">false</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.4em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.6em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.8em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Programlistings
+ ################################################### -->
+
+ <!-- Verbatim text formatting (programlistings) -->
+ <xsl:attribute-set name="verbatim.properties">
+ <xsl:attribute name="space-before.minimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.optimum">1em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ <xsl:attribute name="border-color">#444444</xsl:attribute>
+ <xsl:attribute name="border-style">solid</xsl:attribute>
+ <xsl:attribute name="border-width">0.1pt</xsl:attribute>
+ <xsl:attribute name="padding-top">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-left">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-right">0.5em</xsl:attribute>
+ <xsl:attribute name="padding-bottom">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-left">0.5em</xsl:attribute>
+ <xsl:attribute name="margin-right">0.5em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Shade (background) programlistings -->
+ <xsl:param name="shade.verbatim">1</xsl:param>
+ <xsl:attribute-set name="shade.verbatim.style">
+ <xsl:attribute name="background-color">#F0F0F0</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!--###################################################
+ Callouts
+ ################################################### -->
+
+ <!-- We want to use callouts... -->
+ <xsl:param name="callout.extensions">1</xsl:param>
+
+ <!-- Place callout bullets at this column in programmlisting.-->
+ <xsl:param name="callout.defaultcolumn">90</xsl:param>
+
+ <!--
+ No, don't use crappy graphics for the callout bullets. This setting
+ enables some weird Unicode rendering for some fancy bullet points
+ in callouts. By default, this can only count to 10 and produces
+ strange results if you ever have more than 10 callouts for one
+ programlisting. We will fix that next.
+ -->
+ <xsl:param name="callout.graphics">0</xsl:param>
+
+ <!--
+ Again, fun with DocBook XSL: The callout bullets are rendered in
+ two places: In the programlisting itself and in the list below
+ the listing, with the actual callout text. The rendering in the
+ programlisting is some XSL transformer extension (e.g. a Saxon
+ extension), so we can't change that without messing with the
+ extensions. We only can turn it off by setting this limit to
+ zero, then, a simple bracket style like "(3)" and "(4)" will
+ be used in the programlisting.
+ -->
+ <xsl:param name="callout.unicode.number.limit" select="'0'"></xsl:param>
+
+ <!--
+ The callout bullets in the actual callout list will be rendered
+ with an XSL FO template. The default template is broken: limited to 10
+ nice looking Unicode bullet points and then it doesn't print anything,
+ the fallback doesn't work. We implement our own template, which is not
+ as complicated, more ugly, but works. As always, function is more
+ important than form.
+ -->
+ <xsl:template name="callout-bug">
+ <xsl:param name="conum" select='1'/>
+ <fo:inline
+ color="black"
+ padding-top="0.1em"
+ padding-bottom="0.1em"
+ padding-start="0.2em"
+ padding-end="0.2em"
+ baseline-shift="0.1em"
+ font-family="{$monospace.font.family}"
+ font-weight="bold"
+ font-size="75%">
+ <xsl:text>(</xsl:text>
+ <xsl:value-of select="$conum"/>
+ <xsl:text>)</xsl:text>
+ </fo:inline>
+
+ </xsl:template>
+
+ <!--###################################################
+ Misc
+ ################################################### -->
+
+ <!-- Correct placement of titles for figures and examples. -->
+ <xsl:param name="formal.title.placement">
+ figure after
+ example before
+ equation before
+ table before
+ procedure before
+ </xsl:param>
+
+ <!-- Format Variable Lists as Blocks (prevents horizontal overflow). -->
+ <xsl:param name="variablelist.as.blocks">1</xsl:param>
+
+ <!-- The horrible list spacing problems, this is much better. -->
+ <xsl:attribute-set name="list.block.spacing">
+ <xsl:attribute name="space-before.optimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.minimum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-before.maximum">0.8em</xsl:attribute>
+ <xsl:attribute name="space-after.optimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.minimum">0.1em</xsl:attribute>
+ <xsl:attribute name="space-after.maximum">0.1em</xsl:attribute>
+ </xsl:attribute-set>
+
+ <!-- Newer DocBook XSL apparently thinks that some sections are by
+ default "draft" status, and this idiotic thing is by default
+ also set to "maybe", so it spits out a lot of errors with the
+ latest FOP as the XSL/FO styles have references to some draft
+ watermarks, which you actually don't want in the first place.
+ Turn this crap off. If you have to work with the "status"
+ attribute, don't.
+ -->
+ <xsl:param name="draft.mode" select="'no'"/>
+
+</xsl:stylesheet>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/styles/html.xsl)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html.xsl 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+
+<!--
+
+ This is the XSL HTML configuration file for the Hibernate
+ Reference Documentation.
+
+ It took me days to figure out this stuff and fix most of
+ the obvious bugs in the DocBook XSL distribution. Some of
+ the workarounds might not be appropriate with a newer version
+ of DocBook XSL. This file is released as part of Hibernate,
+ hence LGPL licensed.
+
+ christian(a)hibernate.org
+-->
+
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY db_xsl_path "../../support/docbook-xsl/">
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ xmlns="http://www.w3.org/TR/xhtml1/transitional"
+ exclude-result-prefixes="#default">
+
+<xsl:import href="&db_xsl_path;/html/docbook.xsl"/>
+
+<!--###################################################
+ HTML Settings
+ ################################################### -->
+
+ <xsl:param name="html.stylesheet">../shared/css/html.css</xsl:param>
+
+ <!-- These extensions are required for table printing and other stuff -->
+ <xsl:param name="use.extensions">1</xsl:param>
+ <xsl:param name="tablecolumns.extension">0</xsl:param>
+ <xsl:param name="callout.extensions">1</xsl:param>
+ <xsl:param name="graphicsize.extension">0</xsl:param>
+
+<!--###################################################
+ Table Of Contents
+ ################################################### -->
+
+ <!-- Generate the TOCs for named components only -->
+ <xsl:param name="generate.toc">
+ book toc
+ </xsl:param>
+
+ <!-- Show only Sections up to level 3 in the TOCs -->
+ <xsl:param name="toc.section.depth">3</xsl:param>
+
+<!--###################################################
+ Labels
+ ################################################### -->
+
+ <!-- Label Chapters and Sections (numbering) -->
+ <xsl:param name="chapter.autolabel">1</xsl:param>
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+
+<!--###################################################
+ Callouts
+ ################################################### -->
+
+ <!-- Don't use graphics, use a simple number style -->
+ <xsl:param name="callout.graphics">0</xsl:param>
+
+ <!-- Place callout marks at this column in annotated areas -->
+ <xsl:param name="callout.defaultcolumn">90</xsl:param>
+
+<!--###################################################
+ Misc
+ ################################################### -->
+
+ <!-- Placement of titles -->
+ <xsl:param name="formal.title.placement">
+ figure after
+ example before
+ equation before
+ table before
+ procedure before
+ </xsl:param>
+
+</xsl:stylesheet>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/styles/html_chunk.xsl)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/standard/style/html_chunk.xsl 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,86 @@
+<?xml version="1.0"?>
+
+<!--
+
+ This is the XSL HTML configuration file for the Hibernate
+ Reference Documentation.
+
+ It took me days to figure out this stuff and fix most of
+ the obvious bugs in the DocBook XSL distribution. Some of
+ the workarounds might not be appropriate with a newer version
+ of DocBook XSL. This file is released as part of Hibernate,
+ hence LGPL licensed.
+
+ christian(a)hibernate.org
+-->
+
+<!DOCTYPE xsl:stylesheet [
+ <!ENTITY db_xsl_path "../../support/docbook-xsl/">
+]>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ version="1.0"
+ xmlns="http://www.w3.org/TR/xhtml1/transitional"
+ exclude-result-prefixes="#default">
+
+<xsl:import href="&db_xsl_path;/html/chunk.xsl"/>
+
+<!--###################################################
+ HTML Settings
+ ################################################### -->
+
+ <xsl:param name="chunk.section.depth">'5'</xsl:param>
+ <xsl:param name="use.id.as.filename">'1'</xsl:param>
+ <xsl:param name="html.stylesheet">../shared/css/html.css</xsl:param>
+
+ <!-- These extensions are required for table printing and other stuff -->
+ <xsl:param name="use.extensions">1</xsl:param>
+ <xsl:param name="tablecolumns.extension">0</xsl:param>
+ <xsl:param name="callout.extensions">1</xsl:param>
+ <xsl:param name="graphicsize.extension">0</xsl:param>
+
+<!--###################################################
+ Table Of Contents
+ ################################################### -->
+
+ <!-- Generate the TOCs for named components only -->
+ <xsl:param name="generate.toc">
+ book toc
+ </xsl:param>
+
+ <!-- Show only Sections up to level 3 in the TOCs -->
+ <xsl:param name="toc.section.depth">3</xsl:param>
+
+<!--###################################################
+ Labels
+ ################################################### -->
+
+ <!-- Label Chapters and Sections (numbering) -->
+ <xsl:param name="chapter.autolabel">1</xsl:param>
+ <xsl:param name="section.autolabel" select="1"/>
+ <xsl:param name="section.label.includes.component.label" select="1"/>
+
+<!--###################################################
+ Callouts
+ ################################################### -->
+
+ <!-- Don't use graphics, use a simple number style -->
+ <xsl:param name="callout.graphics">0</xsl:param>
+
+ <!-- Place callout marks at this column in annotated areas -->
+ <xsl:param name="callout.defaultcolumn">90</xsl:param>
+
+<!--###################################################
+ Misc
+ ################################################### -->
+
+ <!-- Placement of titles -->
+ <xsl:param name="formal.title.placement">
+ figure after
+ example before
+ equation before
+ table before
+ procedure before
+ </xsl:param>
+
+</xsl:stylesheet>
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/en/master.xml (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/en/master.xml)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/en/master.xml (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/test/resources/org/jboss/maven/docbook/gen/translations/en/master.xml 2007-05-03 07:25:50 UTC (rev 11461)
@@ -0,0 +1,124 @@
+<?xml version='1.0' encoding="iso-8859-1"?>
+
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+<!ENTITY version "(undefined)">
+]>
+
+<book lang="en">
+
+ <bookinfo>
+ <title>HIBERNATE - Relational Persistence for Idiomatic Java</title>
+ <subtitle>Hibernate Reference Documentation</subtitle>
+ <releaseinfo>&version;</releaseinfo>
+ </bookinfo>
+
+ <toc/>
+
+ <preface id="preface" revision="2">
+ <title>Preface</title>
+
+ <para>
+ Working with object-oriented software and a relational database can be cumbersome
+ and time consuming in today's enterprise environments. Hibernate is an object/relational
+ mapping tool for Java environments. The term object/relational mapping (ORM) refers to
+ the technique of mapping a data representation from an object model to a relational
+ data model with a SQL-based schema.
+ </para>
+
+ <para>
+ Hibernate not only takes care of the mapping from Java classes to
+ database tables (and from Java data types to SQL data types), but also provides data
+ query and retrieval facilities and can significantly reduce development time otherwise
+ spent with manual data handling in SQL and JDBC.
+ </para>
+
+ <para>
+ Hibernates goal is to relieve the developer from 95 percent of common data persistence
+ related programming tasks. Hibernate may not be the best solution for data-centric
+ applications that only use stored-procedures to implement the business logic in the
+ database, it is most useful with object-oriented domain models and business logic in
+ the Java-based middle-tier. However, Hibernate can certainly help you to remove or
+ encapsulate vendor-specific SQL code and will help with the common task of result set
+ translation from a tabular representation to a graph of objects.
+ </para>
+
+ <para>
+ If you are new to Hibernate and Object/Relational Mapping or even Java,
+ please follow these steps:
+ </para>
+
+ <orderedlist>
+ <listitem>
+ <para>
+ Read <xref linkend="tutorial"/> for a tutorial with step-by-step
+ instructions. The source code for the tutorial is included in the
+ distribution in the <literal>doc/reference/tutorial/</literal>
+ directory.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Read <xref linkend="architecture"/> to understand the environments where
+ Hibernate can be used.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Have a look at the <literal>eg/</literal> directory in the Hibernate
+ distribution, it contains a simple standalone application. Copy your
+ JDBC driver to the <literal>lib/</literal> directory and edit
+ <literal>etc/hibernate.properties</literal>, specifying correct values for
+ your database. From a command prompt in the distribution directory,
+ type <literal>ant eg</literal> (using Ant), or under Windows, type
+ <literal>build eg</literal>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Use this reference documentation as your primary source of information.
+ Consider reading <emphasis>Hibernate in Action</emphasis>
+ (http://www.manning.com/bauer) if you need more help with application
+ design or if you prefer a step-by-step tutorial. Also visit
+ http://caveatemptor.hibernate.org and download the example application
+ for Hibernate in Action.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ FAQs are answered on the Hibernate website.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Third party demos, examples, and tutorials are linked on the Hibernate
+ website.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The Community Area on the Hibernate website is a good resource for
+ design patterns and various integration solutions (Tomcat, JBoss AS,
+ Struts, EJB, etc.).
+ </para>
+ </listitem>
+ </orderedlist>
+
+ <para>
+ If you have questions, use the user forum linked on the Hibernate website. We also
+ provide a JIRA issue trackings system for bug reports and feature requests. If you
+ are interested in the development of Hibernate, join the developer mailing list. If
+ you are interested in translating this documentation into your language, contact us
+ on the developer mailing list.
+ </para>
+
+ <para>
+ Commercial development support, production support, and training for Hibernate is
+ available through JBoss Inc. (see http://www.hibernate.org/SupportTraining/).
+ Hibernate is a Professional Open Source project and a critical component of the
+ JBoss Enterprise Middleware System (JEMS) suite of products.
+ </para>
+
+ </preface>
+
+</book>
+
17 years, 9 months
Hibernate SVN: r11460 - in trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook: gen and 3 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2007-05-03 03:24:48 -0400 (Thu, 03 May 2007)
New Revision: 11460
Added:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Entity.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Format.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Settings.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translation.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/Formatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/HtmlFormatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/MainRenderer.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/PdfFormatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/RenderingException.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardDocBookFormatType.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardFormatterFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/ResolverContext.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerType.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java
Removed:
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Entity.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Format.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/GenerationMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Rendition.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/RevisionDiffMojo.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Translation.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Configuration.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Formatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterSupport.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/HtmlFormatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/PdfFormatter.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Renderer.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/RenderingException.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/StandardFormatterFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerFactory.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerType.java
trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translator.java
Log:
refactoring
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Entity.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Entity.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Entity.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,19 +0,0 @@
-package org.jboss.maven.docbook;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Entity extends com.agilejava.docbkx.maven.Entity {
-
- public Entity() {
- super();
- }
-
- public Entity(String name, String value) {
- super();
- setName( name );
- setValue( value );
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Format.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Format.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Format.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,57 +0,0 @@
-package org.jboss.maven.docbook;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Format {
- private String type;
- private String stylesheet;
- private boolean styleSheetRelativeToTranslation;
- private boolean chunkedOutput;
- private String formatDirectory; // relative to translationDirectory...
- private String finalName;
-
- public Format() {
- }
-
- public Format(
- String type,
- String stylesheet,
- boolean styleSheetRelativeToTranslation,
- boolean chunkedOutput,
- String formatDirectory,
- String finalName) {
- this.type = type;
- this.stylesheet = stylesheet;
- this.styleSheetRelativeToTranslation = styleSheetRelativeToTranslation;
- this.chunkedOutput = chunkedOutput;
- this.formatDirectory = formatDirectory;
- this.finalName = finalName;
- }
-
- public String getType() {
- return type;
- }
-
- public String getStylesheet() {
- return stylesheet;
- }
-
- public boolean isStyleSheetRelativeToTranslation() {
- return styleSheetRelativeToTranslation;
- }
-
- public boolean isChunkedOutput() {
- return chunkedOutput;
- }
-
- public String getFormatDirectory() {
- return formatDirectory;
- }
-
- public String getFinalName() {
- return finalName;
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/GenerationMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/GenerationMojo.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/GenerationMojo.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,194 +0,0 @@
-package org.jboss.maven.docbook;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.jboss.maven.docbook.gen.Configuration;
-import org.jboss.maven.docbook.gen.Renderer;
-import org.jboss.maven.docbook.gen.RenderingException;
-import org.jboss.maven.docbook.gen.FormatterFactory;
-import org.jboss.maven.docbook.gen.StandardFormatterFactory;
-import org.jboss.maven.docbook.gen.TransformerType;
-
-/**
- * A DocBook plugin based on the excellent docbkx-maven-plugin, but which
- * specifically handles language translations in a more transparent way.
- *
- * @goal generate
- *
- * @author Steve Ebersole
- */
-public class GenerationMojo extends AbstractMojo {
-
- /**
- * The directory where the DocBook sources and translations can be found.
- * <b>This should be a directory containing the different translations as
- * subdirectories</b>.
- *
- * @parameter expression="${basedir}/src/main/docbkx"
- */
- private String sourceDirectory;
-
- /**
- * The name of the DocBook source file, relative to the translation
- * directories.
- *
- * @parameter
- * @required
- */
- private String sourceFile;
-
- /**
- * The directory where the image sources can be found.
- * </p>
- * If relative, it is assumed to be relative to sourceDirectory.
- * </p>
- * This names the directory for images for translations which do
- * not define a custom image source directory.
- *
- * @parameter
- */
- private String imageSourceDirectory;
-
- /**
- * The directory where the output will be written. The renditions and
- * translations will be written to directories relative to this parameter
- * using ${targetDirectory}/${language}/${rendition}/
- *
- * @parameter expression="${basedir}/target/docbkx"
- */
- private String targetDirectory;
-
- /**
- * The directory where image are to be copied.
- * <p/>
- * Unspecified means to perform to copying.
- * <p/>
- * If relative, it is assumed to be relative to the output directory for
- * the current translation
- *
- * @parameter
- */
- private String imageTargetDirectory;
-
- /**
- * The translations to be rendered.
- *
- * @parameter
- * @required
- */
- private Translation[] translations;
-
- /**
- * The formats in which to perform rendering.
- *
- * @parameter
- * @required
- */
- private Format[] formats;
-
- /**
- * The configured entity injections.
- *
- * @parameter
- */
- private Entity[] entities;
-
- /**
- * A boolean, indicating if XInclude should be supported.
- *
- * @parameter default="false"
- */
- private boolean xincludeSupported;
-
- /**
- * The implementation of {@link org.jboss.maven.docbook.gen.FormatterFactory}
- * to use.
- *
- * @parameter
- */
- private String formatterFactoryClassName;
-
- /**
- * Which XML transformation library should be used. Both saxon and xalan
- * are supported. saxon is the default as it is generally more robust;
- * also I have problems trying to run either the hibernate or standard
- * docbook stylesheets through xalan...
- *
- * @parameter default="saxon"
- */
- private String xmlTransformerType;
-
- /**
- * Any parameters (DocBook or custom) to be passed to the XSLT transformer.
- *
- * @parameter
- */
- private Properties transformerParameters;
-
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- Configuration configuration = new Configuration(
- new File( sourceDirectory ),
- sourceFile,
- new File( imageSourceDirectory ),
- new File( targetDirectory ),
- new File( imageTargetDirectory ),
- xincludeSupported,
- entities,
- buildFormatterFactory(),
- TransformerType.parse( xmlTransformerType ),
- transformerParameters,
- getLog()
- );
-
- try {
- new Renderer( configuration ).render( translations, formats );
- }
- catch ( RenderingException e ) {
- throw new MojoExecutionException( "error performing DocBook rendering", e );
- }
- }
-
- private FormatterFactory buildFormatterFactory() throws MojoExecutionException {
- if ( formatterFactoryClassName != null ) {
- Class formatterFactoryClass = locateCustomFormatterFactoryClass();
- try {
- return ( FormatterFactory ) formatterFactoryClass.newInstance();
- }
- catch( ClassCastException cce ) {
- throw new MojoExecutionException( "custom formatter factory [" + formatterFactoryClass + "] did not implement factory interface [" + FormatterFactory.class.getName() + "]" );
- }
- catch ( Throwable t ) {
- throw new MojoExecutionException( "could not instantiate custom formatter factory [" + formatterFactoryClass + "]" );
- }
- }
- else {
- return new StandardFormatterFactory();
- }
- }
-
- private Class locateCustomFormatterFactoryClass() throws MojoExecutionException {
- Class formatterFactoryClass = null;
- try {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if ( cl == null ) {
- cl = getClass().getClassLoader();
- }
- formatterFactoryClass = cl.loadClass( formatterFactoryClassName );
- }
- catch( Throwable t ) {
- try {
- formatterFactoryClass = Class.forName( formatterFactoryClassName );
- }
- catch ( Throwable t2 ) {
- throw new MojoExecutionException( "could not locate custom formatter factory [" + formatterFactoryClass + "]" );
- }
- }
- return formatterFactoryClass;
- }
-
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Rendition.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Rendition.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Rendition.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,62 +0,0 @@
-package org.jboss.maven.docbook;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Rendition {
- private String type;
- private String stylesheet;
- private boolean chunkedOutput;
- private String renditionDirectory;
- private String fileExtension;
- private Map finalNameMap = new HashMap();
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getStylesheet() {
- return stylesheet;
- }
-
- public void setStylesheet(String stylesheet) {
- this.stylesheet = stylesheet;
- }
-
- public boolean isChunkedOutput() {
- return chunkedOutput;
- }
-
- public void setChunkedOutput(boolean chunkedOutput) {
- this.chunkedOutput = chunkedOutput;
- }
-
- public String getRenditionDirectory() {
- return renditionDirectory;
- }
-
- public void setRenditionDirectory(String renditionDirectory) {
- this.renditionDirectory = renditionDirectory;
- }
-
- public String getFileExtension() {
- return fileExtension;
- }
-
- public void setFileExtension(String fileExtension) {
- this.fileExtension = fileExtension;
- }
-
- public Map getFinalNameMap() {
- return finalNameMap;
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/RevisionDiffMojo.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/RevisionDiffMojo.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/RevisionDiffMojo.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,101 +0,0 @@
-package org.jboss.maven.docbook;
-
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Properties;
-import java.io.IOException;
-
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.xerces.parsers.SAXParser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.jboss.maven.docbook.revdiff.ModuleElementsExtractor;
-import org.jboss.maven.docbook.revdiff.ModuleElementsComparator;
-import org.jboss.maven.docbook.revdiff.ModuleReportHTML;
-import org.jboss.maven.docbook.revdiff.ModuleReport;
-
-/**
- * A plugin for generating a "revision diff" report across different
- * translations of the same document. This is useful for the translators to
- * know what changes exist between their translation and another.
- *
- * @goal revision-diff
- *
- * @author Christian Bauer
- * @author Steve Ebersole
- */
-public class RevisionDiffMojo extends AbstractMojo {
- /**
- * The translation against which to baseline the diff.
- *
- * @parameter
- * @required
- */
- private String original;
-
- /**
- * The translation to be compared to the master.
- *
- * @parameter
- * @required
- */
- private String copy;
-
- /**
- * The file where the diff report should be written.
- *
- * @parameter default="${build.outputDirectory}/docbkx/revdiff
- * @required
- */
- private String reportFile;
-
- public void execute() throws MojoExecutionException, MojoFailureException {
- Set moduleElements = new HashSet();
- XMLReader parser = generateParser();
- try {
- // Parse original file
- parser.setContentHandler( new ModuleElementsExtractor( moduleElements ) );
- parser.parse( original );
-
- // Parse copy
- parser.setContentHandler( new ModuleElementsComparator( moduleElements ) );
- parser.parse( copy );
-
- // Set properties for HTML report
- Properties props = new Properties();
- props.setProperty( ModuleReportHTML.DESTINATION_FILE, reportFile );
-
- // Generate HTML report
- ModuleReport report = new ModuleReportHTML();
- report.runReport( moduleElements, props );
- }
- catch ( IOException e ) {
- throw new MojoExecutionException( "Files not found : " + original + " or " + copy, e );
-
- }
- catch ( Exception e ) {
- throw new MojoExecutionException( "unable to run revdiff report", e );
- }
-
- }
-
- private XMLReader generateParser() throws MojoExecutionException {
- try {
- 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 MojoExecutionException( "unable to generate SAX Parser", e );
- }
- catch ( SAXNotRecognizedException e ) {
- throw new MojoExecutionException( "unable to generate SAX Parser", e );
- }
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Translation.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Translation.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Translation.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,33 +0,0 @@
-package org.jboss.maven.docbook;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Translation {
- private String language;
- private String stylesheet;
- private String imageSourceDirectory;
-
- public Translation() {
- }
-
- public Translation(String language, String stylesheet, String imageSourceDirectory) {
- this.language = language;
- this.stylesheet = stylesheet;
- this.imageSourceDirectory = imageSourceDirectory;
- }
-
- public String getLanguage() {
- return language;
- }
-
- public String getStylesheet() {
- return stylesheet;
- }
-
- public String getImageSourceDirectory() {
- return imageSourceDirectory;
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Configuration.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Configuration.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Configuration.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,90 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.io.File;
-import java.util.Properties;
-
-import org.jboss.maven.docbook.Entity;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Configuration {
- private final File sourceDirectory;
- private final String source;
- private final File imageSourceDirectory;
- private final File targetDirectory;
- private final File imageTargetDirectory;
- private boolean xincludeSupported;
- private final Entity[] entities;
- private final FormatterFactory formatterFactory;
- private final TransformerFactory transformerFactory;
- private final Log log;
-
-
- public Configuration(
- File sourceDirectory,
- String source,
- File imageSourceDirectory,
- File targetDirectory,
- File imageTargetDirectory,
- boolean xincludeSupported,
- Entity[] entities,
- FormatterFactory formatterFactory,
- TransformerType transformerType,
- Properties transformerParameters,
- Log log) {
- this.sourceDirectory = sourceDirectory;
- this.source = source;
- this.imageSourceDirectory = imageSourceDirectory;
- this.targetDirectory = targetDirectory;
- this.imageTargetDirectory = imageTargetDirectory;
- this.xincludeSupported = xincludeSupported;
- this.entities = entities;
- this.formatterFactory = formatterFactory;
- this.transformerFactory = new TransformerFactory( transformerType, transformerParameters );
- this.log = log;
- }
-
- public File getSourceDirectory() {
- return sourceDirectory;
- }
-
- public String getSource() {
- return source;
- }
-
- public File getImageSourceDirectory() {
- return imageSourceDirectory;
- }
-
- public File getTargetDirectory() {
- return targetDirectory;
- }
-
- public File getImageTargetDirectory() {
- return imageTargetDirectory;
- }
-
- public boolean isXincludeSupported() {
- return xincludeSupported;
- }
-
- public Entity[] getEntities() {
- return entities;
- }
-
- public FormatterFactory getFormatterFactory() {
- return formatterFactory;
- }
-
- public TransformerFactory getTransformerFactory() {
- return transformerFactory;
- }
-
- public Log getLog() {
- return log;
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Entity.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Entity.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Entity.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Entity.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,19 @@
+package org.jboss.maven.docbook.gen;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Entity extends com.agilejava.docbkx.maven.Entity {
+
+ public Entity() {
+ super();
+ }
+
+ public Entity(String name, String value) {
+ super();
+ setName( name );
+ setValue( value );
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Format.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Format.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Format.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Format.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,52 @@
+package org.jboss.maven.docbook.gen;
+
+import java.util.Map;
+
+/**
+ * Defines a format in which to render DocBook source.
+ *
+ * @author Steve Ebersole
+ */
+public class Format {
+ private String formatName;
+ private String stylesheet;
+ private boolean chunkedOutput;
+ private String relativeFormatDirectory;
+ private Map finalNameMap;
+
+ public Format() {
+ }
+
+ public Format(
+ String formatName,
+ String stylesheet,
+ boolean chunkedOutput,
+ String relativeFormatDirectory,
+ Map finalNameMap) {
+ this.formatName = formatName;
+ this.stylesheet = stylesheet;
+ this.chunkedOutput = chunkedOutput;
+ this.relativeFormatDirectory = relativeFormatDirectory;
+ this.finalNameMap = finalNameMap;
+ }
+
+ public String getFormatName() {
+ return formatName;
+ }
+
+ public String getStylesheet() {
+ return stylesheet;
+ }
+
+ public boolean isChunkedOutput() {
+ return chunkedOutput;
+ }
+
+ public String getRelativeFormatDirectory() {
+ return relativeFormatDirectory;
+ }
+
+ public Map getFinalNameMap() {
+ return finalNameMap;
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Formatter.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Formatter.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Formatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,10 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public interface Formatter {
- public void apply() throws RenderingException;
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterFactory.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterFactory.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,12 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import org.jboss.maven.docbook.Format;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public interface FormatterFactory {
- public Formatter buildFormatter(Translator translator, Format format) throws RenderingException;
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterSupport.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterSupport.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterSupport.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,222 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.Enumeration;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.Source;
-import javax.xml.transform.Result;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.parsers.SAXParserFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.jboss.maven.docbook.Format;
-import org.codehaus.plexus.util.FileUtils;
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.apache.xml.resolver.CatalogManager;
-import org.apache.maven.plugin.logging.Log;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
-import com.agilejava.docbkx.maven.InjectingEntityResolver;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public abstract class FormatterSupport implements Formatter {
- 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";
-
- private final CatalogResolver catalogResolver;
- private final Translator translator;
- private final Format format;
-
- public FormatterSupport(Translator translator, Format format) {
- this.translator = translator;
- this.format = format;
- catalogResolver = new CatalogResolver( createCatalogManager() );
- }
-
- public Translator getTranslator() {
- return translator;
- }
-
- public Format getFormat() {
- return format;
- }
-
- protected Log getLog() {
- return translator.getRenderer().getConfiguration().getLog();
- }
-
- protected abstract String getType();
-
- protected abstract Result buildResult(File taretFile) throws RenderingException;
-
- protected abstract URL getDefaultStylesheetUrl();
-
- protected URL getChunkedStyleSheetUrl() {
- return getDefaultStylesheetUrl();
- }
-
- public final void apply() throws RenderingException {
- getLog().debug( "starting formatting [format=" + format.getType() + ", translation=" + translator.getTranslation() + "]" );
-
- String formatDirectoryName = format.getFormatDirectory() != null
- ? format.getFormatDirectory()
- : getType();
-
- String targetFileName = format.getFinalName() != null
- ? format.getFinalName()
- : FileUtils.basename( translator.getTranslationSource().getAbsolutePath() ) + getType();
-
- File formatTargetDirectory = new File( translator.getTranslationTargetDirectory(), formatDirectoryName );
- if ( !formatTargetDirectory.exists() ) {
- FileUtils.mkdir( formatTargetDirectory.getAbsolutePath() );
- }
- File targetFile = new File( formatTargetDirectory, targetFileName );
- if ( targetFile.exists() ) {
- if ( ! targetFile.delete() ) {
- getLog().warn( "unable to clean up previous output file [" + targetFile.getAbsolutePath() + "]" );
- }
- }
- if ( !targetFile.exists() ) {
- try {
- targetFile.createNewFile();
- }
- catch ( IOException e ) {
- throw new RenderingException( "unable to create output file [" + targetFile.getAbsolutePath() + "]", e );
- }
- }
-
- Transformer transformer = buildTransformer( targetFile );
- Source transformationSource = buildSource( translator.getTranslationSource() );
- Result transformationResult = buildResult( targetFile );
- try {
- transformer.transform( transformationSource, transformationResult );
- }
- catch ( TransformerException e ) {
- throw new RenderingException( "unable to perform transformation", e );
- }
- finally {
- releaseResult( transformationResult );
- }
- }
-
- protected void releaseResult(Result transformationResult) {
- // typically nothing to do...
- }
-
- protected Transformer buildTransformer(File targetFile) throws RenderingException {
- URL docbookStyleSheet = format.isChunkedOutput() ? getChunkedStyleSheetUrl() : getDefaultStylesheetUrl();
- URL xsltStyleSheet = getStylesheetURL();
- File imageDirectory = new File( translator.getTranslationSourceDirectory(), "images" ); // todo : configurable
- return translator.getRenderer().getConfiguration()
- .getTransformerFactory()
- .buildTransformer( docbookStyleSheet, xsltStyleSheet, imageDirectory );
- }
-
- private Source buildSource(File sourceFile) throws RenderingException {
- try {
- EntityResolver resolver = catalogResolver;
- if ( translator.getRenderer().getConfiguration().getEntities() != null ) {
- resolver = new InjectingEntityResolver(
- java.util.Arrays.asList( translator.getRenderer().getConfiguration().getEntities() ),
- resolver,
- format.getType(),
- translator.getRenderer().getConfiguration().getLog()
- );
- }
- 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 URL getStylesheetURL() throws RenderingException {
- if ( format.getStylesheet() != null ) {
- try {
- File styleSheetFile = null;
- if ( format.isStyleSheetRelativeToTranslation() ) {
- styleSheetFile = new File( translator.getTranslationSourceDirectory(), format.getStylesheet() );
- getLog().info( "trying to locate custom xslt stylesheet [" + styleSheetFile.getAbsolutePath() + "]" );
- }
- if ( styleSheetFile == null || !styleSheetFile.exists() ) {
- styleSheetFile = new File( format.getStylesheet() );
- getLog().info( "trying to locate custom xslt stylesheet [" + styleSheetFile.getAbsolutePath() + "]" );
- }
- if ( ! styleSheetFile.exists() ) {
- throw new RenderingException( "unable to locate custom stylesheet [" + format.getStylesheet() + "]" );
- }
- return styleSheetFile.toURL();
- }
- catch ( MalformedURLException e ) {
- throw new RenderingException( "unable to locate custom stylesheet [" + format.getStylesheet() + "]", e );
- }
- }
- else {
- return format.isChunkedOutput()
- ? getChunkedStyleSheetUrl()
- : getDefaultStylesheetUrl();
- }
- }
-
- protected CatalogManager createCatalogManager() {
- CatalogManager manager = new CatalogManager();
- manager.setIgnoreMissingProperties(true);
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- StringBuffer builder = new StringBuffer();
- boolean first = true;
- try {
- Enumeration enumeration = classLoader.getResources( "/catalog.xml" );
- while ( enumeration.hasMoreElements() ) {
- if ( !first ) {
- builder.append( ';' );
- }
- else {
- first = false;
- }
- URL resource = ( URL ) enumeration.nextElement();
- builder.append( resource.toExternalForm() );
- }
- }
- catch ( IOException ioe ) {
- // Let's be a little tolerant here.
- getLog().warn( "Failed to search for catalog files." );
- }
- String catalogFiles = builder.toString();
- if ( catalogFiles.length() == 0 ) {
- getLog().warn( "Failed to find catalog files." );
- }
- else {
- manager.setCatalogFiles( catalogFiles );
- }
- return manager;
- }
-
-
- private SAXParserFactory createParserFactory() {
- SAXParserFactory factory = new SAXParserFactoryImpl();
- factory.setXIncludeAware( translator.getRenderer().getConfiguration().isXincludeSupported() );
- return factory;
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/GenerationMojo.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/GenerationMojo.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,190 @@
+package org.jboss.maven.docbook.gen;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.jboss.maven.docbook.gen.Settings;
+import org.jboss.maven.docbook.gen.rendering.MainRenderer;
+import org.jboss.maven.docbook.gen.rendering.RenderingException;
+import org.jboss.maven.docbook.gen.rendering.FormatterFactory;
+import org.jboss.maven.docbook.gen.rendering.StandardFormatterFactory;
+import org.jboss.maven.docbook.gen.xslt.TransformerType;
+import org.jboss.maven.docbook.gen.xslt.TransformerFactory;
+
+/**
+ * A DocBook plugin based on the excellent docbkx-maven-plugin, but which
+ * specifically handles language translations in a more transparent way.
+ *
+ * @goal generate
+ * @phase generate-sources
+ *
+ * @author Steve Ebersole
+ */
+public class GenerationMojo extends AbstractMojo {
+
+ /**
+ * The directory where the DocBook sources and translations can be found.
+ *
+ * @parameter expression="${basedir}/src/main/docbook"
+ */
+ private File sourcesDirectory;
+
+ /**
+ * The directory containing default (i.e. language-agnostic) shared resources.
+ *
+ * @parameter expression="${sourcesDirectory}/standard/resources"
+ */
+ private File standardResourcesDirectory;
+
+ /**
+ * The directory containing the default (i.e. language-agnostic) XSLT stylesheets.
+ *
+ * @parameter expression="${sourcesDirectory}/standard/style"
+ */
+ private File standardStylesheetDirectory;
+
+ /**
+ * The directory containing the translated DocBook sources.
+ *
+ * @parameter expression="${sourcesDirectory}/translations"
+ */
+ private File translationsDirectory;
+
+ /**
+ * Patternsets of sources (relative to translationsDirectory) to include
+ * in formatting.
+ *
+ * @parameter
+ * @required
+ */
+ private String[] sourceIncludes;
+
+ /**
+ * The directory where the output will be written. The formats and
+ * translations will be written to directories relative to this parameter
+ * using ${targetDirectory}/${language}/${format}/
+ *
+ * @parameter expression="${basedir}/target/docbook"
+ */
+ private File targetDirectory;
+
+ /**
+ * The translations to be rendered.
+ *
+ * @parameter
+ * @required
+ */
+ private Translation[] translations;
+
+ /**
+ * The formats in which to perform rendering.
+ *
+ * @parameter
+ * @required
+ */
+ private Format[] formats;
+
+ /**
+ * The configured entity injections.
+ *
+ * @parameter
+ */
+ private Entity[] entities;
+
+ /**
+ * A boolean, indicating if XInclude should be supported.
+ *
+ * @parameter default="false"
+ */
+ private boolean xincludeSupported;
+
+ /**
+ * The implementation of {@link org.jboss.maven.docbook.gen.rendering.FormatterFactory}
+ * to use.
+ *
+ * @parameter
+ */
+ private String formatterFactoryClassName;
+
+ /**
+ * Which XML transformation library should be used. Both saxon and xalan
+ * are supported. saxon is the default as it is generally more robust;
+ * also I have problems trying to run either the hibernate or standard
+ * docbook stylesheets through xalan...
+ *
+ * @parameter default="saxon"
+ */
+ private String xmlTransformerType;
+
+ /**
+ * Any parameters (DocBook or custom) to be passed to the XSLT transformer.
+ *
+ * @parameter
+ */
+ private Properties transformerParameters;
+
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ Settings settings = new Settings(
+ translationsDirectory,
+ sourceIncludes,
+ standardResourcesDirectory,
+ standardStylesheetDirectory,
+ targetDirectory,
+ xincludeSupported,
+ entities,
+ buildFormatterFactory(),
+ new TransformerFactory( TransformerType.parse( xmlTransformerType ), transformerParameters ),
+ getLog()
+ );
+
+ try {
+ new MainRenderer( settings ).render( translations, formats );
+ }
+ catch ( RenderingException e ) {
+ throw new MojoExecutionException( "error performing DocBook rendering", e );
+ }
+ }
+
+ private FormatterFactory buildFormatterFactory() throws MojoExecutionException {
+ if ( formatterFactoryClassName != null ) {
+ Class formatterFactoryClass = locateCustomFormatterFactoryClass();
+ try {
+ return ( FormatterFactory ) formatterFactoryClass.newInstance();
+ }
+ catch( ClassCastException cce ) {
+ throw new MojoExecutionException( "custom formatter factory [" + formatterFactoryClass + "] did not implement factory interface [" + FormatterFactory.class.getName() + "]" );
+ }
+ catch ( Throwable t ) {
+ throw new MojoExecutionException( "could not instantiate custom formatter factory [" + formatterFactoryClass + "]" );
+ }
+ }
+ else {
+ return new StandardFormatterFactory();
+ }
+ }
+
+ private Class locateCustomFormatterFactoryClass() throws MojoExecutionException {
+ Class formatterFactoryClass = null;
+ try {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if ( cl == null ) {
+ cl = getClass().getClassLoader();
+ }
+ formatterFactoryClass = cl.loadClass( formatterFactoryClassName );
+ }
+ catch( Throwable t ) {
+ try {
+ formatterFactoryClass = Class.forName( formatterFactoryClassName );
+ }
+ catch ( Throwable t2 ) {
+ throw new MojoExecutionException( "could not locate custom formatter factory [" + formatterFactoryClass + "]" );
+ }
+ }
+ return formatterFactoryClass;
+ }
+
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/HtmlFormatter.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/HtmlFormatter.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/HtmlFormatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,53 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.io.File;
-import java.net.URL;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.stream.StreamResult;
-
-import org.jboss.maven.docbook.Format;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class HtmlFormatter extends FormatterSupport {
- public static final String TYPE = "html";
- public static final String DEF_STYLESHEET = "/META-INF/docbkx/html/docbook.xsl";
- public static final String CHUNK_STYLESHEET = "/META-INF/docbkx/html/chunk.xsl";
-
- public HtmlFormatter(Translator translator, Format format) {
- super( translator, format );
- }
-
- protected String getType() {
- return TYPE;
- }
-
- protected URL getDefaultStylesheetUrl() {
- return this.getClass().getResource( DEF_STYLESHEET );
- }
-
- protected URL getChunkedStyleSheetUrl() {
- return this.getClass().getResource( CHUNK_STYLESHEET );
- }
-
-
- protected Transformer buildTransformer(File targetFile) throws RenderingException {
- Transformer transformer = super.buildTransformer( targetFile );
- if ( getFormat().isChunkedOutput() ) {
- 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);
- }
- return transformer;
- }
-
- protected Result buildResult(File targetFile) throws RenderingException {
- return new StreamResult( targetFile );
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/PdfFormatter.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/PdfFormatter.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/PdfFormatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,50 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.OutputStream;
-import java.net.URL;
-import javax.xml.transform.Result;
-import javax.xml.transform.sax.SAXResult;
-
-import com.agilejava.docbkx.maven.AvalonMavenBridgeLogger;
-import org.apache.fop.apps.Driver;
-import org.jboss.maven.docbook.Format;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class PdfFormatter extends FormatterSupport {
- public static final String TYPE = "pdf";
- public static final String STYLESHEET = "/META-INF/docbkx/fo/docbook.xsl";
-
- public PdfFormatter(Translator translator, Format format) {
- super( translator, format );
- }
-
- protected String getType() {
- return TYPE;
- }
-
- protected URL getDefaultStylesheetUrl() {
- return this.getClass().getResource( STYLESHEET );
- }
-
- protected Result buildResult(File targetFile) throws RenderingException {
- getLog().info( "building formatting result [" + targetFile.getAbsolutePath() + "]" );
- Driver driver = new Driver();
- driver.setLogger( new AvalonMavenBridgeLogger( getLog() ) );
- driver.setRenderer( Driver.RENDER_PDF );
-
- try {
- OutputStream out = new java.io.FileOutputStream( targetFile );
- driver.setOutputStream( out );
- return new SAXResult( driver.getContentHandler() );
- }
- catch ( FileNotFoundException e ) {
- throw new RenderingException( "unable to access target file " + targetFile.getAbsolutePath() );
- }
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Renderer.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Renderer.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Renderer.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,42 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import org.codehaus.plexus.util.FileUtils;
-import org.jboss.maven.docbook.Format;
-import org.jboss.maven.docbook.Translation;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Renderer {
-
- private final Configuration configuration;
-
- /*package*/Configuration getConfiguration() {
- return configuration;
- }
-
- public Renderer(Configuration configuration) {
- this.configuration = configuration;
- }
-
- public void render(Translation[] translations, Format[] formats) throws RenderingException {
- if ( ! configuration.getSourceDirectory().exists() ) {
- getLog().info( "sourceDirectory [" + configuration.getSourceDirectory().getAbsolutePath() + "] did not exist" );
- return; // No sources, so there is nothing to render.
- }
- if ( ! configuration.getTargetDirectory().exists() ) {
- FileUtils.mkdir( configuration.getTargetDirectory().getAbsolutePath() );
- }
-
- for ( int i = 0; i < translations.length; i++ ) {
- new Translator( this, translations[i] ).translate( formats );
- }
- }
-
- private Log getLog() {
- return configuration.getLog();
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/RenderingException.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/RenderingException.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/RenderingException.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,17 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class RenderingException extends Exception {
-
- public RenderingException(String message) {
- super( message );
- }
-
- public RenderingException(String message, Throwable cause) {
- super( message, cause );
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Settings.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Configuration.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Settings.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Settings.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,90 @@
+package org.jboss.maven.docbook.gen;
+
+import java.io.File;
+import java.util.List;
+import java.util.Arrays;
+
+import org.jboss.maven.docbook.gen.xslt.TransformerFactory;
+import org.jboss.maven.docbook.gen.rendering.FormatterFactory;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class Settings {
+ private final File translationsDirectory;
+ private final String[] sourceIncludes;
+ private final File standardResourcesDirectory;
+ private final File standardStylesheetDirectory;
+ private final File targetDirectory;
+ private final boolean xincludeSupported;
+ private final List entities;
+ private final FormatterFactory formatterFactory;
+ private final TransformerFactory transformerFactory;
+ private final Log log;
+
+ public Settings(
+ File translationsDirectory,
+ String[] sourceIncludes,
+ File standardResourcesDirectory,
+ File standardStylesheetDirectory,
+ File targetDirectory,
+ boolean xincludeSupported,
+ Entity[] entities,
+ FormatterFactory formatterFactory,
+ TransformerFactory transformerFactory,
+ Log log) {
+ this.translationsDirectory = translationsDirectory;
+ this.sourceIncludes = sourceIncludes;
+ this.standardResourcesDirectory = standardResourcesDirectory;
+ this.standardStylesheetDirectory = standardStylesheetDirectory;
+ this.targetDirectory = targetDirectory;
+ this.xincludeSupported = xincludeSupported;
+ this.entities = Arrays.asList( entities );
+ this.formatterFactory = formatterFactory;
+ this.transformerFactory = transformerFactory;
+ this.log = log;
+ }
+
+ public File getTranslationsDirectory() {
+ return translationsDirectory;
+ }
+
+ public String[] getSourceIncludes() {
+ return sourceIncludes;
+ }
+
+ public File getStandardResourcesDirectory() {
+ return standardResourcesDirectory;
+ }
+
+ public File getStandardStylesheetDirectory() {
+ return standardStylesheetDirectory;
+ }
+
+ public File getTargetDirectory() {
+ return targetDirectory;
+ }
+
+ public boolean isXincludeSupported() {
+ return xincludeSupported;
+ }
+
+ public List getEntities() {
+ return entities;
+ }
+
+ public FormatterFactory getFormatterFactory() {
+ return formatterFactory;
+ }
+
+ public TransformerFactory getTransformerFactory() {
+ return transformerFactory;
+ }
+
+ public Log getLog() {
+ return log;
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/StandardFormatterFactory.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/StandardFormatterFactory.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/StandardFormatterFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,22 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import org.jboss.maven.docbook.Format;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class StandardFormatterFactory implements FormatterFactory {
- public Formatter buildFormatter(Translator translator, Format format) throws RenderingException {
- if ( HtmlFormatter.TYPE.equals( format.getType() ) ) {
- return new HtmlFormatter( translator, format );
- }
- else if ( PdfFormatter.TYPE.equals( format.getType() ) ) {
- return new PdfFormatter( translator, format );
- }
- else {
- throw new RenderingException( "unknown format type [" + format.getType() + "]" );
- }
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerFactory.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerFactory.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,137 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.util.Enumeration;
-import java.util.Properties;
-import java.util.Iterator;
-import java.util.Map;
-import java.net.URL;
-import java.io.IOException;
-import java.io.File;
-
-import javax.xml.transform.Transformer;
-import javax.xml.transform.URIResolver;
-import javax.xml.transform.Source;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.stream.StreamSource;
-
-import org.apache.xml.resolver.tools.CatalogResolver;
-import org.apache.xml.resolver.CatalogManager;
-import com.agilejava.docbkx.maven.StylesheetResolver;
-import com.agilejava.docbkx.maven.NullWriter;
-import com.icl.saxon.Controller;
-
-/**
- * A factory for {@link Transformer} instances, configurable to return either
- * SAXON or XALAN based transformers.
- * <p/>
- * Note: the transformers are cached, being reset upon "re acquitions". However,
- * that means that the transformers generated from this class should not be used
- * concurrently.
- *
- * @author Steve Ebersole
- */
-public class TransformerFactory {
- private final CatalogResolver catalogResolver = new CatalogResolver( createCatalogManager() );
-
- private final TransformerType transformerType;
- private final Properties transformerParameters;
-
- public TransformerFactory(TransformerType transformerType, Properties transformerParameters) {
- this.transformerType = transformerType;
- this.transformerParameters = transformerParameters;
- }
-
- public synchronized Transformer buildTransformer(URL docbookStylesheet, URL xsltStylesheet, File imageDirectory) throws RenderingException {
- if ( docbookStylesheet == null ) {
- throw new RenderingException( "docbook stylesheet was null" );
- }
- if ( xsltStylesheet == null ) {
- throw new RenderingException( "xslt stylesheet was null" );
- }
-
- try {
- URIResolver uriResolver = new StylesheetResolver(
- "urn:docbkx:stylesheet",
- new StreamSource( docbookStylesheet.openStream(), docbookStylesheet.toExternalForm() ),
- catalogResolver
- );
- return createTransformer( uriResolver, xsltStylesheet, imageDirectory );
- }
- catch ( IOException ioe) {
- throw new RenderingException( "Failed to read docbook stylesheet.", ioe );
- }
- }
-
- /*package*/ Transformer createTransformer(URIResolver uriResolver, URL xsltStylesheet, File imageDirectory) throws RenderingException {
- if ( xsltStylesheet == null ) {
- throw new RenderingException( "xslt stylesheet was null" );
- }
-
- try {
- javax.xml.transform.TransformerFactory transformerFactory = transformerType == TransformerType.XALAN
- ? new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl()
- : new com.icl.saxon.TransformerFactoryImpl();
- transformerFactory.setURIResolver( uriResolver );
- Source source = new StreamSource( xsltStylesheet.openStream(), xsltStylesheet.toExternalForm() );
- Transformer transformer = transformerFactory.newTransformer( source );
- transformer.setURIResolver( uriResolver );
- applyParameters( transformer );
- Controller controller = ( Controller ) transformer;
- try {
- controller.makeMessageEmitter();
- controller.getMessageEmitter().setWriter( new NullWriter() );
- }
- catch ( TransformerException te ) {
-// getLog().error( "Failed to redirect xsl:message output.", te );
- }
- return transformer;
- }
- catch ( IOException ioe ) {
- throw new RenderingException( "Failed to read stylesheet from " + xsltStylesheet.toExternalForm(), ioe );
- }
- catch ( TransformerConfigurationException tce ) {
- throw new RenderingException( "Failed to build Transformer from " + xsltStylesheet.toExternalForm(), tce );
- }
- }
-
- 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() );
- }
- }
-
- /*package*/ CatalogManager createCatalogManager() {
- CatalogManager manager = new CatalogManager();
- manager.setIgnoreMissingProperties(true);
- ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
- StringBuffer builder = new StringBuffer();
- boolean first = true;
- try {
- Enumeration enumeration = classLoader.getResources( "/catalog.xml" );
- while ( enumeration.hasMoreElements() ) {
- if ( !first ) {
- builder.append( ';' );
- }
- else {
- first = false;
- }
- URL resource = ( URL ) enumeration.nextElement();
- builder.append( resource.toExternalForm() );
- }
- }
- catch ( IOException ignore ) {
- // intentionally empty
- }
- String catalogFiles = builder.toString();
- if ( catalogFiles.length() != 0 ) {
- manager.setCatalogFiles( catalogFiles );
- }
- return manager;
- }
-}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerType.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerType.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerType.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,37 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-/**
- * {@inheritDoc}
- *
- * @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;
-
- public 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: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translation.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/Translation.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translation.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translation.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,36 @@
+package org.jboss.maven.docbook.gen;
+
+/**
+ * Defines a particular translation and any translation specific configuration.
+ *
+ * @author Steve Ebersole
+ */
+public class Translation {
+ private String language;
+ private String specializedResourcesDirectory;
+ private String specializedStylesheetDirectory;
+
+ public Translation() {
+ }
+
+ public Translation(
+ String language,
+ String specializedResourcesDirectory,
+ String specializedStylesheetDirectory) {
+ this.language = language;
+ this.specializedResourcesDirectory = specializedResourcesDirectory;
+ this.specializedStylesheetDirectory = specializedStylesheetDirectory;
+ }
+
+ public String getLanguage() {
+ return language;
+ }
+
+ public String getSpecializedResourcesDirectory() {
+ return specializedResourcesDirectory;
+ }
+
+ public String getSpecializedStylesheetDirectory() {
+ return specializedStylesheetDirectory;
+ }
+}
Deleted: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translator.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translator.java 2007-05-02 07:38:01 UTC (rev 11459)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translator.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -1,75 +0,0 @@
-package org.jboss.maven.docbook.gen;
-
-import java.io.File;
-
-import org.jboss.maven.docbook.Format;
-import org.jboss.maven.docbook.Translation;
-import org.codehaus.plexus.util.FileUtils;
-import org.apache.maven.plugin.logging.Log;
-
-/**
- * {@inheritDoc}
- *
- * @author Steve Ebersole
- */
-public class Translator {
- private final Renderer renderer;
- private final Translation translation;
-
- private final File translationSourceDirectory;
- private final File translationTargetDirectory;
- private final File translationSource;
-
- public Translator(Renderer renderer, Translation translation) {
- this.renderer = renderer;
- this.translation = translation;
-
- this.translationSourceDirectory = new File( renderer.getConfiguration().getSourceDirectory(), translation.getLanguage() );
- this.translationTargetDirectory = new File( renderer.getConfiguration().getTargetDirectory(), translation.getLanguage() );
- this.translationSource = new File( translationSourceDirectory, renderer.getConfiguration().getSource() );
- }
-
- public Renderer getRenderer() {
- return renderer;
- }
-
- public Translation getTranslation() {
- return translation;
- }
-
- public File getTranslationSourceDirectory() {
- return translationSourceDirectory;
- }
-
- public File getTranslationTargetDirectory() {
- return translationTargetDirectory;
- }
-
- public File getTranslationSource() {
- return translationSource;
- }
-
- public void translate(Format[] formats) throws RenderingException {
- getLog().debug( "starting translation : " + translation );
- if ( ! translationSourceDirectory.exists() ) {
- getLog().info( "translation directory [" + translationSourceDirectory.getAbsolutePath() + "did not exist; skipping" );
- return;
- }
- if ( ! translationSource.exists() ) {
- getLog().info( "translation source [" + translationSource.getAbsolutePath() + "did not exist; skipping" );
- return;
- }
- if ( ! translationTargetDirectory.exists() ) {
- FileUtils.mkdir( translationTargetDirectory.getAbsolutePath() );
- }
-
-
- for ( int i = 0; i < formats.length; i++ ) {
- renderer.getConfiguration().getFormatterFactory().buildFormatter( this, formats[i] ).apply();
- }
- }
-
- private Log getLog() {
- return renderer.getConfiguration().getLog();
- }
-}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/Formatter.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Formatter.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/Formatter.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/Formatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,12 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import java.io.File;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public interface Formatter {
+ public void format(File source) throws RenderingException;
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterFactory.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterFactory.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterFactory.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,12 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import org.jboss.maven.docbook.gen.Format;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public interface FormatterFactory {
+ public Formatter buildFormatter(TranslationRenderer translationRenderer, Format format) throws RenderingException;
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/FormatterSupport.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/FormatterSupport.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,205 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+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 com.agilejava.docbkx.maven.InjectingEntityResolver;
+import com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl;
+import org.apache.maven.plugin.logging.Log;
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.docbook.gen.Format;
+import org.jboss.maven.docbook.gen.Settings;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public abstract class FormatterSupport implements Formatter {
+ 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";
+
+ private final TranslationRenderer translationRenderer;
+ private final Format format;
+
+ public FormatterSupport(TranslationRenderer translationRenderer, Format format) {
+ this.translationRenderer = translationRenderer;
+ this.format = format;
+ }
+
+ public TranslationRenderer getTranslator() {
+ return translationRenderer;
+ }
+
+ public Format getFormat() {
+ return format;
+ }
+
+ protected Settings getSettings() {
+ return translationRenderer.getMainRenderer().getSettings();
+ }
+
+ protected Log getLog() {
+ return getSettings().getLog();
+ }
+
+ protected abstract String getType();
+
+ protected abstract Result buildResult(File taretFile) throws RenderingException;
+
+ protected abstract URL getDefaultStylesheetUrl();
+
+ protected URL getChunkedStyleSheetUrl() {
+ return getDefaultStylesheetUrl();
+ }
+
+ public final void format(File source) throws RenderingException {
+ getLog().debug( "starting formatting [format=" + format.getFormatName() + ", translation=" + translationRenderer.getTranslation() + "]" );
+
+ String formatDirectoryName = format.getRelativeFormatDirectory() != null
+ ? format.getRelativeFormatDirectory()
+ : getType();
+
+ String targetFileName = deduceTargetFileName( source );
+
+ File formatTargetDirectory = new File( translationRenderer.getTranslationTargetDirectory(), formatDirectoryName );
+ if ( !formatTargetDirectory.exists() ) {
+ FileUtils.mkdir( formatTargetDirectory.getAbsolutePath() );
+ }
+
+ File targetFile = new File( formatTargetDirectory, targetFileName );
+ if ( targetFile.exists() ) {
+ if ( ! targetFile.delete() ) {
+ getLog().warn( "unable to clean up previous output file [" + targetFile.getAbsolutePath() + "]" );
+ }
+ }
+ if ( !targetFile.exists() ) {
+ try {
+ targetFile.createNewFile();
+ }
+ catch ( IOException e ) {
+ throw new RenderingException( "unable to create output file [" + targetFile.getAbsolutePath() + "]", e );
+ }
+ }
+
+ Transformer transformer = buildTransformer( targetFile );
+ Source transformationSource = buildSource( source );
+ Result transformationResult = buildResult( targetFile );
+ try {
+ transformer.transform( transformationSource, transformationResult );
+ }
+ catch ( TransformerException e ) {
+ throw new RenderingException( "unable to perform transformation", e );
+ }
+ finally {
+ releaseResult( transformationResult );
+ }
+ }
+
+ private String deduceTargetFileName(File source) {
+ if ( format.getFinalNameMap() != null ) {
+ String supplied = ( String ) format.getFinalNameMap().get( source.getName() );
+ if ( supplied != null ) {
+ return supplied;
+ }
+ }
+ return FileUtils.basename( source.getAbsolutePath() ) + getType();
+ }
+
+ protected void releaseResult(Result transformationResult) {
+ // typically nothing to do...
+ }
+
+ protected Transformer buildTransformer(File targetFile) throws RenderingException {
+ final URL docbookStylesheet = format.isChunkedOutput() ? getChunkedStyleSheetUrl() : getDefaultStylesheetUrl();
+ final URL transformationStylesheet = resolveTransformationStylesheet();
+ return getSettings().getTransformerFactory().buildTransformer( docbookStylesheet, transformationStylesheet );
+ }
+
+ private Source buildSource(File sourceFile) throws RenderingException {
+ try {
+ EntityResolver resolver = getSettings().getTransformerFactory().getCatalogResolver();
+ if ( getSettings().getEntities() != null ) {
+ resolver = new InjectingEntityResolver(
+ java.util.Arrays.asList( getSettings().getEntities() ),
+ resolver,
+ format.getFormatName(),
+ translationRenderer.getMainRenderer().getSettings().getLog()
+ );
+ }
+ 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 );
+ }
+ }
+
+ private URL resolveTransformationStylesheet() throws RenderingException {
+ if ( format.getStylesheet() != null ) {
+ try {
+ return resolveCustomTransformationStylesheetFile().toURL();
+ }
+ catch ( MalformedURLException e ) {
+ throw new RenderingException( "unable to locate custom stylesheet [" + format.getStylesheet() + "]", e );
+ }
+ }
+ else {
+ return format.isChunkedOutput() ? getChunkedStyleSheetUrl() : getDefaultStylesheetUrl();
+ }
+ }
+
+ private File resolveCustomTransformationStylesheetFile() throws RenderingException {
+ // the custom stylesheet could be relative to either:
+ // 1) the translation dir
+ // 2) the standard stylesheet dir
+ // #1 takes precedence
+ String translationSpecificStyleDirectoryName = translationRenderer.getTranslation().getSpecializedStylesheetDirectory() == null
+ ? getSettings().getStandardStylesheetDirectory().getName()
+ : translationRenderer.getTranslation().getSpecializedStylesheetDirectory();
+ File translationSpecificStyleDirectory = new File( translationRenderer.getTranslationSourceDirectory(), translationSpecificStyleDirectoryName );
+ if ( translationSpecificStyleDirectory.exists() ) {
+ File stylesheet = new File( translationSpecificStyleDirectory, format.getStylesheet() );
+ if ( stylesheet.exists() ) {
+ return stylesheet;
+ }
+ getLog().info( "translation-specific style directory [" + translationSpecificStyleDirectory.getAbsolutePath() + "] did not contain specified style override [" + format.getStylesheet() + "]" );
+ }
+
+ File stylesheet = new File( translationRenderer.getMainRenderer().getSettings().getStandardStylesheetDirectory(), format.getStylesheet() );
+ if ( stylesheet.exists() ) {
+ return stylesheet;
+ }
+
+ throw new RenderingException( "unable to locate custom stylesheet [" + format.getStylesheet() + "]" );
+ }
+
+ private SAXParserFactory createParserFactory() {
+ SAXParserFactory factory = new SAXParserFactoryImpl();
+ factory.setXIncludeAware( translationRenderer.getMainRenderer().getSettings().isXincludeSupported() );
+ return factory;
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/HtmlFormatter.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/HtmlFormatter.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/HtmlFormatter.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/HtmlFormatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,50 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import java.io.File;
+import java.net.URL;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.stream.StreamResult;
+
+import org.jboss.maven.docbook.gen.Format;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class HtmlFormatter extends FormatterSupport {
+
+ public HtmlFormatter(TranslationRenderer translationRenderer, Format format) {
+ super( translationRenderer, format );
+ }
+
+ protected String getType() {
+ return StandardDocBookFormatType.HTML.getName();
+ }
+
+ protected URL getDefaultStylesheetUrl() {
+ return this.getClass().getResource( StandardDocBookFormatType.HTML.getNormalStylesheet() );
+ }
+
+ protected URL getChunkedStyleSheetUrl() {
+ return this.getClass().getResource( StandardDocBookFormatType.HTML.getChunkedStylesheet() );
+ }
+
+
+ protected Transformer buildTransformer(File targetFile) throws RenderingException {
+ Transformer transformer = super.buildTransformer( targetFile );
+ if ( getFormat().isChunkedOutput() ) {
+ 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);
+ }
+ return transformer;
+ }
+
+ protected Result buildResult(File targetFile) throws RenderingException {
+ return new StreamResult( targetFile );
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/MainRenderer.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/MainRenderer.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/MainRenderer.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,45 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import org.codehaus.plexus.util.FileUtils;
+import org.jboss.maven.docbook.gen.Format;
+import org.jboss.maven.docbook.gen.Translation;
+import org.jboss.maven.docbook.gen.Settings;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Coordinates rendering of DocBook sources in the requested translations and
+ * formats.
+ *
+ * @author Steve Ebersole
+ */
+public class MainRenderer {
+
+ private final Settings settings;
+
+ /*package*/Settings getSettings() {
+ return settings;
+ }
+
+ public MainRenderer(Settings settings) {
+ this.settings = settings;
+ }
+
+ public void render(Translation[] translations, Format[] formats) throws RenderingException {
+ if ( ! settings.getTranslationsDirectory().exists() ) {
+ getLog().info( "translationsDirectory [" + settings.getTranslationsDirectory().getAbsolutePath() + "] did not exist" );
+ return; // No sources, so there is nothing to render.
+ }
+ if ( ! settings.getTargetDirectory().exists() ) {
+ FileUtils.mkdir( settings.getTargetDirectory().getAbsolutePath() );
+ }
+
+ // for each requested translation, delegate to the TranslationRenderer
+ for ( int i = 0; i < translations.length; i++ ) {
+ new TranslationRenderer( this, translations[i] ).translate( formats );
+ }
+ }
+
+ private Log getLog() {
+ return settings.getLog();
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/PdfFormatter.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/PdfFormatter.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/PdfFormatter.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/PdfFormatter.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,48 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.OutputStream;
+import java.net.URL;
+import javax.xml.transform.Result;
+import javax.xml.transform.sax.SAXResult;
+
+import com.agilejava.docbkx.maven.AvalonMavenBridgeLogger;
+import org.apache.fop.apps.Driver;
+import org.jboss.maven.docbook.gen.Format;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class PdfFormatter extends FormatterSupport {
+
+ public PdfFormatter(TranslationRenderer translationRenderer, Format format) {
+ super( translationRenderer, format );
+ }
+
+ protected String getType() {
+ return StandardDocBookFormatType.PDF.getName();
+ }
+
+ protected URL getDefaultStylesheetUrl() {
+ return this.getClass().getResource( StandardDocBookFormatType.PDF.getNormalStylesheet() );
+ }
+
+ protected Result buildResult(File targetFile) throws RenderingException {
+ getLog().info( "building formatting result [" + targetFile.getAbsolutePath() + "]" );
+ Driver driver = new Driver();
+ driver.setLogger( new AvalonMavenBridgeLogger( getLog() ) );
+ driver.setRenderer( Driver.RENDER_PDF );
+
+ try {
+ OutputStream out = new java.io.FileOutputStream( targetFile );
+ driver.setOutputStream( out );
+ return new SAXResult( driver.getContentHandler() );
+ }
+ catch ( FileNotFoundException e ) {
+ throw new RenderingException( "unable to access target file " + targetFile.getAbsolutePath() );
+ }
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/RenderingException.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/RenderingException.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/RenderingException.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/RenderingException.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,17 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class RenderingException extends Exception {
+
+ public RenderingException(String message) {
+ super( message );
+ }
+
+ public RenderingException(String message, Throwable cause) {
+ super( message, cause );
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardDocBookFormatType.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardDocBookFormatType.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardDocBookFormatType.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,49 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+/**
+ * Enum of DocBook formats given special meaning/attention
+ *
+ * @author Steve Ebersole
+ */
+public class StandardDocBookFormatType {
+ public static final StandardDocBookFormatType HTML = new StandardDocBookFormatType( "html", "/META-INF/docbkx/html/docbook.xsl", "/META-INF/docbkx/html/chunk.xsl" );
+ public static final StandardDocBookFormatType PDF = new StandardDocBookFormatType( "pdf", "/META-INF/docbkx/fo/docbook.xsl", "/META-INF/docbkx/fo/docbook.xsl" );
+
+ private final String name;
+ private final String normalStylesheet;
+ private final String chunkedStylesheet;
+
+ public StandardDocBookFormatType(String name, String normalStylesheet, String chunkedStylesheet) {
+ this.name = name;
+ this.normalStylesheet = normalStylesheet;
+ this.chunkedStylesheet = chunkedStylesheet;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getNormalStylesheet() {
+ return normalStylesheet;
+ }
+
+ public String getChunkedStylesheet() {
+ return chunkedStylesheet;
+ }
+
+ public String getCommonFileExtension() {
+ return name;
+ }
+
+ public static StandardDocBookFormatType parse(String name) throws RenderingException {
+ if ( HTML.name.equals( name ) ) {
+ return HTML;
+ }
+ else if ( PDF.name.equals( name ) ) {
+ return PDF;
+ }
+ else {
+ throw new RenderingException( "unknown format type [" + name + "]" );
+ }
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardFormatterFactory.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/StandardFormatterFactory.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardFormatterFactory.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/StandardFormatterFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,22 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import org.jboss.maven.docbook.gen.Format;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class StandardFormatterFactory implements FormatterFactory {
+ public Formatter buildFormatter(TranslationRenderer translationRenderer, Format format) throws RenderingException {
+ if ( StandardDocBookFormatType.HTML.getName().equals( format.getFormatName() ) ) {
+ return new HtmlFormatter( translationRenderer, format );
+ }
+ else if ( StandardDocBookFormatType.PDF.getName().equals( format.getFormatName() ) ) {
+ return new PdfFormatter( translationRenderer, format );
+ }
+ else {
+ throw new RenderingException( "unknown format type [" + format.getFormatName() + "]" );
+ }
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/Translator.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/rendering/TranslationRenderer.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,106 @@
+package org.jboss.maven.docbook.gen.rendering;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.jboss.maven.docbook.gen.Format;
+import org.jboss.maven.docbook.gen.Translation;
+import org.codehaus.plexus.util.FileUtils;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public class TranslationRenderer {
+ private final MainRenderer mainRenderer;
+ private final Translation translation;
+
+ private final File translationSourceDirectory;
+ private final File translationTargetDirectory;
+
+ public TranslationRenderer(MainRenderer mainRenderer, Translation translation) {
+ this.mainRenderer = mainRenderer;
+ this.translation = translation;
+
+ this.translationSourceDirectory = new File( mainRenderer.getSettings().getTranslationsDirectory(), translation.getLanguage() );
+ this.translationTargetDirectory = new File( mainRenderer.getSettings().getTargetDirectory(), translation.getLanguage() );
+ }
+
+ public MainRenderer getMainRenderer() {
+ return mainRenderer;
+ }
+
+ public Translation getTranslation() {
+ return translation;
+ }
+
+ public File getTranslationSourceDirectory() {
+ return translationSourceDirectory;
+ }
+
+ public File getTranslationTargetDirectory() {
+ return translationTargetDirectory;
+ }
+
+ public void translate(Format[] formats) throws RenderingException {
+ getLog().debug( "starting translation : " + translation );
+ if ( ! translationSourceDirectory.exists() ) {
+ getLog().info( "translation directory [" + translationSourceDirectory.getAbsolutePath() + "did not exist; skipping" );
+ return;
+ }
+
+ DirectoryScanner scanner = new DirectoryScanner();
+ scanner.setBasedir( translationSourceDirectory );
+ scanner.setIncludes( mainRenderer.getSettings().getSourceIncludes() );
+ scanner.scan();
+ String[] matched = scanner.getIncludedFiles();
+
+ if ( matched == null || matched.length == 0 ) {
+ getLog().info( "translation directory [" + translationSourceDirectory.getAbsolutePath() + "contained no included sources; skipping" );
+ return;
+ }
+
+ if ( ! translationTargetDirectory.exists() ) {
+ FileUtils.mkdir( translationTargetDirectory.getAbsolutePath() );
+ }
+
+ copyResources();
+
+ for ( int i = 0; i < matched.length; i++ ) {
+ final File source = new File( translationSourceDirectory, matched[i] );
+ mainRenderer.getSettings().getFormatterFactory().buildFormatter( this, formats[i] ).format( source );
+ }
+ }
+
+ private void copyResources() throws RenderingException {
+ File source = mainRenderer.getSettings().getStandardResourcesDirectory();
+ if ( source != null && source.exists() && source.isDirectory() ) {
+ // first, copy over any standard resources...
+ copyResources( source, translationTargetDirectory );
+ // then translation-specific resources
+ String translationSpecificResourcesDirectoryName = translation.getSpecializedResourcesDirectory() == null
+ ? source.getName()
+ : translation.getSpecializedResourcesDirectory();
+ File translationSpecificResourcesDir = new File( translationSourceDirectory, translationSpecificResourcesDirectoryName );
+ if ( translationSpecificResourcesDir.exists() ) {
+ copyResources( translationSpecificResourcesDir, translationTargetDirectory );
+ }
+ }
+ }
+
+ private void copyResources(File source, File target) throws RenderingException {
+ try {
+ FileUtils.copyDirectoryStructure( source, target );
+ }
+ catch ( IOException e ) {
+ throw new RenderingException( "could not copy resources [" + source.getAbsolutePath() + " -> " + target.getAbsolutePath() + "]" );
+ }
+ }
+
+ private Log getLog() {
+ return mainRenderer.getSettings().getLog();
+ }
+}
Added: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/ResolverContext.java
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/ResolverContext.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/ResolverContext.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,14 @@
+package org.jboss.maven.docbook.gen.xslt;
+
+import javax.xml.transform.URIResolver;
+
+import org.jboss.maven.docbook.gen.rendering.RenderingException;
+
+/**
+ * {@inheritDoc}
+ *
+ * @author Steve Ebersole
+ */
+public interface ResolverContext {
+ public URIResolver buildResolver(URIResolver root) throws RenderingException;
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerFactory.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerFactory.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,136 @@
+package org.jboss.maven.docbook.gen.xslt;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+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.agilejava.docbkx.maven.NullWriter;
+import com.agilejava.docbkx.maven.StylesheetResolver;
+import com.icl.saxon.Controller;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
+import org.jboss.maven.docbook.gen.rendering.RenderingException;
+
+/**
+ * A factory for {@link Transformer} instances, configurable to return either
+ * SAXON or XALAN based transformers.
+ *
+ * @author Steve Ebersole
+ */
+public class TransformerFactory {
+ private final CatalogResolver catalogResolver = new CatalogResolver( createCatalogManager() );
+
+ private final TransformerType transformerType;
+ private final Properties transformerParameters;
+
+ public TransformerFactory(TransformerType transformerType, Properties transformerParameters) {
+ this.transformerType = transformerType;
+ this.transformerParameters = transformerParameters;
+ }
+
+ public CatalogResolver getCatalogResolver() {
+ return catalogResolver;
+ }
+
+ public synchronized Transformer buildTransformer(URL docbookStylesheet, URL xsltStylesheet) throws RenderingException {
+ if ( docbookStylesheet == null ) {
+ throw new RenderingException( "docbook stylesheet was null" );
+ }
+ if ( xsltStylesheet == null ) {
+ throw new RenderingException( "xslt stylesheet was null" );
+ }
+
+ try {
+ URIResolver uriResolver = new StylesheetResolver(
+ "urn:docbkx:stylesheet",
+ new StreamSource( docbookStylesheet.openStream(), docbookStylesheet.toExternalForm() ),
+ catalogResolver
+ );
+ return createTransformer( uriResolver, xsltStylesheet );
+ }
+ catch ( IOException ioe) {
+ throw new RenderingException( "Failed to read docbook stylesheet.", ioe );
+ }
+ }
+
+ /*package*/ Transformer createTransformer(URIResolver uriResolver, URL xsltStylesheet) throws RenderingException {
+ if ( xsltStylesheet == null ) {
+ throw new RenderingException( "xslt stylesheet was null" );
+ }
+
+ try {
+ javax.xml.transform.TransformerFactory transformerFactory = transformerType == TransformerType.XALAN
+ ? new com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl()
+ : new com.icl.saxon.TransformerFactoryImpl();
+ transformerFactory.setURIResolver( uriResolver );
+ Source source = new StreamSource( xsltStylesheet.openStream(), xsltStylesheet.toExternalForm() );
+ Transformer transformer = transformerFactory.newTransformer( source );
+ transformer.setURIResolver( uriResolver );
+ applyParameters( transformer );
+ Controller controller = ( Controller ) transformer;
+ try {
+ controller.makeMessageEmitter();
+ controller.getMessageEmitter().setWriter( new NullWriter() );
+ }
+ catch ( TransformerException te ) {
+// getLog().error( "Failed to redirect xsl:message output.", te );
+ }
+ return transformer;
+ }
+ catch ( IOException ioe ) {
+ throw new RenderingException( "Failed to read stylesheet from " + xsltStylesheet.toExternalForm(), ioe );
+ }
+ catch ( TransformerConfigurationException tce ) {
+ throw new RenderingException( "Failed to build Transformer from " + xsltStylesheet.toExternalForm(), tce );
+ }
+ }
+
+ 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() );
+ }
+ }
+
+ private CatalogManager createCatalogManager() {
+ CatalogManager manager = new CatalogManager();
+ manager.setIgnoreMissingProperties(true);
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ StringBuffer builder = new StringBuffer();
+ boolean first = true;
+ try {
+ Enumeration enumeration = classLoader.getResources( "/catalog.xml" );
+ while ( enumeration.hasMoreElements() ) {
+ if ( !first ) {
+ builder.append( ';' );
+ }
+ else {
+ first = false;
+ }
+ URL resource = ( URL ) enumeration.nextElement();
+ builder.append( resource.toExternalForm() );
+ }
+ }
+ catch ( IOException ignore ) {
+ // intentionally empty
+ }
+ String catalogFiles = builder.toString();
+ if ( catalogFiles.length() != 0 ) {
+ manager.setCatalogFiles( catalogFiles );
+ }
+ return manager;
+ }
+}
Copied: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerType.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/TransformerType.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerType.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/gen/xslt/TransformerType.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,37 @@
+package org.jboss.maven.docbook.gen.xslt;
+
+/**
+ * {@inheritDoc}
+ *
+ * @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: trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java (from rev 11433, trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/RevisionDiffMojo.java)
===================================================================
--- trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java (rev 0)
+++ trunk/sandbox/maven-poc/plugins/docbook/src/main/java/org/jboss/maven/docbook/revdiff/RevisionDiffMojo.java 2007-05-03 07:24:48 UTC (rev 11460)
@@ -0,0 +1,101 @@
+package org.jboss.maven.docbook.revdiff;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Properties;
+import java.io.IOException;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.xerces.parsers.SAXParser;
+import org.xml.sax.XMLReader;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.jboss.maven.docbook.revdiff.ModuleElementsExtractor;
+import org.jboss.maven.docbook.revdiff.ModuleElementsComparator;
+import org.jboss.maven.docbook.revdiff.ModuleReportHTML;
+import org.jboss.maven.docbook.revdiff.ModuleReport;
+
+/**
+ * A plugin for generating a "revision diff" report across different
+ * translations of the same document. This is useful for the translators to
+ * know what changes exist between their translation and another.
+ *
+ * @goal revision-diff
+ *
+ * @author Christian Bauer
+ * @author Steve Ebersole
+ */
+public class RevisionDiffMojo extends AbstractMojo {
+ /**
+ * The translation against which to baseline the diff.
+ *
+ * @parameter
+ * @required
+ */
+ private String original;
+
+ /**
+ * The translation to be compared to the master.
+ *
+ * @parameter
+ * @required
+ */
+ private String copy;
+
+ /**
+ * The file where the diff report should be written.
+ *
+ * @parameter default="${build.outputDirectory}/docbkx/revdiff
+ * @required
+ */
+ private String reportFile;
+
+ public void execute() throws MojoExecutionException, MojoFailureException {
+ Set moduleElements = new HashSet();
+ XMLReader parser = generateParser();
+ try {
+ // Parse original file
+ parser.setContentHandler( new ModuleElementsExtractor( moduleElements ) );
+ parser.parse( original );
+
+ // Parse copy
+ parser.setContentHandler( new ModuleElementsComparator( moduleElements ) );
+ parser.parse( copy );
+
+ // Set properties for HTML report
+ Properties props = new Properties();
+ props.setProperty( ModuleReportHTML.DESTINATION_FILE, reportFile );
+
+ // Generate HTML report
+ ModuleReport report = new ModuleReportHTML();
+ report.runReport( moduleElements, props );
+ }
+ catch ( IOException e ) {
+ throw new MojoExecutionException( "Files not found : " + original + " or " + copy, e );
+
+ }
+ catch ( Exception e ) {
+ throw new MojoExecutionException( "unable to run revdiff report", e );
+ }
+
+ }
+
+ private XMLReader generateParser() throws MojoExecutionException {
+ try {
+ 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 MojoExecutionException( "unable to generate SAX Parser", e );
+ }
+ catch ( SAXNotRecognizedException e ) {
+ throw new MojoExecutionException( "unable to generate SAX Parser", e );
+ }
+ }
+}
17 years, 9 months