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 // * @deprecated since 1.1.2, use {@link #render(File, File, DocumentModel, DocumentRendererContext)}
69 */
70 void render( File baseDirectory, File outputDirectory, DocumentModel documentModel )
71 throws DocumentRendererException, IOException;
72
73 // /**
74 // * Render a document from the files found in a source directory, depending on a rendering context.
75 // *
76 // * @param baseDirectory the directory containing the source files.
77 // * This should follow the standard Maven convention, ie containing all the site modules.
78 // * @param outputDirectory the output directory where the document should be generated.
79 // * @param documentModel the document model, containing all the metadata, etc.
80 // * If the model contains a TOC, only the files found in this TOC are rendered,
81 // * otherwise all files found under baseDirectory will be processed.
82 // * If the model is null, render all files from baseDirectory individually.
83 // * @param context the rendering context when processing files.
84 // * @throws org.apache.maven.doxia.docrenderer.DocumentRendererException if any
85 // * @throws java.io.IOException if any
86 // * @since 1.1.2
87 // */
88 // void render( File baseDirectory, File outputDirectory, DocumentModel documentModel,
89 // 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 }