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 output path of the document.
45       * <p>
46       * Note: This method won't be {@code default} anymore when {@link #getOutputName()} is removed.
47       * You are advised to implement it as soon as possible.
48       *
49       * @since 2.0.0
50       * @return the name of the output document.
51       */
52      default String getOutputPath() {
53          return getOutputName();
54      }
55  
56      /**
57       * @deprecated Method name does not properly reflect its purpose. Implement and use
58       * {@link #getOutputPath()} instead.
59       */
60      @Deprecated
61      String getOutputName();
62  
63      /**
64       * Return the rendering context of the document.
65       *
66       * @return DocumentRenderingContext.
67       */
68      DocumentRenderingContext getRenderingContext();
69  
70      /**
71       * Whether to always overwrite the document, or only do so when it is changed.
72       *
73       * @return whether to overwrite
74       */
75      boolean isOverwrite();
76  
77      /**
78       * Whether this document is an external report, independent from the site templating.
79       *
80       * @return {@code true} if report is external, otherwise {@code false}
81       * @since 1.7
82       */
83      boolean isExternalReport();
84  }