@Component(role=SiteTool.class) public class DefaultSiteTool extends org.codehaus.plexus.logging.AbstractLogEnabled implements SiteTool
Modifier and Type | Field and Description |
---|---|
protected DecorationModelInheritanceAssembler |
assembler
The component for assembling inheritance.
|
protected org.codehaus.plexus.i18n.I18N |
i18n
Internationalization.
|
protected org.apache.maven.project.MavenProjectBuilder |
mavenProjectBuilder
Project builder (deprecated in Maven 3: should use ProjectBuilder, which will avoid
issues like DOXIASITETOOLS-166)
|
DEFAULT_LOCALE, ROLE
Constructor and Description |
---|
DefaultSiteTool() |
Modifier and Type | Method and Description |
---|---|
DecorationModel |
getDecorationModel(File siteDirectory,
Locale locale,
org.apache.maven.project.MavenProject project,
List<org.apache.maven.project.MavenProject> reactorProjects,
org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
Get a decoration model for a project.
|
org.apache.maven.artifact.Artifact |
getDefaultSkinArtifact(org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories)
Get the default skin artifact for a project from one of the repositories.
|
String |
getInterpolatedSiteDescriptorContent(Map<String,String> props,
org.apache.maven.project.MavenProject aProject,
String siteDescriptorContent)
Interpolating several expressions in the site descriptor content.
|
protected static String |
getNormalizedPath(String path) |
org.apache.maven.project.MavenProject |
getParentProject(org.apache.maven.project.MavenProject aProject,
List<org.apache.maven.project.MavenProject> reactorProjects,
org.apache.maven.artifact.repository.ArtifactRepository localRepository)
Returns the parent POM with interpolated URLs.
|
String |
getRelativePath(String to,
String from)
Calculate the relative path between two URLs or between two files.
|
File |
getSiteDescriptor(File siteDirectory,
Locale locale)
Get a site descriptor from the project's site directory.
|
List<Locale> |
getSiteLocales(String locales)
Extracts from a comma-separated list the locales that are available in
site-tool
resource bundle. |
org.apache.maven.artifact.Artifact |
getSkinArtifactFromRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository,
List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories,
DecorationModel decoration)
Get a skin artifact from one of the repositories.
|
void |
populateReportsMenu(DecorationModel decorationModel,
Locale locale,
Map<String,List<org.apache.maven.reporting.MavenReport>> categories)
Populate the pre-defined
reports menu of the decoration model,
if used through <menu ref="reports"/> . |
@Requirement protected org.codehaus.plexus.i18n.I18N i18n
@Requirement protected DecorationModelInheritanceAssembler assembler
@Requirement protected org.apache.maven.project.MavenProjectBuilder mavenProjectBuilder
public org.apache.maven.artifact.Artifact getSkinArtifactFromRepository(org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories, DecorationModel decoration) throws SiteToolException
getSkinArtifactFromRepository
in interface SiteTool
localRepository
- the Maven local repository, not null.remoteArtifactRepositories
- the Maven remote repositories, not null.decoration
- the Doxia site descriptor model, not null.Skin
artifact defined in a DecorationModel
from a given project and a
local repositorySiteToolException
- if anypublic org.apache.maven.artifact.Artifact getDefaultSkinArtifact(org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories) throws SiteToolException
getDefaultSkinArtifact
in interface SiteTool
localRepository
- the Maven local repository, not null.remoteArtifactRepositories
- the Maven remote repositories, not null.Skin
artifact from a given project and a local repositorySiteToolException
- if anySkin.getDefaultSkin()
,
SiteTool.getSkinArtifactFromRepository(ArtifactRepository, List, DecorationModel)
public String getRelativePath(String to, String from)
dav:https://dav.codehaus.org/
or
scm:svn:https://svn.apache.org/repos/asf
.getRelativePath
in interface SiteTool
to
- the to
url of file as stringfrom
- the from
url of file as stringfrom
to to
.public File getSiteDescriptor(File siteDirectory, Locale locale)
getSiteDescriptor
in interface SiteTool
siteDirectory
- the site directory, not nulllocale
- the locale wanted for the site descriptor. If not null, searching for
site_localeLanguage.xml
, otherwise searching for site.xml
.public DecorationModel getDecorationModel(File siteDirectory, Locale locale, org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> reactorProjects, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> repositories) throws SiteToolException
getDecorationModel
in interface SiteTool
siteDirectory
- the site directory, may be null if project from repositorylocale
- the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm.project
- the Maven project, not null.reactorProjects
- the Maven reactor projects, not null.localRepository
- the Maven local repository, not null.repositories
- the Maven remote repositories, not null.DecorationModel
object corresponding to the site.xml
file with some
interpolations.SiteToolException
- if anypublic String getInterpolatedSiteDescriptorContent(Map<String,String> props, org.apache.maven.project.MavenProject aProject, String siteDescriptorContent) throws SiteToolException
encoding
.
For instance:
<project>
<name>myProjectName</name>
</project>
<properties>
<my.value>hello</my.value>
</properties>
getInterpolatedSiteDescriptorContent
in interface SiteTool
props
- a map used for interpolation, not null.aProject
- a Maven project, not null.siteDescriptorContent
- the site descriptor file, not null.SiteToolException
- if errors happened during the interpolation.public org.apache.maven.project.MavenProject getParentProject(org.apache.maven.project.MavenProject aProject, List<org.apache.maven.project.MavenProject> reactorProjects, org.apache.maven.artifact.repository.ArtifactRepository localRepository)
project.getParent()
, which is already
interpolated. But when called from Maven 2, attempts to source this value from the
reactorProjects
parameters 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 been interpolated.getParentProject
in interface SiteTool
aProject
- a Maven project, not null.reactorProjects
- the Maven reactor projects, not null.localRepository
- the Maven local repository, not null.public void populateReportsMenu(DecorationModel decorationModel, Locale locale, Map<String,List<org.apache.maven.reporting.MavenReport>> categories)
reports
menu of the decoration model,
if used through <menu ref="reports"/>
. Notice this menu reference is translated into
2 separate menus: "Project Information" and "Project Reports".populateReportsMenu
in interface SiteTool
decorationModel
- the Doxia Sitetools DecorationModel, not null.locale
- the locale used for the i18n in DecorationModel. If null, using the default locale in the jvm.categories
- reports per category to put in "Reports" or "Information" menus, not null.MavenReport.CATEGORY_PROJECT_INFORMATION
,
MavenReport.CATEGORY_PROJECT_REPORTS
public List<Locale> getSiteLocales(String locales)
site-tool
resource bundle. Notice that default
value will be changed to the default locale of
the JVM.getSiteLocales
in interface SiteTool
locales
- A comma separated list of localesLocale
, which at least contains the Maven default locale which is englishCopyright © 2005–2018 The Apache Software Foundation. All rights reserved.