Class DefaultDoxia

java.lang.Object
org.codehaus.plexus.logging.AbstractLogEnabled
org.apache.maven.doxia.DefaultDoxia
All Implemented Interfaces:
Doxia, org.codehaus.plexus.logging.LogEnabled

@Component(role=Doxia.class) public class DefaultDoxia extends org.codehaus.plexus.logging.AbstractLogEnabled implements Doxia
Simple implementation of the Doxia interface: uses a ParserManager to lookup a parser.
Since:
1.0
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
     

    Fields inherited from interface org.apache.maven.doxia.Doxia

    ROLE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getParser(String parserId)
    Return a parser for the given parserId.
    void
    parse(Reader source, String parserId, Sink sink)
    Parses the given source model using a parser with given id, and emits Doxia events into the given sink.
    void
    parse(Reader source, String parserId, Sink sink, String reference)
    Parses the given source model using a parser with given id, and emits Doxia events into the given sink.

    Methods inherited from class org.codehaus.plexus.logging.AbstractLogEnabled

    enableLogging, getLogger, setupLogger, setupLogger, setupLogger

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • parserManager

      @Requirement private ParserManager parserManager
  • Constructor Details

    • DefaultDoxia

      public DefaultDoxia()
  • Method Details

    • parse

      public void parse(Reader source, String parserId, Sink sink) throws ParserNotFoundException, ParseException
      Parses the given source model using a parser with given id, and emits Doxia events into the given sink.
      Specified by:
      parse in interface Doxia
      Parameters:
      source - not null reader that provides the source document
      parserId - identifier for the parser to use
      sink - a sink that consumes the Doxia events
      Throws:
      ParserNotFoundException - if no parser could be found for the given id
      ParseException - if the model could not be parsed
    • parse

      public void parse(Reader source, String parserId, Sink sink, String reference) throws ParserNotFoundException, ParseException
      Parses the given source model using a parser with given id, and emits Doxia events into the given sink.
      Specified by:
      parse in interface Doxia
      Parameters:
      source - not null reader that provides the source document
      parserId - identifier for the parser to use
      sink - a sink that consumes the Doxia events
      reference - string containing the reference to the source (e.g. filename)
      Throws:
      ParserNotFoundException - if no parser could be found for the given id
      ParseException - if the model could not be parsed
    • getParser

      public Parser getParser(String parserId) throws ParserNotFoundException
      Return a parser for the given parserId.
      Specified by:
      getParser in interface Doxia
      Parameters:
      parserId - identifier for the parser to use
      Returns:
      the parser identified by parserId
      Throws:
      ParserNotFoundException - if no parser could be found for the given id