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:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo, org.apache.maven.reporting.MavenReport
Direct Known Subclasses:
DependencyUpdatesReport, PluginUpdatesReport, PropertyUpdatesReport

public abstract class AbstractVersionsReport
extends org.apache.maven.reporting.AbstractMavenReport

Base class for all versions reports.

Since:
1.0-alpha-3
Author:
Stephen Connolly

Field Summary
protected  Boolean allowSnapshots
          Whether to allow snapshots when searching for the latest version of an artifact.
protected  org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
           
protected  org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
          The artifact metadata source to use.
protected  String comparisonMethod
          The versioning rule to use when comparing versions.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
           
protected  org.apache.maven.project.path.PathTranslator pathTranslator
           
protected  List remoteArtifactRepositories
           
protected  List remotePluginRepositories
           
protected  org.apache.maven.execution.MavenSession session
          The Maven Session.
 
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  org.apache.maven.artifact.versioning.ArtifactVersion findLatestVersion(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.versioning.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()
           
 org.codehaus.plexus.i18n.I18N getI18n()
           
 String getName(Locale locale)
           
protected  String getOutputDirectory()
           
protected  org.apache.maven.project.MavenProject getProject()
           
 org.apache.maven.artifact.resolver.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, generate, generate, getCategoryName, getReportOutputDirectory, getSink, getSinkFactory, 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

artifactFactory

protected org.apache.maven.artifact.factory.ArtifactFactory artifactFactory
Since:
1.0-alpha-3

artifactMetadataSource

protected org.apache.maven.artifact.metadata.ArtifactMetadataSource artifactMetadataSource
The artifact metadata source to use.

Since:
1.0-alpha-1

remoteArtifactRepositories

protected List remoteArtifactRepositories
Since:
1.0-alpha-3

remotePluginRepositories

protected List remotePluginRepositories
Since:
1.0-alpha-3

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
Since:
1.0-alpha-1

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

allowSnapshots

protected Boolean allowSnapshots
Whether to allow snapshots when searching for the latest version of an artifact.

Since:
1.0-alpha-3

session

protected org.apache.maven.execution.MavenSession session
The Maven Session.

Since:
1.0-beta-1

pathTranslator

protected org.apache.maven.project.path.PathTranslator pathTranslator
Constructor Detail

AbstractVersionsReport

public AbstractVersionsReport()
Method Detail

getHelper

public VersionsHelper getHelper()
                         throws org.apache.maven.reporting.MavenReportException
Throws:
org.apache.maven.reporting.MavenReportException

executeReport

protected void executeReport(Locale locale)
                      throws org.apache.maven.reporting.MavenReportException

Specified by:
executeReport in class org.apache.maven.reporting.AbstractMavenReport
Throws:
org.apache.maven.reporting.MavenReportException

doGenerateReport

protected abstract void doGenerateReport(Locale locale,
                                         org.apache.maven.doxia.sink.Sink sink)
                                  throws org.apache.maven.reporting.MavenReportException,
                                         org.apache.maven.plugin.MojoExecutionException
generates the report.

Parameters:
locale - the locale to generate the report for.
sink - the report formatting tool.
Throws:
org.apache.maven.reporting.MavenReportException - when things go wrong.
org.apache.maven.plugin.MojoExecutionException

findLatestVersion

protected org.apache.maven.artifact.versioning.ArtifactVersion findLatestVersion(org.apache.maven.artifact.Artifact artifact,
                                                                                 org.apache.maven.artifact.versioning.VersionRange versionRange,
                                                                                 Boolean allowingSnapshots,
                                                                                 boolean usePluginRepositories)
                                                                          throws org.apache.maven.reporting.MavenReportException
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:
org.apache.maven.plugin.MojoExecutionException - If the artifact metadata could not be found.
org.apache.maven.reporting.MavenReportException
Since:
1.0-alpha-1

getProject

protected org.apache.maven.project.MavenProject getProject()
Specified by:
getProject in class org.apache.maven.reporting.AbstractMavenReport
See Also:
AbstractMavenReport.getProject()

getOutputDirectory

protected String getOutputDirectory()
Specified by:
getOutputDirectory in class org.apache.maven.reporting.AbstractMavenReport
See Also:
AbstractMavenReport.getOutputDirectory()

getSiteRenderer

protected org.apache.maven.doxia.siterenderer.Renderer getSiteRenderer()
Specified by:
getSiteRenderer in class org.apache.maven.reporting.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 org.apache.maven.artifact.resolver.ArtifactResolver getResolver()

getI18n

public org.codehaus.plexus.i18n.I18N getI18n()


Copyright © 2008-2011 Codehaus. All Rights Reserved.