View Javadoc

1   package org.apache.maven.doxia.book;
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.book.model.BookModel;
23  
24  import java.io.File;
25  import java.util.List;
26  import java.util.Locale;
27  
28  /**
29   * An interface to create books in different output formats from a book descriptor.
30   *
31   * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
32   * @version $Id: BookDoxia.java 1090706 2011-04-09 23:15:28Z hboutemy $
33   */
34  public interface BookDoxia
35  {
36      /** The plexus lookup role. */
37      String ROLE = BookDoxia.class.getName();
38  
39      /**
40       * Load a BookModel from a descriptor file.
41       *
42       * @param bookDescriptor the book descriptor file.
43       * @return BookModel
44       * @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
45       */
46      BookModel loadBook( File bookDescriptor )
47          throws BookDoxiaException;
48  
49      /**
50       * Creates a book from a BookModel using the {@link Locale#getDefault()} and UTF-8 as default encoding.
51       *
52       * @param book the BookModel.
53       * @param bookRendererId the id of the output format.
54       * @param files a list of source files.
55       * @param outputDirectory the output directory.
56       * @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
57       * @see #renderBook(BookModel, String, List, File, Locale, String, String)
58       * @see Locale#getDefault()
59       */
60      void renderBook( BookModel book, String bookRendererId, List<File> files, File outputDirectory )
61          throws BookDoxiaException;
62  
63      /**
64       * Creates a book from a BookModel.
65       *
66       * @param book the BookModel.
67       * @param bookRendererId the id of the output format.
68       * @param files a list of source files.
69       * @param outputDirectory the output directory.
70       * @param locale the wanted locale.
71       * @param inputEncoding the input encoding when processing <code>files</code>.
72       * @param outputEncoding the output encoding when writing files in <code>ouputDirectory</code>.
73       * @throws org.apache.maven.doxia.book.BookDoxiaException if the model cannot be loaded.
74       * @since 1.1
75       */
76      void renderBook( BookModel book, String bookRendererId, List<File> files, File outputDirectory, Locale locale,
77                       String inputEncoding, String outputEncoding )
78          throws BookDoxiaException;
79  }