org.codehaus.doxia.parser.AbstractParser Maven / Gradle / Ivy
The newest version!
package org.codehaus.doxia.parser;
import org.codehaus.doxia.macro.manager.MacroManager;
import org.codehaus.doxia.macro.manager.MacroNotFoundException;
import org.codehaus.doxia.macro.MacroRequest;
import org.codehaus.doxia.macro.Macro;
import org.codehaus.doxia.sink.Sink;
/**
* @author Jason van Zyl
* @version $Id: AbstractParser.java 94 2005-07-08 12:43:37Z evenisse $
*
* @plexus.component
*/
public abstract class AbstractParser
implements Parser
{
/**
* @plexus.requirement
*/
private MacroManager macroManager;
public MacroManager getMacroManager()
{
return macroManager;
}
// Made public right now because of the structure of the APT parser and
// all its inner classes.
public void executeMacro( String macroId, MacroRequest request, Sink sink )
{
try
{
System.out.println( "macroId = " + macroId );
System.out.println( "getMacroManager() = " + getMacroManager() );
Macro macro = getMacroManager().getMacro( macroId );
try
{
macro.execute( sink, request );
}
catch ( Exception e )
{
e.printStackTrace();
}
}
catch ( MacroNotFoundException e )
{
System.out.println( "The requested macro with id = " + macroId + " cannot be found." );
}
}
}