|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.maven.doxia.macro.AbstractMacro org.tinyjee.maven.dim.IncludeMacro
public class IncludeMacro
Implements a more feature rich alternative to the bundled "Snippet" macro.
Field Summary | |
---|---|
static String |
RESOURCES_FOLDER_NAME
Specifies the folder name of the folder where resources are put. |
static String |
VELOCITY_TEMPLATE_EXTENSION
Specifies the extension used to detect velocity templates. |
Fields inherited from interface org.apache.maven.doxia.macro.Macro |
---|
EOL, ROLE |
Constructor Summary | |
---|---|
IncludeMacro()
|
Method Summary | |
---|---|
void |
contextualize(org.codehaus.plexus.context.Context context)
|
void |
execute(Sink sink,
MacroRequest request)
|
protected Map<String,String> |
extractTextParameters(Map requestParameters)
Extracts all text only parameters from the given map of request parameters. |
protected File |
findSiteAttachedIncludesDirectory(File basePath,
Map<String,String> textParameters)
Finds the directory to use for attaching file includes to the site. |
protected File |
findSiteSourceDirectory(File baseDir,
Map<String,String> params)
Finds the directory where the site sources are located. |
protected Source |
findSource(File basePath,
Map<String,String> textParameters)
Finds the source implementation given the provided input. |
protected URL |
findSourceURL(File basePath,
Map<String,String> parameters)
Attempts to find the URL that locates the source to include. |
protected Parser |
getContentParser(URL source,
Map<String,String> params)
Returns a content parser for the given source or 'null' if not no parser exists. |
CodeHighlighter |
getHighlighter()
|
protected org.apache.maven.doxia.logging.Log |
getLogger()
Is a helper method to retrieve a Doxia logger using reflection (to be compatible with earlier versions of Doxia). |
protected void |
processRawContent(Source source,
SortedMap<Integer,List<String>> snippets,
Sink sink)
Sends raw text to the sink. |
protected void |
processSource(Map<String,String> textParameters,
File basePath,
Source source,
Sink sink)
Processes the given source to the Sink. |
Methods inherited from class org.apache.maven.doxia.macro.AbstractMacro |
---|
enableLogging, getAttributesFromMap, getLog, required |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String RESOURCES_FOLDER_NAME
public static final String VELOCITY_TEMPLATE_EXTENSION
Constructor Detail |
---|
public IncludeMacro()
Method Detail |
---|
public CodeHighlighter getHighlighter()
public void contextualize(org.codehaus.plexus.context.Context context) throws org.codehaus.plexus.context.ContextException
contextualize
in interface org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable
org.codehaus.plexus.context.ContextException
public void execute(Sink sink, MacroRequest request) throws MacroExecutionException
execute
in interface Macro
MacroExecutionException
protected Source findSource(File basePath, Map<String,String> textParameters) throws MacroExecutionException
basePath
- the base path the macro operates on.textParameters
- the given parameters.
MacroExecutionException
- in case of the given input parameters were invalid.protected URL findSourceURL(File basePath, Map<String,String> parameters) throws MacroExecutionException
basePath
- the base path to resolve files against.parameters
- the given macro parameters.
MacroExecutionException
- In case of a source was specified but not found.protected void processSource(Map<String,String> textParameters, File basePath, Source source, Sink sink) throws MacroExecutionException
textParameters
- a text-only version of the request params.basePath
- the module's base path.source
- the effective source.sink
- the sink to write the output to.
MacroExecutionException
- in case of the processing failed.protected void processRawContent(Source source, SortedMap<Integer,List<String>> snippets, Sink sink) throws IOException
source
- the source to process.snippets
- optional snippet selection.sink
- the sink to write the raw content to.
IOException
- in case of writing failed.protected File findSiteAttachedIncludesDirectory(File basePath, Map<String,String> textParameters)
basePath
- the current project's base path.textParameters
- any given macro parameters that may influence the selection process.
protected File findSiteSourceDirectory(File baseDir, Map<String,String> params)
baseDir
- the base directory ot the module.params
- the parameters of the macro request.
protected Map<String,String> extractTextParameters(Map requestParameters)
requestParameters
- the request parameters.
protected Parser getContentParser(URL source, Map<String,String> params)
source
- the source url to retrieve the parser for (can be 'null').params
- the request params.
protected org.apache.maven.doxia.logging.Log getLogger()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |