@Singleton @Named public class DefaultSiteTool extends Object implements SiteTool
Modifier and Type | Field and Description |
---|---|
protected SiteModelInheritanceAssembler |
assembler
The component for assembling inheritance.
|
protected org.codehaus.plexus.i18n.I18N |
i18n
Internationalization.
|
protected org.apache.maven.project.ProjectBuilder |
projectBuilder
Project builder.
|
protected org.eclipse.aether.RepositorySystem |
repositorySystem
The component that is used to resolve additional required artifacts.
|
DEFAULT_LOCALE
Constructor and Description |
---|
DefaultSiteTool() |
Modifier and Type | Method and Description |
---|---|
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) |
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. |
SiteModel |
getSiteModel(File siteDirectory,
Locale locale,
org.apache.maven.project.MavenProject project,
List<org.apache.maven.project.MavenProject> reactorProjects,
org.eclipse.aether.RepositorySystemSession repoSession,
List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories)
Get a site model for a project.
|
org.apache.maven.artifact.Artifact |
getSkinArtifactFromRepository(org.eclipse.aether.RepositorySystemSession repoSession,
List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories,
Skin skin)
Get a skin artifact from one of the repositories.
|
void |
populateReportsMenu(SiteModel siteModel,
Locale locale,
Map<String,List<org.apache.maven.reporting.MavenReport>> categories)
Populate the pre-defined
reports menu of the site model,
if used through <menu ref="reports"/> . |
@Inject protected org.eclipse.aether.RepositorySystem repositorySystem
@Inject protected org.codehaus.plexus.i18n.I18N i18n
@Inject protected SiteModelInheritanceAssembler assembler
@Inject protected org.apache.maven.project.ProjectBuilder projectBuilder
public org.apache.maven.artifact.Artifact getSkinArtifactFromRepository(org.eclipse.aether.RepositorySystemSession repoSession, List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories, Skin skin) throws SiteToolException
getSkinArtifactFromRepository
in interface SiteTool
repoSession
- the repository system session, not null.remoteProjectRepositories
- the Maven remote project repositories, not null.skin
- the Skin model, not null.Skin
artifact defined in a SiteModel
from a given projectSiteToolException
- 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 SiteModel getSiteModel(File siteDirectory, Locale locale, org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> reactorProjects, org.eclipse.aether.RepositorySystemSession repoSession, List<org.eclipse.aether.repository.RemoteRepository> remoteProjectRepositories) throws SiteToolException
getSiteModel
in interface SiteTool
siteDirectory
- the site directory, may be null if project from repositorylocale
- the locale used for the i18n in SiteModel, not null.
See SiteTool.getSiteDescriptor(File, Locale)
for details.project
- the Maven project, not null.reactorProjects
- the Maven reactor projects, not null.repoSession
- the repository system session, not null.remoteProjectRepositories
- the Maven remote project repositories, not null.SiteModel
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 void populateReportsMenu(SiteModel siteModel, Locale locale, Map<String,List<org.apache.maven.reporting.MavenReport>> categories)
reports
menu of the site 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
siteModel
- the Doxia Sitetools SiteModel, not null.locale
- the locale used for the i18n in SiteModel, 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–2024 The Apache Software Foundation. All rights reserved.