View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.doxia.siterenderer;
20  
21  import java.io.FileNotFoundException;
22  import java.io.UnsupportedEncodingException;
23  import java.io.Writer;
24  
25  /**
26   * Renders a page in a site, whatever the source is: a Doxia source file, a report or anything else.
27   *
28   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
29   * @see RenderingContext document rendering context
30   */
31  public interface DocumentRenderer {
32      /**
33       * Render a document in a site.
34       *
35       * @param writer the Writer for the document output.
36       * @param siteRenderer the site renderer to merge document content to.
37       * @param siteRenderingContext the site rendering context.
38       * @throws org.apache.maven.doxia.siterenderer.RendererException if it bombs.
39       * @throws java.io.FileNotFoundException if it bombs.
40       * @throws java.io.UnsupportedEncodingException if it bombs.
41       */
42      void renderDocument(Writer writer, Renderer siteRenderer, SiteRenderingContext siteRenderingContext)
43              throws RendererException, FileNotFoundException, UnsupportedEncodingException;
44  
45      /**
46       * The name of the output document.
47       *
48       * @return the name of the output document.
49       */
50      String getOutputName();
51  
52      /**
53       * Return the RenderingContext of the document.
54       *
55       * @return RenderingContext.
56       */
57      RenderingContext getRenderingContext();
58  
59      /**
60       * Whether to always overwrite the document, or only do so when it is changed.
61       *
62       * @return whether to overwrite
63       */
64      boolean isOverwrite();
65  
66      /**
67       * Whether this document is an external report, independent from the site templating.
68       *
69       * @return {@code true} if report is external, otherwise {@code false}
70       * @since 1.7
71       */
72      boolean isExternalReport();
73  }