public abstract class AbstractDocumentRenderer extends org.codehaus.plexus.logging.AbstractLogEnabled implements DocumentRenderer
document renderer.| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
baseDir
The common base directory of source files.
|
protected org.apache.maven.doxia.Doxia |
doxia |
protected org.apache.maven.doxia.parser.module.ParserModuleManager |
parserModuleManager |
private org.codehaus.plexus.velocity.VelocityComponent |
velocity |
ROLE| Constructor and Description |
|---|
AbstractDocumentRenderer() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
copyDirectory(java.io.File source,
java.io.File destination)
Copy content of a directory, excluding scm-specific files.
|
protected void |
copyResources(java.io.File outputDirectory)
Copies the contents of the resource directory to an output folder.
|
protected static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String searchStr) |
protected static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String[] searchStrs) |
java.lang.String |
getBaseDir()
Return the current base directory.
|
protected static java.lang.String[] |
getExtensions(org.apache.maven.doxia.parser.module.ParserModule module) |
java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> |
getFilesToProcess(java.util.Collection<java.lang.String> files)
Returns a Map of files to process.
|
java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> |
getFilesToProcess(java.io.File baseDirectory)
Returns a Map of files to process.
|
protected java.lang.String |
getOutputName(org.apache.maven.doxia.document.DocumentModel documentModel) |
private java.io.Reader |
getVelocityReader(java.io.File f,
java.lang.String encoding,
DocumentRendererContext context)
TODO: DOXIA-111: we need a general filter here that knows how to alter the context
|
private static boolean |
isVelocityFile(java.io.File f) |
protected void |
parse(java.lang.String fullDocPath,
java.lang.String parserId,
org.apache.maven.doxia.sink.Sink sink)
Deprecated.
since 1.1.2, use
parse(String, String, Sink, DocumentRendererContext) |
protected void |
parse(java.lang.String fullDocPath,
java.lang.String parserId,
org.apache.maven.doxia.sink.Sink sink,
DocumentRendererContext context)
Parse a source document into a sink.
|
org.apache.maven.doxia.document.DocumentModel |
readDocumentModel(java.io.File documentDescriptor)
Read a document model from a file.
|
void |
render(java.util.Collection<java.lang.String> files,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
Render a document from a set of files, depending on a rendering context.
|
void |
render(java.io.File baseDirectory,
java.io.File outputDirectory)
Render a document from the files found in baseDirectory.
|
void |
render(java.io.File baseDirectory,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
Render a document from the files found in a source directory, depending on a rendering context.
|
void |
render(java.io.File baseDirectory,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel,
DocumentRendererContext context)
Render a document from the files found in a source directory, depending on a rendering context.
|
void |
render(java.io.File baseDirectory,
java.io.File outputDirectory,
java.io.File documentDescriptor)
Render a document from the files found in baseDirectory.
|
abstract void |
render(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
Deprecated.
since 1.1.2, use
render(Map, File, DocumentModel, DocumentRendererContext) |
void |
render(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel,
DocumentRendererContext context)
Render an aggregate document from the files found in a Map.
|
void |
renderIndividual(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory)
Deprecated.
since 1.1.2, use
renderIndividual(Map, File, DocumentRendererContext) |
void |
renderIndividual(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
DocumentRendererContext context)
Render documents separately for each file found in a Map.
|
void |
setBaseDir(java.lang.String newDir)
Sets the current base directory.
|
private java.io.Reader |
validate(java.io.Reader source,
java.lang.String resource) |
enableLogging, getLogger, setupLogger, setupLogger, setupLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOutputExtension@Requirement protected org.apache.maven.doxia.parser.module.ParserModuleManager parserModuleManager
@Requirement protected org.apache.maven.doxia.Doxia doxia
@Requirement private org.codehaus.plexus.velocity.VelocityComponent velocity
private java.lang.String baseDir
public abstract void render(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
throws DocumentRendererException,
java.io.IOException
render(Map, File, DocumentModel, DocumentRendererContext)filesToProcess - the Map of Files to process. The Map should contain as keys the paths of the
source files (relative to baseDir), and the corresponding ParserModule as values.outputDirectory - the output directory where the aggregate document should be generated.documentModel - the document model, containing all the metadata, etc.DocumentRendererException - if anyjava.io.IOException - if anypublic void render(java.util.Collection<java.lang.String> files,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
throws DocumentRendererException,
java.io.IOException
render in interface DocumentRendererfiles - the path name Strings (relative to a common base directory)
of files to include in the document generation.outputDirectory - the output directory where the document should be generated.documentModel - the document model, containing all the metadata, etc.
If the model contains a TOC, only the files found in this TOC are rendered,
otherwise all files from the Collection of files will be processed.
If the model is null, render all files individually.DocumentRendererException - if any.java.io.IOException - if any.public void render(java.io.File baseDirectory,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel)
throws DocumentRendererException,
java.io.IOException
render in interface DocumentRendererbaseDirectory - the directory containing the source files.
This should follow the standard Maven convention, ie containing all the site modules.outputDirectory - the output directory where the document should be generated.documentModel - the document model, containing all the metadata, etc.
If the model contains a TOC, only the files found in this TOC are rendered,
otherwise all files found under baseDirectory will be processed.
If the model is null, render all files from baseDirectory individually.DocumentRendererException - if anyjava.io.IOException - if any
// * @deprecated since 1.1.2, use #render(File, File, DocumentModel, DocumentRendererContext)public void render(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel,
DocumentRendererContext context)
throws DocumentRendererException,
java.io.IOException
filesToProcess - the Map of Files to process. The Map should contain as keys the paths of the
source files (relative to baseDir), and the corresponding ParserModule as values.outputDirectory - the output directory where the aggregate document should be generated.documentModel - the document model, containing all the metadata, etc.context - the rendering context when processing files.DocumentRendererException - if anyjava.io.IOException - if anypublic void render(java.io.File baseDirectory,
java.io.File outputDirectory,
org.apache.maven.doxia.document.DocumentModel documentModel,
DocumentRendererContext context)
throws DocumentRendererException,
java.io.IOException
baseDirectory - the directory containing the source files.
This should follow the standard Maven convention, ie containing all the site modules.outputDirectory - the output directory where the document should be generated.documentModel - the document model, containing all the metadata, etc.
If the model contains a TOC, only the files found in this TOC are rendered,
otherwise all files found under baseDirectory will be processed.
If the model is null, render all files from baseDirectory individually.context - the rendering context when processing files.DocumentRendererException - if anyjava.io.IOException - if anypublic void render(java.io.File baseDirectory,
java.io.File outputDirectory)
throws DocumentRendererException,
java.io.IOException
render(File,File,DocumentModel) with a new DocumentModel.baseDirectory - the directory containing the source files.
This should follow the standard Maven convention, ie containing all the site modules.outputDirectory - the output directory where the document should be generated.DocumentRendererException - if anyjava.io.IOException - if anyrender(File, File, DocumentModel)public void render(java.io.File baseDirectory,
java.io.File outputDirectory,
java.io.File documentDescriptor)
throws DocumentRendererException,
java.io.IOException
baseDirectory - the directory containing the source files.
This should follow the standard Maven convention, ie containing all the site modules.outputDirectory - the output directory where the document should be generated.documentDescriptor - a file containing the document model.
If this file does not exist or is null, some default settings will be used.DocumentRendererException - if anyjava.io.IOException - if anyif documentDescriptor does not exist or is null,
otherwisepublic void renderIndividual(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory)
throws DocumentRendererException,
java.io.IOException
renderIndividual(Map, File, DocumentRendererContext)filesToProcess - the Map of Files to process. The Map should contain as keys the paths of the
source files (relative to baseDir), and the corresponding ParserModule as values.outputDirectory - the output directory where the documents should be generated.DocumentRendererException - if anyjava.io.IOException - if anypublic void renderIndividual(java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> filesToProcess,
java.io.File outputDirectory,
DocumentRendererContext context)
throws DocumentRendererException,
java.io.IOException
filesToProcess - the Map of Files to process. The Map should contain as keys the paths of the
source files (relative to baseDir), and the corresponding ParserModule as values.outputDirectory - the output directory where the documents should be generated.context - the rendering context.DocumentRendererException - if anyjava.io.IOException - if anypublic java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> getFilesToProcess(java.io.File baseDirectory)
throws java.io.IOException,
DocumentRendererException
baseDir), and the corresponding ParserModule as values.baseDirectory - the directory containing the source files.
This should follow the standard Maven convention, ie containing all the site modules.java.io.IOException - in case of a problem reading the files under baseDirectory.DocumentRendererException - if anyprotected static java.lang.String[] getExtensions(org.apache.maven.doxia.parser.module.ParserModule module)
protected static boolean endsWithIgnoreCase(java.lang.String str,
java.lang.String searchStr)
protected static boolean endsWithIgnoreCase(java.lang.String str,
java.lang.String[] searchStrs)
public java.util.Map<java.lang.String,org.apache.maven.doxia.parser.module.ParserModule> getFilesToProcess(java.util.Collection<java.lang.String> files)
baseDir), and the corresponding ParserModule as values.files - The Collection of source files.public org.apache.maven.doxia.document.DocumentModel readDocumentModel(java.io.File documentDescriptor)
throws DocumentRendererException,
java.io.IOException
readDocumentModel in interface DocumentRendererdocumentDescriptor - a document descriptor file that contains the document model.DocumentRendererException - if anyjava.io.IOException - if anypublic void setBaseDir(java.lang.String newDir)
newDir - the absolute path to the base directory to set.public java.lang.String getBaseDir()
protected void parse(java.lang.String fullDocPath,
java.lang.String parserId,
org.apache.maven.doxia.sink.Sink sink)
throws DocumentRendererException,
java.io.IOException
parse(String, String, Sink, DocumentRendererContext)fullDocPath - absolute path to the source document.parserId - determines the parser to use.sink - the sink to receive the events.DocumentRendererException - in case of a parsing error.java.io.IOException - if the source document cannot be opened.protected void parse(java.lang.String fullDocPath,
java.lang.String parserId,
org.apache.maven.doxia.sink.Sink sink,
DocumentRendererContext context)
throws DocumentRendererException,
java.io.IOException
fullDocPath - absolute path to the source document.parserId - determines the parser to use.sink - the sink to receive the events.context - the rendering context.DocumentRendererException - in case of a parsing error.java.io.IOException - if the source document cannot be opened.protected void copyResources(java.io.File outputDirectory)
throws java.io.IOException
outputDirectory - the destination folder.java.io.IOException - if any.protected void copyDirectory(java.io.File source,
java.io.File destination)
throws java.io.IOException
source - directory that contains the files and sub-directories to be copied.destination - destination folder.java.io.IOException - if any.protected java.lang.String getOutputName(org.apache.maven.doxia.document.DocumentModel documentModel)
documentModel - not nullDocumentModel.getOutputName(),
DocumentRenderer.getOutputExtension()private java.io.Reader getVelocityReader(java.io.File f,
java.lang.String encoding,
DocumentRendererContext context)
throws DocumentRendererException
f - the file to process, not nullencoding - the wanted encoding, not nullcontext - the current render document context not nullDocumentRendererExceptionprivate static boolean isVelocityFile(java.io.File f)
f - not nulltrue if file has a vm extension, false otherwise.private java.io.Reader validate(java.io.Reader source,
java.lang.String resource)
throws org.apache.maven.doxia.parser.ParseException,
java.io.IOException
org.apache.maven.doxia.parser.ParseExceptionjava.io.IOException