@Component(role=Renderer.class) public class DefaultSiteRenderer extends org.codehaus.plexus.logging.AbstractLogEnabled implements Renderer
DefaultSiteRenderer class.
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
DEFAULT_TEMPLATE |
private org.apache.maven.doxia.Doxia |
doxia |
private org.codehaus.plexus.i18n.I18N |
i18n |
private org.apache.maven.doxia.parser.module.ParserModuleManager |
parserModuleManager |
private org.codehaus.plexus.PlexusContainer |
plexus |
private static java.lang.String |
RESOURCE_DIR |
private static java.lang.String |
SKIN_TEMPLATE_LOCATION |
private static java.lang.String |
TOOLS_LOCATION |
private org.codehaus.plexus.velocity.VelocityComponent |
velocity |
Constructor and Description |
---|
DefaultSiteRenderer() |
Modifier and Type | Method and Description |
---|---|
private void |
addModuleFiles(java.io.File rootDir,
java.io.File moduleBasedir,
org.apache.maven.doxia.parser.module.ParserModule module,
java.lang.String excludes,
java.util.Map<java.lang.String,DocumentRenderer> files,
boolean editable) |
private static void |
closeZipFile(java.util.zip.ZipFile zipFile) |
protected void |
copyDirectory(java.io.File source,
java.io.File destination)
Copy the directory
|
private static void |
copyFileFromZip(java.util.zip.ZipFile file,
java.util.zip.ZipEntry entry,
java.io.File destFile) |
void |
copyResources(SiteRenderingContext siteRenderingContext,
java.io.File outputDirectory)
Copy resource files from skin, template, and site resources.
|
void |
copyResources(SiteRenderingContext siteRenderingContext,
java.io.File resourcesDirectory,
java.io.File outputDirectory)
Copy resource files.
|
SiteRenderingContext |
createContextForSkin(org.apache.maven.artifact.Artifact skin,
java.util.Map<java.lang.String,?> attributes,
DecorationModel decoration,
java.lang.String defaultWindowTitle,
java.util.Locale locale)
Create a Site Rendering Context for a site using a skin.
|
SiteRenderingContext |
createContextForTemplate(java.io.File templateFile,
java.util.Map<java.lang.String,?> attributes,
DecorationModel decoration,
java.lang.String defaultWindowTitle,
java.util.Locale locale)
Deprecated.
|
protected org.apache.velocity.context.Context |
createDocumentVelocityContext(RenderingContext renderingContext,
SiteRenderingContext siteRenderingContext)
Create a Velocity Context for a Doxia document, containing every information about rendered document.
|
private SiteRenderingContext |
createSiteRenderingContext(java.util.Map<java.lang.String,?> attributes,
DecorationModel decoration,
java.lang.String defaultWindowTitle,
java.util.Locale locale) |
protected org.apache.velocity.context.Context |
createSiteTemplateVelocityContext(DocumentContent content,
SiteRenderingContext siteRenderingContext)
Create a Velocity Context for the site template decorating the document.
|
protected org.apache.velocity.context.Context |
createToolManagedVelocityContext(SiteRenderingContext siteRenderingContext)
Creates a Velocity Context with all generic tools configured wit the site rendering context.
|
(package private) static boolean |
endsWithIgnoreCase(java.lang.String str,
java.lang.String searchStr) |
private java.util.List<java.lang.String> |
filterExtensionIgnoreCase(java.util.List<java.lang.String> fileNames,
java.lang.String extension) |
void |
generateDocument(java.io.Writer writer,
SiteRendererSink sink,
SiteRenderingContext siteRenderingContext)
Generate a document output from a Doxia SiteRenderer Sink, i.e.
|
private static java.util.zip.ZipFile |
getZipFile(java.io.File file) |
java.util.Map<java.lang.String,DocumentRenderer> |
locateDocumentFiles(SiteRenderingContext siteRenderingContext)
Locate Doxia document source files in the site source context.
|
java.util.Map<java.lang.String,DocumentRenderer> |
locateDocumentFiles(SiteRenderingContext siteRenderingContext,
boolean editable)
Locate Doxia document source files in the site source context.
|
(package private) boolean |
matchVersion(java.lang.String current,
java.lang.String prerequisite) |
void |
mergeDocumentIntoSite(java.io.Writer writer,
DocumentContent content,
SiteRenderingContext siteRenderingContext)
Generate a document output integrated in a site from a document content,
i.e.
|
void |
render(java.util.Collection<DocumentRenderer> documents,
SiteRenderingContext siteRenderingContext,
java.io.File outputDirectory)
Render a collection of documents into a site.
|
void |
renderDocument(java.io.Writer writer,
RenderingContext docRenderingContext,
SiteRenderingContext siteContext)
Render a document written in a Doxia markup language.
|
private void |
saveVelocityProcessedContent(RenderingContext docRenderingContext,
SiteRenderingContext siteContext,
java.lang.String doxiaContent) |
private java.io.Reader |
validate(java.io.Reader source,
java.lang.String resource) |
@Requirement private org.codehaus.plexus.velocity.VelocityComponent velocity
@Requirement private org.apache.maven.doxia.parser.module.ParserModuleManager parserModuleManager
@Requirement private org.apache.maven.doxia.Doxia doxia
@Requirement private org.codehaus.plexus.i18n.I18N i18n
@Requirement private org.codehaus.plexus.PlexusContainer plexus
private static final java.lang.String RESOURCE_DIR
private static final java.lang.String DEFAULT_TEMPLATE
private static final java.lang.String SKIN_TEMPLATE_LOCATION
private static final java.lang.String TOOLS_LOCATION
public java.util.Map<java.lang.String,DocumentRenderer> locateDocumentFiles(SiteRenderingContext siteRenderingContext) throws java.io.IOException, RendererException
locateDocumentFiles
in interface Renderer
java.io.IOException
- if it bombs.RendererException
- if it bombs.public java.util.Map<java.lang.String,DocumentRenderer> locateDocumentFiles(SiteRenderingContext siteRenderingContext, boolean editable) throws java.io.IOException, RendererException
locateDocumentFiles
in interface Renderer
java.io.IOException
- if it bombs.RendererException
- if it bombs.private java.util.List<java.lang.String> filterExtensionIgnoreCase(java.util.List<java.lang.String> fileNames, java.lang.String extension)
private void addModuleFiles(java.io.File rootDir, java.io.File moduleBasedir, org.apache.maven.doxia.parser.module.ParserModule module, java.lang.String excludes, java.util.Map<java.lang.String,DocumentRenderer> files, boolean editable) throws java.io.IOException, RendererException
java.io.IOException
RendererException
public void render(java.util.Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws RendererException, java.io.IOException
render
in interface Renderer
documents
- the documents to render.siteRenderingContext
- the SiteRenderingContext to use.outputDirectory
- the output directory to write results.RendererException
- if it bombs.java.io.IOException
- if it bombs.public void renderDocument(java.io.Writer writer, RenderingContext docRenderingContext, SiteRenderingContext siteContext) throws RendererException, java.io.FileNotFoundException, java.io.UnsupportedEncodingException
DoxiaDocumentRenderer
.renderDocument
in interface Renderer
writer
- the writer to render the document to.docRenderingContext
- the document's rendering context, which is expected to have a non-null parser id.siteContext
- the site's rendering contextRendererException
- if it bombs.java.io.FileNotFoundException
- if it bombs.java.io.UnsupportedEncodingException
- if it bombs.private void saveVelocityProcessedContent(RenderingContext docRenderingContext, SiteRenderingContext siteContext, java.lang.String doxiaContent) throws java.io.IOException
java.io.IOException
protected org.apache.velocity.context.Context createToolManagedVelocityContext(SiteRenderingContext siteRenderingContext)
siteRenderingContext
- the site rendering contextprotected org.apache.velocity.context.Context createDocumentVelocityContext(RenderingContext renderingContext, SiteRenderingContext siteRenderingContext)
sink
- the site renderer sink for the documentsiteRenderingContext
- the site rendering contextprotected org.apache.velocity.context.Context createSiteTemplateVelocityContext(DocumentContent content, SiteRenderingContext siteRenderingContext)
SiteRendererSink
during document rendering.content
- the document content to be merged into the templatesiteRenderingContext
- the site rendering contextpublic void generateDocument(java.io.Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext) throws RendererException
generateDocument
in interface Renderer
writer
- the Writer to use.sink
- the Site Renderer Sink that received the Doxia events during document content rendering.siteRenderingContext
- the SiteRenderingContext to use.RendererException
- if it bombs.public void mergeDocumentIntoSite(java.io.Writer writer, DocumentContent content, SiteRenderingContext siteRenderingContext) throws RendererException
mergeDocumentIntoSite
in interface Renderer
writer
- the Writer to use.content
- the document content to be mergedsiteRenderingContext
- the SiteRenderingContext to use.RendererException
- if it bombs.private SiteRenderingContext createSiteRenderingContext(java.util.Map<java.lang.String,?> attributes, DecorationModel decoration, java.lang.String defaultWindowTitle, java.util.Locale locale)
public SiteRenderingContext createContextForSkin(org.apache.maven.artifact.Artifact skin, java.util.Map<java.lang.String,?> attributes, DecorationModel decoration, java.lang.String defaultWindowTitle, java.util.Locale locale) throws java.io.IOException, RendererException
createContextForSkin
in interface Renderer
java.io.IOException
- if it bombs.RendererException
boolean matchVersion(java.lang.String current, java.lang.String prerequisite) throws RendererException
RendererException
@Deprecated public SiteRenderingContext createContextForTemplate(java.io.File templateFile, java.util.Map<java.lang.String,?> attributes, DecorationModel decoration, java.lang.String defaultWindowTitle, java.util.Locale locale) throws java.net.MalformedURLException
createContextForTemplate
in interface Renderer
java.net.MalformedURLException
- if it bombs.#createContextForSkin(File, Map, DecorationModel, String, Locale)
public void copyResources(SiteRenderingContext siteRenderingContext, java.io.File resourcesDirectory, java.io.File outputDirectory) throws java.io.IOException
copyResources
in interface Renderer
java.io.IOException
- if it bombs.public void copyResources(SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws java.io.IOException
copyResources
in interface Renderer
java.io.IOException
- if it bombs.private static void copyFileFromZip(java.util.zip.ZipFile file, java.util.zip.ZipEntry entry, java.io.File destFile) throws java.io.IOException
java.io.IOException
protected void copyDirectory(java.io.File source, java.io.File destination) throws java.io.IOException
source
- source file to be copieddestination
- destination filejava.io.IOException
- if anyprivate 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.ParseException
java.io.IOException
static boolean endsWithIgnoreCase(java.lang.String str, java.lang.String searchStr)
private static java.util.zip.ZipFile getZipFile(java.io.File file) throws java.io.IOException
java.io.IOException
private static void closeZipFile(java.util.zip.ZipFile zipFile)