org.apache.maven.plugins.site
Class AbstractSiteMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.maven.plugins.site.AbstractSiteMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractSiteRenderingMojo, SiteDescriptorAttachMojo

public abstract class AbstractSiteMojo
extends org.apache.maven.plugin.AbstractMojo

Base class for site mojos.

Author:
Brett Porter

Field Summary
protected  org.codehaus.plexus.i18n.I18N i18n
          Internationalization.
protected  java.lang.String inputEncoding
          Specifies the input encoding.
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          The local repository.
protected  org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
          Project builder
protected  java.lang.String outputEncoding
          Specifies the output encoding.
protected  org.apache.maven.project.MavenProject project
          The maven project.
protected  java.util.List reactorProjects
          The reactor projects.
protected  java.io.File siteDirectory
          Directory containing the site.xml file and the source for apt, fml and xdoc docs.
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractSiteMojo()
           
 
Method Summary
protected  java.util.List getAvailableLocales()
          Init the localesList variable.
protected  java.lang.String getInterpolatedSiteDescriptorContent(java.util.Map props, org.apache.maven.project.MavenProject aProject, java.lang.String siteDescriptorContent)
          Interpolating several expressions in the site descriptor content.
protected  org.apache.maven.project.MavenProject getParentProject(org.apache.maven.project.MavenProject aProject)
          Returns the parent POM URL.
protected  java.lang.String getRelativePath(java.lang.String to, java.lang.String from)
           
protected  java.io.File getSiteDescriptorFile(java.io.File basedir, java.util.Locale locale)
          Get the path of the site descriptor for a given locale.
protected  void populateModules(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel, java.util.Locale locale, boolean keepInheritedRefs)
           
protected  void populateProjectParentMenu(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel, java.util.Locale locale, org.apache.maven.project.MavenProject parentProject, boolean keepInheritedRefs)
           
protected  void populateReportItems(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel, java.util.Locale locale, java.util.Map reportsByOutputName)
           
protected  void populateReportsMenu(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel, java.util.Locale locale, java.util.Map categories)
           
 
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.plugin.Mojo
execute
 

Field Detail

i18n

protected org.codehaus.plexus.i18n.I18N i18n
Internationalization.


siteDirectory

protected java.io.File siteDirectory
Directory containing the site.xml file and the source for apt, fml and xdoc docs.


project

protected org.apache.maven.project.MavenProject project
The maven project.


localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
The local repository.


reactorProjects

protected java.util.List reactorProjects
The reactor projects.


mavenProjectBuilder

protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
Project builder


inputEncoding

protected java.lang.String inputEncoding
Specifies the input encoding.


outputEncoding

protected java.lang.String outputEncoding
Specifies the output encoding.

Constructor Detail

AbstractSiteMojo

public AbstractSiteMojo()
Method Detail

getAvailableLocales

protected java.util.List getAvailableLocales()
Init the localesList variable.

If locales variable is available, the first valid token will be the defaultLocale for this instance of the Java Virtual Machine.

Returns:
a list of Locale

getSiteDescriptorFile

protected java.io.File getSiteDescriptorFile(java.io.File basedir,
                                             java.util.Locale locale)
Get the path of the site descriptor for a given locale.

Parameters:
basedir - the base dir
locale - the locale
Returns:
the site descriptor path

populateModules

protected void populateModules(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel,
                               java.util.Locale locale,
                               boolean keepInheritedRefs)
                        throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

populateReportsMenu

protected void populateReportsMenu(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel,
                                   java.util.Locale locale,
                                   java.util.Map categories)

populateReportItems

protected void populateReportItems(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel,
                                   java.util.Locale locale,
                                   java.util.Map reportsByOutputName)

getRelativePath

protected java.lang.String getRelativePath(java.lang.String to,
                                           java.lang.String from)

populateProjectParentMenu

protected void populateProjectParentMenu(org.apache.maven.doxia.site.decoration.DecorationModel decorationModel,
                                         java.util.Locale locale,
                                         org.apache.maven.project.MavenProject parentProject,
                                         boolean keepInheritedRefs)

getParentProject

protected org.apache.maven.project.MavenProject getParentProject(org.apache.maven.project.MavenProject aProject)
Returns the parent POM URL. Attempts to source this value from the reactor env if available (reactor env model attributes are interpolated), or if the reactor is unavailable (-N) resorts to the project.getParent().getUrl() value which will NOT have be interpolated.

TODO: once bug is fixed in Maven proper, remove this

Parameters:
aProject -
Returns:
parent project URL.

getInterpolatedSiteDescriptorContent

protected java.lang.String getInterpolatedSiteDescriptorContent(java.util.Map props,
                                                                org.apache.maven.project.MavenProject aProject,
                                                                java.lang.String siteDescriptorContent)
                                                         throws java.io.IOException
Interpolating several expressions in the site descriptor content. Actually, the expressions could be on the project, the environment variables and the specific properties like encoding.

For instance:

${project.name}
The value from the POM of:

<project>
<name>myProjectName</name>
</project>

${my.value}
The value from the POM of:

<properties>
<my.value>hello</my.value>
</properties>

${JAVA_HOME}
The value of JAVA_HOME in the environment variables

Parameters:
props -
aProject -
siteDescriptorContent -
Returns:
the site descriptor content with interpolate string
Throws:
java.io.IOException


Copyright © 2002-2010 Apache Software Foundation. All Rights Reserved.