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 640549 2008-03-24 20:05:11Z bentmann $
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       * @return the output name of this report.
61       */
62      String getOutputName();
63  
64      /**
65       * Get the category name for this report.
66       *
67       * @return the category name of this report. Should be <code>CATEGORY_PROJECT_INFORMATION</code>
68       * or <code>CATEGORY_PROJECT_REPORTS</code>
69       * {@link #CATEGORY_PROJECT_INFORMATION}
70       * {@link #CATEGORY_PROJECT_REPORTS}
71       */
72      String getCategoryName();
73  
74      /**
75       * @param locale the wanted locale to return the report's name, could be null.
76       * @return the name of this report.
77       */
78      String getName( Locale locale );
79  
80      /**
81       * @param locale the wanted locale to return the report's description, could be null.
82       * @return the description of this report.
83       */
84      String getDescription( Locale locale );
85  
86      /**
87       * Set a new output directory. Useful for staging.
88       *
89       * @param outputDirectory the new output directory
90       */
91      void setReportOutputDirectory( File outputDirectory );
92  
93      /**
94       * @return the current report output directory.
95       */
96      File getReportOutputDirectory();
97  
98      /**
99       * An external report is a report which calls a third party program which generates some reports too.
100      * A good example is javadoc tool.
101      *
102      * @return <tt>true</tt> if this report is external, <tt>false</tt> otherwise.
103      * Default should <tt>false</tt>.
104      */
105     boolean isExternalReport();
106 
107     /**
108      * Verify some conditions before generate the report.
109      *
110      * @return <tt>true</tt> if this report could be generated, <tt>false</tt> otherwise.
111      * Default should <tt>true</tt>.
112      */
113     boolean canGenerateReport();
114 }