Class RenderingContext
- java.lang.Object
-
- org.apache.maven.doxia.siterenderer.RenderingContext
-
public class RenderingContext 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)
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.String>attributesprivate java.io.Filebasedirprivate java.lang.StringbasedirRelativePathprivate booleaneditableprivate java.lang.Stringextensionprivate java.lang.Stringgeneratorprivate java.lang.StringinputNameprivate java.lang.StringoutputNameprivate java.lang.StringparserIdprivate java.lang.StringrelativePath
-
Constructor Summary
Constructors Constructor Description RenderingContext(java.io.File basedir, java.lang.String document)Deprecated.RenderingContext(java.io.File basedir, java.lang.String document, java.lang.String generator)Constructor for RenderingContext when document is not rendered from a Doxia markup source.RenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension)Deprecated.RenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable)RenderingContext(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)Constructor for document RenderingContext.
-
Method Summary
All Methods Instance Methods Concrete 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 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 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()Getter for the fieldinputName.java.lang.StringgetOutputName()Get html output name, relative to site root.java.lang.StringgetParserId()Get the parserId when document comes from a Doxia source.java.lang.StringgetRelativePath()Get the relative path 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.
-
-
-
Field Detail
-
basedir
private final java.io.File basedir
-
basedirRelativePath
private final java.lang.String basedirRelativePath
-
inputName
private final java.lang.String inputName
-
outputName
private final java.lang.String outputName
-
parserId
private final java.lang.String parserId
-
relativePath
private final java.lang.String relativePath
-
extension
private final java.lang.String extension
-
attributes
private java.util.Map<java.lang.String,java.lang.String> attributes
-
editable
private final boolean editable
-
generator
private final java.lang.String generator
-
-
Constructor Detail
-
RenderingContext
@Deprecated public RenderingContext(java.io.File basedir, java.lang.String document)Deprecated.
-
RenderingContext
public RenderingContext(java.io.File basedir, java.lang.String document, java.lang.String generator)Constructor for RenderingContext when document is not rendered from a Doxia markup source.
- Parameters:
basedir- the pseudo-source base directory.document- the pseudo-source document name: will be used to compute output name (same name with extension replaced with.html).generator- the generator (in general a reporting goal:groupId:artifactId:version:goal)- Since:
- 1.8
-
RenderingContext
@Deprecated public RenderingContext(java.io.File basedir, java.lang.String document, java.lang.String parserId, java.lang.String extension)Deprecated.
-
RenderingContext
public RenderingContext(java.io.File basedir, java.lang.String basedirRelativePath, java.lang.String document, java.lang.String parserId, java.lang.String extension, boolean editable)
-
RenderingContext
public RenderingContext(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)Constructor for document RenderingContext.
- Parameters:
basedir- the source base directory (not null, pseudo value when not a Doxia source).basedirRelativePath- the relative path from root (null if not Doxia source)document- the source document name.parserId- the Doxia module parser id associated to 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- is the document editable as source, i.e. not generated?generator- the generator (in general a reporting goal:groupId:artifactId:version:goal)- Since:
- 1.8
-
-
Method Detail
-
getBasedir
public java.io.File getBasedir()
Getter for the field
basedir.- Returns:
- a
Fileobject.
-
getInputName
public java.lang.String getInputName()
Getter for the field
inputName.- Returns:
- a
Stringobject.
-
getOutputName
public java.lang.String getOutputName()
Get html output name, relative to site root.- Returns:
- html output name
- See Also:
PathTool.getRelativePath(String)
-
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 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 relative path of basedir (when a Doxia source)- 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.- 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 url of the Doxia source calculate from given base url.- Parameters:
base- the base url to use- Returns:
- the resulting url
- Since:
- 1.8
-
-