View Javadoc
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.logging.LogEnabled;
23  import org.apache.maven.doxia.wrapper.InputFileWrapper;
24  import org.apache.maven.doxia.wrapper.InputReaderWrapper;
25  import org.apache.maven.doxia.wrapper.OutputFileWrapper;
26  import org.apache.maven.doxia.wrapper.OutputStreamWrapper;
27  
28  /**
29   * Interface to convert a Doxia input wrapper to a Doxia output wrapper.
30   *
31   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
32   */
33  public interface Converter
34      extends LogEnabled
35  {
36      /**
37       * @return a not null array containing supported input formats, i.e. <code>apt</code>.
38       */
39      String[] getInputFormats();
40  
41      /**
42       * @return a not null array containing supported output formats, i.e. <code>xhtml</code>.
43       */
44      String[] getOutputFormats();
45  
46      /**
47       * @param input an input file wrapper, not null.
48       * @param output an output file wrapper, not null.
49       * @throws UnsupportedFormatException if any
50       * @throws ConverterException if any
51       */
52      void convert( InputFileWrapper input, OutputFileWrapper output )
53          throws UnsupportedFormatException, ConverterException;
54  
55      /**
56       * @param input an input reader wrapper, not null.
57       * @param output an output writer wrapper, not null.
58       * @throws UnsupportedFormatException if any
59       * @throws ConverterException if any
60       */
61      void convert( InputReaderWrapper input, OutputStreamWrapper output )
62          throws UnsupportedFormatException, ConverterException;
63  
64      /**
65       * Make the generated files human readable.
66       * <br>
67       * <b>Note</b>: actually, only XML based outputs could be formatted.
68       *
69       * @param formatOutput <code>true</code> to format the generated files, <code>false</code> otherwise.
70       */
71      void setFormatOutput( boolean formatOutput );
72  }