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.IOException;
22  import java.io.Writer;
23  
24  /**
25   * Renders a page in a site, whatever the source is: a Doxia source file, a report or anything else.
26   *
27   * @author <a href="mailto:brett@apache.org">Brett Porter</a>
28   * @see DocumentRenderingContext document rendering context
29   */
30  public interface DocumentRenderer {
31      /**
32       * Render a document in a site.
33       *
34       * @param writer the Writer for the document output.
35       * @param siteRenderer the site renderer to merge document content to.
36       * @param siteRenderingContext the site rendering context.
37       * @throws RendererException if it bombs.
38       * @throws IOException if it bombs.
39       */
40      void renderDocument(Writer writer, SiteRenderer siteRenderer, SiteRenderingContext siteRenderingContext)
41              throws IOException, RendererException;
42  
43      /**
44       * The name of the output document.
45       *
46       * @return the name of the output document.
47       */
48      String getOutputName();
49  
50      /**
51       * Return the rendering context of the document.
52       *
53       * @return DocumentRenderingContext.
54       */
55      DocumentRenderingContext getRenderingContext();
56  
57      /**
58       * Whether to always overwrite the document, or only do so when it is changed.
59       *
60       * @return whether to overwrite
61       */
62      boolean isOverwrite();
63  
64      /**
65       * Whether this document is an external report, independent from the site templating.
66       *
67       * @return {@code true} if report is external, otherwise {@code false}
68       * @since 1.7
69       */
70      boolean isExternalReport();
71  }