Class DocumentRenderingContext
- java.lang.Object
-
- org.apache.maven.doxia.siterenderer.DocumentRenderingContext
-
public class DocumentRenderingContext extends java.lang.ObjectThe rendering context of a document. If not rendered from a Doxia markup source, parserId and extension will be null.- Since:
- 1.5 (was since 1.1 in o.a.m.d.sink.render)
- Author:
- Jason van Zyl
-
-
Constructor Summary
Constructors Constructor Description DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String generator)Constructor for rendering context when document is not rendered from a Doxia markup source.DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension, java.io.File rootDirectory, java.io.File siteRootDirectory, java.util.Collection<java.io.File> sourceDirectories)Constructor for rendering context when document is a Doxia markup source.DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension, java.io.File rootDirectory, java.io.File siteRootDirectory, java.util.Collection<java.io.File> sourceDirectories, java.lang.String generator)Constructor for document rendering context.DocumentRenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable)Deprecated.DocumentRenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable, java.lang.String generator)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAttribute(java.lang.String key)getAttribute.java.io.FilegetBasedir()Getter for the fieldbasedir.java.lang.StringgetBasedirRelativePath()Get the project root relative path of basedir (when a Doxia source).java.lang.StringgetDoxiaSourcePath()Get the relative path to Doxia source from build root.java.lang.StringgetDoxiaSourcePath(java.lang.String base)Get absolute url of the Doxia source calculate from given base url.java.lang.StringgetExtension()Get the source document filename extension (when a Doxia source)java.lang.StringgetGenerator()What is the generator (if any)?java.lang.StringgetInputName()Deprecated.Method name does not properly reflect its purpose.java.lang.StringgetInputPath()Getter for the fieldinputPath.java.lang.StringgetOutputName()Deprecated.Method name does not properly reflect its purpose.java.lang.StringgetOutputPath()Get html output path, relative to site root.java.lang.StringgetParserId()Get the parserId when document comes from a Doxia source.java.lang.StringgetRelativePath()Get the relative path of the parent directory of this document to site root.booleanisDoxiaSource()Is the document rendered from a Doxia source?booleanisEditable()Is the source document editable?voidsetAttribute(java.lang.String key, java.lang.String value)setAttribute.
-
-
-
Constructor Detail
-
DocumentRenderingContext
public DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String generator)Constructor for rendering context when document is not rendered from a Doxia markup source.
- Parameters:
basedir- the pseudo-source base directory.document- the pseudo-source document path: will be used to compute output path (same path with extension replaced with.html).generator- the generator (in general a reporting goal:groupId:artifactId:version:goal)- Since:
- 1.8
-
DocumentRenderingContext
@Deprecated public DocumentRenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable)Deprecated.- Parameters:
basedir-basedirRelativePath-document-parserId-extension-editable-
-
DocumentRenderingContext
public DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension, java.io.File rootDirectory, java.io.File siteRootDirectory, java.util.Collection<java.io.File> sourceDirectories)Constructor for rendering context when document is a Doxia markup source.
Same asDocumentRenderingContext(File, String, String, String, File, File, Collection, String)withgeneratorset tonull.- Parameters:
basedir- the source base directory (not null, pseudo value when not a Doxia source).document- the source document path.parserId- the Doxia module parser id associated with this document, may be null if document not rendered from a Doxia source.extension- the source document filename extension, may be null if document not rendered from a Doxia source.rootDirectory- the absolute project's root directory (not null), usuallyproject.basedir, must be an ancestor ofsiteRootDirectorysiteRootDirectory- the absolute site's root directory (not null), must start withrootDirectory, often ends with/src/sitesourceDirectories- the absolute paths of directories which may contain the original editable source.- Since:
- 2.1
-
DocumentRenderingContext
@Deprecated public DocumentRenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable, java.lang.String generator)Deprecated.Constructor for document rendering context.
- Parameters:
basedir- the absolute source base directory (not null, pseudo value when not a Doxia source).basedirRelativePath- the relative path of#basedirfrom project root (null if not Doxia source)document- the source document path.parserId- the Doxia module parser id associated with this document, may be null if document not rendered from a Doxia source.extension- the source document filename extension, may be null if document not rendered from a Doxia source.editable-trueif the document is editable as source, i.e. not generated,falseotherwise.generator- the generator of this document (in general a reporting goal:groupId:artifactId:version:goal), not set when document is based on a Doxia source.- Since:
- 1.8
-
DocumentRenderingContext
public DocumentRenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension, java.io.File rootDirectory, java.io.File siteRootDirectory, java.util.Collection<java.io.File> sourceDirectories, java.lang.String generator)Constructor for document rendering context.
- Parameters:
basedir- the source base directory (not null, pseudo value when not a Doxia source).document- the source document path.parserId- the Doxia module parser id associated with this document, may be null if document not rendered from a Doxia source.extension- the source document filename extension, may be null if document not rendered from a Doxia source.rootDirectory- the absolute project's root directory (not null), usuallyproject.basedir, must be an ancestor ofsiteRootDirectorysiteRootDirectory- the absolute site's root directory (not null), must start withrootDirectory, often ends with/src/sitesourceDirectories- the absolute paths of directories which may contain the original editable source.generator- the generator (in general a reporting goal:groupId:artifactId:version:goal)- Since:
- 2.1
-
-
Method Detail
-
getBasedir
public java.io.File getBasedir()
Getter for the field
basedir.- Returns:
- a
Fileobject.
-
getInputPath
public java.lang.String getInputPath()
Getter for the field
inputPath.- Returns:
- a
Stringobject.
-
getInputName
@Deprecated public java.lang.String getInputName()
Deprecated.Method name does not properly reflect its purpose. UsegetInputPath()instead.
-
getOutputPath
public java.lang.String getOutputPath()
Get html output path, relative to site root.- Returns:
- html output path
- See Also:
PathTool.getRelativePath(String)
-
getOutputName
@Deprecated public java.lang.String getOutputName()
Deprecated.Method name does not properly reflect its purpose. UsegetOutputPath()instead.
-
getParserId
public java.lang.String getParserId()
Get the parserId when document comes from a Doxia source.- Returns:
- parser id, or
nullif not froma DOxia source.
-
getRelativePath
public java.lang.String getRelativePath()
Get the relative path of the parent directory of this document to site root.- Returns:
- the relative path to site root
-
setAttribute
public void setAttribute(java.lang.String key, java.lang.String value)setAttribute.
- Parameters:
key- aStringobject.value- aStringobject.
-
getAttribute
public java.lang.String getAttribute(java.lang.String key)
getAttribute.
- Parameters:
key- aStringobject.- Returns:
- a
Stringobject.
-
getExtension
public java.lang.String getExtension()
Get the source document filename extension (when a Doxia source)- Returns:
- the source document filename extension when a Doxia source, or
nullif not a Doxia source
-
isEditable
public boolean isEditable()
Is the source document editable?- Returns:
trueif comes from an editable Doxia source (not generated one).- Since:
- 1.8
-
isDoxiaSource
public boolean isDoxiaSource()
Is the document rendered from a Doxia source?- Returns:
trueif comes from a Doxia source.- Since:
- 1.8
-
getGenerator
public java.lang.String getGenerator()
What is the generator (if any)?- Returns:
nullif no known generator- Since:
- 1.8
-
getBasedirRelativePath
public java.lang.String getBasedirRelativePath()
Get the project root relative path of basedir (when a Doxia source). For examplesrc/site/markdown.- Returns:
- the relative path of basedir when a Doxia source, or
nullif not a Doxia source - Since:
- 1.8
-
getDoxiaSourcePath
public java.lang.String getDoxiaSourcePath()
Get the relative path to Doxia source from build root. The file separators in the returned path are/regardless of the platform..- Returns:
- the relative path to Doxia source from build root, or
nullif not a Doxia source - Since:
- 1.8
-
getDoxiaSourcePath
public java.lang.String getDoxiaSourcePath(java.lang.String base)
Get absolute url of the Doxia source calculate from given base url. Used from Skins to render an edit button.- Parameters:
base- the base url to use- Returns:
- the resulting url
- Since:
- 1.8
-
-