@Singleton @Named public class DefaultSiteTool extends Object 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.ProjectBuilder |
projectBuilder
Project builder.
|
DEFAULT_LOCALE
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.
|
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)
Deprecated.
|
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"/> . |
@Inject protected org.codehaus.plexus.i18n.I18N i18n
@Inject protected DecorationModelInheritanceAssembler assembler
@Inject protected org.apache.maven.project.ProjectBuilder projectBuilder
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
SiteTool
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 any@Deprecated public String getRelativePath(String to, String from)
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, not null. Most specific
to least specific lookup from site_language_country_variant.xml
,
site_language_country.xml
, site_language.xml}
,
to site.xml
as last resort for Locale.ROOT
, if provided
locale defines a variant and/or a country and/or a language.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, not null.
See SiteTool.getSiteDescriptor(File, Locale)
for details.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, not null.
See SiteTool.getSiteDescriptor(File, Locale)
for details.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.getSiteLocales
in interface SiteTool
locales
- A comma separated list of localesLocale
s.Copyright © 2005–2022 The Apache Software Foundation. All rights reserved.