org.apache.maven.reporting
Class AbstractMavenReport

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.reporting.AbstractMavenReport
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, MavenMultiPageReport, org.apache.maven.reporting.MavenReport

public abstract class AbstractMavenReport
extends org.apache.maven.plugin.AbstractMojo
implements MavenMultiPageReport

The basis for a Maven report which can be generated both as part of a site generation or as a direct standalone invocation.

Since:
2.0
Version:
$Id: AbstractMavenReport.java 942606 2010-05-09 20:17:20Z hboutemy $
Author:
Emmanuel Venisse
See Also:
execute(), generate(Sink, SinkFactory, Locale), executeReport(Locale)

Field Summary
 
Fields inherited from interface org.apache.maven.reporting.MavenReport
CATEGORY_PROJECT_INFORMATION, CATEGORY_PROJECT_REPORTS, ROLE
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractMavenReport()
           
 
Method Summary
 boolean canGenerateReport()
          
protected  void closeReport()
          Actions when closing the report.
 void execute()
          This method is called when the report generation is invoked directly as a standalone Mojo.
protected abstract  void executeReport(java.util.Locale locale)
          Execute the generation of the report.
 void generate(org.codehaus.doxia.sink.Sink aSink, java.util.Locale aLocale)
          Deprecated. use generate(Sink, SinkFactory, Locale) instead.
 void generate(org.apache.maven.doxia.sink.Sink aSink, java.util.Locale aLocale)
          Deprecated. use generate(Sink, SinkFactory, Locale) instead.
 void generate(org.apache.maven.doxia.sink.Sink aSink, org.apache.maven.doxia.sink.SinkFactory aSinkFactory, java.util.Locale aLocale)
          This method is called when the report generation is invoked by maven-site-plugin.
 java.lang.String getCategoryName()
          
protected abstract  java.lang.String getOutputDirectory()
          The output directory when the mojo is run directly from the command line.
protected abstract  org.apache.maven.project.MavenProject getProject()
           
 java.io.File getReportOutputDirectory()
          
 org.apache.maven.doxia.sink.Sink getSink()
           
 org.apache.maven.doxia.sink.SinkFactory getSinkFactory()
           
protected abstract  org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
           
 boolean isExternalReport()
           
 void setReportOutputDirectory(java.io.File reportOutputDirectory)
          
 
Methods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.maven.reporting.MavenReport
getDescription, getName, getOutputName
 

Constructor Detail

AbstractMavenReport

public AbstractMavenReport()
Method Detail

execute

public void execute()
             throws org.apache.maven.plugin.MojoExecutionException
This method is called when the report generation is invoked directly as a standalone Mojo.

Specified by:
execute in interface org.apache.maven.plugin.Mojo
Throws:
org.apache.maven.plugin.MojoExecutionException - if an error occurs when generating the report
See Also:
org.apache.maven.plugins.site.ReportDocumentRender, Mojo.execute()

generate

public void generate(org.codehaus.doxia.sink.Sink aSink,
                     java.util.Locale aLocale)
              throws org.apache.maven.reporting.MavenReportException
Deprecated. use generate(Sink, SinkFactory, Locale) instead.

Generate a report.

Specified by:
generate in interface org.apache.maven.reporting.MavenReport
Parameters:
aSink - the sink to use for the generation.
aLocale - the wanted locale to generate the report, could be null.
Throws:
MavenReportException - if any

generate

public void generate(org.apache.maven.doxia.sink.Sink aSink,
                     java.util.Locale aLocale)
              throws org.apache.maven.reporting.MavenReportException
Deprecated. use generate(Sink, SinkFactory, Locale) instead.

Generate a report.

Parameters:
aSink -
aLocale -
Throws:
MavenReportException
See Also:
org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)

generate

public void generate(org.apache.maven.doxia.sink.Sink aSink,
                     org.apache.maven.doxia.sink.SinkFactory aSinkFactory,
                     java.util.Locale aLocale)
              throws org.apache.maven.reporting.MavenReportException
This method is called when the report generation is invoked by maven-site-plugin.

Specified by:
generate in interface MavenMultiPageReport
Parameters:
aSink -
aSinkFactory -
aLocale -
Throws:
MavenReportException

getCategoryName

public java.lang.String getCategoryName()

Specified by:
getCategoryName in interface org.apache.maven.reporting.MavenReport

getReportOutputDirectory

public java.io.File getReportOutputDirectory()

Specified by:
getReportOutputDirectory in interface org.apache.maven.reporting.MavenReport

setReportOutputDirectory

public void setReportOutputDirectory(java.io.File reportOutputDirectory)

Specified by:
setReportOutputDirectory in interface org.apache.maven.reporting.MavenReport

closeReport

protected void closeReport()
Actions when closing the report.


getSink

public org.apache.maven.doxia.sink.Sink getSink()
Returns:
the sink used

getSinkFactory

public org.apache.maven.doxia.sink.SinkFactory getSinkFactory()
Returns:
the sink factory used

isExternalReport

public boolean isExternalReport()
Specified by:
isExternalReport in interface org.apache.maven.reporting.MavenReport
Returns:
false by default.
See Also:
MavenReport.isExternalReport()

canGenerateReport

public boolean canGenerateReport()

Specified by:
canGenerateReport in interface org.apache.maven.reporting.MavenReport

getSiteRenderer

protected abstract org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
Returns:
the site renderer used.

getOutputDirectory

protected abstract java.lang.String getOutputDirectory()
The output directory when the mojo is run directly from the command line. Implementors should use this method to return the value of a mojo parameter that the user may use to customize the output directory.
Note: When the mojo is run as part of a site generation, Maven will set the effective output directory via MavenReport.setReportOutputDirectory(java.io.File). In this case, the return value of this method is irrelevant. Therefore, developers should always call getReportOutputDirectory() to get the effective output directory for the report. The later method will eventually fallback to this method if the mojo is not run as part of a site generation.

Returns:
The path to the output directory as specified in the plugin configuration for this report.

getProject

protected abstract org.apache.maven.project.MavenProject getProject()
Returns:
the Maven project instance.

executeReport

protected abstract void executeReport(java.util.Locale locale)
                               throws org.apache.maven.reporting.MavenReportException
Execute the generation of the report.

Parameters:
locale - the wanted locale to return the report's description, could be null.
Throws:
MavenReportException - if any


Copyright © 2011. All Rights Reserved.