Class DefaultSiteRenderer
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.apache.maven.doxia.siterenderer.DefaultSiteRenderer
-
- All Implemented Interfaces:
Renderer,org.codehaus.plexus.logging.LogEnabled
@Component(role=Renderer.class) public class DefaultSiteRenderer extends org.codehaus.plexus.logging.AbstractLogEnabled implements Renderer
DefaultSiteRenderer class.
- Since:
- 1.0
- Version:
- $Id: DefaultSiteRenderer.java 1800812 2017-07-04 19:51:00Z michaelo $
- Author:
- Emmanuel Venisse, Vincent Siveton
-
-
Constructor Summary
Constructors Constructor Description DefaultSiteRenderer()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidcopyDirectory(java.io.File source, java.io.File destination)Copy the directoryvoidcopyResources(SiteRenderingContext siteRenderingContext, java.io.File outputDirectory)Copy resource files from skin, template, and site resources.voidcopyResources(SiteRenderingContext siteRenderingContext, java.io.File resourcesDirectory, java.io.File outputDirectory)Copy resource files.SiteRenderingContextcreateContextForSkin(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.SiteRenderingContextcreateContextForTemplate(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.ContextcreateDocumentVelocityContext(org.apache.maven.doxia.sink.render.RenderingContext renderingContext, SiteRenderingContext siteRenderingContext)Create a Velocity Context for a Doxia document, containing every information about rendered document.protected org.apache.velocity.context.ContextcreateSiteTemplateVelocityContext(SiteRendererSink siteRendererSink, SiteRenderingContext siteRenderingContext)Create a Velocity Context for the site template decorating the document.protected org.apache.velocity.context.ContextcreateToolManagedVelocityContext(SiteRenderingContext siteRenderingContext)Creates a Velocity Context with all generic tools configured wit the site rendering context.voidgenerateDocument(java.io.Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext)Generate a document output from a Doxia SiteRenderer Sink.java.util.Map<java.lang.String,DocumentRenderer>locateDocumentFiles(SiteRenderingContext siteRenderingContext)Locate Doxia document source files in the site source context.voidrender(java.util.Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, java.io.File outputDirectory)Render a collection of documents into a site.voidrenderDocument(java.io.Writer writer, RenderingContext renderingContext, SiteRenderingContext siteContext)Render a document written in a Doxia markup language.
-
-
-
Method Detail
-
locateDocumentFiles
public java.util.Map<java.lang.String,DocumentRenderer> locateDocumentFiles(SiteRenderingContext siteRenderingContext) throws java.io.IOException, RendererException
Locate Doxia document source files in the site source context.- Specified by:
locateDocumentFilesin interfaceRenderer- Returns:
- the Doxia document renderers in a Map keyed by output file name.
- Throws:
java.io.IOException- if it bombs.RendererException- if it bombs.
-
render
public void render(java.util.Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws RendererException, java.io.IOException
Render a collection of documents into a site.- Specified by:
renderin interfaceRenderer- Parameters:
documents- the documents to render.siteRenderingContext- the SiteRenderingContext to use.outputDirectory- the output directory to write results.- Throws:
RendererException- if it bombs.java.io.IOException- if it bombs.
-
renderDocument
public void renderDocument(java.io.Writer writer, RenderingContext renderingContext, SiteRenderingContext siteContext) throws RendererException, java.io.FileNotFoundException, java.io.UnsupportedEncodingExceptionRender a document written in a Doxia markup language. This method is an internal method, used byDoxiaDocumentRenderer.- Specified by:
renderDocumentin interfaceRenderer- Parameters:
writer- the writer to render the document to.renderingContext- the document's rendering context, which is expected to have a non-null parser id.siteContext- the site's rendering context- Throws:
RendererException- if it bombs.java.io.FileNotFoundException- if it bombs.java.io.UnsupportedEncodingException- if it bombs.
-
createToolManagedVelocityContext
protected org.apache.velocity.context.Context createToolManagedVelocityContext(SiteRenderingContext siteRenderingContext)
Creates a Velocity Context with all generic tools configured wit the site rendering context.- Parameters:
siteRenderingContext- the site rendering context- Returns:
- a Velocity tools managed context
-
createDocumentVelocityContext
protected org.apache.velocity.context.Context createDocumentVelocityContext(org.apache.maven.doxia.sink.render.RenderingContext renderingContext, SiteRenderingContext siteRenderingContext)Create a Velocity Context for a Doxia document, containing every information about rendered document.- Parameters:
sink- the site renderer sink for the documentsiteRenderingContext- the site rendering context- Returns:
-
createSiteTemplateVelocityContext
protected org.apache.velocity.context.Context createSiteTemplateVelocityContext(SiteRendererSink siteRendererSink, SiteRenderingContext siteRenderingContext)
Create a Velocity Context for the site template decorating the document. In addition to all the informations from the document, this context contains data gathered inSiteRendererSinkduring document rendering.- Parameters:
siteRendererSink- the site renderer sink for the documentsiteRenderingContext- the site rendering context- Returns:
-
generateDocument
public void generateDocument(java.io.Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext) throws RendererExceptionGenerate a document output from a Doxia SiteRenderer Sink.- Specified by:
generateDocumentin interfaceRenderer- Parameters:
writer- the Writer to use.sink- the Site Renderer Sink to receive the Doxia events.siteRenderingContext- the SiteRenderingContext to use.- Throws:
RendererException- if it bombs.
-
createContextForSkin
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
Create a Site Rendering Context for a site using a skin.- Specified by:
createContextForSkinin interfaceRenderer- Returns:
- a SiteRenderingContext.
- Throws:
java.io.IOException- if it bombs.RendererException
-
createContextForTemplate
@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
Deprecated.Create a Site Rendering Context for a site using a local template.- Specified by:
createContextForTemplatein interfaceRenderer- Returns:
- a SiteRenderingContext.
- Throws:
java.net.MalformedURLException- if it bombs.- See Also:
#createContextForSkin(File, Map, DecorationModel, String, Locale)
-
copyResources
public void copyResources(SiteRenderingContext siteRenderingContext, java.io.File resourcesDirectory, java.io.File outputDirectory) throws java.io.IOException
Copy resource files.- Specified by:
copyResourcesin interfaceRenderer- Throws:
java.io.IOException- if it bombs.
-
copyResources
public void copyResources(SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws java.io.IOException
Copy resource files from skin, template, and site resources.- Specified by:
copyResourcesin interfaceRenderer- Throws:
java.io.IOException- if it bombs.
-
copyDirectory
protected void copyDirectory(java.io.File source, java.io.File destination) throws java.io.IOExceptionCopy the directory- Parameters:
source- source file to be copieddestination- destination file- Throws:
java.io.IOException- if any
-
-