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
- Author:
- Emmanuel Venisse, Vincent Siveton
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
copyDirectory
(File source, File destination) Copy the directoryvoid
copyResources
(SiteRenderingContext siteRenderingContext, File outputDirectory) Copy resource files from skin, template, and site resources.void
copyResources
(SiteRenderingContext siteRenderingContext, File resourcesDirectory, File outputDirectory) Copy resource files.createContextForSkin
(org.apache.maven.artifact.Artifact skin, Map<String, ?> attributes, org.apache.maven.doxia.site.decoration.DecorationModel decoration, String defaultWindowTitle, Locale locale) Create a Site Rendering Context for a site using a skin.createContextForTemplate
(File templateFile, Map<String, ?> attributes, org.apache.maven.doxia.site.decoration.DecorationModel decoration, String defaultWindowTitle, 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.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.void
generateDocument
(Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext) Generate a document output from a Doxia SiteRenderer Sink, i.e.locateDocumentFiles
(SiteRenderingContext siteRenderingContext) Locate Doxia document source files in the site source context.locateDocumentFiles
(SiteRenderingContext siteRenderingContext, boolean editable) Locate Doxia document source files in the site source context.void
mergeDocumentIntoSite
(Writer writer, DocumentContent content, SiteRenderingContext siteRenderingContext) Generate a document output integrated in a site from a document content, i.e.void
render
(Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, File outputDirectory) Render a collection of documents into a site.void
renderDocument
(Writer writer, RenderingContext docRenderingContext, SiteRenderingContext siteContext) Render a document written in a Doxia markup language.Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Constructor Details
-
DefaultSiteRenderer
public DefaultSiteRenderer()
-
-
Method Details
-
locateDocumentFiles
public Map<String,DocumentRenderer> locateDocumentFiles(SiteRenderingContext siteRenderingContext) throws IOException, RendererException Locate Doxia document source files in the site source context.- Specified by:
locateDocumentFiles
in interfaceRenderer
- Parameters:
siteRenderingContext
- the SiteRenderingContext to use- Returns:
- the Doxia document renderers in a Map keyed by output file name.
- Throws:
IOException
- if it bombs.RendererException
- if it bombs.
-
locateDocumentFiles
public Map<String,DocumentRenderer> locateDocumentFiles(SiteRenderingContext siteRenderingContext, boolean editable) throws IOException, RendererException Locate Doxia document source files in the site source context.- Specified by:
locateDocumentFiles
in interfaceRenderer
- Parameters:
siteRenderingContext
- the SiteRenderingContext to useeditable
- Doxia document renderer as editable? (should not set editable if generated Doxia source)- Returns:
- the Doxia document renderers in a Map keyed by output file name.
- Throws:
IOException
- if it bombs.RendererException
- if it bombs.
-
render
public void render(Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, File outputDirectory) throws RendererException, IOException Render a collection of documents into a site.- Specified by:
render
in interfaceRenderer
- Parameters:
documents
- the documents to render.siteRenderingContext
- the SiteRenderingContext to use.outputDirectory
- the output directory to write results.- Throws:
RendererException
- if it bombs.IOException
- if it bombs.
-
renderDocument
public void renderDocument(Writer writer, RenderingContext docRenderingContext, SiteRenderingContext siteContext) throws RendererException, FileNotFoundException, UnsupportedEncodingException Render a document written in a Doxia markup language. This method is an internal method, used byDoxiaDocumentRenderer
.- Specified by:
renderDocument
in interfaceRenderer
- Parameters:
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 context- Throws:
RendererException
- if it bombs.FileNotFoundException
- if it bombs.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(RenderingContext renderingContext, SiteRenderingContext siteRenderingContext) Create a Velocity Context for a Doxia document, containing every information about rendered document.- Parameters:
renderingContext
- the document's RenderingContextsiteRenderingContext
- the site rendering context- Returns:
- a Velocity tools managed context
-
createSiteTemplateVelocityContext
protected org.apache.velocity.context.Context createSiteTemplateVelocityContext(DocumentContent content, 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 inSiteRendererSink
during document rendering.- Parameters:
content
- the document content to be merged into the templatesiteRenderingContext
- the site rendering context- Returns:
- a Velocity tools managed context
-
generateDocument
public void generateDocument(Writer writer, SiteRendererSink sink, SiteRenderingContext siteRenderingContext) throws RendererException Generate a document output from a Doxia SiteRenderer Sink, i.e. merge the document content into the site template.- Specified by:
generateDocument
in interfaceRenderer
- Parameters:
writer
- the Writer to use.sink
- the Site Renderer Sink that received the Doxia events during document content rendering.siteRenderingContext
- the SiteRenderingContext to use.- Throws:
RendererException
- if it bombs.
-
mergeDocumentIntoSite
public void mergeDocumentIntoSite(Writer writer, DocumentContent content, SiteRenderingContext siteRenderingContext) throws RendererException Generate a document output integrated in a site from a document content, i.e. merge the document content into the site template.- Specified by:
mergeDocumentIntoSite
in interfaceRenderer
- Parameters:
writer
- the Writer to use.content
- the document content to be merged.siteRenderingContext
- the SiteRenderingContext to use.- Throws:
RendererException
- if it bombs.
-
createContextForSkin
public SiteRenderingContext createContextForSkin(org.apache.maven.artifact.Artifact skin, Map<String, ?> attributes, org.apache.maven.doxia.site.decoration.DecorationModel decoration, String defaultWindowTitle, Locale locale) throws IOException, RendererExceptionCreate a Site Rendering Context for a site using a skin.- Specified by:
createContextForSkin
in interfaceRenderer
- Parameters:
skin
- a skinattributes
- attributes to usedecoration
- a decoration modeldefaultWindowTitle
- default window titlelocale
- locale to use- Returns:
- a SiteRenderingContext.
- Throws:
IOException
- if it bombs.RendererException
- if it bombs.
-
createContextForTemplate
@Deprecated public SiteRenderingContext createContextForTemplate(File templateFile, Map<String, ?> attributes, org.apache.maven.doxia.site.decoration.DecorationModel decoration, String defaultWindowTitle, Locale locale) throws MalformedURLExceptionDeprecated.Create a Site Rendering Context for a site using a local template.- Specified by:
createContextForTemplate
in interfaceRenderer
- Parameters:
templateFile
- template fileattributes
- attributes to usedecoration
- a decoration modeldefaultWindowTitle
- default window titlelocale
- locale to use- Returns:
- a SiteRenderingContext.
- Throws:
MalformedURLException
- if it bombs.- See Also:
-
copyResources
public void copyResources(SiteRenderingContext siteRenderingContext, File resourcesDirectory, File outputDirectory) throws IOException Copy resource files.- Specified by:
copyResources
in interfaceRenderer
- Parameters:
siteRenderingContext
- the SiteRenderingContext to useresourcesDirectory
- resources directory as fileoutputDirectory
- output directory as file- Throws:
IOException
- if it bombs.
-
copyResources
public void copyResources(SiteRenderingContext siteRenderingContext, File outputDirectory) throws IOException Copy resource files from skin, template, and site resources.- Specified by:
copyResources
in interfaceRenderer
- Parameters:
siteRenderingContext
- the SiteRenderingContext to use.outputDirectory
- output directory as file- Throws:
IOException
- if it bombs.
-
copyDirectory
Copy the directory- Parameters:
source
- source file to be copieddestination
- destination file- Throws:
IOException
- if any
-