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