1 package org.apache.maven.reporting;
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 org.codehaus.doxia.sink.Sink;
23
24 import java.io.File;
25 import java.util.Locale;
26
27 /**
28 * The basis for a Maven report.
29 *
30 * @author Brett Porter
31 * @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
32 * @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
33 * @since 2.0
34 */
35 public interface MavenReport
36 {
37 /** Plexus lookup name */
38 String ROLE = MavenReport.class.getName();
39
40 /** Category for project information reports */
41 String CATEGORY_PROJECT_INFORMATION = "Project Info";
42
43 /** Category for project reports */
44 String CATEGORY_PROJECT_REPORTS = "Project Reports";
45
46 /**
47 * Generate the report depending the wanted locale.
48 * <br>
49 * Mainly used for external reports like javadoc.
50 *
51 * @param sink the sink to use for the generation.
52 * @param locale the wanted locale to generate the report, could be null.
53 * @throws MavenReportException if any
54 */
55 void generate( Sink sink, Locale locale )
56 throws MavenReportException;
57
58 /**
59 * Get the base name used to create report's output file(s).
60 *
61 * @return the output name of this report.
62 */
63 String getOutputName();
64
65 /**
66 * Get the category name for this report.
67 *
68 * @return the category name of this report. Should be {@link #CATEGORY_PROJECT_INFORMATION}
69 * or {@link #CATEGORY_PROJECT_REPORTS}
70 */
71 String getCategoryName();
72
73 /**
74 * Get the localized report name.
75 *
76 * @param locale the wanted locale to return the report's name, could be null.
77 * @return the name of this report.
78 */
79 String getName( Locale locale );
80
81 /**
82 * Get the localized report description.
83 *
84 * @param locale the wanted locale to return the report's description, could be null.
85 * @return the description of this report.
86 */
87 String getDescription( Locale locale );
88
89 /**
90 * Set a new output directory. Useful for staging.
91 *
92 * @param outputDirectory the new output directory
93 */
94 void setReportOutputDirectory( File outputDirectory );
95
96 /**
97 * @return the current report output directory.
98 */
99 File getReportOutputDirectory();
100
101 /**
102 * An external report is a report which calls a third party program which generates some reports too.
103 * A good example is javadoc tool.
104 *
105 * @return {@code true} if this report is external, {@code false} otherwise.
106 * Default should be {@code false}.
107 */
108 boolean isExternalReport();
109
110 /**
111 * Verify some conditions before generate the report.
112 *
113 * @return {@code true} if this report could be generated, {@code false} otherwise.
114 * Default should be {@code true}.
115 */
116 boolean canGenerateReport();
117 }