1 package org.apache.maven.doxia; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import org.apache.maven.doxia.parser.ParseException; 23 import org.apache.maven.doxia.parser.Parser; 24 import org.apache.maven.doxia.parser.manager.ParserNotFoundException; 25 import org.apache.maven.doxia.sink.Sink; 26 27 import java.io.Reader; 28 29 /** 30 * Basic interface of the Doxia framework. 31 * 32 * @author Jason van Zyl 33 * @since 1.0 34 */ 35 public interface Doxia 36 { 37 /** The Plexus lookup role. */ 38 String ROLE = Doxia.class.getName(); 39 40 /** 41 * Parses the given source model using a parser with given id, 42 * and emits Doxia events into the given sink. 43 * 44 * @param source not null reader that provides the source document 45 * @param parserId identifier for the parser to use 46 * @param sink a sink that consumes the Doxia events 47 * @throws ParserNotFoundException if no parser could be found for the given id 48 * @throws ParseException if the model could not be parsed 49 */ 50 void parse( Reader source, String parserId, Sink sink ) 51 throws ParserNotFoundException, ParseException; 52 53 /** 54 * Parses the given source model using a parser with given id, 55 * and emits Doxia events into the given sink. 56 * 57 * @param source not null reader that provides the source document 58 * @param parserId identifier for the parser to use 59 * @param sink a sink that consumes the Doxia events 60 * @param reference string containing the reference to the source (e.g. filename) 61 * @throws ParserNotFoundException if no parser could be found for the given id 62 * @throws ParseException if the model could not be parsed 63 */ 64 void parse( Reader source, String parserId, Sink sink, String reference ) 65 throws ParserNotFoundException, ParseException; 66 67 /** 68 * Return a parser for the given <code>parserId</code>. 69 * 70 * @param parserId identifier for the parser to use 71 * @return the parser identified by parserId 72 * @throws ParserNotFoundException if no parser could be found for the given id 73 */ 74 Parser getParser( String parserId ) 75 throws ParserNotFoundException; 76 }