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 * @version $Id$ 34 * @since 1.0 35 */ 36 public interface Doxia 37 { 38 /** The Plexus lookup role. */ 39 String ROLE = Doxia.class.getName(); 40 41 /** 42 * Parses the given source model using a parser with given id, 43 * and emits Doxia events into the given sink. 44 * 45 * @param source not null reader that provides the source document. 46 * You could use <code>newReader</code> methods from {@link org.codehaus.plexus.util.ReaderFactory}. 47 * @param parserId Identifier for the parser to use. 48 * @param sink A sink that consumes the Doxia events. 49 * @throws org.apache.maven.doxia.parser.manager.ParserNotFoundException 50 * if no parser could be found for the given id. 51 * @throws org.apache.maven.doxia.parser.ParseException if the model could not be parsed. 52 */ 53 void parse( Reader source, String parserId, Sink sink ) 54 throws ParserNotFoundException, ParseException; 55 56 /** 57 * Return a parser for the given <code>parserId</code>. 58 * 59 * @param parserId Identifier for the parser to use. 60 * @return the parser defining by parserId. 61 * @throws org.apache.maven.doxia.parser.manager.ParserNotFoundException 62 * if no parser could be found for the given id. 63 */ 64 Parser getParser( String parserId ) 65 throws ParserNotFoundException; 66 }