View Javadoc

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