Package org.apache.maven.doxia.siterenderer

## 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

### Field Summary

### Fields inherited from interface org.apache.maven.doxia.siterenderer.Renderer

`ROLE`

### Constructor Summary

Constructors
`DefaultSiteRenderer()`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`protected void` `copyDirectory​(java.io.File source, java.io.File destination)` Copy the directory
`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​(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.Context` `createSiteTemplateVelocityContext​(SiteRendererSink siteRendererSink, 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​(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.
`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 renderingContext, 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`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### DefaultSiteRenderer

    public DefaultSiteRenderer()

### 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:
  `locateDocumentFiles` in interface `Renderer`
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:
  `render` in interface `Renderer`
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.UnsupportedEncodingException

Render a document written in a Doxia markup language. This method is an internal method, used by `DoxiaDocumentRenderer`.

Specified by:
  `renderDocument` in interface `Renderer`
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 document
  `siteRenderingContext` - 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 in `SiteRendererSink` during document rendering.

Parameters:
  `siteRendererSink` - the site renderer sink for the document
  `siteRenderingContext` - the site rendering context
Returns:

#### generateDocument

    public void generateDocument​(java.io.Writer writer,
                                 SiteRendererSink sink,
                                 SiteRenderingContext siteRenderingContext)
                          throws RendererException

Generate a document output from a Doxia SiteRenderer Sink.

Specified by:
  `generateDocument` in interface `Renderer`
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:
  `createContextForSkin` in interface `Renderer`
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:
  `createContextForTemplate` in interface `Renderer`
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:
  `copyResources` in interface `Renderer`
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:
  `copyResources` in interface `Renderer`
Throws:
  `java.io.IOException` - if it bombs.

#### copyDirectory

    protected void copyDirectory​(java.io.File source,
                                 java.io.File destination)
                          throws java.io.IOException

Copy the directory

Parameters:
  `source` - source file to be copied
  `destination` - destination file
Throws:
  `java.io.IOException` - if any