org.codehaus.mojo.versions
Class AbstractVersionsReport

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.reporting.AbstractMavenReport
          extended by org.codehaus.mojo.versions.AbstractVersionsReport
All Implemented Interfaces:
ContextEnabled, Mojo, MavenReport
Direct Known Subclasses:
DependencyUpdatesReport, DisplayDependencyUpdatesReport, SimpleReport

public abstract class AbstractVersionsReport
extends AbstractMavenReport

Base class for all versions reports.

Since:
1.0-alpha-3
Author:
Stephen Connolly

Field Summary
protected  ArtifactMetadataSource artifactMetadataSource
          The artifact metadata source to use.
protected  String comparisonMethod
          The versioning rule to use when comparing versions.
protected  ArtifactRepository localRepository
           
protected  List remoteArtifactRepositories
           
protected  List remotePluginRepositories
           
 
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
AbstractVersionsReport()
           
 
Method Summary
protected abstract  void doGenerateReport(Locale locale, org.apache.maven.doxia.sink.Sink sink)
          generates the report.
protected  void executeReport(Locale locale)
           
protected  ArtifactVersion findLatestVersion(Artifact artifact, VersionRange versionRange, Boolean allowingSnapshots, boolean usePluginRepositories)
          Finds the latest version of the specified artifact that matches the version range.
 Boolean getAllowSnapshots()
           
 String getComparisonMethod()
           
 String getDescription(Locale locale)
           
 VersionsHelper getHelper()
           
 String getName(Locale locale)
           
protected  String getOutputDirectory()
           
protected  MavenProject getProject()
           
 ArtifactResolver getResolver()
           
protected  org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
           
 String getText(Locale locale, String key)
          Gets the localized message for this report.
 
Methods inherited from class org.apache.maven.reporting.AbstractMavenReport
canGenerateReport, closeReport, execute, generate, getCategoryName, getReportOutputDirectory, getSink, isExternalReport, setReportOutputDirectory
 
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
getOutputName
 

Field Detail

artifactMetadataSource

protected ArtifactMetadataSource artifactMetadataSource
The artifact metadata source to use.

Since:
1.0-alpha-1
Is a Plexus component defined by:
Is readonly.
Is required.

remoteArtifactRepositories

protected List remoteArtifactRepositories
Since:
1.0-alpha-3
Is defined by:
expression:
${project.remoteArtifactRepositories}
Is readonly.

remotePluginRepositories

protected List remotePluginRepositories
Since:
1.0-alpha-3
Is defined by:
expression:
${project.pluginArtifactRepositories}
Is readonly.

localRepository

protected ArtifactRepository localRepository
Since:
1.0-alpha-1
Is defined by:
expression:
${localRepository}
Is readonly.

comparisonMethod

protected String comparisonMethod
The versioning rule to use when comparing versions. Valid values are maven, numeric which will handle long version numbers provided all components are numeric, or mercury which will use the mercury version number comparison rules.

Since:
1.0-alpha-1
Is defined by:
expression:
${comparisonMethod}
Constructor Detail

AbstractVersionsReport

public AbstractVersionsReport()
Method Detail

getHelper

public VersionsHelper getHelper()
                         throws MojoExecutionException
Throws:
MojoExecutionException

executeReport

protected void executeReport(Locale locale)
                      throws MavenReportException
Specified by:
executeReport in class AbstractMavenReport
Throws:
MavenReportException

doGenerateReport

protected abstract void doGenerateReport(Locale locale,
                                         org.apache.maven.doxia.sink.Sink sink)
generates the report.

Parameters:
locale - the locale to generate the report for.
sink - the report formatting tool.

findLatestVersion

protected ArtifactVersion findLatestVersion(Artifact artifact,
                                            VersionRange versionRange,
                                            Boolean allowingSnapshots,
                                            boolean usePluginRepositories)
                                     throws MojoExecutionException
Finds the latest version of the specified artifact that matches the version range.

Parameters:
artifact - The artifact.
versionRange - The version range.
allowingSnapshots - null for no override, otherwise the local override to apply.
Returns:
The latest version of the specified artifact that matches the specified version range or null if no matching version could be found.
Throws:
MojoExecutionException - If the artifact metadata could not be found.
Since:
1.0-alpha-1

getProject

protected MavenProject getProject()
Specified by:
getProject in class AbstractMavenReport
See Also:
AbstractMavenReport.getProject()

getOutputDirectory

protected String getOutputDirectory()
Specified by:
getOutputDirectory in class AbstractMavenReport
See Also:
AbstractMavenReport.getOutputDirectory()

getSiteRenderer

protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
Specified by:
getSiteRenderer in class AbstractMavenReport
See Also:
AbstractMavenReport.getSiteRenderer()

getDescription

public String getDescription(Locale locale)
See Also:
MavenReport.getDescription(java.util.Locale)

getName

public String getName(Locale locale)
See Also:
MavenReport.getName(java.util.Locale)

getText

public String getText(Locale locale,
                      String key)
Gets the localized message for this report.

Parameters:
locale - the locale.
key - the message key.
Returns:
the message.

getAllowSnapshots

public Boolean getAllowSnapshots()

getComparisonMethod

public String getComparisonMethod()

getResolver

public ArtifactResolver getResolver()


Copyright © 2008-2009 Codehaus. All Rights Reserved.