View Javadoc
1   package org.apache.maven.doxia.docrenderer;
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 java.io.File;
23  import java.io.IOException;
24  import java.util.Collection;
25  
26  import org.apache.maven.doxia.document.DocumentModel;
27  
28  /**
29   * Base interface for rendering documents from a set of input files.
30   *
31   * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
32   * @author ltheussl
33   * @since 1.1
34   */
35  public interface DocumentRenderer
36  {
37      /** Plexus lookup role. */
38      String ROLE = DocumentRenderer.class.getName();
39  
40      /**
41       * Render a document from a set of files, depending on a rendering context.
42       *
43       * @param files the path name Strings (relative to a common base directory)
44       *              of files to include in the document generation.
45       * @param outputDirectory the output directory where the document should be generated.
46       * @param documentModel the document model, containing all the metadata, etc.
47       *              If the model contains a TOC, only the files found in this TOC are rendered,
48       *              otherwise all files from the Collection of files will be processed.
49       *              If the model is null, render all files individually.
50       * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any.
51       * @throws java.io.IOException if any.
52       */
53      void render( Collection<String> files, File outputDirectory, DocumentModel documentModel )
54          throws DocumentRendererException, IOException;
55  
56      /**
57       * Render a document from the files found in a source directory, depending on a rendering context.
58       *
59       * @param baseDirectory the directory containing the source files.
60       *              This should follow the standard Maven convention, ie containing all the site modules.
61       * @param outputDirectory the output directory where the document should be generated.
62       * @param documentModel the document model, containing all the metadata, etc.
63       *              If the model contains a TOC, only the files found in this TOC are rendered,
64       *              otherwise all files found under baseDirectory will be processed.
65       *              If the model is null, render all files from baseDirectory individually.
66       * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
67       * @throws java.io.IOException if any
68       */
69      void render( File baseDirectory, File outputDirectory, DocumentModel documentModel )
70          throws DocumentRendererException, IOException;
71  
72  //    /**
73  //     * Render a document from the files found in a source directory, depending on a rendering context.
74  //     *
75  //     * @param baseDirectory the directory containing the source files.
76  //     *              This should follow the standard Maven convention, ie containing all the site modules.
77  //     * @param outputDirectory the output directory where the document should be generated.
78  //     * @param documentModel the document model, containing all the metadata, etc.
79  //     *              If the model contains a TOC, only the files found in this TOC are rendered,
80  //     *              otherwise all files found under baseDirectory will be processed.
81  //     *              If the model is null, render all files from baseDirectory individually.
82  //     * @param context the rendering context when processing files.
83  //     * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
84  //     * @throws java.io.IOException if any
85  //     * @since 1.1.2
86  //     */
87  //    void render( File baseDirectory, File outputDirectory, DocumentModel documentModel,
88  //                 DocumentRendererContext context )
89  //        throws DocumentRendererException, IOException;
90  
91      /**
92       * Read a document model from a file.
93       *
94       * @param documentDescriptor a document descriptor file that contains the document model.
95       * @return the document model, containing all the metadata, etc.
96       * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
97       * @throws java.io.IOException if any
98       */
99      DocumentModel readDocumentModel( File documentDescriptor )
100         throws DocumentRendererException, IOException;
101 
102     /**
103      * Get the output extension associated with this DocumentRenderer.
104      *
105      * @return the ouput extension.
106      */
107     String getOutputExtension();
108 }