...
 
Commits (4)
// ------------------------------------------------------------------
// Transitive dependencies of this project determined from the
// maven pom organized by organization.
// ------------------------------------------------------------------
Doxia
This diff is collapsed.
Doxia
Copyright 2005-2016 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
doxia (1.7-1) UNRELEASED; urgency=medium
* Team upload.
* Fix debian/watch
* New upstream release (1.7). Update:
- patches
- build dependencies
- Maven properties, rules and ignoreRules
- debian/libdoxia-java.poms
-- Christopher Hoskin <christopher.hoskin@gmail.com> Sun, 30 Oct 2016 20:10:01 +0000
doxia (1.1.4-7) unstable; urgency=medium
* Team upload.
......
......@@ -30,7 +30,9 @@ Build-Depends-Indep: default-jdk-doc,
libplexus-i18n-java,
libplexus-utils-java,
libplexus-utils-java-doc,
libxerces2-java
libxerces2-java,
libxmlunit-java,
libpegdown-java
Standards-Version: 3.9.8
Vcs-Git: https://anonscm.debian.org/git/pkg-java/doxia.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-java/doxia.git
......
......@@ -42,5 +42,4 @@ doxia-modules/doxia-module-rtf/pom.xml --has-package-version --java-lib
doxia-modules/doxia-module-twiki/pom.xml --has-package-version --java-lib
doxia-modules/doxia-module-xdoc/pom.xml --has-package-version --java-lib
doxia-modules/doxia-module-xhtml/pom.xml --has-package-version --java-lib
doxia-book/pom.xml --has-package-version --java-lib
doxia-maven-plugin/pom.xml --ignore
doxia-modules/doxia-module-markdown/pom.xml --has-package-version --java-lib
......@@ -18,3 +18,5 @@ org.apache.maven.plugins maven-project-info-reports-plugin * * * *
org.codehaus.mojo clirr-maven-plugin * * * *
org.apache.maven.doxia doxia-core test-jar * * *
org.apache.maven.doxia doxia-test-docs * * * *
org.apache.rat apache-rat-plugin * * * *
org.apache.maven.plugins maven-scm-publish-plugin * * * *
......@@ -2,4 +2,5 @@
# For example:
maven.test.skip=true
useJava5=true
project.build.sourceEncoding=UTF-8
......@@ -17,7 +17,7 @@
# junit junit jar s/3\\..*/3.x/
com.lowagie itext jar 1.4 * *
junit junit jar s/3\..*/3.x/ * *
junit junit jar s/4\..*/4.x/ * *
log4j log4j jar s/1\.2\..*/1.2.x/ * *
org.apache.maven.doxia doxia-book jar s/.*/debian/ * *
org.apache.maven.doxia doxia-core jar s/.*/debian/ * *
......@@ -38,3 +38,4 @@ org.apache.maven.doxia doxia-sink-api jar s/.*/debian/ * *
org.apache.maven.doxia doxia-test-docs jar s/.*/debian/ * *
org.apache.maven.doxia doxia pom s/.*/debian/ * *
org.codehaus.plexus plexus-container-default jar s/1\.0-alpha.*/1.0-alpha/ * *
commons-collections commons-collections jar s/3\..*/3.x/ * *
......@@ -87,12 +87,12 @@ diff --git a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/
index 72d6789..7aa1d63 100644
--- a/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
+++ b/doxia-modules/doxia-module-fo/src/main/java/org/apache/maven/doxia/module/fo/FoAggregateSink.java
@@ -1219,7 +1219,7 @@ public class FoAggregateSink
@@ -1272,7 +1272,7 @@ public class FoAggregateSink
att.addAttribute( "height", "0.3in" );
att.addAttribute( "text-align", "left" );
writeStartTag( BLOCK_TAG, att );
- write( compName == null ? ( cover.getAuthor() == null ? "" : cover.getAuthor() ) : compName );
+ write( compName == null ? ( cover.getAllAuthorNames() == null ? "" : cover.getAllAuthorNames() ) : compName );
- text( compName == null ? ( cover.getAuthor() == null ? "" : cover.getAuthor() ) : compName );
+ text( compName == null ? ( cover.getAllAuthorNames() == null ? "" : cover.getAllAuthorNames() ) : compName );
writeEndTag( BLOCK_TAG );
writeEndTag( TABLE_CELL_TAG );
......
From: Torsten Werner <twerner@debian.org>
Date: Sat, 10 Sep 2011 00:06:13 +0200
Subject: switch to plexus-component-metadata
The old plexus-maven-plugin fails in merge-descriptors and has been replaced by
plexus-component-metadata.
---
doxia-modules/doxia-module-apt/pom.xml | 11 ++++-------
doxia-modules/doxia-module-docbook-simple/pom.xml | 9 +++------
doxia-modules/doxia-module-fml/pom.xml | 9 +++------
doxia-modules/doxia-module-xdoc/pom.xml | 9 +++------
pom.xml | 9 ++++-----
5 files changed, 17 insertions(+), 30 deletions(-)
diff --git a/doxia-modules/doxia-module-apt/pom.xml b/doxia-modules/doxia-module-apt/pom.xml
index 010c559..a652578 100644
--- a/doxia-modules/doxia-module-apt/pom.xml
+++ b/doxia-modules/doxia-module-apt/pom.xml
@@ -49,21 +49,18 @@ under the License.
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
+ <artifactId>plexus-component-metadata</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/main/components/components.xml</descriptor>
- <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
- </descriptors>
+ <staticMetadataDirectory>${basedir}/src/main/components/</staticMetadataDirectory>
</configuration>
<executions>
<execution>
<goals>
- <goal>merge-descriptors</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
-</project>
\ No newline at end of file
+</project>
diff --git a/doxia-modules/doxia-module-docbook-simple/pom.xml b/doxia-modules/doxia-module-docbook-simple/pom.xml
index 64f671a..a3bf3b2 100644
--- a/doxia-modules/doxia-module-docbook-simple/pom.xml
+++ b/doxia-modules/doxia-module-docbook-simple/pom.xml
@@ -45,17 +45,14 @@ under the License.
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
+ <artifactId>plexus-component-metadata</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/main/components/components.xml</descriptor>
- <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
- </descriptors>
+ <staticMetadataDirectory>${basedir}/src/main/components/</staticMetadataDirectory>
</configuration>
<executions>
<execution>
<goals>
- <goal>merge-descriptors</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>
diff --git a/doxia-modules/doxia-module-fml/pom.xml b/doxia-modules/doxia-module-fml/pom.xml
index 2afafe8..2a4b94f 100644
--- a/doxia-modules/doxia-module-fml/pom.xml
+++ b/doxia-modules/doxia-module-fml/pom.xml
@@ -77,17 +77,14 @@ under the License.
</plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
+ <artifactId>plexus-component-metadata</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/main/components/components.xml</descriptor>
- <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
- </descriptors>
+ <staticMetadataDirectory>${basedir}/src/main/components</staticMetadataDirectory>
</configuration>
<executions>
<execution>
<goals>
- <goal>merge-descriptors</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>
diff --git a/doxia-modules/doxia-module-xdoc/pom.xml b/doxia-modules/doxia-module-xdoc/pom.xml
index f393ef8..947d1e2 100644
--- a/doxia-modules/doxia-module-xdoc/pom.xml
+++ b/doxia-modules/doxia-module-xdoc/pom.xml
@@ -68,17 +68,14 @@ under the License.
</plugin>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
+ <artifactId>plexus-component-metadata</artifactId>
<configuration>
- <descriptors>
- <descriptor>src/main/components/components.xml</descriptor>
- <descriptor>target/generated-resources/plexus/META-INF/plexus/components.xml</descriptor>
- </descriptors>
+ <staticMetadataDirectory>${basedir}/src/main/components/components.xml</staticMetadataDirectory>
</configuration>
<executions>
<execution>
<goals>
- <goal>merge-descriptors</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>
diff --git a/pom.xml b/pom.xml
index 5f9dee3..160e2d4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -271,9 +271,8 @@ under the License.
<!-- TODO need to upgrade to last version or Maven parent version -->
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
- <!-- Version 1.3.8 makes the descriptor merges fail, probably due to PLX-409 -->
- <version>1.3.5</version>
+ <artifactId>plexus-component-metadata</artifactId>
+ <version>1.5.5</version>
</plugin>
<plugin>
<groupId>org.codehaus.modello</groupId>
@@ -328,11 +327,11 @@ under the License.
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-maven-plugin</artifactId>
+ <artifactId>plexus-component-metadata</artifactId>
<executions>
<execution>
<goals>
- <goal>descriptor</goal>
+ <goal>generate-metadata</goal>
</goals>
</execution>
</executions>
--
From: Torsten Werner <twerner@debian.org>
Date: Sat, 10 Sep 2011 00:15:06 +0200
Subject: disable plexus-javadoc
It has some unresolved dependency.
---
pom.xml | 7 -------
1 files changed, 0 insertions(+), 7 deletions(-)
diff --git a/pom.xml b/pom.xml
index 22ad945..d18ba78 100644
--- a/pom.xml
+++ b/pom.xml
@@ -306,13 +306,6 @@ under the License.
<link>http://plexus.codehaus.org/plexus-utils/apidocs/</link>
<link>http://junit.sourceforge.net/javadoc/</link>
</links>
- <tagletArtifacts>
- <tagletArtifact>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-javadoc</artifactId>
- <version>1.0</version>
- </tagletArtifact>
- </tagletArtifacts>
</configuration>
</plugin>
<plugin>
--
0001-modello.patch
0002-add-version-to-plexus-container-default.patch
0003-switch-to-plexus-component-metadata.patch
0007-disable-plexus-javadoc.patch
0008-fop2-compatibility.patch
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.7 (GNU/Linux)
mQGiBEdUhrIRBADCU9cuKc92CWQlZxwtRuSIV/36Qmj264YD+Lix+r1Qe1PqRr1I
/MObOo83ulorWigSkx1k81Mnr56NwmIeo2bMhjmgRgf7EG6XEbKdRKfJcJRR1lDV
Ml4ru40W958M3PX5fsi0m0g2TuVrAKIS4vscUt4L/Cf4IT2/0OhaT6bWswCgsNws
Qq6NtCkLkpWSBNYGT4zb6yUEALlhHMnfzPSDerKjDOaYHTz3PRc/GGUDSBTSVj6W
hQIDrgTqrPxoB5JMnfUz8BLSayk0d6HiwspJ4Wnxe2/jdIT+6xhX9xBYXVHZVs4R
cr8zbBNcW2kwFg5Mqy7TiAPzakzCslKAAX+cjAKSOWyRbmkEYnNgMlctdyENOR9+
BpP+A/9anoVEfULqoETShmgWdi94gx713qymhNBpFZnPpm4j4JuxKopl/unQmw5i
Jwtu93cg38UfaOMJjTi6tJ6F6SE8xXv43nKs3Xb+Ll1MpTgaGUXEhCOeTZl223Qe
NBUp8kvfcys6aVX6GT93dmWxtMewlc6gc7HVQnUnyCFsVeoy/7QjSGVydmUgQm91
dGVteSA8aGJvdXRlbXlAYXBhY2hlLm9yZz6IYAQTEQIAIAUCR1SGsgIbAwYLCQgH
AwIEFQIIAwQWAgMBAh4BAheAAAoJEMksX+xwFhxid2sAoKppOorIM7ygdeFyhvcN
VV0l9cRnAKCGxTdvoOnDAgZN+5lBP0q/o3PGPbkCDQRHVIayEAgA/OzW6erYExaW
TjI7wPnD1uv1Leq2WRhG1I5YfuKU7K91TMilBm8L+qCmF1QEg7yF6mYtdwXjOiA0
YoGOVEeNJELhJFKZOoeZob+R3DC05uUsBl7xi3NgB8Msags5N4q+nqZSMZaEDl5J
R4ZAhYCZBy5xBmnvmRPUL50CDN2IBKxHVOaUllBIZDtdtVH37GwaVzXuhPxsLiAO
eJ29W1t8RrIP9TjQlPhzwu7P9Fq3/JcCmhF8xOmcn3wfCZ/VMteFVp8aTr4aO4uo
0O/HYisbStUw2YDGe/RmXiNOD8CXHFOg0/c4tettRhtnl8OO3hQ4srY5eymBG4tn
V02l3/Y2CwADBggA2i5UGKqWDJ46LviS1rNzBLLHPv7GASFicQY4HxMTvREdBIdb
+p287azp0l0ixaLQOq6HgSMZbexRG/DdDSakxlOr+kil5NJnHmZ9tXzGmnLP1Wox
QEc2FVdG/jKTg6gz2x9Cz1pRMxxAHN6Os+c7hxYKbD649fBbGPgZPP0OCjwrHVfu
3WaMaek41QxnFfk5s+YNENly+XfeX2PuYLwKwuVkYJftqohU9bRx0phdDgQWbIZM
Vzihxr5yTxfkCvmHlrLHn+lAOz3N3xh0Qh/DofWEDAee8uk+pbzCXSON2v4iO9ls
Hg+wXYLREBHxdE0EreZu2VzBFa9iN2nhtJnuTIhJBBgRAgAJBQJHVIayAhsMAAoJ
EMksX+xwFhxicoMAn01LUw+mkBfQJFsMLdCpx+OORYPOAJ9YRvfAo/Xn3TqMTLep
QBB19Xhy6g==
=TCT6
-----END PGP PUBLIC KEY BLOCK-----
version=3
opts="uversionmangle=s/-(alpha|beta)-/~$1/" \
http://svn.apache.org/repos/asf/maven/doxia/doxia/tags/ \
doxia-(\d.*)/ debian debian/orig-tar.sh
opts="pgpsigurlmangle=s/$/.asc/"\
http://archive.apache.org/dist/maven/doxia/ doxia-(\d.*)-source-release.zip
package org.apache.maven.doxia.book;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.model.BookModel;
import java.io.File;
import java.util.List;
import java.util.Locale;
/**
* An interface to create books in different output formats from a book descriptor.
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: BookDoxia.java 748141 2009-02-26 13:29:10Z vsiveton $
*/
public interface BookDoxia
{
/** The plexus lookup role. */
String ROLE = BookDoxia.class.getName();
/**
* Load a BookModel from a descriptor file.
*
* @param bookDescriptor the book descriptor file.
* @return BookModel
* @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
*/
BookModel loadBook( File bookDescriptor )
throws BookDoxiaException;
/**
* Creates a book from a BookModel using the {@link Locale#getDefault()} and UTF-8 as default encoding.
*
* @param book the BookModel.
* @param bookRendererId the id of the output format.
* @param files a list of source files.
* @param outputDirectory the output directory.
* @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
* @see #renderBook(BookModel, String, List, File, Locale, String, String)
* @see Locale#getDefault()
*/
void renderBook( BookModel book, String bookRendererId, List files, File outputDirectory )
throws BookDoxiaException;
/**
* Creates a book from a BookModel.
*
* @param book the BookModel.
* @param bookRendererId the id of the output format.
* @param files a list of source files.
* @param outputDirectory the output directory.
* @param locale the wanted locale.
* @param inputEncoding the input encoding when processing <code>files</code>.
* @param outputEncoding the output encoding when writing files in <code>ouputDirectory</code>.
* @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
* @since 1.1
*/
void renderBook( BookModel book, String bookRendererId, List files, File outputDirectory, Locale locale,
String inputEncoding, String outputEncoding )
throws BookDoxiaException;
}
package org.apache.maven.doxia.book;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Wraps an exception when rendering books.
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: BookDoxiaException.java 740275 2009-02-03 11:17:28Z vsiveton $
*/
public class BookDoxiaException
extends Exception
{
/** serialVersionUID */
private static final long serialVersionUID = 87146681585045106L;
/**
* Construct a new BookDoxiaException with the specified detail message.
*
* @param message The detailed message. This can later be retrieved by the Throwable.getMessage() method.
*/
public BookDoxiaException( String message )
{
super( message );
}
/**
* Construct a new BookDoxiaException with the specified detail message and cause.
*
* @param message The detailed message. This can later be retrieved by the Throwable.getMessage() method.
* @param cause the cause. This can be retrieved later by the Throwable.getCause() method
* (a null value is permitted, and indicates that the cause is nonexistent or unknown).
*/
public BookDoxiaException( String message, Throwable cause )
{
super( message, cause );
}
}
package org.apache.maven.doxia.book;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.context.BookContext;
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.services.indexer.BookIndexer;
import org.apache.maven.doxia.book.services.io.BookIo;
import org.apache.maven.doxia.book.services.renderer.BookRenderer;
import org.apache.maven.doxia.book.services.validation.BookValidator;
import org.apache.maven.doxia.book.services.validation.ValidationResult;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.io.File;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
/**
* Default implementation of BookDoxia.
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: DefaultBookDoxia.java 740705 2009-02-04 11:57:33Z vsiveton $
* @plexus.component
*/
public class DefaultBookDoxia
extends AbstractLogEnabled
implements BookDoxia
{
/**
* @plexus.requirement
*/
private BookIo bookIo;
/**
* @plexus.requirement
*/
private BookValidator bookValidator;
/**
* @plexus.requirement
*/
private BookIndexer bookIndexer;
/**
* @plexus.requirement role="org.apache.maven.doxia.book.services.renderer.BookRenderer"
*/
private Map bookRenderers;
// ----------------------------------------------------------------------
// BookDoxia Implementation
// ----------------------------------------------------------------------
/** {@inheritDoc} */
public BookModel loadBook( File bookDescriptor )
throws BookDoxiaException
{
return bookIo.readBook( bookDescriptor );
}
/** {@inheritDoc} */
public void renderBook( BookModel book, String bookRendererId, List files, File outputDirectory )
throws BookDoxiaException
{
renderBook( book, bookRendererId, files, outputDirectory, Locale.getDefault(), "UTF-8", "UTF-8" );
}
/** {@inheritDoc} */
public void renderBook( BookModel book, String bookRendererId, List files, File outputDirectory, Locale locale,
String inputEncoding, String outputEncoding )
throws BookDoxiaException
{
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
ValidationResult validationResult = bookValidator.validateBook( book );
if ( !validationResult.isAllOk() )
{
throw new InvalidBookDescriptorException( validationResult );
}
// ----------------------------------------------------------------------
// Create and initialize the context
// ----------------------------------------------------------------------
BookContext context = new BookContext();
context.setBook( book );
context.setOutputDirectory( outputDirectory );
context.setLocale( locale );
context.setInputEncoding( inputEncoding );
context.setOutputEncoding( outputEncoding );
// -----------------------------------------------------------------------
//
// -----------------------------------------------------------------------
bookIo.loadFiles( context, files );
// ----------------------------------------------------------------------
// Generate indexes
// ----------------------------------------------------------------------
bookIndexer.indexBook( book, context );
// ----------------------------------------------------------------------
// Render the book
// ----------------------------------------------------------------------
BookRenderer bookRenderer = (BookRenderer) bookRenderers.get( bookRendererId );
if ( bookRenderer == null )
{
throw new BookDoxiaException( "No such book renderer '" + bookRendererId + "'." );
}
bookRenderer.renderBook( context );
}
/**
* Returns a Set of ids of the BookRenderers that are available in this BookDoxia.
*
* @return Set
*/
public Set getAvailableBookRenderers()
{
return Collections.unmodifiableSet( bookRenderers.keySet() );
}
}
package org.apache.maven.doxia.book.context;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.model.BookModel;
import java.io.File;
import java.util.Locale;
import java.util.Map;
import java.util.HashMap;
/**
* Context to render a book.
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: BookContext.java 746976 2009-02-23 12:15:38Z vsiveton $
*/
public class BookContext
{
/** The BookModel of this context. */
private BookModel book;
/** The files. */
private Map files;
/** The output directory. */
private File outputDirectory;
/** The BookIndex of this context. */
private BookIndex index;
/** The Locale used to generate the navigation. */
private Locale locale;
/** The input encoding used to read Doxia file. */
private String inputEncoding;
/** The output encoding used to write the renderer files. */
private String outputEncoding;
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
/** Represents a BookFile. */
public static class BookFile
{
/** The file. */
private File file;
/** The id of the parser. */
private String parserId;
/**
* Constructor.
*
* @param file the file.
* @param parserId the parser id.
*/
public BookFile( File file, String parserId )
{
this.file = file;
this.parserId = parserId;
}
/**
* Return the file of this BookFile.
*
* @return File.
*/
public File getFile()
{
return file;
}
/**
* Return the parserId of this BookFile.
*
* @return String.
*/
public String getParserId()
{
return parserId;
}
}
// ----------------------------------------------------------------------
// Accessors
// ----------------------------------------------------------------------
/**
* Return the BookModel of this BookContext.
*
* @return BookModel.
*/
public BookModel getBook()
{
return book;
}
/**
* Set the BookModel of this BookContext.
*
* @param book the BookModel.
*/
public void setBook( BookModel book )
{
this.book = book;
}
/**
* Return the files of this BookContext.
*
* @return Map. A new HashMap is constructed if the current Map is null.
*/
public Map getFiles()
{
if ( files == null )
{
files = new HashMap();
}
return files;
}
/**
* Set the files of this BookContext.
*
* @param files the Map of files.
*/
public void setFiles( Map files )
{
this.files = files;
}
/**
* Return the outputDirectory of this BookContext.
*
* @return File.
*/
public File getOutputDirectory()
{
return outputDirectory;
}
/**
* Set the outputDirectory of this BookContext.
*
* @param outputDirectory the output directory.
*/
public void setOutputDirectory( File outputDirectory )
{
this.outputDirectory = outputDirectory;
}
/**
* Return the index of this BookContext.
*
* @return BookIndex.
*/
public BookIndex getIndex()
{
return index;
}
/**
* Set the index of this BookContext.
*
* @param index the index to set.
*/
public void setIndex( BookIndex index )
{
this.index = index;
}
/**
* <p>Getter for the field <code>locale</code>.</p>
*
* @return the locale
* @since 1.1
*/
public Locale getLocale()
{
return locale;
}
/**
* <p>Setter for the field <code>locale</code>.</p>
*
* @param locale the locale to set
* @since 1.1
*/
public void setLocale( Locale locale )
{
this.locale = locale;
}
/**
* <p>Getter for the field <code>inputEncoding</code>.</p>
*
* @return the inputEncoding
* @since 1.1
*/
public String getInputEncoding()
{
return inputEncoding;
}
/**
* <p>Setter for the field <code>inputEncoding</code>.</p>
*
* @param inputEncoding the inputEncoding to set
* @since 1.1
*/
public void setInputEncoding( String inputEncoding )
{
this.inputEncoding = inputEncoding;
}
/**
* <p>Getter for the field <code>outputEncoding</code>.</p>
*
* @return the outputEncoding
* @since 1.1
*/
public String getOutputEncoding()
{
return outputEncoding;
}
/**
* <p>Setter for the field <code>outputEncoding</code>.</p>
*
* @param outputEncoding the outputEncoding to set
* @since 1.1
*/
public void setOutputEncoding( String outputEncoding )
{
this.outputEncoding = outputEncoding;
}
}
package org.apache.maven.doxia.book.services.indexer;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.context.BookContext;
import org.apache.maven.doxia.book.BookDoxiaException;
/**
* Index a book.
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: BookIndexer.java 746976 2009-02-23 12:15:38Z vsiveton $
*/
public interface BookIndexer
{
/** The plexus lookup role. */
String ROLE = BookIndexer.class.getName();
/**
* Index a book.
*
* @param book the book to index.
* @param bookContext the BookContext.
* @throws org.apache.maven.doxia.book.BookDoxiaException if the book cannot be indexed.
*/
void indexBook( BookModel book, BookContext bookContext )
throws BookDoxiaException;
}
package org.apache.maven.doxia.book.services.indexer;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Iterator;
import org.apache.maven.doxia.Doxia;
import org.apache.maven.doxia.book.BookDoxiaException;
import org.apache.maven.doxia.book.context.BookContext;
import org.apache.maven.doxia.book.context.BookIndex;
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.model.Chapter;
import org.apache.maven.doxia.book.model.Section;
import org.apache.maven.doxia.index.IndexEntry;
import org.apache.maven.doxia.index.IndexingSink;
import org.apache.maven.doxia.parser.ParseException;
import org.apache.maven.doxia.parser.manager.ParserNotFoundException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
/**
* Default implementation of BookIndexer.
*
* @plexus.component
*
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
* @version $Id: DefaultBookIndexer.java 638290 2008-03-18 09:45:22Z bentmann $
*/
public class DefaultBookIndexer
extends AbstractLogEnabled
implements BookIndexer
{
/**
* @plexus.requirement
*/
private Doxia doxia;
// ----------------------------------------------------------------------
// BookIndexer Implementation
// ----------------------------------------------------------------------
/** {@inheritDoc} */
public void indexBook( BookModel book, BookContext bookContext )
throws BookDoxiaException
{
BookIndex index = new BookIndex();
for ( Iterator it = book.getChapters().iterator(); it.hasNext(); )
{
Chapter chapter = (Chapter) it.next();
indexChapter( bookContext, index, chapter );
}
bookContext.setIndex( index );
}
// ----------------------------------------------------------------------
// Private
// ----------------------------------------------------------------------
/**
* Index a chapter.
*
* @param context the BookContext.
* @param bookEntry the IndexEntry.
* @param chapter the Chapter to index.
* @throws BookDoxiaException if the chapter cannot be indexed.
*/
private void indexChapter( BookContext context, IndexEntry bookEntry, Chapter chapter )
throws BookDoxiaException
{
IndexEntry chapterEntry = new IndexEntry( bookEntry, chapter.getId( ) );
chapterEntry.setTitle( chapter.getTitle() );
for ( Iterator it = chapter.getSections().iterator(); it.hasNext(); )
{
Section section = (Section) it.next();
indexSection( context, chapterEntry, section );
}
}
/**
* Index a section.
*
* @param bookContext the BookContext.
* @param chapterEntry the IndexEntry.
* @param section the Section to index.
* @throws BookDoxiaException if the section cannot be indexed.
*/
private void indexSection( BookContext bookContext, IndexEntry chapterEntry, Section section )
throws BookDoxiaException
{
BookContext.BookFile bookFile = (BookContext.BookFile) bookContext.getFiles().get( section.getId() );
if ( bookFile == null )
{
throw new BookDoxiaException( "No document that matches section with id="
+ section.getId() + "." );
}
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
IndexEntry sectionEntry = new IndexEntry( chapterEntry, section.getId() );
IndexingSink sink = new IndexingSink( sectionEntry );
try
{
doxia.parse( new FileReader( bookFile.getFile() ), bookFile.getParserId(), sink );
}
catch ( ParserNotFoundException e )
{
throw new BookDoxiaException( "Parser not found: "
+ bookFile.getParserId() + ".", e );
}
catch ( ParseException e )
{
throw new BookDoxiaException( "Error while parsing document: "
+ bookFile.getFile().getAbsolutePath() + ".", e );
}
catch ( FileNotFoundException e )
{
throw new BookDoxiaException( "Could not find document: "
+ bookFile.getFile().getAbsolutePath() + ".", e );
}
sectionEntry.setTitle( sink.getTitle() );
}
}
package org.apache.maven.doxia.book.services.io;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.BookDoxiaException;
import org.apache.maven.doxia.book.context.BookContext;
import java.io.File;
import java.util.List;
/**
* Common book-related IO methods.
*
* @author <a href="mailto:trygve.laugstol@objectware.no">Trygve Laugst&oslash;l</a>
* @version $Id: BookIo.java 746976 2009-02-23 12:15:38Z vsiveton $
*/
public interface BookIo
{
/** The plexus lookup role. */
String ROLE = BookIo.class.getName();
/**
* Read a BookModel from a descriptor file.
*
* @param bookDescriptor the book descriptor file.
* @return BookModel
* @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be read.
*/
BookModel readBook( File bookDescriptor )
throws BookDoxiaException;
/**
* Loads files in a given context.
*
* @param context the BookContext.
* @param files a list of files.
*/
void loadFiles( BookContext context, List files );
}
package org.apache.maven.doxia.book.services.io;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import org.apache.maven.doxia.book.model.io.xpp3.BookModelXpp3Reader;
import org.apache.maven.doxia.book.model.BookModel;
import org.apache.maven.doxia.book.BookDoxiaException;
import org.apache.maven.doxia.book.context.BookContext;
import org.apache.maven.doxia.module.site.SiteModule;
import org.apache.maven.doxia.module.site.manager.SiteModuleManager;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.io.IOException;
import java.io.File;
import java.io.Reader;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import java.util.List;
/**
* <p>DefaultBookIo class.</p>
*
* @plexus.component
* @author <a href="mailto:trygve.laugstol@objectware.no">Trygve Laugst&oslash;l</a>
* @version $Id: DefaultBookIo.java 769433 2009-04-28 15:26:55Z ltheussl $
*/
public class DefaultBookIo
extends AbstractLogEnabled
implements BookIo
{
/**
* @plexus.requirement
*/
private SiteModuleManager siteModuleManager;
// -----------------------------------------------------------------------
// DefaultBookIo Implementation
// -----------------------------------------------------------------------
/** {@inheritDoc} */
public BookModel readBook( File bookDescriptor )
throws BookDoxiaException
{
Reader reader = null;
try
{
reader = ReaderFactory.newXmlReader( bookDescriptor );
return new BookModelXpp3Reader().read( reader, true );
}
catch ( IOException e )
{
throw new BookDoxiaException( "Error while reading book descriptor.", e );
}
catch ( XmlPullParserException e )
{
throw new BookDoxiaException( "Error while reading book descriptor.", e );
}
finally
{
IOUtil.close( reader );
}
}
/** {@inheritDoc} */
public void loadFiles( BookContext context, List files )
{
// ----------------------------------------------------------------------
// Find all the files, map the file names to ids
// ----------------------------------------------------------------------
Collection siteModules = siteModuleManager.getSiteModules();
for ( Iterator it = siteModules.iterator(); it.hasNext(); )
{
SiteModule siteModule = (SiteModule) it.next();
String extension = siteModule.getExtension();
String sourceDirectory = File.separator + siteModule.getSourceDirectory() + File.separator;
String parserId = siteModule.getParserId();
for ( Iterator j = files.iterator(); j.hasNext(); )
{
File file = (File) j.next();
String name = file.getName();
String path = file.getAbsolutePath();
// first check if the file path contains one of the recognized source dir identifiers
// (there's trouble if a pathname contains 2 identifiers), then match file extensions (not unique).
if ( path.indexOf( sourceDirectory ) != -1 )
{
name = name.substring( 0, name.length() - extension.length() - 1 );
context.getFiles().put( name, new BookContext.BookFile( file, parserId ) );
}
else if ( name.endsWith( extension ) )
{
name = name.substring( 0, name.length() - extension.length() - 1 );
// don't overwrite if it's there already
if ( !context.getFiles().containsKey( name ) )
{
context.getFiles().put( name, new BookContext.BookFile( file, parserId ) );
}
}
}
}
if ( getLogger().isDebugEnabled() )
{
getLogger().debug( "Dumping document <-> id mapping:" );
Map map = new TreeMap( context.getFiles() );
for ( Iterator it = map.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Map.Entry) it.next();