org.apache.maven.doxia.macro.snippet
Class SnippetMacro

java.lang.Object
  extended by org.apache.maven.doxia.macro.AbstractMacro
      extended by org.apache.maven.doxia.macro.snippet.SnippetMacro
All Implemented Interfaces:
LogEnabled, Macro

public class SnippetMacro
extends AbstractMacro

A macro that prints out the content of a file or a URL.

Version:
$Id: SnippetMacro.java 1090706 2011-04-09 23:15:28Z hboutemy $
Plexus component:
role-hint:
"snippet"

Field Summary
 
Fields inherited from interface org.apache.maven.doxia.macro.Macro
EOL, ROLE
 
Constructor Summary
SnippetMacro()
           
 
Method Summary
 void cacheSnippet(URL url, String id, String content)
          Puts the given snippet into the cache.
 void execute(Sink sink, MacroRequest request)
          Execute the current macro using the given MacroRequest, and emit events into the given sink.
 void setCacheTimeout(int time)
          Set the cache timeout.
 
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
 

Constructor Detail

SnippetMacro

public SnippetMacro()
Method Detail

execute

public void execute(Sink sink,
                    MacroRequest request)
             throws MacroExecutionException
Execute the current macro using the given MacroRequest, and emit events into the given sink.

Parameters:
sink - The sink to receive the events.
request - The corresponding MacroRequest.
Throws:
MacroExecutionException - if an error occurred during execution.

cacheSnippet

public void cacheSnippet(URL url,
                         String id,
                         String content)
Puts the given snippet into the cache.

Parameters:
url - The URL to parse.
id - The id of the snippet.
content - The content of the snippet.

setCacheTimeout

public void setCacheTimeout(int time)
Set the cache timeout.

Parameters:
time - The timeout to set.


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.