@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 moduleBasedir,
org.apache.maven.doxia.parser.module.ParserModule module,
java.lang.String excludes,
java.util.Map<java.lang.String,DocumentRenderer> files) |
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(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.
|
(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.
|
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.
|
(package private) boolean |
matchVersion(java.lang.String current,
java.lang.String prerequisite) |
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.
|
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 Rendererjava.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 moduleBasedir,
org.apache.maven.doxia.parser.module.ParserModule module,
java.lang.String excludes,
java.util.Map<java.lang.String,DocumentRenderer> files)
throws java.io.IOException,
RendererException
java.io.IOExceptionRendererExceptionpublic void render(java.util.Collection<DocumentRenderer> documents, SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws RendererException, java.io.IOException
render in interface Rendererdocuments - 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 renderingContext,
SiteRenderingContext siteContext)
throws RendererException,
java.io.FileNotFoundException,
java.io.UnsupportedEncodingException
DoxiaDocumentRenderer.renderDocument in interface Rendererwriter - 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 contextRendererException - if it bombs.java.io.FileNotFoundException - if it bombs.java.io.UnsupportedEncodingException - if it bombs.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(SiteRendererSink siteRendererSink, SiteRenderingContext siteRenderingContext)
SiteRendererSink during document rendering.siteRendererSink - the site renderer sink for the documentsiteRenderingContext - the site rendering contextpublic void generateDocument(java.io.Writer writer,
SiteRendererSink sink,
SiteRenderingContext siteRenderingContext)
throws RendererException
generateDocument in interface Rendererwriter - the Writer to use.sink - the Site Renderer Sink to receive the Doxia events.siteRenderingContext - 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 Rendererjava.io.IOException - if it bombs.RendererExceptionboolean 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 Rendererjava.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 Rendererjava.io.IOException - if it bombs.public void copyResources(SiteRenderingContext siteRenderingContext, java.io.File outputDirectory) throws java.io.IOException
copyResources in interface Rendererjava.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.IOExceptionprotected 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.ParseExceptionjava.io.IOExceptionstatic 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.IOExceptionprivate static void closeZipFile(java.util.zip.ZipFile zipFile)