1 package org.apache.maven.doxia.siterenderer;
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.FileNotFoundException;
23 import java.io.UnsupportedEncodingException;
24 import java.io.Writer;
25
26 /**
27 * Renderer for a document that has a source file to be parsed by Doxia.
28 * Details about the source file are in {@link RenderingContext}, which is expected to have
29 * a non-null parserId and extension.
30 *
31 * @author <a href="mailto:brett@apache.org">Brett Porter</a>
32 */
33 public class DoxiaDocumentRenderer
34 implements DocumentRenderer
35 {
36 private RenderingContext renderingContext;
37
38 /**
39 * Constructor.
40 *
41 * @param renderingContext the document's RenderingContext to use.
42 */
43 public DoxiaDocumentRenderer( RenderingContext renderingContext )
44 {
45 this.renderingContext = renderingContext;
46 }
47
48 /** {@inheritDoc} */
49 public void renderDocument( Writer writer, Renderer siteRenderer, SiteRenderingContext siteRenderingContext )
50 throws RendererException, FileNotFoundException, UnsupportedEncodingException
51 {
52 siteRenderer.renderDocument( writer, renderingContext, siteRenderingContext );
53 }
54
55 /** {@inheritDoc} */
56 public String getOutputName()
57 {
58 return renderingContext.getOutputName();
59 }
60
61 /** {@inheritDoc} */
62 public RenderingContext getRenderingContext()
63 {
64 return renderingContext;
65 }
66
67 /** {@inheritDoc} */
68 public boolean isOverwrite()
69 {
70 return false;
71 }
72
73 public boolean isExternalReport()
74 {
75 return false;
76 }
77
78 }